{"_id":"@c4h/beatbox","_rev":"2-d5c89a2cf4fe3dc4ed32cd97f365fb65","name":"@c4h/beatbox","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@c4h/beatbox","version":"0.1.0","keywords":["mapbox","mvt","vector-tiles","url-parser","scheme","style","tiles"],"author":{"name":"Code for History"},"license":"MIT","_id":"@c4h/beatbox@0.1.0","maintainers":[{"name":"kochizufan","email":"kochizufan@gmail.com"}],"homepage":"https://github.com/code4history/BeatBox#readme","bugs":{"url":"https://github.com/code4history/BeatBox/issues"},"dist":{"shasum":"f897c24d106c3385a1606223c6e2c92e966536f5","tarball":"https://registry.npmjs.org/@c4h/beatbox/-/beatbox-0.1.0.tgz","fileCount":8,"integrity":"sha512-Al7yl8RBwOpoFu7kmL/ZZblifwqBkobmDYHGYk16HvXPdD/Jp4FpetEbaIqi/FXLDpRrWkin7ZkpcTcZjnmWhg==","signatures":[{"sig":"MEUCIBaL+IMWBsuOzpIHOQFE990Bv1stz4mV8V2vfQIPRZ5HAiEA9GtZXct0EiSyEzW14z+ZSahEy1PgFjNh/I71N7n03zc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29350},"main":"./dist/beatbox.cjs","type":"module","_from":"file:c4h-beatbox-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/beatbox.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/beatbox.js","require":"./dist/beatbox.cjs"}},"scripts":{"dev":"vite","lint":"eslint src tests","test":"vitest run","build":"npm run typecheck && cross-env BUILD_MODE=package vite build","coverage":"vitest run --coverage","test:e2e":"playwright test","typecheck":"tsc --noEmit --allowImportingTsExtensions","test:watch":"vitest","publish:npm":"node scripts/publish-npm.js","test:e2e:ci":"playwright test --config=playwright-ci.config.ts","test:e2e:ui":"playwright test --ui","version:bump":"node scripts/bump-version.js","version:sync":"node scripts/sync-version.js","publish:npm:dry":"node scripts/publish-npm.js --dry-run"},"_npmUser":{"name":"kochizufan","actor":{"name":"kochizufan","type":"user","email":"kochizufan@gmail.com"},"email":"kochizufan@gmail.com"},"_resolved":"/tmp/c0d5d9eee2831e15e8d742174470a271/c4h-beatbox-0.1.0.tgz","_integrity":"sha512-Al7yl8RBwOpoFu7kmL/ZZblifwqBkobmDYHGYk16HvXPdD/Jp4FpetEbaIqi/FXLDpRrWkin7ZkpcTcZjnmWhg==","repository":{"url":"git+https://github.com/code4history/BeatBox.git","type":"git"},"_npmVersion":"10.9.2","description":"Mapbox scheme URL parser and MVT configuration translator","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.5","jsdom":"^26.1.0","eslint":"^9.17.0","vitest":"^3.2.4","prettier":"^3.4.2","cross-env":"^7.0.3","@eslint/js":"^9.17.0","typescript":"^5.7.2","@types/node":"^24.0.10","vite-plugin-dts":"^4.4.0","@playwright/test":"^1.53.1","typescript-eslint":"^8.35.1","@vitest/coverage-v8":"^3.2.4","eslint-config-prettier":"^10.1.5"},"_npmOperationalInternal":{"tmp":"tmp/beatbox_0.1.0_1751589556172_0.08927195545168942","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@c4h/beatbox","version":"0.1.1","description":"Mapbox scheme URL parser and MVT configuration translator","type":"module","main":"./dist/beatbox.cjs","module":"./dist/beatbox.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/beatbox.js","require":"./dist/beatbox.cjs"}},"repository":{"type":"git","url":"git+https://github.com/code4history/BeatBox.git"},"author":{"name":"Code for History"},"license":"MIT","keywords":["mapbox","mvt","vector-tiles","url-parser","scheme","style","tiles"],"devDependencies":{"@eslint/js":"^9.17.0","@playwright/test":"^1.53.1","@types/node":"^24.0.10","typescript-eslint":"^8.35.1","@vitest/coverage-v8":"^3.2.4","cross-env":"^7.0.3","eslint":"^9.17.0","eslint-config-prettier":"^10.1.5","jsdom":"^26.1.0","prettier":"^3.4.2","typescript":"^5.7.2","vite":"^6.3.5","vite-plugin-dts":"^4.4.0","vitest":"^3.2.4"},"scripts":{"dev":"vite","build":"npm run typecheck && cross-env BUILD_MODE=package vite build","typecheck":"tsc --noEmit --allowImportingTsExtensions","test":"vitest run","test:watch":"vitest","coverage":"vitest run --coverage","test:e2e":"playwright test","test:e2e:ui":"playwright test --ui","test:e2e:ci":"playwright test --config=playwright-ci.config.ts","lint":"eslint src tests","version:bump":"node scripts/bump-version.js","version:sync":"node scripts/sync-version.js","publish:npm":"node scripts/publish-npm.js","publish:npm:dry":"node scripts/publish-npm.js --dry-run"},"_id":"@c4h/beatbox@0.1.1","bugs":{"url":"https://github.com/code4history/BeatBox/issues"},"homepage":"https://github.com/code4history/BeatBox#readme","_integrity":"sha512-arBmqL8wrw/RrhGQu6saqSDRwyKE7LCUtfUdef6RIuBeIlF+yAVLNiTv2rM1OMDZ0P28fiC+LUkQBKMFGqVadw==","_resolved":"/tmp/1c7efbe4eb56b384ddd0dc298538a0f5/c4h-beatbox-0.1.1.tgz","_from":"file:c4h-beatbox-0.1.1.tgz","_nodeVersion":"20.19.3","_npmVersion":"10.8.2","dist":{"integrity":"sha512-arBmqL8wrw/RrhGQu6saqSDRwyKE7LCUtfUdef6RIuBeIlF+yAVLNiTv2rM1OMDZ0P28fiC+LUkQBKMFGqVadw==","shasum":"ad5503d92eeba2af55bad6b6e24a32c86ea63af1","tarball":"https://registry.npmjs.org/@c4h/beatbox/-/beatbox-0.1.1.tgz","fileCount":8,"unpackedSize":31396,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDO6jfNh5DPJds2KHKrVSTLnDap8VB4caP71piq3B3rLQIgBp3GsTtJPfvj119Nv+bb1H7jJLrHdcBHMcc/dxTHX+c="}]},"_npmUser":{"name":"kochizufan","email":"kochizufan@gmail.com","actor":{"name":"kochizufan","email":"kochizufan@gmail.com","type":"user"}},"directories":{},"maintainers":[{"name":"kochizufan","email":"kochizufan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/beatbox_0.1.1_1751714224364_0.8517595379212557"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-04T00:39:16.077Z","modified":"2025-07-05T11:17:04.764Z","0.1.0":"2025-07-04T00:39:16.409Z","0.1.1":"2025-07-05T11:17:04.543Z"},"bugs":{"url":"https://github.com/code4history/BeatBox/issues"},"author":{"name":"Code for History"},"license":"MIT","homepage":"https://github.com/code4history/BeatBox#readme","keywords":["mapbox","mvt","vector-tiles","url-parser","scheme","style","tiles"],"repository":{"type":"git","url":"git+https://github.com/code4history/BeatBox.git"},"description":"Mapbox scheme URL parser and MVT configuration translator","maintainers":[{"name":"kochizufan","email":"kochizufan@gmail.com"}],"readme":"# @c4h/beatbox\n\nMapbox scheme URL parser and MVT configuration translator for JavaScript.\n\n## Features\n\n- Convert mapbox:// scheme URLs to HTTP URLs\n- Parse Mapbox style configuration files\n- Extract and translate all resource URLs (tiles, fonts, icons, sprites)\n- Generate MVT configuration with fully resolved HTTP URLs\n- Support for various Mapbox resource types:\n  - Styles: `mapbox://styles/{username}/{style_id}`\n  - Tiles: `mapbox://tiles/{tileset_id}/{z}/{x}/{y}`\n  - Composite tiles: `mapbox://mapbox.mapbox-streets-v8,mapbox.mapbox-terrain-v2`\n  - Fonts: `mapbox://fonts/{username}/{font_stack}/{range}`\n  - Sprites: `mapbox://sprites/{username}/{style_id}`\n\n## Installation\n\n### npm\n\n```sh\nnpm install @c4h/beatbox\n```\n\n### Browser\n\n```html\n<script src=\"https://unpkg.com/@c4h/beatbox/dist/beatbox.umd.js\"></script>\n```\n\n## Usage\n\n```typescript\nimport { BeatBox } from '@c4h/beatbox';\n\n// Initialize with your Mapbox access token\nconst beatbox = new BeatBox({\n  accessToken: 'your-mapbox-access-token'\n});\n\n// Convert a single mapbox:// URL to HTTP\nconst httpUrl = beatbox.toHttpUrl('mapbox://styles/mapbox/streets-v11');\nconsole.log(httpUrl);\n// → https://api.mapbox.com/styles/v1/mapbox/streets-v11?access_token=...\n\n// Convert composite tileset URLs\nconst compositeUrl = beatbox.toHttpUrl('mapbox://mapbox.mapbox-streets-v8,mapbox.mapbox-terrain-v2');\nconsole.log(compositeUrl);\n// → https://api.mapbox.com/v4/mapbox.mapbox-streets-v8,mapbox.mapbox-terrain-v2.json?access_token=...\n\n// Parse and translate a complete style configuration\nconst styleUrl = 'mapbox://styles/moritoru/ck3xqi0hh1pob1cqpanp3jxxo';\nconst translatedStyle = await beatbox.translateStyle(styleUrl);\n// Returns style JSON with all mapbox:// URLs converted to HTTP URLs\n\n// Get all resource URLs from a style\nconst resources = await beatbox.getStyleResources(styleUrl);\nconsole.log(resources);\n// → {\n//     style: 'https://api.mapbox.com/styles/v1/...',\n//     tiles: ['https://api.mapbox.com/v4/...'],\n//     fonts: ['https://api.mapbox.com/fonts/v1/...'],\n//     sprites: ['https://api.mapbox.com/styles/v1/.../sprite']\n//   }\n```\n\n## API Documentation\n\n### BeatBox\n\nThe main class for Mapbox URL translation.\n\n#### Constructor Options\n\n- `accessToken` (string): Your Mapbox access token (required)\n- `apiUrl` (string): Custom Mapbox API URL (default: 'https://api.mapbox.com')\n\n#### Methods\n\n- `toHttpUrl(mapboxUrl: string): string` - Convert a single mapbox:// URL to HTTP URL\n- `translateStyle(styleUrl: string): Promise<object>` - Fetch and translate a complete style configuration\n- `getStyleResources(styleUrl: string): Promise<ResourceList>` - Extract all resource URLs from a style\n- `parseMapboxUrl(url: string): MapboxUrlInfo` - Parse a mapbox:// URL into its components\n\n## License\n\nMIT License\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.","readmeFilename":"README.md"}