open-index/open-npm huggingface dataset:
npm package: @maptalks/geojson-bbox
Description: Calculates bbox for GeoJSON object.
Author: wsw0108@qq.com
Latest version: 1.0.5

# geojson-bbox

[![Node.js CI](https://github.com/maptalks/geojson-bbox/actions/workflows/node.js.yml/badge.svg)](https://github.com/maptalks/geojson-bbox/actions/workflows/node.js.yml)

Tests are adopted from [https://github.com/geosquare/geojson-bbox](https://github.com/geosquare/geojson-bbox).
npm package: @maptalks/glsl-parser
Description: transform streamed glsl tokens into an ast
Latest version: 2.0.3

# glsl-parser

![](http://img.shields.io/badge/stability-stable-green.svg?style=flat)
![](http://img.shields.io/npm/v/glsl-parser.svg?style=flat)
![](http://img.shields.io/npm/dm/glsl-parser.svg?style=flat)
![](http://img.shields.io/npm/l/glsl-parser.svg?style=flat)

A GLSL parser that takes tokens from
[glsl-tokenizer](http://github.com/stackgl/glsl-tokenizer) and turns them into
an AST.

May either be used synchronously or as a stream.

## API

### `stream = require('glsl-parser/stream')`

Creates a GLSL parser stream, which emits nodes as they're parsed.

``` javascript
var TokenStream = require('glsl-tokenizer/stream')
var ParseStream = require('glsl-parser/stream')
var fs = require('fs')

fs.createReadStream('test.glsl')
  .pipe(TokenStream())
  .pipe(ParseStream())
  .on('data', function(x) {
    console.log('ast of', x.type)
  })
```

### `ast = stream.program`

The full program's AST, which will be updated with each incoming token.

### `ast = require('glsl-parser/direct')(tokens)`

Synchronously parses an array of tokens from `glsl-tokenizer`.

``` javascript
var TokenString = require('glsl-tokenizer/string')
var ParseTokens = require('glsl-parser/direct')
var fs = require('fs')

var src = fs.readFileSync('test.glsl', 'utf8')
var tokens = TokenString(src)
var ast = ParseTokens(tokens)

console.log(ast)
```

## Nodes

* `stmtlist`
* `stmt`
* `struct`
* `function`
* `functionargs`
* `decl`
* `decllist`
* `forloop`
* `whileloop`
* `if`
* `expr`
* `precision`
* `comment`
* `preprocessor`
* `keyword`
* `ident`
* `return`
* `continue`
* `break`
* `discard`
* `do-while`
* `binary`
* `ternary`
* `unary`

## Known Issues

* because i am not smart enough to write a fully streaming parser, the current parser "cheats" a bit when it encounters a `expr` node! it actually waits until it has all the tokens it needs to build a tree for a given expression, then builds it and emits the constituent child nodes in the expected order. the `expr` parsing is heavily influenced by [crockford's tdop article](http://javascript.crockford.com/tdop/tdop.html). the rest of the parser is heavily influenced by fever dreams.

* the parser might hit a state where it's looking at what *could be* an expression, or it could be a declaration --
that is, the statement starts with a previously declared `struct`. it'll opt to pretend it's a declaration, but that
might not be the case -- it might be a user-defined constructor starting a statement!

* "unhygenic" `#if` / `#endif` macros are completely unhandled at the moment, since they're a bit of a pain.
if you've got unhygenic macros in your code, move the #if / #endifs to statement level, and have them surround
wholly parseable code. this sucks, and i am sorry.

## License

MIT, see [LICENSE.md](LICENSE.md) for more details.
npm package: @maptalks/rollup-plugin-glsl-minify
Description: through stream that transforms glsl-parser AST nodes and rewrites variables into shorter forms
Latest version: 0.1.7

# rollup-plugin-glsl-minify

A rollup plugin to minify glsl on the fly.

## Known issues to avoid
* property confliction
albedo conflicts with materialUniforms.albedo
```glsl
    vec4 albedo = vec4(1.0);
    materialUniforms.albedo *= albedo.rgb;
```

* variable name in vec4
```glsl
uniform vec2 texSize;

void main() {
	vec2 invSize = 1.0 / texSize;
	//vec4(invSize, invSize); will be transformed to vec4(a)
	vec2 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);
	gl_FragColor = uvOffset;
}
```

* built-in name conflicts (内置函数名不能用于变量名)
  * distance

* 变量名不能太简单，例如单字母，会与混淆生成的变量名冲突
npm package: @maptalks/rollup-plugin-polyfill-node
Description: rollup-plugin-polyfill-node ===
Latest version: 0.12.0

rollup-plugin-polyfill-node
===

🔩 A modern Node.js polyfill for your Rollup bundle.

> This repo is an updated, maintained fork of https://github.com/ionic-team/rollup-plugin-node-polyfills to support better Node.js polyfills in Snowpack and all other Rollup projects. See this thread for discussion on moving this plugin into the official Rollup org: https://github.com/rollup/plugins/pull/51#issuecomment-747489334
> 
> **This repo is completely community-maintained.** If you have an issue and know JavaScript, help out and submit a PR. This may be the only way to get your issue resolved!


## Quickstart

```
npm install --save-dev rollup-plugin-polyfill-node
```

```js
import nodePolyfills from 'rollup-plugin-polyfill-node';
rollup({
  entry: 'main.js',
  plugins: [
    nodePolyfills( /* options */ )
  ]
})
```

## Options

*All options are optional.*

- `include: Array<string | RegExp> | string | RegExp | null;`: Defaults to transforming Node.js builtins in all `node_modules/**/*.js` files only. Pass in `null` to transform all files, including all files including any source files.
- `exclude: Array<string | RegExp> | string | RegExp | null;`: Exclude files from transformation. 
- `sourceMap: boolean`: True to get source maps, false otherwise.


## Node.js Builtin Support Table

The following modules include ES6 specific version which allow you to do named imports in addition to the default import and should work fine if you only use this plugin.

- process*
- events
- stream*
- util*
- path
- buffer*
- querystring
- url*
- string_decoder*
- punycode
- http*†
- https*†
- os*
- assert*
- constants
- timers*
- console*‡
- vm*§
- zlib*
- tty
- domain
- dns∆
- dgram∆
- child_process∆
- cluster∆
- module∆
- net∆
- readline∆
- repl∆
- tls∆
- fs˚
- crypto˚
- perf_hooks˚ - **New:* just an empty shim for now, but would love help building a true polyfill!*


† the http and https modules are actually the same and don't differentiate based on protocol

‡ default export only, because it's console, seriously just use the global

§ vm does not have all corner cases and has less of them in a web worker

∆ not shimmed, just returns mock

˚ shimmed, but too complex to polyfill fully. Avoid if at all possible. Some bugs and partial support expected. 

Not all included modules rollup equally, streams (and by extension anything that requires it like http) are a mess of circular references that are pretty much impossible to tree-shake out, similarly url methods are actually a shortcut to a url object so those methods don't tree shake out very well, punycode, path, querystring, events, util, and process tree shake very well especially if you do named imports.
npm package: @maptalks/tbn-packer
Description: pack normal and tangent data into a quaternion
Author: fuzhenn
Latest version: 1.4.5

# tbn-packer
[![Circle CI](https://circleci.com/gh/fuzhenn/tbn-packer.svg?style=shield)](https://circleci.com/gh/fuzhenn/tbn-packer)

Pack tangent and normal data into a quaternion, a useful [tech published by crytek](http://www.crytek.com/download/izfrey_siggraph2011.pdf) to compress data push to GPU.

This is ported from C++ implementation of [google filament](https://github.com/google/filament).

## Usage

```js
import { packTangentFrame, unpackQuaternion } from "@maptalks/tbn-packer";
const tangent = [1, 0, 0, 1];
const normal = [0, 1, 0];

const q = [];
//pack tangent and normal to a quaternion
packTangentFrame(q, normal, tangent);
const n = [], t = [];
//unpack a given quaternion to a normal and tangent.
unpackQuaternion(q, n, t);
```

### GLSL Code to unpack

From google filament:

```glsl
/**
 * Extracts the normal vector of the tangent frame encoded in the specified quaternion.
 */
void toTangentFrame(const highp vec4 q, out highp vec3 n) {
    n = vec3( 0.0,  0.0,  1.0) +
        vec3( 2.0, -2.0, -2.0) * q.x * q.zwx +
        vec3( 2.0,  2.0, -2.0) * q.y * q.wzy;
}

/**
 * Extracts the normal and tangent vectors of the tangent frame encoded in the
 * specified quaternion.
 */
void toTangentFrame(const highp vec4 q, out highp vec3 n, out highp vec3 t) {
    toTangentFrame(q, n);
    t = vec3( 1.0,  0.0,  0.0) +
        vec3(-2.0,  2.0, -2.0) * q.y * q.yxw +
        vec3(-2.0,  2.0,  2.0) * q.z * q.zwx;
}
```

## Install

```shell
npm i @maptalks/tbn-packer
```

### Test
```shell
npm test
```
npm package: @maptaskr/shpjs
Description: A fork of shpjs - Modified to support nested polygon rings
Author: Stephen Dcruz
Latest version: 6.1.3

# Shapefile.js

Pure JavaScript library for parsing Shapefiles, returns Geojson projected into WGS84 lat lons.

See original package here:
https://github.com/calvinmetcalf/shapefile-js

This is a fork from the PR branch:
https://github.com/calvinmetcalf/shapefile-js/pull/225

with changes to help fix incorrectly wound polygons.

## About

Descended in a ship of theseus way from [RandomEtc's shapefile library](https://github.com/RandomEtc/shapefile-js) no code is shared.

- [World Borders shapefile](http://thematicmapping.org/downloads/world_borders.php) is CC-BY-SA 3.0.
- Park and Ride shapefile is from [MassDOT](http://mass.gov/massdot) and is public domain.
- MA town boundaries from [MassGIS](http://www.mass.gov/anf/research-and-tech/it-serv-and-support/application-serv/office-of-geographic-information-massgis/) and is public domain
- NJ County Boundaries from [NJgin](https://njgin.state.nj.us/NJ_NJGINExplorer/index.jsp) and should be public domain.
- [Proj4js](https://github.com/proj4js/proj4js) by me et al MIT
- Other test datasets copyright their respective owners.
npm package: @mapthing/core
Description: Reserved namespace for the MapThing project. Official release coming soon.
Author: Playful Platypus LLC
Latest version: 0.0.1

# MapThing

Reserved namespace for the MapThing project.  
Official npm packages will be published here soon.

👉 Website: [https://mapthing.app](https://mapthing.app)  
👉 Maintained by Playful Platypus LLC
npm package: @maptiler/cra-template-maplibre-gl-js
Description: Quick way to star a web map application with MapLibre GL JS using Create React App.
Author: MapTiler Team
Latest version: 1.0.3

# MapLibre GL JS map using React JS

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Quick way to star a web map application with MapLibre GL JS using Create React App.

A simple fullscreen map application as an example on how to use MapTiler maps together with React and MapLibre GL JS for your own React app.

## Screenshot

![react maplibre template](/assets/react-maplibre-template.png "React Maplibre template")

<p align="right">(<a href="#top">back to top</a>)</p>

## Step-by-step tutorial - How to display a map in React JS using MapLibre GL JS

Documentation: [How to display a map in React JS using MapLibre GL JS](https://documentation.maptiler.com/hc/en-us/articles/4405444890897-how-to-display-maplibre-gl-js-map-using-react-js?utm_medium=referral&utm_source=github&utm_campaign=2022-05%20%7C%20js%20frameworks%20%7C%20react)

## Demo

Online demo: https://labs.maptiler.com/cra-template-maplibre-gl-js/

<p align="right">(<a href="#top">back to top</a>)</p>

## Build With

* [React.js](https://reactjs.org/)
* [MapLibre GL JS](https://maplibre.org/)
* [MapTiler](https://www.maptiler.com/)

## Getting Started

### Prerequisites

* npm
  ```sh
  npm install npm@latest -g
  ```

<p align="right">(<a href="#top">back to top</a>)</p>

### Create an app

To create a new react project run in your command-line:

```
  npx create-react-app my-react-map --template @maptiler/cra-template-maplibre-gl-js
```

Navigate to the newly created project folder **my-react-map**

```
  cd my-react-map
```

### API KEY

Rename or copy the `.env.example` file to `.env`

```
  cp .env.example .env
```

Open the `.env` file, :warning: you will need to replace **YOUR_MAPTILER_API_KEY** with your own MapTiler API key.

Your MapTiler account access key is on your MapTiler [Cloud](https://cloud.maptiler.com/account/keys/) account page. 

:information_source: If you don't have an API KEY you can create it for free at https://www.maptiler.com/cloud/

### Run

To start your local environment run: 

```
  npm start
``` 

You will find your app on address http://localhost:3000/.

Now you should see the app in your browser.

### Build

To build for production, run: 
```
  npm run build
``` 

### gh-pages

To deploy the app to the gh-pages branch, run:
```
  npm run deploy
```

<p align="right">(<a href="#top">back to top</a>)</p>

<!-- LICENSE -->
## License

Distributed under the MIT License. See `LICENSE` for more information.

<p align="right">(<a href="#top">back to top</a>)</p>

<!-- ACKNOWLEDGMENTS -->
## Acknowledgments

Instead of using or developing a custom map component you can use the [reac-map-gl component](http://visgl.github.io/react-map-gl/docs/get-started/get-started#using-with-a-mapbox-gl-fork)