text
stringlengths
55
456k
metadata
dict
# pause Pause streams... ## License (The MIT License) Copyright (c) 2012 TJ Holowaychuk <[email protected]> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pause/Readme.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pause/Readme.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1145 }
# pg-cloudflare A socket implementation that can run on Cloudflare Workers using native TCP connections. ## install ``` npm i --save-dev pg-cloudflare ``` ### license The MIT License (MIT) Copyright (c) 2023 Brian M. Carlson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pg-cloudflare/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pg-cloudflare/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1254 }
pg-connection-string ==================== [![NPM](https://nodei.co/npm/pg-connection-string.png?compact=true)](https://nodei.co/npm/pg-connection-string/) [![Build Status](https://travis-ci.org/iceddev/pg-connection-string.svg?branch=master)](https://travis-ci.org/iceddev/pg-connection-string) [![Coverage Status](https://coveralls.io/repos/github/iceddev/pg-connection-string/badge.svg?branch=master)](https://coveralls.io/github/iceddev/pg-connection-string?branch=master) Functions for dealing with a PostgresSQL connection string `parse` method taken from [node-postgres](https://github.com/brianc/node-postgres.git) Copyright (c) 2010-2014 Brian Carlson ([email protected]) MIT License ## Usage ```js var parse = require('pg-connection-string').parse; var config = parse('postgres://someuser:somepassword@somehost:381/somedatabase') ``` The resulting config contains a subset of the following properties: * `user` - User with which to authenticate to the server * `password` - Corresponding password * `host` - Postgres server hostname or, for UNIX domain sockets, the socket filename * `port` - port on which to connect * `database` - Database name within the server * `client_encoding` - string encoding the client will use * `ssl`, either a boolean or an object with properties * `rejectUnauthorized` * `cert` * `key` * `ca` * any other query parameters (for example, `application_name`) are preserved intact. ## Connection Strings The short summary of acceptable URLs is: * `socket:<path>?<query>` - UNIX domain socket * `postgres://<user>:<password>@<host>:<port>/<database>?<query>` - TCP connection But see below for more details. ### UNIX Domain Sockets When user and password are not given, the socket path follows `socket:`, as in `socket:/var/run/pgsql`. This form can be shortened to just a path: `/var/run/pgsql`. When user and password are given, they are included in the typical URL positions, with an empty `host`, as in `socket://user:pass@/var/run/pgsql`. Query parameters follow a `?` character, including the following special query parameters: * `db=<database>` - sets the database name (urlencoded) * `encoding=<encoding>` - sets the `client_encoding` property ### TCP Connections TCP connections to the Postgres server are indicated with `pg:` or `postgres:` schemes (in fact, any scheme but `socket:` is accepted). If username and password are included, they should be urlencoded. The database name, however, should *not* be urlencoded. Query parameters follow a `?` character, including the following special query parameters: * `host=<host>` - sets `host` property, overriding the URL's host * `encoding=<encoding>` - sets the `client_encoding` property * `ssl=1`, `ssl=true`, `ssl=0`, `ssl=false` - sets `ssl` to true or false, accordingly * `sslmode=<sslmode>` * `sslmode=disable` - sets `ssl` to false * `sslmode=no-verify` - sets `ssl` to `{ rejectUnauthorized: false }` * `sslmode=prefer`, `sslmode=require`, `sslmode=verify-ca`, `sslmode=verify-full` - sets `ssl` to true * `sslcert=<filename>` - reads data from the given file and includes the result as `ssl.cert` * `sslkey=<filename>` - reads data from the given file and includes the result as `ssl.key` * `sslrootcert=<filename>` - reads data from the given file and includes the result as `ssl.ca` A bare relative URL, such as `salesdata`, will indicate a database name while leaving other properties empty.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pg-connection-string/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pg-connection-string/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 3459 }
[![Build status][ci image]][ci] 64-bit big-endian signed integer-to-string conversion designed for [pg][]. ```js const readInt8 = require('pg-int8'); readInt8(Buffer.from([0, 1, 2, 3, 4, 5, 6, 7])) // '283686952306183' ``` [pg]: https://github.com/brianc/node-postgres [ci]: https://travis-ci.org/charmander/pg-int8 [ci image]: https://api.travis-ci.org/charmander/pg-int8.svg
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pg-int8/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pg-int8/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 388 }
## Unreleased ## [1.0.2][] – 2019-11-10 ### Fixed - A negative sign is no longer stripped by mistake for numbers of the form −0.000…00(d) where the number of zeros after the decimal point is 2 mod 4. [1.0.2]: https://github.com/charmander/pg-numeric/compare/v1.0.1...v1.0.2
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pg-numeric/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pg-numeric/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 279 }
A reader for the PostgreSQL binary format for numeric values, producing a string. Designed for [pg][]. ```js const readNumeric = require('pg-numeric'); readNumeric(Buffer.from('000600020000000a000c0d801ed203db198f0834', 'hex')) // '1234567890.0987654321' ``` [pg]: https://github.com/brianc/node-postgres
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pg-numeric/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pg-numeric/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 310 }
# pg-pool [![Build Status](https://travis-ci.org/brianc/node-pg-pool.svg?branch=master)](https://travis-ci.org/brianc/node-pg-pool) A connection pool for node-postgres ## install ```sh npm i pg-pool pg ``` ## use ### create to use pg-pool you must first create an instance of a pool ```js var Pool = require('pg-pool') // by default the pool uses the same // configuration as whatever `pg` version you have installed var pool = new Pool() // you can pass properties to the pool // these properties are passed unchanged to both the node-postgres Client constructor // and the node-pool (https://github.com/coopernurse/node-pool) constructor // allowing you to fully configure the behavior of both var pool2 = new Pool({ database: 'postgres', user: 'brianc', password: 'secret!', port: 5432, ssl: true, max: 20, // set pool max size to 20 idleTimeoutMillis: 1000, // close idle clients after 1 second connectionTimeoutMillis: 1000, // return an error after 1 second if connection could not be established maxUses: 7500, // close (and replace) a connection after it has been used 7500 times (see below for discussion) }) //you can supply a custom client constructor //if you want to use the native postgres client var NativeClient = require('pg').native.Client var nativePool = new Pool({ Client: NativeClient }) //you can even pool pg-native clients directly var PgNativeClient = require('pg-native') var pgNativePool = new Pool({ Client: PgNativeClient }) ``` ##### Note: The Pool constructor does not support passing a Database URL as the parameter. To use pg-pool on heroku, for example, you need to parse the URL into a config object. Here is an example of how to parse a Database URL. ```js const Pool = require('pg-pool'); const url = require('url') const params = url.parse(process.env.DATABASE_URL); const auth = params.auth.split(':'); const config = { user: auth[0], password: auth[1], host: params.hostname, port: params.port, database: params.pathname.split('/')[1], ssl: true }; const pool = new Pool(config); /* Transforms, 'postgres://DBuser:secret@DBHost:#####/myDB', into config = { user: 'DBuser', password: 'secret', host: 'DBHost', port: '#####', database: 'myDB', ssl: true } */ ``` ### acquire clients with a promise pg-pool supports a fully promise-based api for acquiring clients ```js var pool = new Pool() pool.connect().then(client => { client.query('select $1::text as name', ['pg-pool']).then(res => { client.release() console.log('hello from', res.rows[0].name) }) .catch(e => { client.release() console.error('query error', e.message, e.stack) }) }) ``` ### plays nice with async/await this ends up looking much nicer if you're using [co](https://github.com/tj/co) or async/await: ```js // with async/await (async () => { var pool = new Pool() var client = await pool.connect() try { var result = await client.query('select $1::text as name', ['brianc']) console.log('hello from', result.rows[0]) } finally { client.release() } })().catch(e => console.error(e.message, e.stack)) // with co co(function * () { var client = yield pool.connect() try { var result = yield client.query('select $1::text as name', ['brianc']) console.log('hello from', result.rows[0]) } finally { client.release() } }).catch(e => console.error(e.message, e.stack)) ``` ### your new favorite helper method because its so common to just run a query and return the client to the pool afterward pg-pool has this built-in: ```js var pool = new Pool() var time = await pool.query('SELECT NOW()') var name = await pool.query('select $1::text as name', ['brianc']) console.log(name.rows[0].name, 'says hello at', time.rows[0].now) ``` you can also use a callback here if you'd like: ```js var pool = new Pool() pool.query('SELECT $1::text as name', ['brianc'], function (err, res) { console.log(res.rows[0].name) // brianc }) ``` __pro tip:__ unless you need to run a transaction (which requires a single client for multiple queries) or you have some other edge case like [streaming rows](https://github.com/brianc/node-pg-query-stream) or using a [cursor](https://github.com/brianc/node-pg-cursor) you should almost always just use `pool.query`. Its easy, it does the right thing :tm:, and wont ever forget to return clients back to the pool after the query is done. ### drop-in backwards compatible pg-pool still and will always support the traditional callback api for acquiring a client. This is the exact API node-postgres has shipped with for years: ```js var pool = new Pool() pool.connect((err, client, done) => { if (err) return done(err) client.query('SELECT $1::text as name', ['pg-pool'], (err, res) => { done() if (err) { return console.error('query error', err.message, err.stack) } console.log('hello from', res.rows[0].name) }) }) ``` ### shut it down When you are finished with the pool if all the clients are idle the pool will close them after `config.idleTimeoutMillis` and your app will shutdown gracefully. If you don't want to wait for the timeout you can end the pool as follows: ```js var pool = new Pool() var client = await pool.connect() console.log(await client.query('select now()')) client.release() await pool.end() ``` ### a note on instances The pool should be a __long-lived object__ in your application. Generally you'll want to instantiate one pool when your app starts up and use the same instance of the pool throughout the lifetime of your application. If you are frequently creating a new pool within your code you likely don't have your pool initialization code in the correct place. Example: ```js // assume this is a file in your program at ./your-app/lib/db.js // correct usage: create the pool and let it live // 'globally' here, controlling access to it through exported methods var pool = new pg.Pool() // this is the right way to export the query method module.exports.query = (text, values) => { console.log('query:', text, values) return pool.query(text, values) } // this would be the WRONG way to export the connect method module.exports.connect = () => { // notice how we would be creating a pool instance here // every time we called 'connect' to get a new client? // that's a bad thing & results in creating an unbounded // number of pools & therefore connections var aPool = new pg.Pool() return aPool.connect() } ``` ### events Every instance of a `Pool` is an event emitter. These instances emit the following events: #### error Emitted whenever an idle client in the pool encounters an error. This is common when your PostgreSQL server shuts down, reboots, or a network partition otherwise causes it to become unavailable while your pool has connected clients. Example: ```js const Pool = require('pg-pool') const pool = new Pool() // attach an error handler to the pool for when a connected, idle client // receives an error by being disconnected, etc pool.on('error', function(error, client) { // handle this in the same way you would treat process.on('uncaughtException') // it is supplied the error as well as the idle client which received the error }) ``` #### connect Fired whenever the pool creates a __new__ `pg.Client` instance and successfully connects it to the backend. Example: ```js const Pool = require('pg-pool') const pool = new Pool() var count = 0 pool.on('connect', client => { client.count = count++ }) pool .connect() .then(client => { return client .query('SELECT $1::int AS "clientCount"', [client.count]) .then(res => console.log(res.rows[0].clientCount)) // outputs 0 .then(() => client) }) .then(client => client.release()) ``` #### acquire Fired whenever the a client is acquired from the pool Example: This allows you to count the number of clients which have ever been acquired from the pool. ```js var Pool = require('pg-pool') var pool = new Pool() var acquireCount = 0 pool.on('acquire', function (client) { acquireCount++ }) var connectCount = 0 pool.on('connect', function () { connectCount++ }) for (var i = 0; i < 200; i++) { pool.query('SELECT NOW()') } setTimeout(function () { console.log('connect count:', connectCount) // output: connect count: 10 console.log('acquire count:', acquireCount) // output: acquire count: 200 }, 100) ``` ### environment variables pg-pool & node-postgres support some of the same environment variables as `psql` supports. The most common are: ``` PGDATABASE=my_db PGUSER=username PGPASSWORD="my awesome password" PGPORT=5432 PGSSLMODE=require ``` Usually I will export these into my local environment via a `.env` file with environment settings or export them in `~/.bash_profile` or something similar. This way I get configurability which works with both the postgres suite of tools (`psql`, `pg_dump`, `pg_restore`) and node, I can vary the environment variables locally and in production, and it supports the concept of a [12-factor app](http://12factor.net/) out of the box. ## bring your own promise In versions of node `<=0.12.x` there is no native promise implementation available globally. You can polyfill the promise globally like this: ```js // first run `npm install promise-polyfill --save if (typeof Promise == 'undefined') { global.Promise = require('promise-polyfill') } ``` You can use any other promise implementation you'd like. The pool also allows you to configure the promise implementation on a per-pool level: ```js var bluebirdPool = new Pool({ Promise: require('bluebird') }) ``` __please note:__ in node `<=0.12.x` the pool will throw if you do not provide a promise constructor in one of the two ways mentioned above. In node `>=4.0.0` the pool will use the native promise implementation by default; however, the two methods above still allow you to "bring your own." ## maxUses and read-replica autoscaling (e.g. AWS Aurora) The maxUses config option can help an application instance rebalance load against a replica set that has been auto-scaled after the connection pool is already full of healthy connections. The mechanism here is that a connection is considered "expended" after it has been acquired and released `maxUses` number of times. Depending on the load on your system, this means there will be an approximate time in which any given connection will live, thus creating a window for rebalancing. Imagine a scenario where you have 10 app instances providing an API running against a replica cluster of 3 that are accessed via a round-robin DNS entry. Each instance runs a connection pool size of 20. With an ambient load of 50 requests per second, the connection pool will likely fill up in a few minutes with healthy connections. If you have weekly bursts of traffic which peak at 1,000 requests per second, you might want to grow your replicas to 10 during this period. Without setting `maxUses`, the new replicas will not be adopted by the app servers without an intervention -- namely, restarting each in turn in order to build up new connection pools that are balanced against all the replicas. Adding additional app server instances will help to some extent because they will adopt all the replicas in an even way, but the initial app servers will continue to focus additional load on the original replicas. This is where the `maxUses` configuration option comes into play. Setting `maxUses` to 7500 will ensure that over a period of 30 minutes or so the new replicas will be adopted as the pre-existing connections are closed and replaced with new ones, thus creating a window for eventual balance. You'll want to test based on your own scenarios, but one way to make a first guess at `maxUses` is to identify an acceptable window for rebalancing and then solve for the value: ``` maxUses = rebalanceWindowSeconds * totalRequestsPerSecond / numAppInstances / poolSize ``` In the example above, assuming we acquire and release 1 connection per request and we are aiming for a 30 minute rebalancing window: ``` maxUses = rebalanceWindowSeconds * totalRequestsPerSecond / numAppInstances / poolSize 7200 = 1800 * 1000 / 10 / 25 ``` ## tests To run tests clone the repo, `npm i` in the working dir, and then run `npm test` ## contributions I love contributions. Please make sure they have tests, and submit a PR. If you're not sure if the issue is worth it or will be accepted it never hurts to open an issue to begin the conversation. If you're interested in keeping up with node-postgres releated stuff, you can follow me on twitter at [@briancarlson](https://twitter.com/briancarlson) - I generally announce any noteworthy updates there. ## license The MIT License (MIT) Copyright (c) 2016 Brian M. Carlson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pg-pool/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pg-pool/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 13900 }
# pg-protocol Low level postgres wire protocol parser and serializer written in Typescript. Used by node-postgres. Needs more documentation. :smile:
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pg-protocol/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pg-protocol/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 149 }
# pg-types This is the code that turns all the raw text from postgres into JavaScript types for [node-postgres](https://github.com/brianc/node-postgres.git) ## use This module is consumed and exported from the root `pg` object of node-postgres. To access it, do the following: ```js var types = require('pg').types ``` Generally what you'll want to do is override how a specific data-type is parsed and turned into a JavaScript type. By default the PostgreSQL backend server returns everything as strings. Every data type corresponds to a unique `OID` within the server, and these `OIDs` are sent back with the query response. So, you need to match a particluar `OID` to a function you'd like to use to take the raw text input and produce a valid JavaScript object as a result. `null` values are never parsed. Let's do something I commonly like to do on projects: return 64-bit integers `(int8)` as JavaScript integers. Because JavaScript doesn't have support for 64-bit integers node-postgres cannot confidently parse `int8` data type results as numbers because if you have a _huge_ number it will overflow and the result you'd get back from node-postgres would not be the result in the database. That would be a __very bad thing__ so node-postgres just returns `int8` results as strings and leaves the parsing up to you. Let's say that you know you don't and wont ever have numbers greater than `int4` in your database, but you're tired of receiving results from the `COUNT(*)` function as strings (because that function returns `int8`). You would do this: ```js var types = require('pg').types types.setTypeParser(20, function(val) { return parseInt(val, 10) }) ``` __boom__: now you get numbers instead of strings. Just as another example -- not saying this is a good idea -- let's say you want to return all dates from your database as [moment](http://momentjs.com/docs/) objects. Okay, do this: ```js var types = require('pg').types var moment = require('moment') var parseFn = function(val) { return val === null ? null : moment(val) } types.setTypeParser(types.builtins.TIMESTAMPTZ, parseFn) types.setTypeParser(types.builtins.TIMESTAMP, parseFn) ``` _note: I've never done that with my dates, and I'm not 100% sure moment can parse all the date strings returned from postgres. It's just an example!_ If you're thinking "gee, this seems pretty handy, but how can I get a list of all the OIDs in the database and what they correspond to?!?!?!" worry not: ```bash $ psql -c "select typname, oid, typarray from pg_type order by oid" ``` If you want to find out the OID of a specific type: ```bash $ psql -c "select typname, oid, typarray from pg_type where typname = 'daterange' order by oid" ``` :smile: ## license The MIT License (MIT) Copyright (c) 2014 Brian M. Carlson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pg-types/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pg-types/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 3835 }
# node-postgres [![Build Status](https://secure.travis-ci.org/brianc/node-postgres.svg?branch=master)](http://travis-ci.org/brianc/node-postgres) <span class="badge-npmversion"><a href="https://npmjs.org/package/pg" title="View this project on NPM"><img src="https://img.shields.io/npm/v/pg.svg" alt="NPM version" /></a></span> <span class="badge-npmdownloads"><a href="https://npmjs.org/package/pg" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/pg.svg" alt="NPM downloads" /></a></span> Non-blocking PostgreSQL client for Node.js. Pure JavaScript and optional native libpq bindings. ## Install ```sh $ npm install pg ``` --- ## :star: [Documentation](https://node-postgres.com) :star: ### Features - Pure JavaScript client and native libpq bindings share _the same API_ - Connection pooling - Extensible JS ↔ PostgreSQL data-type coercion - Supported PostgreSQL features - Parameterized queries - Named statements with query plan caching - Async notifications with `LISTEN/NOTIFY` - Bulk import & export with `COPY TO/COPY FROM` ### Extras node-postgres is by design pretty light on abstractions. These are some handy modules we've been using over the years to complete the picture. The entire list can be found on our [wiki](https://github.com/brianc/node-postgres/wiki/Extras). ## Support node-postgres is free software. If you encounter a bug with the library please open an issue on the [GitHub repo](https://github.com/brianc/node-postgres). If you have questions unanswered by the documentation please open an issue pointing out how the documentation was unclear & I will do my best to make it better! When you open an issue please provide: - version of Node - version of Postgres - smallest possible snippet of code to reproduce the problem You can also follow me [@briancarlson](https://twitter.com/briancarlson) if that's your thing. I try to always announce noteworthy changes & developments with node-postgres on Twitter. ## Sponsorship :two_hearts: node-postgres's continued development has been made possible in part by generous finanical support from [the community](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md). If you or your company are benefiting from node-postgres and would like to help keep the project financially sustainable [please consider supporting](https://github.com/sponsors/brianc) its development. ## Contributing **:heart: contributions!** I will **happily** accept your pull request if it: - **has tests** - looks reasonable - does not break backwards compatibility If your change involves breaking backwards compatibility please please point that out in the pull request & we can discuss & plan when and how to release it and what type of documentation or communicate it will require. ## Troubleshooting and FAQ The causes and solutions to common errors can be found among the [Frequently Asked Questions (FAQ)](https://github.com/brianc/node-postgres/wiki/FAQ) ## License Copyright (c) 2010-2020 Brian Carlson ([email protected]) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pg/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pg/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 4080 }
# pgpass [![Build Status](https://github.com/hoegaarden/pgpass/workflows/CI/badge.svg?branch=master)](https://github.com/hoegaarden/pgpass/actions?query=workflow%3ACI+branch%3Amaster) ## Install ```sh npm install pgpass ``` ## Usage ```js var pgPass = require('pgpass'); var connInfo = { 'host' : 'pgserver' , 'user' : 'the_user_name' , }; pgPass(connInfo, function(pass){ conn_info.password = pass; // connect to postgresql server }); ``` ## Description This module tries to read the `~/.pgpass` file (or the equivalent for windows systems). If the environment variable `PGPASSFILE` is set, this file is used instead. If everything goes right, the password from said file is passed to the callback; if the password cannot be read `undefined` is passed to the callback. Cases where `undefined` is returned: - the environment variable `PGPASSWORD` is set - the file cannot be read (wrong permissions, no such file, ...) - for non windows systems: the file is write-/readable by the group or by other users - there is no matching line for the given connection info There should be no need to use this module directly; it is already included in `node-postgres`. ## Configuration The module reads the environment variable `PGPASS_NO_DEESCAPE` to decide if the the read tokens from the password file should be de-escaped or not. Default is to do de-escaping. For further information on this see [this commit](https://github.com/postgres/postgres/commit/8d15e3ec4fcb735875a8a70a09ec0c62153c3329). ## Tests There are tests in `./test/`; including linting and coverage testing. Running `npm test` runs: - `jshint` - `mocha` tests - `jscoverage` and `mocha -R html-cov` You can see the coverage report in `coverage.html`. ## Development, Patches, Bugs, ... If you find Bugs or have improvements, please feel free to open a issue on GitHub. If you provide a pull request, I'm more than happy to merge them, just make sure to add tests for your changes. ## Links - https://github.com/hoegaarden/node-pgpass - http://www.postgresql.org/docs/current/static/libpq-pgpass.html - https://wiki.postgresql.org/wiki/Pgpass - https://github.com/postgres/postgres/blob/master/src/interfaces/libpq/fe-connect.c ## License Copyright (c) 2013-2016 Hannes Hörl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pgpass/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pgpass/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 3292 }
# picocolors The tiniest and the fastest library for terminal output formatting with ANSI colors. ```javascript import pc from "picocolors" console.log( pc.green(`How are ${pc.italic(`you`)} doing?`) ) ``` - **No dependencies.** - **14 times** smaller and **2 times** faster than chalk. - Used by popular tools like PostCSS, SVGO, Stylelint, and Browserslist. - Node.js v6+ & browsers support. Support for both CJS and ESM projects. - TypeScript type declarations included. - [`NO_COLOR`](https://no-color.org/) friendly. ## Docs Read **[full docs](https://github.com/alexeyraspopov/picocolors#readme)** on GitHub.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/picocolors/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/picocolors/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 621 }
# Release history **All notable changes to this project will be documented in this file.** The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). <details> <summary><strong>Guiding Principles</strong></summary> - Changelogs are for humans, not machines. - There should be an entry for every single version. - The same types of changes should be grouped. - Versions and sections should be linkable. - The latest version comes first. - The release date of each versions is displayed. - Mention whether you follow Semantic Versioning. </details> <details> <summary><strong>Types of changes</strong></summary> Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): - `Added` for new features. - `Changed` for changes in existing functionality. - `Deprecated` for soon-to-be removed features. - `Removed` for now removed features. - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. </details> ## 2.3.1 (2022-01-02) ### Fixed * Fixes bug when a pattern containing an expression after the closing parenthesis (`/!(*.d).{ts,tsx}`) was incorrectly converted to regexp ([9f241ef](https://github.com/micromatch/picomatch/commit/9f241ef)). ### Changed * Some documentation improvements ([f81d236](https://github.com/micromatch/picomatch/commit/f81d236), [421e0e7](https://github.com/micromatch/picomatch/commit/421e0e7)). ## 2.3.0 (2021-05-21) ### Fixed * Fixes bug where file names with two dots were not being matched consistently with negation extglobs containing a star ([56083ef](https://github.com/micromatch/picomatch/commit/56083ef)) ## 2.2.3 (2021-04-10) ### Fixed * Do not skip pattern seperator for square brackets ([fb08a30](https://github.com/micromatch/picomatch/commit/fb08a30)). * Set negatedExtGlob also if it does not span the whole pattern ([032e3f5](https://github.com/micromatch/picomatch/commit/032e3f5)). ## 2.2.2 (2020-03-21) ### Fixed * Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)). ## 2.2.1 (2020-01-04) * Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals. ## 2.2.0 (2020-01-04) * Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f)) * Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`. ## 2.1.0 (2019-10-31) * add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92)) * Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650)) * Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c)) * Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9)) * Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625)) * closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0)) * Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8)) * fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07)) * fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45)) * Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34)) * lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55)) * Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03)) * minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87)) * minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d)) * remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa)) * remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d)) * Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54)) * Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367)) * support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569)) * update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77)) * update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038)) * Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd)) ## 2.0.7 (2019-05-14) * 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71)) * supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e)) * update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279)) * fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44)) ## 2.0.4 (2019-04-10) ### Fixed - Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez. - `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza. ## 2.0.0 (2019-04-10) ### Added - Adds support for `options.onIgnore`. See the readme for details - Adds support for `options.onResult`. See the readme for details ### Breaking changes - The unixify option was renamed to `windows` - caching and all related options and methods have been removed ## 1.0.0 (2018-11-05) - adds `.onMatch` option - improvements to `.scan` method - numerous improvements and optimizations for matching and parsing - better windows path handling ## 0.1.0 - 2017-04-13 First release. [keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/picomatch/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/picomatch/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 6202 }
<h1 align="center">Picomatch</h1> <p align="center"> <a href="https://npmjs.org/package/picomatch"> <img src="https://img.shields.io/npm/v/picomatch.svg" alt="version"> </a> <a href="https://github.com/micromatch/picomatch/actions?workflow=Tests"> <img src="https://github.com/micromatch/picomatch/workflows/Tests/badge.svg" alt="test status"> </a> <a href="https://coveralls.io/github/micromatch/picomatch"> <img src="https://img.shields.io/coveralls/github/micromatch/picomatch/master.svg" alt="coverage status"> </a> <a href="https://npmjs.org/package/picomatch"> <img src="https://img.shields.io/npm/dm/picomatch.svg" alt="downloads"> </a> </p> <br> <br> <p align="center"> <strong>Blazing fast and accurate glob matcher written in JavaScript.</strong></br> <em>No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.</em> </p> <br> <br> ## Why picomatch? * **Lightweight** - No dependencies * **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. * **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) * **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) * **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. * **Well tested** - Thousands of unit tests See the [library comparison](#library-comparisons) to other libraries. <br> <br> ## Table of Contents <details><summary> Click to expand </summary> - [Install](#install) - [Usage](#usage) - [API](#api) * [picomatch](#picomatch) * [.test](#test) * [.matchBase](#matchbase) * [.isMatch](#ismatch) * [.parse](#parse) * [.scan](#scan) * [.compileRe](#compilere) * [.makeRe](#makere) * [.toRegex](#toregex) - [Options](#options) * [Picomatch options](#picomatch-options) * [Scan Options](#scan-options) * [Options Examples](#options-examples) - [Globbing features](#globbing-features) * [Basic globbing](#basic-globbing) * [Advanced globbing](#advanced-globbing) * [Braces](#braces) * [Matching special characters as literals](#matching-special-characters-as-literals) - [Library Comparisons](#library-comparisons) - [Benchmarks](#benchmarks) - [Philosophies](#philosophies) - [About](#about) * [Author](#author) * [License](#license) _(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ </details> <br> <br> ## Install Install with [npm](https://www.npmjs.com/): ```sh npm install --save picomatch ``` <br> ## Usage The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. ```js const pm = require('picomatch'); const isMatch = pm('*.js'); console.log(isMatch('abcd')); //=> false console.log(isMatch('a.js')); //=> true console.log(isMatch('a.md')); //=> false console.log(isMatch('a/b.js')); //=> false ``` <br> ## API ### [picomatch](lib/picomatch.js#L32) Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. **Params** * `globs` **{String|Array}**: One or more glob patterns. * `options` **{Object=}** * `returns` **{Function=}**: Returns a matcher function. **Example** ```js const picomatch = require('picomatch'); // picomatch(glob[, options]); const isMatch = picomatch('*.!(*a)'); console.log(isMatch('a.a')); //=> false console.log(isMatch('a.b')); //=> true ``` ### [.test](lib/picomatch.js#L117) Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. **Params** * `input` **{String}**: String to test. * `regex` **{RegExp}** * `returns` **{Object}**: Returns an object with matching info. **Example** ```js const picomatch = require('picomatch'); // picomatch.test(input, regex[, options]); console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } ``` ### [.matchBase](lib/picomatch.js#L161) Match the basename of a filepath. **Params** * `input` **{String}**: String to test. * `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). * `returns` **{Boolean}** **Example** ```js const picomatch = require('picomatch'); // picomatch.matchBase(input, glob[, options]); console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true ``` ### [.isMatch](lib/picomatch.js#L183) Returns true if **any** of the given glob `patterns` match the specified `string`. **Params** * **{String|Array}**: str The string to test. * **{String|Array}**: patterns One or more glob patterns to use for matching. * **{Object}**: See available [options](#options). * `returns` **{Boolean}**: Returns true if any patterns match `str` **Example** ```js const picomatch = require('picomatch'); // picomatch.isMatch(string, patterns[, options]); console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true console.log(picomatch.isMatch('a.a', 'b.*')); //=> false ``` ### [.parse](lib/picomatch.js#L199) Parse a glob pattern to create the source string for a regular expression. **Params** * `pattern` **{String}** * `options` **{Object}** * `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. **Example** ```js const picomatch = require('picomatch'); const result = picomatch.parse(pattern[, options]); ``` ### [.scan](lib/picomatch.js#L231) Scan a glob pattern to separate the pattern into segments. **Params** * `input` **{String}**: Glob pattern to scan. * `options` **{Object}** * `returns` **{Object}**: Returns an object with **Example** ```js const picomatch = require('picomatch'); // picomatch.scan(input[, options]); const result = picomatch.scan('!./foo/*.js'); console.log(result); { prefix: '!./', input: '!./foo/*.js', start: 3, base: 'foo', glob: '*.js', isBrace: false, isBracket: false, isGlob: true, isExtglob: false, isGlobstar: false, negated: true } ``` ### [.compileRe](lib/picomatch.js#L245) Compile a regular expression from the `state` object returned by the [parse()](#parse) method. **Params** * `state` **{Object}** * `options` **{Object}** * `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. * `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. * `returns` **{RegExp}** ### [.makeRe](lib/picomatch.js#L286) Create a regular expression from a parsed glob pattern. **Params** * `state` **{String}**: The object returned from the `.parse` method. * `options` **{Object}** * `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. * `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. * `returns` **{RegExp}**: Returns a regex created from the given pattern. **Example** ```js const picomatch = require('picomatch'); const state = picomatch.parse('*.js'); // picomatch.compileRe(state[, options]); console.log(picomatch.compileRe(state)); //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ ``` ### [.toRegex](lib/picomatch.js#L321) Create a regular expression from the given regex source string. **Params** * `source` **{String}**: Regular expression source string. * `options` **{Object}** * `returns` **{RegExp}** **Example** ```js const picomatch = require('picomatch'); // picomatch.toRegex(source[, options]); const { output } = picomatch.parse('*.js'); console.log(picomatch.toRegex(output)); //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ ``` <br> ## Options ### Picomatch options The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. | **Option** | **Type** | **Default value** | **Description** | | --- | --- | --- | --- | | `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | | `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | | `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | | `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | | `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | | `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | | `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | | `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | | `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | | `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | | `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | | [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | | `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | | `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | | `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | | `matchBase` | `boolean` | `false` | Alias for `basename` | | `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | | `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | | `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | | `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | | `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | | `noext` | `boolean` | `false` | Alias for `noextglob` | | `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | | `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | | `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | | `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | | [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | | [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | | [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | | `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | | `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | | `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | | `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | | `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | | `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | | `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | | `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error. ### Scan Options In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. | **Option** | **Type** | **Default value** | **Description** | | --- | --- | --- | --- | | `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | | `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | **Example** ```js const picomatch = require('picomatch'); const result = picomatch.scan('!./foo/*.js', { tokens: true }); console.log(result); // { // prefix: '!./', // input: '!./foo/*.js', // start: 3, // base: 'foo', // glob: '*.js', // isBrace: false, // isBracket: false, // isGlob: true, // isExtglob: false, // isGlobstar: false, // negated: true, // maxDepth: 2, // tokens: [ // { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, // { value: 'foo', depth: 1, isGlob: false }, // { value: '*.js', depth: 1, isGlob: true } // ], // slashes: [ 2, 6 ], // parts: [ 'foo', '*.js' ] // } ``` <br> ### Options Examples #### options.expandRange **Type**: `function` **Default**: `undefined` Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. **Example** The following example shows how to create a glob that matches a folder ```js const fill = require('fill-range'); const regex = pm.makeRe('foo/{01..25}/bar', { expandRange(a, b) { return `(${fill(a, b, { toRegex: true })})`; } }); console.log(regex); //=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ console.log(regex.test('foo/00/bar')) // false console.log(regex.test('foo/01/bar')) // true console.log(regex.test('foo/10/bar')) // true console.log(regex.test('foo/22/bar')) // true console.log(regex.test('foo/25/bar')) // true console.log(regex.test('foo/26/bar')) // false ``` #### options.format **Type**: `function` **Default**: `undefined` Custom function for formatting strings before they're matched. **Example** ```js // strip leading './' from strings const format = str => str.replace(/^\.\//, ''); const isMatch = picomatch('foo/*.js', { format }); console.log(isMatch('./foo/bar.js')); //=> true ``` #### options.onMatch ```js const onMatch = ({ glob, regex, input, output }) => { console.log({ glob, regex, input, output }); }; const isMatch = picomatch('*', { onMatch }); isMatch('foo'); isMatch('bar'); isMatch('baz'); ``` #### options.onIgnore ```js const onIgnore = ({ glob, regex, input, output }) => { console.log({ glob, regex, input, output }); }; const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); isMatch('foo'); isMatch('bar'); isMatch('baz'); ``` #### options.onResult ```js const onResult = ({ glob, regex, input, output }) => { console.log({ glob, regex, input, output }); }; const isMatch = picomatch('*', { onResult, ignore: 'f*' }); isMatch('foo'); isMatch('bar'); isMatch('baz'); ``` <br> <br> ## Globbing features * [Basic globbing](#basic-globbing) (Wildcard matching) * [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) ### Basic globbing | **Character** | **Description** | | --- | --- | | `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | | `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | | `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | | `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | #### Matching behavior vs. Bash Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: * Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. * Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. <br> ### Advanced globbing * [extglobs](#extglobs) * [POSIX brackets](#posix-brackets) * [Braces](#brace-expansion) #### Extglobs | **Pattern** | **Description** | | --- | --- | | `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | | `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | | `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | | `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | | `!(pattern)` | Match _anything but_ `pattern` | **Examples** ```js const pm = require('picomatch'); // *(pattern) matches ZERO or more of "pattern" console.log(pm.isMatch('a', 'a*(z)')); // true console.log(pm.isMatch('az', 'a*(z)')); // true console.log(pm.isMatch('azzz', 'a*(z)')); // true // +(pattern) matches ONE or more of "pattern" console.log(pm.isMatch('a', 'a*(z)')); // true console.log(pm.isMatch('az', 'a*(z)')); // true console.log(pm.isMatch('azzz', 'a*(z)')); // true // supports multiple extglobs console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false // supports nested extglobs console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true ``` #### POSIX brackets POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. **Enable POSIX bracket support** ```js console.log(pm.makeRe('[[:word:]]+', { posix: true })); //=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ ``` **Supported POSIX classes** The following named POSIX bracket expressions are supported: * `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` * `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. * `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. * `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. * `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. * `[:digit:]` - Numerical digits, equivalent to `[0-9]`. * `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. * `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. * `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. * `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. * `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. * `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. * `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. * `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. ### Braces Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. ### Matching special characters as literals If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: **Special Characters** Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. To match any of the following characters as literals: `$^*+?()[] Examples: ```js console.log(pm.makeRe('foo/bar \\(1\\)')); console.log(pm.makeRe('foo/bar \\(1\\)')); ``` <br> <br> ## Library Comparisons The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). | **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | | --- | --- | --- | --- | --- | --- | --- | --- | | Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | | Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | | Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | | Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | | Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | | Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | | Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | | File system operations | - | - | - | - | - | - | - | <br> <br> ## Benchmarks Performance comparison of picomatch and minimatch. ``` # .makeRe star picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled) minimatch x 627,206 ops/sec ±1.96% (87 runs sampled)) # .makeRe star; dot=true picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled) minimatch x 525,876 ops/sec ±0.60% (88 runs sampled) # .makeRe globstar picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled) minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d) # .makeRe globstars picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled) minimatch x 477,179 ops/sec ±1.33% (91 runs sampled) # .makeRe with leading star picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled) minimatch x 453,564 ops/sec ±1.43% (94 runs sampled) # .makeRe - basic braces picomatch x 392,067 ops/sec ±0.70% (90 runs sampled) minimatch x 99,532 ops/sec ±2.03% (87 runs sampled)) ``` <br> <br> ## Philosophies The goal of this library is to be blazing fast, without compromising on accuracy. **Accuracy** The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. **Performance** Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. <br> <br> ## About <details> <summary><strong>Contributing</strong></summary> Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. </details> <details> <summary><strong>Running Tests</strong></summary> Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: ```sh npm install && npm test ``` </details> <details> <summary><strong>Building docs</strong></summary> _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ To generate the readme, run the following command: ```sh npm install -g verbose/verb#dev verb-generate-readme && verb ``` </details> ### Author **Jon Schlinkert** * [GitHub Profile](https://github.com/jonschlinkert) * [Twitter Profile](https://twitter.com/jonschlinkert) * [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) ### License Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). Released under the [MIT License](LICENSE).
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/picomatch/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/picomatch/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 27381 }
# pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify) > Promisify a callback-style function ## Install ``` $ npm install --save pify ``` ## Usage ```js const fs = require('fs'); const pify = require('pify'); // promisify a single function pify(fs.readFile)('package.json', 'utf8').then(data => { console.log(JSON.parse(data).name); //=> 'pify' }); // or promisify all methods in a module pify(fs).readFile('package.json', 'utf8').then(data => { console.log(JSON.parse(data).name); //=> 'pify' }); ``` ## API ### pify(input, [promiseModule], [options]) Returns a promise wrapped version of the supplied function or module. #### input Type: `function`, `object` Callback-style function or module whose methods you want to promisify. #### promiseModule Type: `function` Custom promise module to use instead of the native one. Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. #### options ##### multiArgs Type: `boolean` Default: `false` By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. ```js const request = require('request'); const pify = require('pify'); pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { const [httpResponse, body] = result; }); ``` ##### include Type: `array` of (`string`|`regex`) Methods in a module to promisify. Remaining methods will be left untouched. ##### exclude Type: `array` of (`string`|`regex`) Default: `[/.+Sync$/]` Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. ##### excludeMain Type: `boolean` Default: `false` By default, if given module is a function itself, this function will be promisified. Turn this option on if you want to promisify only methods of the module. ```js const pify = require('pify'); function fn() { return true; } fn.method = (data, callback) => { setImmediate(() => { callback(data, null); }); }; // promisify methods but not fn() const promiseFn = pify(fn, {excludeMain: true}); if (promiseFn()) { promiseFn.method('hi').then(data => { console.log(data); }); } ``` ## License MIT © [Sindre Sorhus](http://sindresorhus.com)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pify/readme.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pify/readme.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2577 }
# Pirates [![Coverage][codecov-badge]][codecov-link] ### Properly hijack require [codecov-badge]: https://img.shields.io/codecov/c/github/danez/pirates/master.svg?style=flat "codecov" [codecov-link]: https://codecov.io/gh/danez/pirates "codecov" ## Why? Two reasons: 1. Babel and istanbul were breaking each other. 2. Everyone seemed to re-invent the wheel on this, and everyone wanted a solution that was DRY, simple, easy to use, and made everything Just Work™, while allowing multiple require hooks, in a fashion similar to calling `super`. For some context, see [the Babel issue thread][] which started this all, then [the nyc issue thread][], where discussion was moved (as we began to discuss just using the code nyc had developed), and finally to [#1][issue-1] where discussion was finally moved. [the Babel issue thread]: https://github.com/babel/babel/pull/3062 "Babel Issue Thread" [the nyc issue thread]: https://github.com/bcoe/nyc/issues/70 "NYC Issue Thread" [issue-1]: https://github.com/danez/pirates/issues/1 "Issue #1" ## Installation npm install --save pirates ## Usage Using pirates is really easy: ```javascript // my-module/register.js const addHook = require('pirates').addHook; // Or if you use ES modules // import { addHook } from 'pirates'; function matcher(filename) { // Here, you can inspect the filename to determine if it should be hooked or // not. Just return a truthy/falsey. Files in node_modules are automatically ignored, // unless otherwise specified in options (see below). // TODO: Implement your logic here return true; } const revert = addHook( (code, filename) => code.replace('@@foo', 'console.log(\'foo\');'), { exts: ['.js'], matcher } ); // And later, if you want to un-hook require, you can just do: revert(); ``` ## API ### pirates.addHook(hook, [opts={ [matcher: true], [exts: ['.js']], [ignoreNodeModules: true] }]); Add a require hook. `hook` must be a function that takes `(code, filename)`, and returns the modified code. `opts` is an optional options object. Available options are: `matcher`, which is a function that accepts a filename, and returns a truthy value if the file should be hooked (defaults to a function that always returns true), falsey if otherwise; `exts`, which is an array of extensions to hook, they should begin with `.` (defaults to `['.js']`); `ignoreNodeModules`, if true, any file in a `node_modules` folder wont be hooked (the matcher also wont be called), if false, then the matcher will be called for any files in `node_modules` (defaults to true). ## Projects that use Pirates See the [wiki page](https://github.com/danez/pirates/wiki/Projects-using-Pirates). If you add Pirates to your project, (And you should! It works best if everyone uses it. Then we can have a happy world full of happy require hooks!), please add yourself to the wiki.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pirates/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pirates/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2864 }
# postcss-import [![Build](https://img.shields.io/travis/postcss/postcss-import/master)](https://travis-ci.org/postcss/postcss-import) [![Version](https://img.shields.io/npm/v/postcss-import)](https://github.com/postcss/postcss-import/blob/master/CHANGELOG.md) [![postcss compatibility](https://img.shields.io/npm/dependency-version/postcss-import/peer/postcss)](https://postcss.org/) > [PostCSS](https://github.com/postcss/postcss) plugin to transform `@import` rules by inlining content. This plugin can consume local files, node modules or web_modules. To resolve path of an `@import` rule, it can look into root directory (by default `process.cwd()`), `web_modules`, `node_modules` or local modules. _When importing a module, it will look for `index.css` or file referenced in `package.json` in the `style` or `main` fields._ You can also provide manually multiples paths where to look at. **Notes:** - **This plugin should probably be used as the first plugin of your list. This way, other plugins will work on the AST as if there were only a single file to process, and will probably work as you can expect**. - This plugin works great with [postcss-url](https://github.com/postcss/postcss-url) plugin, which will allow you to adjust assets `url()` (or even inline them) after inlining imported files. - In order to optimize output, **this plugin will only import a file once** on a given scope (root, media query...). Tests are made from the path & the content of imported files (using a hash table). If this behavior is not what you want, look at `skipDuplicates` option - If you are looking for **Glob Imports**, you can use [postcss-import-ext-glob](https://github.com/dimitrinicolas/postcss-import-ext-glob) to extend postcss-import. - Imports which are not modified (by `options.filter` or because they are remote imports) are moved to the top of the output. - **This plugin attempts to follow the CSS `@import` spec**; `@import` statements must precede all other statements (besides `@charset`). ## Installation ```console $ npm install -D postcss-import ``` ## Usage Unless your stylesheet is in the same place where you run postcss (`process.cwd()`), you will need to use `from` option to make relative imports work. ```js // dependencies const fs = require("fs") const postcss = require("postcss") const atImport = require("postcss-import") // css to be processed const css = fs.readFileSync("css/input.css", "utf8") // process css postcss() .use(atImport()) .process(css, { // `from` option is needed here from: "css/input.css" }) .then((result) => { const output = result.css console.log(output) }) ``` `css/input.css`: ```css /* can consume `node_modules`, `web_modules` or local modules */ @import "cssrecipes-defaults"; /* == @import "../node_modules/cssrecipes-defaults/index.css"; */ @import "normalize.css"; /* == @import "../node_modules/normalize.css/normalize.css"; */ @import "foo.css"; /* relative to css/ according to `from` option above */ @import "bar.css" (min-width: 25em); @import 'baz.css' layer(baz-layer); body { background: black; } ``` will give you: ```css /* ... content of ../node_modules/cssrecipes-defaults/index.css */ /* ... content of ../node_modules/normalize.css/normalize.css */ /* ... content of css/foo.css */ @media (min-width: 25em) { /* ... content of css/bar.css */ } @layer baz-layer { /* ... content of css/baz.css */ } body { background: black; } ``` Checkout the [tests](test) for more examples. ### Options ### `filter` Type: `Function` Default: `() => true` Only transform imports for which the test function returns `true`. Imports for which the test function returns `false` will be left as is. The function gets the path to import as an argument and should return a boolean. #### `root` Type: `String` Default: `process.cwd()` or _dirname of [the postcss `from`](https://github.com/postcss/postcss#node-source)_ Define the root where to resolve path (eg: place where `node_modules` are). Should not be used that much. _Note: nested `@import` will additionally benefit of the relative dirname of imported files._ #### `path` Type: `String|Array` Default: `[]` A string or an array of paths in where to look for files. #### `plugins` Type: `Array` Default: `undefined` An array of plugins to be applied on each imported files. #### `resolve` Type: `Function` Default: `null` You can provide a custom path resolver with this option. This function gets `(id, basedir, importOptions)` arguments and should return a path, an array of paths or a promise resolving to the path(s). If you do not return an absolute path, your path will be resolved to an absolute path using the default resolver. You can use [resolve](https://github.com/substack/node-resolve) for this. #### `load` Type: `Function` Default: null You can overwrite the default loading way by setting this option. This function gets `(filename, importOptions)` arguments and returns content or promised content. #### `skipDuplicates` Type: `Boolean` Default: `true` By default, similar files (based on the same content) are being skipped. It's to optimize output and skip similar files like `normalize.css` for example. If this behavior is not what you want, just set this option to `false` to disable it. #### `addModulesDirectories` Type: `Array` Default: `[]` An array of folder names to add to [Node's resolver](https://github.com/substack/node-resolve). Values will be appended to the default resolve directories: `["node_modules", "web_modules"]`. This option is only for adding additional directories to default resolver. If you provide your own resolver via the `resolve` configuration option above, then this value will be ignored. #### `nameLayer` Type: `Function` Default: `null` You can provide a custom naming function for anonymous layers (`@import 'baz.css' layer;`). This function gets `(index, rootFilename)` arguments and should return a unique string. This option only influences imports without a layer name. Without this option the plugin will warn on anonymous layers. #### Example with some options ```js const postcss = require("postcss") const atImport = require("postcss-import") postcss() .use(atImport({ path: ["src/css"], })) .process(cssString) .then((result) => { const { css } = result }) ``` ## `dependency` Message Support `postcss-import` adds a message to `result.messages` for each `@import`. Messages are in the following format: ``` { type: 'dependency', file: absoluteFilePath, parent: fileContainingTheImport } ``` This is mainly for use by postcss runners that implement file watching. --- ## CONTRIBUTING * ⇄ Pull requests and ★ Stars are always welcome. * For bugs and feature requests, please create an issue. * Pull requests must be accompanied by passing automated tests (`$ npm test`). ## [Changelog](CHANGELOG.md) ## [License](LICENSE)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postcss-import/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postcss-import/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 6949 }
# PostCSS JS <img align="right" width="135" height="95" title="Philosopher’s stone, logo of PostCSS" src="https://postcss.org/logo-leftp.svg"> [PostCSS] for CSS-in-JS and styles in JS objects. For example, to use [Stylelint] or [RTLCSS] plugins in your workflow. <a href="https://evilmartians.com/?utm_source=postcss-js"> <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"> </a> [Stylelint]: https://github.com/stylelint/stylelint [PostCSS]: https://github.com/postcss/postcss [RTLCSS]: https://github.com/MohammadYounes/rtlcss ## Docs Read full docs **[here](https://github.com/postcss/postcss-js#readme)**.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postcss-js/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postcss-js/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 719 }
<div align="center"> <img width="100" height="100" title="Load Options" src="http://michael-ciniawsky.github.io/postcss-load-options/logo.svg"> <a href="https://github.com/postcss/postcss"> <img width="110" height="110" title="PostCSS" src="http://postcss.github.io/postcss/logo.svg" hspace="10"> </a> <img width="100" height="100" title="Load Plugins" src="http://michael-ciniawsky.github.io/postcss-load-plugins/logo.svg"> <h1>Load Config</h1> </div> <h2 align="center">Install</h2> ```bash npm i -D postcss-load-config ``` <h2 align="center">Usage</h2> ```bash npm i -S|-D postcss-plugin ``` Install all required PostCSS plugins and save them to your **package.json** `dependencies`/`devDependencies` Then create a PostCSS config file by choosing one of the following formats ### `package.json` Create a **`postcss`** section in your project's **`package.json`** ``` Project (Root) |– client |– public | |- package.json ``` ```json { "postcss": { "parser": "sugarss", "map": false, "plugins": { "postcss-plugin": {} } } } ``` ### `.postcssrc` Create a **`.postcssrc`** file in JSON or YAML format > ℹ️ It's recommended to use an extension (e.g **`.postcssrc.json`** or **`.postcssrc.yml`**) instead of `.postcssrc` ``` Project (Root) |– client |– public | |- (.postcssrc|.postcssrc.json|.postcssrc.yml) |- package.json ``` **`.postcssrc.json`** ```json { "parser": "sugarss", "map": false, "plugins": { "postcss-plugin": {} } } ``` **`.postcssrc.yml`** ```yaml parser: sugarss map: false plugins: postcss-plugin: {} ``` ### `.postcssrc.js` or `postcss.config.js` You may need some logic within your config. In this case create JS file named: - `.postcssrc.js` - `.postcssrc.mjs` - `.postcssrc.cjs` - `.postcssrc.ts` - `.postcssrc.cts` - `postcss.config.js` - `postcss.config.mjs` - `postcss.config.cjs` - `postcss.config.ts` - `postcss.config.cts` ``` Project (Root) |– client |– public |- (.postcssrc|postcss.config).(js|mjs|cjs|ts|cts) |- package.json ``` You can export the config as an `{Object}` **.postcssrc.js** ```js module.exports = { parser: 'sugarss', map: false, plugins: { 'postcss-plugin': {} } } ``` Or export a `{Function}` that returns the config (more about the `ctx` param below) **.postcssrc.js** ```js module.exports = (ctx) => ({ parser: ctx.parser ? 'sugarss' : false, map: ctx.env === 'development' ? ctx.map : false, plugins: { 'postcss-plugin': ctx.options.plugin } }) ``` Plugins can be loaded either using an `{Object}` or an `{Array}` #### `{Object}` **.postcssrc.js** ```js module.exports = ({ env }) => ({ ...options, plugins: { 'postcss-plugin': env === 'production' ? {} : false } }) ``` > ℹ️ When using an `{Object}`, the key can be a Node.js module name, a path to a JavaScript file that is relative to the directory of the PostCSS config file, or an absolute path to a JavaScript file. #### `{Array}` **.postcssrc.js** ```js module.exports = ({ env }) => ({ ...options, plugins: [ env === 'production' ? require('postcss-plugin')() : false ] }) ``` > :warning: When using an `{Array}`, make sure to `require()` each plugin <h2 align="center">Options</h2> |Name|Type|Default|Description| |:--:|:--:|:-----:|:----------| |[**`to`**](#to)|`{String}`|`undefined`|Destination File Path| |[**`map`**](#map)|`{String\|Object}`|`false`|Enable/Disable Source Maps| |[**`from`**](#from)|`{String}`|`undefined`|Source File Path| |[**`parser`**](#parser)|`{String\|Function}`|`false`|Custom PostCSS Parser| |[**`syntax`**](#syntax)|`{String\|Function}`|`false`|Custom PostCSS Syntax| |[**`stringifier`**](#stringifier)|`{String\|Function}`|`false`|Custom PostCSS Stringifier| ### `parser` **.postcssrc.js** ```js module.exports = { parser: 'sugarss' } ``` ### `syntax` **.postcssrc.js** ```js module.exports = { syntax: 'postcss-scss' } ``` ### `stringifier` **.postcssrc.js** ```js module.exports = { stringifier: 'midas' } ``` ### [**`map`**](https://github.com/postcss/postcss/blob/master/docs/source-maps.md) **.postcssrc.js** ```js module.exports = { map: 'inline' } ``` > :warning: In most cases `options.from` && `options.to` are set by the third-party which integrates this package (CLI, gulp, webpack). It's unlikely one needs to set/use `options.from` && `options.to` within a config file. Unless you're a third-party plugin author using this module and its Node API directly **dont't set `options.from` && `options.to` yourself** ### `to` ```js module.exports = { to: 'path/to/dest.css' } ``` ### `from` ```js module.exports = { from: 'path/to/src.css' } ``` <h2 align="center">Plugins</h2> ### `{} || null` The plugin will be loaded with defaults ```js 'postcss-plugin': {} || null ``` **.postcssrc.js** ```js module.exports = { plugins: { 'postcss-plugin': {} || null } } ``` > :warning: `{}` must be an **empty** `{Object}` literal ### `{Object}` The plugin will be loaded with given options ```js 'postcss-plugin': { option: '', option: '' } ``` **.postcssrc.js** ```js module.exports = { plugins: { 'postcss-plugin': { option: '', option: '' } } } ``` ### `false` The plugin will not be loaded ```js 'postcss-plugin': false ``` **.postcssrc.js** ```js module.exports = { plugins: { 'postcss-plugin': false } } ``` ### `Ordering` Plugin **execution order** is determined by declaration in the plugins section (**top-down**) ```js { plugins: { 'postcss-plugin': {}, // [0] 'postcss-plugin': {}, // [1] 'postcss-plugin': {} // [2] } } ``` <h2 align="center">Context</h2> When using a `{Function}` (`postcss.config.js` or `.postcssrc.js`), it's possible to pass context to `postcss-load-config`, which will be evaluated while loading your config. By default `ctx.env (process.env.NODE_ENV)` and `ctx.cwd (process.cwd())` are available on the `ctx` `{Object}` > ℹ️ Most third-party integrations add additional properties to the `ctx` (e.g `postcss-loader`). Check the specific module's README for more information about what is available on the respective `ctx` <h2 align="center">Examples</h2> **postcss.config.js** ```js module.exports = (ctx) => ({ parser: ctx.parser ? 'sugarss' : false, map: ctx.env === 'development' ? ctx.map : false, plugins: { 'postcss-import': {}, 'postcss-nested': {}, cssnano: ctx.env === 'production' ? {} : false } }) ``` <div align="center"> <img width="80" height="80" src="https://worldvectorlogo.com/logos/nodejs-icon.svg"> </div> ```json "scripts": { "build": "NODE_ENV=production node postcss", "start": "NODE_ENV=development node postcss" } ``` ```js const { readFileSync } = require('fs') const postcss = require('postcss') const postcssrc = require('postcss-load-config') const css = readFileSync('index.sss', 'utf8') const ctx = { parser: true, map: 'inline' } postcssrc(ctx).then(({ plugins, options }) => { postcss(plugins) .process(css, options) .then((result) => console.log(result.css)) }) ``` <div align="center"> <img width="80" height="80" halign="10" src="https://worldvectorlogo.com/logos/gulp.svg"> </div> ```json "scripts": { "build": "NODE_ENV=production gulp", "start": "NODE_ENV=development gulp" } ``` ```js const { task, src, dest, series, watch } = require('gulp') const postcss = require('gulp-postcssrc') const css = () => { src('src/*.css') .pipe(postcss()) .pipe(dest('dest')) }) task('watch', () => { watch(['src/*.css', 'postcss.config.js'], css) }) task('default', series(css, 'watch')) ``` <div align="center"> <img width="80" height="80" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg"> </div> ```json "scripts": { "build": "NODE_ENV=production webpack", "start": "NODE_ENV=development webpack-dev-server" } ``` **webpack.config.js** ```js module.exports = (env) => ({ module: { rules: [ { test: /\.css$/, use: [ 'style-loader', 'css-loader', 'postcss-loader' ] } ] } }) ``` <h2 align="center">Maintainers</h2> <table> <tbody> <tr> <td align="center"> <img width="150" height="150" src="https://github.com/michael-ciniawsky.png?v=3&s=150"> <br /> <a href="https://github.com/michael-ciniawsky">Michael Ciniawsky</a> </td> <td align="center"> <img width="150" height="150" src="https://github.com/ertrzyiks.png?v=3&s=150"> <br /> <a href="https://github.com/ertrzyiks">Mateusz Derks</a> </td> </tr> <tbody> </table> <h2 align="center">Contributors</h2> <table> <tbody> <tr> <td align="center"> <img width="150" height="150" src="https://github.com/sparty02.png?v=3&s=150"> <br /> <a href="https://github.com/sparty02">Ryan Dunckel</a> </td> <td align="center"> <img width="150" height="150" src="https://github.com/pcgilday.png?v=3&s=150"> <br /> <a href="https://github.com/pcgilday">Patrick Gilday</a> </td> <td align="center"> <img width="150" height="150" src="https://github.com/daltones.png?v=3&s=150"> <br /> <a href="https://github.com/daltones">Dalton Santos</a> </td> <td align="center"> <img width="150" height="150" src="https://github.com/fwouts.png?v=3&s=150"> <br /> <a href="https://github.com/fwouts">François Wouts</a> </td> </tr> <tbody> </table ## Security Contact To report a security vulnerability, please use the [Tidelift security contact]. Tidelift will coordinate the fix and disclosure. [Tidelift security contact]: https://tidelift.com/security
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postcss-load-config/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postcss-load-config/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 9734 }
# PostCSS Nested <img align="right" width="135" height="95" title="Philosopher’s stone, logo of PostCSS" src="https://postcss.org/logo-leftp.svg"> [PostCSS] plugin to unwrap nested rules closer to Sass syntax. ```css .phone { &_title { width: 500px; @media (max-width: 500px) { width: auto; } body.is_dark & { color: white; } } img { display: block; } } .title { font-size: var(--font); @at-root html { --font: 16px; } } ``` will be processed to: ```css .phone_title { width: 500px; } @media (max-width: 500px) { .phone_title { width: auto; } } body.is_dark .phone_title { color: white; } .phone img { display: block; } .title { font-size: var(--font); } html { --font: 16px; } ``` Related plugins: - Use [`postcss-current-selector`] **after** this plugin if you want to use current selector in properties or variables values. - Use [`postcss-nested-ancestors`] **before** this plugin if you want to reference any ancestor element directly in your selectors with `^&`. Alternatives: - See also [`postcss-nesting`], which implements [CSSWG draft]. - [`postcss-nested-props`] for nested properties like `font-size`. <a href="https://evilmartians.com/?utm_source=postcss-nested"> <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"> </a> [`postcss-current-selector`]: https://github.com/komlev/postcss-current-selector [`postcss-nested-ancestors`]: https://github.com/toomuchdesign/postcss-nested-ancestors [`postcss-nested-props`]: https://github.com/jedmao/postcss-nested-props [`postcss-nesting`]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting [CSSWG draft]: https://drafts.csswg.org/css-nesting-1/ [PostCSS]: https://github.com/postcss/postcss ## Docs Read full docs **[here](https://github.com/postcss/postcss-nested#readme)**.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postcss-nested/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postcss-nested/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1950 }
# API Documentation *Please use only this documented API when working with the parser. Methods not documented here are subject to change at any point.* ## `parser` function This is the module's main entry point. ```js const parser = require('postcss-selector-parser'); ``` ### `parser([transform], [options])` Creates a new `processor` instance ```js const processor = parser(); ``` Or, with optional transform function ```js const transform = selectors => { selectors.walkUniversals(selector => { selector.remove(); }); }; const processor = parser(transform) // Example const result = processor.processSync('*.class'); // => .class ``` [See processor documentation](#processor) Arguments: * `transform (function)`: Provide a function to work with the parsed AST. * `options (object)`: Provide default options for all calls on the returned `Processor`. ### `parser.attribute([props])` Creates a new attribute selector. ```js parser.attribute({attribute: 'href'}); // => [href] ``` Arguments: * `props (object)`: The new node's properties. ### `parser.className([props])` Creates a new class selector. ```js parser.className({value: 'button'}); // => .button ``` Arguments: * `props (object)`: The new node's properties. ### `parser.combinator([props])` Creates a new selector combinator. ```js parser.combinator({value: '+'}); // => + ``` Arguments: * `props (object)`: The new node's properties. Notes: * **Descendant Combinators** The value of descendant combinators created by the parser always just a single space (`" "`). For descendant selectors with no comments, additional space is now stored in `node.spaces.before`. Depending on the location of comments, additional spaces may be stored in `node.raws.spaces.before`, `node.raws.spaces.after`, or `node.raws.value`. * **Named Combinators** Although, nonstandard and unlikely to ever become a standard, named combinators like `/deep/` and `/for/` are parsed as combinators. The `node.value` is name after being unescaped and normalized as lowercase. The original value for the combinator name is stored in `node.raws.value`. ### `parser.comment([props])` Creates a new comment. ```js parser.comment({value: '/* Affirmative, Dave. I read you. */'}); // => /* Affirmative, Dave. I read you. */ ``` Arguments: * `props (object)`: The new node's properties. ### `parser.id([props])` Creates a new id selector. ```js parser.id({value: 'search'}); // => #search ``` Arguments: * `props (object)`: The new node's properties. ### `parser.nesting([props])` Creates a new nesting selector. ```js parser.nesting(); // => & ``` Arguments: * `props (object)`: The new node's properties. ### `parser.pseudo([props])` Creates a new pseudo selector. ```js parser.pseudo({value: '::before'}); // => ::before ``` Arguments: * `props (object)`: The new node's properties. ### `parser.root([props])` Creates a new root node. ```js parser.root(); // => (empty) ``` Arguments: * `props (object)`: The new node's properties. ### `parser.selector([props])` Creates a new selector node. ```js parser.selector(); // => (empty) ``` Arguments: * `props (object)`: The new node's properties. ### `parser.string([props])` Creates a new string node. ```js parser.string(); // => (empty) ``` Arguments: * `props (object)`: The new node's properties. ### `parser.tag([props])` Creates a new tag selector. ```js parser.tag({value: 'button'}); // => button ``` Arguments: * `props (object)`: The new node's properties. ### `parser.universal([props])` Creates a new universal selector. ```js parser.universal(); // => * ``` Arguments: * `props (object)`: The new node's properties. ## Node types ### `node.type` A string representation of the selector type. It can be one of the following; `attribute`, `class`, `combinator`, `comment`, `id`, `nesting`, `pseudo`, `root`, `selector`, `string`, `tag`, or `universal`. Note that for convenience, these constants are exposed on the main `parser` as uppercased keys. So for example you can get `id` by querying `parser.ID`. ```js parser.attribute({attribute: 'href'}).type; // => 'attribute' ``` ### `node.parent` Returns the parent node. ```js root.nodes[0].parent === root; ``` ### `node.toString()`, `String(node)`, or `'' + node` Returns a string representation of the node. ```js const id = parser.id({value: 'search'}); console.log(String(id)); // => #search ``` ### `node.next()` & `node.prev()` Returns the next/previous child of the parent node. ```js const next = id.next(); if (next && next.type !== 'combinator') { throw new Error('Qualified IDs are not allowed!'); } ``` ### `node.replaceWith(node)` Replace a node with another. ```js const attr = selectors.first.first; const className = parser.className({value: 'test'}); attr.replaceWith(className); ``` Arguments: * `node`: The node to substitute the original with. ### `node.remove()` Removes the node from its parent node. ```js if (node.type === 'id') { node.remove(); } ``` ### `node.clone([opts])` Returns a copy of a node, detached from any parent containers that the original might have had. ```js const cloned = node.clone(); ``` ### `node.isAtPosition(line, column)` Return a `boolean` indicating whether this node includes the character at the position of the given line and column. Returns `undefined` if the nodes lack sufficient source metadata to determine the position. Arguments: * `line`: 1-index based line number relative to the start of the selector. * `column`: 1-index based column number relative to the start of the selector. ### `node.spaces` Extra whitespaces around the node will be moved into `node.spaces.before` and `node.spaces.after`. So for example, these spaces will be moved as they have no semantic meaning: ```css h1 , h2 {} ``` For descendent selectors, the value is always a single space. ```css h1 h2 {} ``` Additional whitespace is found in either the `node.spaces.before` and `node.spaces.after` depending on the presence of comments or other whitespace characters. If the actual whitespace does not start or end with a single space, the node's raw value is set to the actual space(s) found in the source. ### `node.source` An object describing the node's start/end, line/column source position. Within the following CSS, the `.bar` class node ... ```css .foo, .bar {} ``` ... will contain the following `source` object. ```js source: { start: { line: 2, column: 3 }, end: { line: 2, column: 6 } } ``` ### `node.sourceIndex` The zero-based index of the node within the original source string. Within the following CSS, the `.baz` class node will have a `sourceIndex` of `12`. ```css .foo, .bar, .baz {} ``` ## Container types The `root`, `selector`, and `pseudo` nodes have some helper methods for working with their children. ### `container.nodes` An array of the container's children. ```js // Input: h1 h2 selectors.at(0).nodes.length // => 3 selectors.at(0).nodes[0].value // => 'h1' selectors.at(0).nodes[1].value // => ' ' ``` ### `container.first` & `container.last` The first/last child of the container. ```js selector.first === selector.nodes[0]; selector.last === selector.nodes[selector.nodes.length - 1]; ``` ### `container.at(index)` Returns the node at position `index`. ```js selector.at(0) === selector.first; selector.at(0) === selector.nodes[0]; ``` Arguments: * `index`: The index of the node to return. ### `container.atPosition(line, column)` Returns the node at the source position `line` and `column`. ```js // Input: :not(.foo),\n#foo > :matches(ol, ul) selector.atPosition(1, 1); // => :not(.foo) selector.atPosition(2, 1); // => \n#foo ``` Arguments: * `line`: The line number of the node to return. * `column`: The column number of the node to return. ### `container.index(node)` Return the index of the node within its container. ```js selector.index(selector.nodes[2]) // => 2 ``` Arguments: * `node`: A node within the current container. ### `container.length` Proxy to the length of the container's nodes. ```js container.length === container.nodes.length ``` ### `container` Array iterators The container class provides proxies to certain Array methods; these are: * `container.map === container.nodes.map` * `container.reduce === container.nodes.reduce` * `container.every === container.nodes.every` * `container.some === container.nodes.some` * `container.filter === container.nodes.filter` * `container.sort === container.nodes.sort` Note that these methods only work on a container's immediate children; recursive iteration is provided by `container.walk`. ### `container.each(callback)` Iterate the container's immediate children, calling `callback` for each child. You may return `false` within the callback to break the iteration. ```js let className; selectors.each((selector, index) => { if (selector.type === 'class') { className = selector.value; return false; } }); ``` Note that unlike `Array#forEach()`, this iterator is safe to use whilst adding or removing nodes from the container. Arguments: * `callback (function)`: A function to call for each node, which receives `node` and `index` arguments. ### `container.walk(callback)` Like `container#each`, but will also iterate child nodes as long as they are `container` types. ```js selectors.walk((selector, index) => { // all nodes }); ``` Arguments: * `callback (function)`: A function to call for each node, which receives `node` and `index` arguments. This iterator is safe to use whilst mutating `container.nodes`, like `container#each`. ### `container.walk` proxies The container class provides proxy methods for iterating over types of nodes, so that it is easier to write modules that target specific selectors. Those methods are: * `container.walkAttributes` * `container.walkClasses` * `container.walkCombinators` * `container.walkComments` * `container.walkIds` * `container.walkNesting` * `container.walkPseudos` * `container.walkTags` * `container.walkUniversals` ### `container.split(callback)` This method allows you to split a group of nodes by returning `true` from a callback. It returns an array of arrays, where each inner array corresponds to the groups that you created via the callback. ```js // (input) => h1 h2>>h3 const list = selectors.first.split(selector => { return selector.type === 'combinator'; }); // (node values) => [['h1', ' '], ['h2', '>>'], ['h3']] ``` Arguments: * `callback (function)`: A function to call for each node, which receives `node` as an argument. ### `container.prepend(node)` & `container.append(node)` Add a node to the start/end of the container. Note that doing so will set the parent property of the node to this container. ```js const id = parser.id({value: 'search'}); selector.append(id); ``` Arguments: * `node`: The node to add. ### `container.insertBefore(old, new)` & `container.insertAfter(old, new)` Add a node before or after an existing node in a container: ```js selectors.walk(selector => { if (selector.type !== 'class') { const className = parser.className({value: 'theme-name'}); selector.parent.insertAfter(selector, className); } }); ``` Arguments: * `old`: The existing node in the container. * `new`: The new node to add before/after the existing node. ### `container.removeChild(node)` Remove the node from the container. Note that you can also use `node.remove()` if you would like to remove just a single node. ```js selector.length // => 2 selector.remove(id) selector.length // => 1; id.parent // undefined ``` Arguments: * `node`: The node to remove. ### `container.removeAll()` or `container.empty()` Remove all children from the container. ```js selector.removeAll(); selector.length // => 0 ``` ## Root nodes A root node represents a comma separated list of selectors. Indeed, all a root's `toString()` method does is join its selector children with a ','. Other than this, it has no special functionality and acts like a container. ### `root.trailingComma` This will be set to `true` if the input has a trailing comma, in order to support parsing of legacy CSS hacks. ## Selector nodes A selector node represents a single complex selector. For example, this selector string `h1 h2 h3, [href] > p`, is represented as two selector nodes. It has no special functionality of its own. ## Pseudo nodes A pseudo selector extends a container node; if it has any parameters of its own (such as `h1:not(h2, h3)`), they will be its children. Note that the pseudo `value` will always contain the colons preceding the pseudo identifier. This is so that both `:before` and `::before` are properly represented in the AST. ## Attribute nodes ### `attribute.quoted` Returns `true` if the attribute's value is wrapped in quotation marks, false if it is not. Remains `undefined` if there is no attribute value. ```css [href=foo] /* false */ [href='foo'] /* true */ [href="foo"] /* true */ [href] /* undefined */ ``` ### `attribute.qualifiedAttribute` Returns the attribute name qualified with the namespace if one is given. ### `attribute.offsetOf(part)` Returns the offset of the attribute part specified relative to the start of the node of the output string. This is useful in raising error messages about a specific part of the attribute, especially in combination with `attribute.sourceIndex`. Returns `-1` if the name is invalid or the value doesn't exist in this attribute. The legal values for `part` are: * `"ns"` - alias for "namespace" * `"namespace"` - the namespace if it exists. * `"attribute"` - the attribute name * `"attributeNS"` - the start of the attribute or its namespace * `"operator"` - the match operator of the attribute * `"value"` - The value (string or identifier) * `"insensitive"` - the case insensitivity flag ### `attribute.raws.unquoted` Returns the unquoted content of the attribute's value. Remains `undefined` if there is no attribute value. ```css [href=foo] /* foo */ [href='foo'] /* foo */ [href="foo"] /* foo */ [href] /* undefined */ ``` ### `attribute.spaces` Like `node.spaces` with the `before` and `after` values containing the spaces around the element, the parts of the attribute can also have spaces before and after them. The for each of `attribute`, `operator`, `value` and `insensitive` there is corresponding property of the same nam in `node.spaces` that has an optional `before` or `after` string containing only whitespace. Note that corresponding values in `attributes.raws.spaces` contain values including any comments. If set, these values will override the `attribute.spaces` value. Take care to remove them if changing `attribute.spaces`. ### `attribute.raws` The raws object stores comments and other information necessary to re-render the node exactly as it was in the source. If a comment is embedded within the identifiers for the `namespace`, `attribute` or `value` then a property is placed in the raws for that value containing the full source of the propery including comments. If a comment is embedded within the space between parts of the attribute then the raw for that space is set accordingly. Setting an attribute's property `raws` value to be deleted. For now, changing the spaces required also updating or removing any of the raws values that override them. Example: `[ /*before*/ href /* after-attr */ = /* after-operator */ te/*inside-value*/st/* wow */ /*omg*/i/*bbq*/ /*whodoesthis*/]` would parse as: ```js { attribute: "href", operator: "=", value: "test", spaces: { before: '', after: '', attribute: { before: ' ', after: ' ' }, operator: { after: ' ' }, value: { after: ' ' }, insensitive: { after: ' ' } }, raws: { spaces: { attribute: { before: ' /*before*/ ', after: ' /* after-attr */ ' }, operator: { after: ' /* after-operator */ ' }, value: { after: '/* wow */ /*omg*/' }, insensitive: { after: '/*bbq*/ /*whodoesthis*/' } }, unquoted: 'test', value: 'te/*inside-value*/st' } } ``` ## `Processor` ### `ProcessorOptions` * `lossless` - When `true`, whitespace is preserved. Defaults to `true`. * `updateSelector` - When `true`, if any processor methods are passed a postcss `Rule` node instead of a string, then that Rule's selector is updated with the results of the processing. Defaults to `true`. ### `process|processSync(selectors, [options])` Processes the `selectors`, returning a string from the result of processing. Note: when the `updateSelector` option is set, the rule's selector will be updated with the resulting string. **Example:** ```js const parser = require("postcss-selector-parser"); const processor = parser(); let result = processor.processSync(' .class'); console.log(result); // => .class // Asynchronous operation let promise = processor.process(' .class').then(result => { console.log(result) // => .class }); // To have the parser normalize whitespace values, utilize the options result = processor.processSync(' .class ', {lossless: false}); console.log(result); // => .class // For better syntax errors, pass a PostCSS Rule node. const postcss = require('postcss'); rule = postcss.rule({selector: ' #foo > a, .class '}); processor.process(rule, {lossless: false, updateSelector: true}).then(result => { console.log(result); // => #foo>a,.class console.log("rule:", rule.selector); // => rule: #foo>a,.class }) ``` Arguments: * `selectors (string|postcss.Rule)`: Either a selector string or a PostCSS Rule node. * `[options] (object)`: Process options ### `ast|astSync(selectors, [options])` Like `process()` and `processSync()` but after processing the `selectors` these methods return the `Root` node of the result instead of a string. Note: when the `updateSelector` option is set, the rule's selector will be updated with the resulting string. ### `transform|transformSync(selectors, [options])` Like `process()` and `processSync()` but after processing the `selectors` these methods return the value returned by the processor callback. Note: when the `updateSelector` option is set, the rule's selector will be updated with the resulting string. ### Error Handling Within Selector Processors The root node passed to the selector processor callback has a method `error(message, options)` that returns an error object. This method should always be used to raise errors relating to the syntax of selectors. The options to this method are passed to postcss's error constructor ([documentation](http://postcss.org/api/#container-error)). #### Async Error Example ```js let processor = (root) => { return new Promise((resolve, reject) => { root.walkClasses((classNode) => { if (/^(.*)[-_]/.test(classNode.value)) { let msg = "classes may not have underscores or dashes in them"; reject(root.error(msg, { index: classNode.sourceIndex + RegExp.$1.length + 1, word: classNode.value })); } }); resolve(); }); }; const postcss = require("postcss"); const parser = require("postcss-selector-parser"); const selectorProcessor = parser(processor); const plugin = postcss.plugin('classValidator', (options) => { return (root) => { let promises = []; root.walkRules(rule => { promises.push(selectorProcessor.process(rule)); }); return Promise.all(promises); }; }); postcss(plugin()).process(` .foo-bar { color: red; } `.trim(), {from: 'test.css'}).catch((e) => console.error(e.toString())); // CssSyntaxError: classValidator: ./test.css:1:5: classes may not have underscores or dashes in them // // > 1 | .foo-bar { // | ^ // 2 | color: red; // 3 | } ``` #### Synchronous Error Example ```js let processor = (root) => { root.walkClasses((classNode) => { if (/.*[-_]/.test(classNode.value)) { let msg = "classes may not have underscores or dashes in them"; throw root.error(msg, { index: classNode.sourceIndex, word: classNode.value }); } }); }; const postcss = require("postcss"); const parser = require("postcss-selector-parser"); const selectorProcessor = parser(processor); const plugin = postcss.plugin('classValidator', (options) => { return (root) => { root.walkRules(rule => { selectorProcessor.processSync(rule); }); }; }); postcss(plugin()).process(` .foo-bar { color: red; } `.trim(), {from: 'test.css'}).catch((e) => console.error(e.toString())); // CssSyntaxError: classValidator: ./test.css:1:5: classes may not have underscores or dashes in them // // > 1 | .foo-bar { // | ^ // 2 | color: red; // 3 | } ```
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postcss-selector-parser/API.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postcss-selector-parser/API.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 20997 }
# 6.1.2 - Fixed: erroneous trailing combinators in pseudos # 6.1.1 - Fixed: improve typings of constructor helpers (#292) # 6.1.0 - Feature: add `sourceIndex` to `Selector` nodes (#290) # 6.0.16 - Fixed: add missing `index` argument to `each`/`walk` callback types (#289) # 6.0.15 - Fixed: Node#prev and Node#next type for the first/last node # 6.0.14 - Fixed: type definitions # 6.0.13 - Fixed: throw on unexpected pipe symbols # 6.0.12 - Fixed: `clone` arguments should be optional # 6.0.11 - Fixed: parse attribute case insensitivity flag # 6.0.10 - Fixed: `isPseudoElement()` supports `:first-letter` and `:first-line` # 6.0.9 - Fixed: `Combinator.raws` property type # 6.0.8 - Fixed: reduced size # 6.0.7 - Fixed: parse animation percents # 6.0.6 - Fixed: parse quoted attributes containing a newline correctly # 6.0.5 - Perf: rework unesc for a 63+% performance boost # 6.0.4 - Fixed: ts errors # 6.0.3 - Fixed: replace node built-in "util" module with "util-deprecate" - Fixed: handle uppercase pseudo elements - Fixed: do not create invalid combinator before comment # 6.0.2 - Fixed an issue with parsing and stringifying an empty attribute value # 6.0.1 - Fixed an issue with unicode surrogate pair parsing # 6.0.0 - Updated: `cssesc` to 3.0.0 (major) - Fixed: Issues with escaped `id` and `class` selectors # 5.0.0 - Allow escaped dot within class name. - Update PostCSS to 7.0.7 (patch) # 5.0.0-rc.4 - Fixed an issue where comments immediately after an insensitive (in attribute) were not parsed correctly. - Updated `cssesc` to 2.0.0 (major). - Removed outdated integration tests. - Added tests for custom selectors, tags with attributes, the universal selector with pseudos, and tokens after combinators. # 5.0.0-rc.1 To ease adoption of the v5.0 release, we have relaxed the node version check performed by npm at installation time to allow for node 4, which remains officially unsupported, but likely to continue working for the time being. # 5.0.0-rc.0 This release has **BREAKING CHANGES** that were required to fix regressions in 4.0.0 and to make the Combinator Node API consistent for all combinator types. Please read carefully. ## Summary of Changes * The way a descendent combinator that isn't a single space character (E.g. `.a .b`) is stored in the AST has changed. * Named Combinators (E.g. `.a /for/ .b`) are now properly parsed as a combinator. * It is now possible to look up a node based on the source location of a character in that node and to query nodes if they contain some character. * Several bug fixes that caused the parser to hang and run out of memory when a `/` was encountered have been fixed. * The minimum supported version of Node is now `v6.0.0`. ### Changes to the Descendent Combinator In prior releases, the value of a descendant combinator with multiple spaces included all the spaces. * `.a .b`: Extra spaces are now stored as space before. - Old & Busted: - `combinator.value === " "` - New hotness: - `combinator.value === " " && combinator.spaces.before === " "` * `.a /*comment*/.b`: A comment at the end of the combinator causes extra space to become after space. - Old & Busted: - `combinator.value === " "` - `combinator.raws.value === " /*comment/"` - New hotness: - `combinator.value === " "` - `combinator.spaces.after === " "` - `combinator.raws.spaces.after === " /*comment*/"` * `.a<newline>.b`: whitespace that doesn't start or end with a single space character is stored as a raw value. - Old & Busted: - `combinator.value === "\n"` - `combinator.raws.value === undefined` - New hotness: - `combinator.value === " "` - `combinator.raws.value === "\n"` ### Support for "Named Combinators" Although, nonstandard and unlikely to ever become a standard, combinators like `/deep/` and `/for/` are now properly supported. Because they've been taken off the standardization track, there is no spec-official name for combinators of the form `/<ident>/`. However, I talked to [Tab Atkins](https://twitter.com/tabatkins) and we agreed to call them "named combinators" so now they are called that. Before this release such named combinators were parsed without intention and generated three nodes of type `"tag"` where the first and last nodes had a value of `"/"`. * `.a /for/ .b` is parsed as a combinator. - Old & Busted: - `root.nodes[0].nodes[1].type === "tag"` - `root.nodes[0].nodes[1].value === "/"` - New hotness: - `root.nodes[0].nodes[1].type === "combinator"` - `root.nodes[0].nodes[1].value === "/for/"` * `.a /F\6fR/ .b` escapes are handled and uppercase is normalized. - Old & Busted: - `root.nodes[0].nodes[2].type === "tag"` - `root.nodes[0].nodes[2].value === "F\\6fR"` - New hotness: - `root.nodes[0].nodes[1].type === "combinator"` - `root.nodes[0].nodes[1].value === "/for/"` - `root.nodes[0].nodes[1].raws.value === "/F\\6fR/"` ### Source position checks and lookups A new API was added to look up a node based on the source location. ```js const selectorParser = require("postcss-selector-parser"); // You can find the most specific node for any given character let combinator = selectorParser.astSync(".a > .b").atPosition(1,4); combinator.toString() === " > "; // You can check if a node includes a specific character // Whitespace surrounding the node that is owned by that node // is included in the check. [2,3,4,5,6].map(column => combinator.isAtPosition(1, column)); // => [false, true, true, true, false] ``` # 4.0.0 This release has **BREAKING CHANGES** that were required to fix bugs regarding values with escape sequences. Please read carefully. * **Identifiers with escapes** - CSS escape sequences are now hidden from the public API by default. The normal value of a node like a class name or ID, or an aspect of a node such as attribute selector's value, is unescaped. Escapes representing Non-ascii characters are unescaped into unicode characters. For example: `bu\tton, .\31 00, #i\2764\FE0Fu, [attr="value is \"quoted\""]` will parse respectively to the values `button`, `100`, `i❤️u`, `value is "quoted"`. The original escape sequences for these values can be found in the corresponding property name in `node.raws`. Where possible, deprecation warnings were added, but the nature of escape handling makes it impossible to detect what is escaped or not. Our expectation is that most users are neither expecting nor handling escape sequences in their use of this library, and so for them, this is a bug fix. Users who are taking care to handle escapes correctly can now update their code to remove the escape handling and let us do it for them. * **Mutating values with escapes** - When you make an update to a node property that has escape handling The value is assumed to be unescaped, and any special characters are escaped automatically and the corresponding `raws` value is immediately updated. This can result in changes to the original escape format. Where the exact value of the escape sequence is important there are methods that allow both values to be set in conjunction. There are a number of new convenience methods for manipulating values that involve escapes, especially for attributes values where the quote mark is involved. See https://github.com/postcss/postcss-selector-parser/pull/133 for an extensive write-up on these changes. **Upgrade/API Example** In `3.x` there was no unescape handling and internal consistency of several properties was the caller's job to maintain. It was very easy for the developer to create a CSS file that did not parse correctly when some types of values were in use. ```js const selectorParser = require("postcss-selector-parser"); let attr = selectorParser.attribute({attribute: "id", operator: "=", value: "a-value"}); attr.value; // => "a-value" attr.toString(); // => [id=a-value] // Add quotes to an attribute's value. // All these values have to be set by the caller to be consistent: // no internal consistency is maintained. attr.raws.unquoted = attr.value attr.value = "'" + attr.value + "'"; attr.value; // => "'a-value'" attr.quoted = true; attr.toString(); // => "[id='a-value']" ``` In `4.0` there is a convenient API for setting and mutating values that may need escaping. Especially for attributes. ```js const selectorParser = require("postcss-selector-parser"); // The constructor requires you specify the exact escape sequence let className = selectorParser.className({value: "illegal class name", raws: {value: "illegal\\ class\\ name"}}); className.toString(); // => '.illegal\\ class\\ name' // So it's better to set the value as a property className = selectorParser.className(); // Most properties that deal with identifiers work like this className.value = "escape for me"; className.value; // => 'escape for me' className.toString(); // => '.escape\\ for\\ me' // emoji and all non-ascii are escaped to ensure it works in every css file. className.value = "😱🦄😍"; className.value; // => '😱🦄😍' className.toString(); // => '.\\1F631\\1F984\\1F60D' // you can control the escape sequence if you want, or do bad bad things className.setPropertyAndEscape('value', 'xxxx', 'yyyy'); className.value; // => "xxxx" className.toString(); // => ".yyyy" // Pass a value directly through to the css output without escaping it. className.setPropertyWithoutEscape('value', '$REPLACE_ME$'); className.value; // => "$REPLACE_ME$" className.toString(); // => ".$REPLACE_ME$" // The biggest changes are to the Attribute class // passing quoteMark explicitly is required to avoid a deprecation warning. let attr = selectorParser.attribute({attribute: "id", operator: "=", value: "a-value", quoteMark: null}); attr.toString(); // => "[id=a-value]" // Get the value with quotes on it and any necessary escapes. // This is the same as reading attr.value in 3.x. attr.getQuotedValue(); // => "a-value"; attr.quoteMark; // => null // Add quotes to an attribute's value. attr.quoteMark = "'"; // This is all that's required. attr.toString(); // => "[id='a-value']" attr.quoted; // => true // The value is still the same, only the quotes have changed. attr.value; // => a-value attr.getQuotedValue(); // => "'a-value'"; // deprecated assignment, no warning because there's no escapes attr.value = "new-value"; // no quote mark is needed so it is removed attr.getQuotedValue(); // => "new-value"; // deprecated assignment, attr.value = "\"a 'single quoted' value\""; // > (node:27859) DeprecationWarning: Assigning an attribute a value containing characters that might need to be escaped is deprecated. Call attribute.setValue() instead. attr.getQuotedValue(); // => '"a \'single quoted\' value"'; // quote mark inferred from first and last characters. attr.quoteMark; // => '"' // setValue takes options to make manipulating the value simple. attr.setValue('foo', {smart: true}); // foo doesn't require any escapes or quotes. attr.toString(); // => '[id=foo]' attr.quoteMark; // => null // An explicit quote mark can be specified attr.setValue('foo', {quoteMark: '"'}); attr.toString(); // => '[id="foo"]' // preserves quote mark by default attr.setValue('bar'); attr.toString(); // => '[id="bar"]' attr.quoteMark = null; attr.toString(); // => '[id=bar]' // with no arguments, it preserves quote mark even when it's not a great idea attr.setValue('a value \n that should be quoted'); attr.toString(); // => '[id=a\\ value\\ \\A\\ that\\ should\\ be\\ quoted]' // smart preservation with a specified default attr.setValue('a value \n that should be quoted', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"}); // => "[id='a value \\A that should be quoted']" attr.quoteMark = '"'; // => '[id="a value \\A that should be quoted"]' // this keeps double quotes because it wants to quote the value and the existing value has double quotes. attr.setValue('this should be quoted', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"}); // => '[id="this should be quoted"]' // picks single quotes because the value has double quotes attr.setValue('a "double quoted" value', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"}); // => "[id='a "double quoted" value']" // setPropertyAndEscape lets you do anything you want. Even things that are a bad idea and illegal. attr.setPropertyAndEscape('value', 'xxxx', 'the password is 42'); attr.value; // => "xxxx" attr.toString(); // => "[id=the password is 42]" // Pass a value directly through to the css output without escaping it. attr.setPropertyWithoutEscape('value', '$REPLACEMENT$'); attr.value; // => "$REPLACEMENT$" attr.toString(); // => "[id=$REPLACEMENT$]" ``` # 3.1.2 * Fix: Removed dot-prop dependency since it's no longer written in es5. # 3.1.1 * Fix: typescript definitions weren't in the published package. # 3.1.0 * Fixed numerous bugs in attribute nodes relating to the handling of comments and whitespace. There's significant changes to `attrNode.spaces` and `attrNode.raws` since the `3.0.0` release. * Added `Attribute#offsetOf(part)` to get the offset location of attribute parts like `"operator"` and `"value"`. This is most often added to `Attribute#sourceIndex` for error reporting. # 3.0.0 ## Breaking changes * Some tweaks to the tokenizer/attribute selector parsing mean that whitespace locations might be slightly different to the 2.x code. * Better attribute selector parsing with more validation; postcss-selector-parser no longer uses regular expressions to parse attribute selectors. * Added an async API (thanks to @jacobp100); the default `process` API is now async, and the sync API is now accessed through `processSync` instead. * `process()` and `processSync()` now return a string instead of the Processor instance. * Tweaks handling of Less interpolation (thanks to @jwilsson). * Removes support for Node 0.12. ## Other changes * `ast()` and `astSync()` methods have been added to the `Processor`. These return the `Root` node of the selectors after processing them. * `transform()` and `transformSync()` methods have been added to the `Processor`. These return the value returned by the processor callback after processing the selectors. * Set the parent when inserting a node (thanks to @chriseppstein). * Correctly adjust indices when using insertBefore/insertAfter (thanks to @tivac). * Fixes handling of namespaces with qualified tag selectors. * `process`, `ast` and `transform` (and their sync variants) now accept a `postcss` rule node. When provided, better errors are generated and selector processing is automatically set back to the rule selector (unless the `updateSelector` option is set to `false`.) * Now more memory efficient when tokenizing selectors. ### Upgrade hints The pattern of: `rule.selector = processor.process(rule.selector).result.toString();` is now: `processor.processSync(rule)` # 2.2.3 * Resolves an issue where the parser would not reduce multiple spaces between an ampersand and another simple selector in lossy mode (thanks to @adam-26). # 2.2.2 * No longer hangs on an unescaped semicolon; instead the parser will throw an exception for these cases. # 2.2.1 * Allows a consumer to specify whitespace tokens when creating a new Node (thanks to @Semigradsky). # 2.2.0 * Added a new option to normalize whitespace when parsing the selector string (thanks to @adam-26). # 2.1.1 * Better unquoted value handling within attribute selectors (thanks to @evilebottnawi). # 2.1.0 * Added: Use string constants for all node types & expose them on the main parser instance (thanks to @Aweary). # 2.0.0 This release contains the following breaking changes: * Renamed all `eachInside` iterators to `walk`. For example, `eachTag` is now `walkTags`, and `eachInside` is now `walk`. * Renamed `Node#removeSelf()` to `Node#remove()`. * Renamed `Container#remove()` to `Container#removeChild()`. * Renamed `Node#raw` to `Node#raws` (thanks to @davidtheclark). * Now parses `&` as the *nesting* selector, rather than a *tag* selector. * Fixes misinterpretation of Sass interpolation (e.g. `#{foo}`) as an id selector (thanks to @davidtheclark). and; * Fixes parsing of attribute selectors with equals signs in them (e.g. `[data-attr="foo=bar"]`) (thanks to @montmanu). * Adds `quoted` and `raw.unquoted` properties to attribute nodes (thanks to @davidtheclark). # 1.3.3 * Fixes an infinite loop on `)` and `]` tokens when they had no opening pairs. Now postcss-selector-parser will throw when it encounters these lone tokens. # 1.3.2 * Now uses plain integers rather than `str.charCodeAt(0)` for compiled builds. # 1.3.1 * Update flatten to v1.x (thanks to @shinnn). # 1.3.0 * Adds a new node type, `String`, to fix a crash on selectors such as `foo:bar("test")`. # 1.2.1 * Fixes a crash when the parser encountered a trailing combinator. # 1.2.0 * A more descriptive error is thrown when the parser expects to find a pseudo-class/pseudo-element (thanks to @ashelley). * Adds support for line/column locations for selector nodes, as well as a `Node#sourceIndex` method (thanks to @davidtheclark). # 1.1.4 * Fixes a crash when a selector started with a `>` combinator. The module will now no longer throw if a selector has a leading/trailing combinator node. # 1.1.3 * Fixes a crash on `@` tokens. # 1.1.2 * Fixes an infinite loop caused by using parentheses in a non-pseudo element context. # 1.1.1 * Fixes a crash when a backslash ended a selector string. # 1.1.0 * Adds support for replacing multiple nodes at once with `replaceWith` (thanks to @jonathantneal). * Parser no longer throws on sequential IDs and trailing commas, to support parsing of selector hacks. # 1.0.1 * Fixes using `insertAfter` and `insertBefore` during iteration. # 1.0.0 * Adds `clone` and `replaceWith` methods to nodes. * Adds `insertBefore` and `insertAfter` to containers. * Stabilises API. # 0.0.5 * Fixes crash on extra whitespace inside a pseudo selector's parentheses. * Adds sort function to the container class. * Enables the parser to pass its input through without transforming. * Iteration-safe `each` and `eachInside`. # 0.0.4 * Tidy up redundant duplication. * Fixes a bug where the parser would loop infinitely on universal selectors inside pseudo selectors. * Adds `length` getter and `eachInside`, `map`, `reduce` to the container class. * When a selector has been removed from the tree, the root node will no longer cast it to a string. * Adds node type iterators to the container class (e.g. `eachComment`). * Adds filter function to the container class. * Adds split function to the container class. * Create new node types by doing `parser.id(opts)` etc. * Adds support for pseudo classes anywhere in the selector. # 0.0.3 * Adds `next` and `prev` to the node class. * Adds `first` and `last` getters to the container class. * Adds `every` and `some` iterators to the container class. * Add `empty` alias for `removeAll`. * Combinators are now types of node. * Fixes the at method so that it is not an alias for `index`. * Tidy up creation of new nodes in the parser. * Refactors how namespaces are handled for consistency & less redundant code. * Refactors AST to use `nodes` exclusively, and eliminates excessive nesting. * Fixes nested pseudo parsing. * Fixes whitespace parsing. # 0.0.2 * Adds support for namespace selectors. * Adds support for selectors joined by escaped spaces - such as `.\31\ 0`. # 0.0.1 * Initial release.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postcss-selector-parser/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postcss-selector-parser/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 19580 }
# postcss-selector-parser [![test](https://github.com/postcss/postcss-selector-parser/actions/workflows/test.yml/badge.svg)](https://github.com/postcss/postcss-selector-parser/actions/workflows/test.yml) > Selector parser with built in methods for working with selector strings. ## Install With [npm](https://npmjs.com/package/postcss-selector-parser) do: ``` npm install postcss-selector-parser ``` ## Quick Start ```js const parser = require('postcss-selector-parser'); const transform = selectors => { selectors.walk(selector => { // do something with the selector console.log(String(selector)) }); }; const transformed = parser(transform).processSync('h1, h2, h3'); ``` To normalize selector whitespace: ```js const parser = require('postcss-selector-parser'); const normalized = parser().processSync('h1, h2, h3', {lossless: false}); // -> h1,h2,h3 ``` Async support is provided through `parser.process` and will resolve a Promise with the resulting selector string. ## API Please see [API.md](API.md). ## Credits * Huge thanks to Andrey Sitnik (@ai) for work on PostCSS which helped accelerate this module's development. ## License MIT
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postcss-selector-parser/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postcss-selector-parser/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1183 }
# postcss-value-parser [![Travis CI](https://travis-ci.org/TrySound/postcss-value-parser.svg)](https://travis-ci.org/TrySound/postcss-value-parser) Transforms CSS declaration values and at-rule parameters into a tree of nodes, and provides a simple traversal API. ## Usage ```js var valueParser = require('postcss-value-parser'); var cssBackgroundValue = 'url(foo.png) no-repeat 40px 73%'; var parsedValue = valueParser(cssBackgroundValue); // parsedValue exposes an API described below, // e.g. parsedValue.walk(..), parsedValue.toString(), etc. ``` For example, parsing the value `rgba(233, 45, 66, .5)` will return the following: ```js { nodes: [ { type: 'function', value: 'rgba', before: '', after: '', nodes: [ { type: 'word', value: '233' }, { type: 'div', value: ',', before: '', after: ' ' }, { type: 'word', value: '45' }, { type: 'div', value: ',', before: '', after: ' ' }, { type: 'word', value: '66' }, { type: 'div', value: ',', before: ' ', after: '' }, { type: 'word', value: '.5' } ] } ] } ``` If you wanted to convert each `rgba()` value in `sourceCSS` to a hex value, you could do so like this: ```js var valueParser = require('postcss-value-parser'); var parsed = valueParser(sourceCSS); // walk() will visit all the of the nodes in the tree, // invoking the callback for each. parsed.walk(function (node) { // Since we only want to transform rgba() values, // we can ignore anything else. if (node.type !== 'function' && node.value !== 'rgba') return; // We can make an array of the rgba() arguments to feed to a // convertToHex() function var color = node.nodes.filter(function (node) { return node.type === 'word'; }).map(function (node) { return Number(node.value); }); // [233, 45, 66, .5] // Now we will transform the existing rgba() function node // into a word node with the hex value node.type = 'word'; node.value = convertToHex(color); }) parsed.toString(); // #E92D42 ``` ## Nodes Each node is an object with these common properties: - **type**: The type of node (`word`, `string`, `div`, `space`, `comment`, or `function`). Each type is documented below. - **value**: Each node has a `value` property; but what exactly `value` means is specific to the node type. Details are documented for each type below. - **sourceIndex**: The starting index of the node within the original source string. For example, given the source string `10px 20px`, the `word` node whose value is `20px` will have a `sourceIndex` of `5`. ### word The catch-all node type that includes keywords (e.g. `no-repeat`), quantities (e.g. `20px`, `75%`, `1.5`), and hex colors (e.g. `#e6e6e6`). Node-specific properties: - **value**: The "word" itself. ### string A quoted string value, e.g. `"something"` in `content: "something";`. Node-specific properties: - **value**: The text content of the string. - **quote**: The quotation mark surrounding the string, either `"` or `'`. - **unclosed**: `true` if the string was not closed properly. e.g. `"unclosed string `. ### div A divider, for example - `,` in `animation-duration: 1s, 2s, 3s` - `/` in `border-radius: 10px / 23px` - `:` in `(min-width: 700px)` Node-specific properties: - **value**: The divider character. Either `,`, `/`, or `:` (see examples above). - **before**: Whitespace before the divider. - **after**: Whitespace after the divider. ### space Whitespace used as a separator, e.g. ` ` occurring twice in `border: 1px solid black;`. Node-specific properties: - **value**: The whitespace itself. ### comment A CSS comment starts with `/*` and ends with `*/` Node-specific properties: - **value**: The comment value without `/*` and `*/` - **unclosed**: `true` if the comment was not closed properly. e.g. `/* comment without an end `. ### function A CSS function, e.g. `rgb(0,0,0)` or `url(foo.bar)`. Function nodes have nodes nested within them: the function arguments. Additional properties: - **value**: The name of the function, e.g. `rgb` in `rgb(0,0,0)`. - **before**: Whitespace after the opening parenthesis and before the first argument, e.g. ` ` in `rgb( 0,0,0)`. - **after**: Whitespace before the closing parenthesis and after the last argument, e.g. ` ` in `rgb(0,0,0 )`. - **nodes**: More nodes representing the arguments to the function. - **unclosed**: `true` if the parentheses was not closed properly. e.g. `( unclosed-function `. Media features surrounded by parentheses are considered functions with an empty value. For example, `(min-width: 700px)` parses to these nodes: ```js [ { type: 'function', value: '', before: '', after: '', nodes: [ { type: 'word', value: 'min-width' }, { type: 'div', value: ':', before: '', after: ' ' }, { type: 'word', value: '700px' } ] } ] ``` `url()` functions can be parsed a little bit differently depending on whether the first character in the argument is a quotation mark. `url( /gfx/img/bg.jpg )` parses to: ```js { type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [ { type: 'word', sourceIndex: 5, value: '/gfx/img/bg.jpg' } ] } ``` `url( "/gfx/img/bg.jpg" )`, on the other hand, parses to: ```js { type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [ type: 'string', sourceIndex: 5, quote: '"', value: '/gfx/img/bg.jpg' }, ] } ``` ### unicode-range The unicode-range CSS descriptor sets the specific range of characters to be used from a font defined by @font-face and made available for use on the current page (`unicode-range: U+0025-00FF`). Node-specific properties: - **value**: The "unicode-range" itself. ## API ``` var valueParser = require('postcss-value-parser'); ``` ### valueParser.unit(quantity) Parses `quantity`, distinguishing the number from the unit. Returns an object like the following: ```js // Given 2rem { number: '2', unit: 'rem' } ``` If the `quantity` argument cannot be parsed as a number, returns `false`. *This function does not parse complete values*: you cannot pass it `1px solid black` and expect `px` as the unit. Instead, you should pass it single quantities only. Parse `1px solid black`, then pass it the stringified `1px` node (a `word` node) to parse the number and unit. ### valueParser.stringify(nodes[, custom]) Stringifies a node or array of nodes. The `custom` function is called for each `node`; return a string to override the default behaviour. ### valueParser.walk(nodes, callback[, bubble]) Walks each provided node, recursively walking all descendent nodes within functions. Returning `false` in the `callback` will prevent traversal of descendent nodes (within functions). You can use this feature to for shallow iteration, walking over only the *immediate* children. *Note: This only applies if `bubble` is `false` (which is the default).* By default, the tree is walked from the outermost node inwards. To reverse the direction, pass `true` for the `bubble` argument. The `callback` is invoked with three arguments: `callback(node, index, nodes)`. - `node`: The current node. - `index`: The index of the current node. - `nodes`: The complete nodes array passed to `walk()`. Returns the `valueParser` instance. ### var parsed = valueParser(value) Returns the parsed node tree. ### parsed.nodes The array of nodes. ### parsed.toString() Stringifies the node tree. ### parsed.walk(callback[, bubble]) Walks each node inside `parsed.nodes`. See the documentation for `valueParser.walk()` above. # License MIT © [Bogdan Chadkin](mailto:[email protected])
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postcss-value-parser/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postcss-value-parser/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 7681 }
# PostCSS <img align="right" width="95" height="95" alt="Philosopher’s stone, logo of PostCSS" src="https://postcss.org/logo.svg"> PostCSS is a tool for transforming styles with JS plugins. These plugins can lint your CSS, support variables and mixins, transpile future CSS syntax, inline images, and more. PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba, and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins is one of the most popular CSS tools. --- <img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" />  Made at <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>. --- [Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree [Evil Martians]: https://evilmartians.com/?utm_source=postcss [Autoprefixer]: https://github.com/postcss/autoprefixer [Stylelint]: https://stylelint.io/ [plugins]: https://github.com/postcss/postcss#plugins ## Docs Read full docs **[here](https://postcss.org/)**.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postcss/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postcss/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1180 }
# postgres-array [![tests](https://github.com/bendrucker/postgres-array/workflows/tests/badge.svg)](https://github.com/bendrucker/postgres-array/actions?query=workflow%3Atests) > Parse postgres array columns ## Install ``` npm install --save postgres-array ``` ## Usage ```js const { parse } = require('postgres-array') parse('{1,2,3}', (value) => parseInt(value, 10)) //=> [1, 2, 3] ``` ## API #### `parse(input, [transform])` -> `array` ##### input *Required* Type: `string` A Postgres array string. ##### transform Type: `function` Default: `identity` A function that transforms non-null values inserted into the array. ## License MIT © [Ben Drucker](http://bendrucker.me)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postgres-array/readme.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postgres-array/readme.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 698 }
# postgres-bytea [![Build Status](https://travis-ci.org/bendrucker/postgres-bytea.svg?branch=master)](https://travis-ci.org/bendrucker/postgres-bytea) [![Greenkeeper badge](https://badges.greenkeeper.io/bendrucker/postgres-bytea.svg)](https://greenkeeper.io/) > Decode/encode Postgres bytea strings to Buffers ## Install ```sh npm install postgres-bytea ``` ## Usage ### Decoding To decode a bytea string into a buffer: ```js const bytea = require('postgres-bytea') // bytea hex format bytea.decode('\\x1234') // <Buffer 12 34> // bytea escape format bytea.decode('\\000\\100\\200') // <Buffer 00 40 80> ``` The `decode` function supports both the hex format used in Postgres 9+ and the escape format used in Postgres 8 and earlier. It automatically detects the format from the incoming data. For backward compatibility, `decode` is also the default export from the package. ### Decoding (Stream) To decode a bytea hex stream into binary: ```js const bytea = require('postgres-bytea') readable.pipe(new bytea.Decoder()) ``` `Decoder` expects a double-escaped `\\x` prefix to allow reading from a `COPY TO` statement. ### Encoding (Stream) ```js const bytea = require('postgres-bytea') readable.pipe(new bytea.Encoder()) ``` `Encoder` adds a double-escaped `\\x` prefix to allow writing to a `COPY FROM` statement. ## API #### `bytea.decode(input)` -> `buffer` ##### input *Required* Type: `string` A Postgres bytea binary string. #### `new bytea.Decoder()` -> `stream.Transform` Creates a bytea decoder stream that emits buffer chunks. #### `new bytea.Encoder()` -> `stream.Transform` Creates a bytea encoder stream that receives buffer chunks and emits them as bytea strings. ## Prefix Escaping > The “hex” format encodes binary data as 2 hexadecimal digits per byte, most significant nibble first. The entire string is preceded by the sequence \x (to distinguish it from the escape format). In some contexts, the initial backslash may need to be escaped by doubling it (see Section 4.1.2.1). > > https://www.postgresql.org/docs/12/datatype-binary.html#id-1.5.7.12.9 A `SELECT` statement returns bytea values using the single-escaped `\x` prefix. The `COPY TO` and `COPY FROM` commands expect and return bytea values with the double-escaped `\\x` prefix. `bytea.decode` expects the single-escaped prefix. The `Decoder` and `Encoder` streams expect the double-escaped prefix, since they are most useful in `COPY FROM` and `COPY TO` statements. ## License MIT © [Ben Drucker](http://bendrucker.me)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postgres-bytea/readme.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postgres-bytea/readme.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2536 }
# postgres-date [![tests](https://github.com/bendrucker/postgres-date/workflows/tests/badge.svg)](https://github.com/bendrucker/postgres-date/actions?query=workflow%3Atests) > Postgres date output parser This package parses [date/time outputs](https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT) from Postgres into Javascript `Date` objects. Its goal is to match Postgres behavior and preserve data accuracy. If you find a case where a valid Postgres output results in incorrect parsing (including loss of precision), please [create a pull request](https://github.com/bendrucker/postgres-date/compare) and provide a failing test. **Supported Postgres Versions:** `>= 9.6` All prior versions of Postgres are likely compatible but not officially supported. ## Install ``` npm install --save postgres-date ``` ## Usage ```js const parse = require('postgres-date') parse('2011-01-23 22:15:51Z') // => 2011-01-23T22:15:51.000Z ``` ## API #### `parse(isoDate)` -> `date` ##### isoDate *Required* Type: `string` A date string from Postgres. ## Releases The following semantic versioning increments will be used for changes: * **Major**: Removal of support for Node.js versions or Postgres versions (not expected) * **Minor**: Unused, since Postgres returns dates in standard ISO 8601 format * **Patch**: Any fix for parsing behavior ## License MIT © [Ben Drucker](http://bendrucker.me)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postgres-date/readme.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postgres-date/readme.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1436 }
# postgres-interval [![tests](https://github.com/bendrucker/postgres-interval/workflows/tests/badge.svg)](https://github.com/bendrucker/postgres-interval/actions?query=workflow%3Atests) > Parse Postgres interval columns ## Install ```sh npm install --save postgres-interval ``` ## Usage ```js var parse = require('postgres-interval') var interval = parse('01:02:03') //=> {hours: 1, minutes: 2, seconds: 3} interval.toPostgres() // 3 seconds 2 minutes 1 hours interval.toISOString() // P0Y0M0DT1H2M3S ``` This package parses the default Postgres interval style. If you have changed [`intervalstyle`](https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-INTERVALSTYLE), you will need to set it back to the default: ```sql set intervalstyle to default; ``` ## API #### `parse(pgInterval)` -> `interval` ##### pgInterval *Required* Type: `string` A Postgres interval string. #### `interval.toPostgres()` -> `string` Returns an interval string. This allows the interval object to be passed into prepared statements. #### `interval.toISOString()` -> `string` Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string, for example `P0Y0M0DT0H9M0S`. Also available as `interval.toISO()` for backwards compatibility. #### `interval.toISOStringShort()` -> `string` Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string shortened to minimum length, for example `PT9M`. ## License MIT © [Ben Drucker](http://bendrucker.me)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postgres-interval/readme.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postgres-interval/readme.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1520 }
# postgres-range [![tests](https://github.com/martianboy/postgres-range/workflows/tests/badge.svg)](https://github.com/martianboy/postgres-range/actions?query=workflow%3Atests) > Parse postgres range columns ## Install ``` npm install --save postgres-range ``` ## Usage ```js const range = require('postgres-range') const rng = range.parse('[0,5)', (value) => parseInt(value, 10)) rng.isBounded() // => true rng.isLowerBoundClosed() // => true rng.isUpperBoundClosed() // => false rng.hasLowerBound() // => true rng.hasUpperBound() // => true rng.containsPoint(4) // => true rng.containsRange(range.parse('[1,2]', x => parseInt(x))) // => true range.parse('empty').isEmpty() // => true range.serialize(new range.Range(0, 5)) // => '(0,5)' range.serialize(new range.Range(0, 5, range.RANGE_LB_INC | RANGE_UB_INC)) // => '[0,5]' ``` ## API #### `parse(input, [transform])` -> `Range` ##### input *Required* Type: `string` A Postgres range string. ##### transform Type: `function` Default: `identity` A function that transforms non-null bounds of the range. #### `serialize(range, [format])` -> `string` ##### range *Required* Type: `Range` A `Range` object. ##### format Type: `function` Default: `identity` A function that formats non-null bounds of the range. ## License MIT © [Abbas Mashayekh](http://github.com/martianboy)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/postgres-range/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/postgres-range/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1362 }
# prop-types [![Build Status](https://travis-ci.com/facebook/prop-types.svg?branch=main)](https://travis-ci.org/facebook/prop-types) Runtime type checking for React props and similar objects. You can use prop-types to document the intended types of properties passed to components. React (and potentially other libraries—see the `checkPropTypes()` reference below) will check props passed to your components against those definitions, and warn in development if they don’t match. ## Installation ```shell npm install --save prop-types ``` ## Importing ```js import PropTypes from 'prop-types'; // ES6 var PropTypes = require('prop-types'); // ES5 with npm ``` ### CDN If you prefer to exclude `prop-types` from your application and use it globally via `window.PropTypes`, the `prop-types` package provides single-file distributions, which are hosted on the following CDNs: * [**unpkg**](https://unpkg.com/prop-types/) ```html <!-- development version --> <script src="https://unpkg.com/[email protected]/prop-types.js"></script> <!-- production version --> <script src="https://unpkg.com/[email protected]/prop-types.min.js"></script> ``` * [**cdnjs**](https://cdnjs.com/libraries/prop-types) ```html <!-- development version --> <script src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.6.0/prop-types.js"></script> <!-- production version --> <script src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.6.0/prop-types.min.js"></script> ``` To load a specific version of `prop-types` replace `15.6.0` with the version number. ## Usage PropTypes was originally exposed as part of the React core module, and is commonly used with React components. Here is an example of using PropTypes with a React component, which also documents the different validators provided: ```js import React from 'react'; import PropTypes from 'prop-types'; class MyComponent extends React.Component { render() { // ... do things with the props } } MyComponent.propTypes = { // You can declare that a prop is a specific JS primitive. By default, these // are all optional. optionalArray: PropTypes.array, optionalBigInt: PropTypes.bigint, optionalBool: PropTypes.bool, optionalFunc: PropTypes.func, optionalNumber: PropTypes.number, optionalObject: PropTypes.object, optionalString: PropTypes.string, optionalSymbol: PropTypes.symbol, // Anything that can be rendered: numbers, strings, elements or an array // (or fragment) containing these types. // see https://reactjs.org/docs/rendering-elements.html for more info optionalNode: PropTypes.node, // A React element (ie. <MyComponent />). optionalElement: PropTypes.element, // A React element type (eg. MyComponent). // a function, string, or "element-like" object (eg. React.Fragment, Suspense, etc.) // see https://github.com/facebook/react/blob/HEAD/packages/shared/isValidElementType.js optionalElementType: PropTypes.elementType, // You can also declare that a prop is an instance of a class. This uses // JS's instanceof operator. optionalMessage: PropTypes.instanceOf(Message), // You can ensure that your prop is limited to specific values by treating // it as an enum. optionalEnum: PropTypes.oneOf(['News', 'Photos']), // An object that could be one of many types optionalUnion: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, PropTypes.instanceOf(Message) ]), // An array of a certain type optionalArrayOf: PropTypes.arrayOf(PropTypes.number), // An object with property values of a certain type optionalObjectOf: PropTypes.objectOf(PropTypes.number), // You can chain any of the above with `isRequired` to make sure a warning // is shown if the prop isn't provided. // An object taking on a particular shape optionalObjectWithShape: PropTypes.shape({ optionalProperty: PropTypes.string, requiredProperty: PropTypes.number.isRequired }), // An object with warnings on extra properties optionalObjectWithStrictShape: PropTypes.exact({ optionalProperty: PropTypes.string, requiredProperty: PropTypes.number.isRequired }), requiredFunc: PropTypes.func.isRequired, // A value of any data type requiredAny: PropTypes.any.isRequired, // You can also specify a custom validator. It should return an Error // object if the validation fails. Don't `console.warn` or throw, as this // won't work inside `oneOfType`. customProp: function(props, propName, componentName) { if (!/matchme/.test(props[propName])) { return new Error( 'Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Validation failed.' ); } }, // You can also supply a custom validator to `arrayOf` and `objectOf`. // It should return an Error object if the validation fails. The validator // will be called for each key in the array or object. The first two // arguments of the validator are the array or object itself, and the // current item's key. customArrayProp: PropTypes.arrayOf(function(propValue, key, componentName, location, propFullName) { if (!/matchme/.test(propValue[key])) { return new Error( 'Invalid prop `' + propFullName + '` supplied to' + ' `' + componentName + '`. Validation failed.' ); } }) }; ``` Refer to the [React documentation](https://facebook.github.io/react/docs/typechecking-with-proptypes.html) for more information. ## Migrating from React.PropTypes Check out [Migrating from React.PropTypes](https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.proptypes) for details on how to migrate to `prop-types` from `React.PropTypes`. Note that this blog posts **mentions a codemod script that performs the conversion automatically**. There are also important notes below. ## How to Depend on This Package? For apps, we recommend putting it in `dependencies` with a caret range. For example: ```js "dependencies": { "prop-types": "^15.5.7" } ``` For libraries, we *also* recommend leaving it in `dependencies`: ```js "dependencies": { "prop-types": "^15.5.7" }, "peerDependencies": { "react": "^15.5.0" } ``` **Note:** there are known issues in versions before 15.5.7 so we recommend using it as the minimal version. Make sure that the version range uses a caret (`^`) and thus is broad enough for npm to efficiently deduplicate packages. For UMD bundles of your components, make sure you **don’t** include `PropTypes` in the build. Usually this is done by marking it as an external (the specifics depend on your bundler), just like you do with React. ## Compatibility ### React 0.14 This package is compatible with **React 0.14.9**. Compared to 0.14.8 (which was released in March of 2016), there are no other changes in 0.14.9, so it should be a painless upgrade. ```shell # ATTENTION: Only run this if you still use React 0.14! npm install --save react@^0.14.9 react-dom@^0.14.9 ``` ### React 15+ This package is compatible with **React 15.3.0** and higher. ``` npm install --save react@^15.3.0 react-dom@^15.3.0 ``` ### What happens on other React versions? It outputs warnings with the message below even though the developer doesn’t do anything wrong. Unfortunately there is no solution for this other than updating React to either 15.3.0 or higher, or 0.14.9 if you’re using React 0.14. ## Difference from `React.PropTypes`: Don’t Call Validator Functions First of all, **which version of React are you using**? You might be seeing this message because a component library has updated to use `prop-types` package, but your version of React is incompatible with it. See the [above section](#compatibility) for more details. Are you using either React 0.14.9 or a version higher than React 15.3.0? Read on. When you migrate components to use the standalone `prop-types`, **all validator functions will start throwing an error if you call them directly**. This makes sure that nobody relies on them in production code, and it is safe to strip their implementations to optimize the bundle size. Code like this is still fine: ```js MyComponent.propTypes = { myProp: PropTypes.bool }; ``` However, code like this will not work with the `prop-types` package: ```js // Will not work with `prop-types` package! var errorOrNull = PropTypes.bool(42, 'myProp', 'MyComponent', 'prop'); ``` It will throw an error: ``` Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. ``` (If you see **a warning** rather than an error with this message, please check the [above section about compatibility](#compatibility).) This is new behavior, and you will only encounter it when you migrate from `React.PropTypes` to the `prop-types` package. For the vast majority of components, this doesn’t matter, and if you didn’t see [this warning](https://facebook.github.io/react/warnings/dont-call-proptypes.html) in your components, your code is safe to migrate. This is not a breaking change in React because you are only opting into this change for a component by explicitly changing your imports to use `prop-types`. If you temporarily need the old behavior, you can keep using `React.PropTypes` until React 16. **If you absolutely need to trigger the validation manually**, call `PropTypes.checkPropTypes()`. Unlike the validators themselves, this function is safe to call in production, as it will be replaced by an empty function: ```js // Works with standalone PropTypes PropTypes.checkPropTypes(MyComponent.propTypes, props, 'prop', 'MyComponent'); ``` See below for more info. **If you DO want to use validation in production**, you can choose to use the **development version** by importing/requiring `prop-types/prop-types` instead of `prop-types`. **You might also see this error** if you’re calling a `PropTypes` validator from your own custom `PropTypes` validator. In this case, the fix is to make sure that you are passing *all* of the arguments to the inner function. There is a more in-depth explanation of how to fix it [on this page](https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes). Alternatively, you can temporarily keep using `React.PropTypes` until React 16, as it would still only warn in this case. If you use a bundler like Browserify or Webpack, don’t forget to [follow these instructions](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) to correctly bundle your application in development or production mode. Otherwise you’ll ship unnecessary code to your users. ## PropTypes.checkPropTypes React will automatically check the propTypes you set on the component, but if you are using PropTypes without React then you may want to manually call `PropTypes.checkPropTypes`, like so: ```js const myPropTypes = { name: PropTypes.string, age: PropTypes.number, // ... define your prop validations }; const props = { name: 'hello', // is valid age: 'world', // not valid }; // Let's say your component is called 'MyComponent' // Works with standalone PropTypes PropTypes.checkPropTypes(myPropTypes, props, 'prop', 'MyComponent'); // This will warn as follows: // Warning: Failed prop type: Invalid prop `age` of type `string` supplied to // `MyComponent`, expected `number`. ``` ## PropTypes.resetWarningCache() `PropTypes.checkPropTypes(...)` only `console.error`s a given message once. To reset the error warning cache in tests, call `PropTypes.resetWarningCache()` ### License prop-types is [MIT licensed](./LICENSE).
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/prop-types/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/prop-types/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 11638 }
2.0.7 / 2021-05-31 ================== * deps: [email protected] - Use `req.socket` over deprecated `req.connection` 2.0.6 / 2020-02-24 ================== * deps: [email protected] 2.0.5 / 2019-04-16 ================== * deps: [email protected] 2.0.4 / 2018-07-26 ================== * deps: [email protected] 2.0.3 / 2018-02-19 ================== * deps: [email protected] 2.0.2 / 2017-09-24 ================== * deps: forwarded@~0.1.2 - perf: improve header parsing - perf: reduce overhead when no `X-Forwarded-For` header 2.0.1 / 2017-09-10 ================== * deps: forwarded@~0.1.1 - Fix trimming leading / trailing OWS - perf: hoist regular expression * deps: [email protected] 2.0.0 / 2017-08-08 ================== * Drop support for Node.js below 0.10 1.1.5 / 2017-07-25 ================== * Fix array argument being altered * deps: [email protected] 1.1.4 / 2017-03-24 ================== * deps: [email protected] 1.1.3 / 2017-01-14 ================== * deps: [email protected] 1.1.2 / 2016-05-29 ================== * deps: [email protected] - Fix IPv6-mapped IPv4 validation edge cases 1.1.1 / 2016-05-03 ================== * Fix regression matching mixed versions against multiple subnets 1.1.0 / 2016-05-01 ================== * Fix accepting various invalid netmasks - IPv4 netmasks must be contingous - IPv6 addresses cannot be used as a netmask * deps: [email protected] 1.0.10 / 2015-12-09 =================== * deps: [email protected] - Fix regression in `isValid` with non-string arguments 1.0.9 / 2015-12-01 ================== * deps: [email protected] - Fix accepting some invalid IPv6 addresses - Reject CIDRs with negative or overlong masks * perf: enable strict mode 1.0.8 / 2015-05-10 ================== * deps: [email protected] 1.0.7 / 2015-03-16 ================== * deps: [email protected] - Fix OOM on certain inputs to `isValid` 1.0.6 / 2015-02-01 ================== * deps: [email protected] 1.0.5 / 2015-01-08 ================== * deps: [email protected] 1.0.4 / 2014-11-23 ================== * deps: [email protected] - Fix edge cases with `isValid` 1.0.3 / 2014-09-21 ================== * Use `forwarded` npm module 1.0.2 / 2014-09-18 ================== * Fix a global leak when multiple subnets are trusted * Support Node.js 0.6 * deps: [email protected] 1.0.1 / 2014-06-03 ================== * Fix links in npm package 1.0.0 / 2014-05-08 ================== * Add `trust` argument to determine proxy trust on * Accepts custom function * Accepts IPv4/IPv6 address(es) * Accepts subnets * Accepts pre-defined names * Add optional `trust` argument to `proxyaddr.all` to stop at first untrusted * Add `proxyaddr.compile` to pre-compile `trust` function to make subsequent calls faster 0.0.1 / 2014-05-04 ================== * Fix bad npm publish 0.0.0 / 2014-05-04 ================== * Initial release
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/proxy-addr/HISTORY.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/proxy-addr/HISTORY.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2990 }
# proxy-addr [![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] [![Node.js Version][node-image]][node-url] [![Build Status][ci-image]][ci-url] [![Test Coverage][coveralls-image]][coveralls-url] Determine address of proxied request ## Install This is a [Node.js](https://nodejs.org/en/) module available through the [npm registry](https://www.npmjs.com/). Installation is done using the [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): ```sh $ npm install proxy-addr ``` ## API ```js var proxyaddr = require('proxy-addr') ``` ### proxyaddr(req, trust) Return the address of the request, using the given `trust` parameter. The `trust` argument is a function that returns `true` if you trust the address, `false` if you don't. The closest untrusted address is returned. ```js proxyaddr(req, function (addr) { return addr === '127.0.0.1' }) proxyaddr(req, function (addr, i) { return i < 1 }) ``` The `trust` arugment may also be a single IP address string or an array of trusted addresses, as plain IP addresses, CIDR-formatted strings, or IP/netmask strings. ```js proxyaddr(req, '127.0.0.1') proxyaddr(req, ['127.0.0.0/8', '10.0.0.0/8']) proxyaddr(req, ['127.0.0.0/255.0.0.0', '192.168.0.0/255.255.0.0']) ``` This module also supports IPv6. Your IPv6 addresses will be normalized automatically (i.e. `fe80::00ed:1` equals `fe80:0:0:0:0:0:ed:1`). ```js proxyaddr(req, '::1') proxyaddr(req, ['::1/128', 'fe80::/10']) ``` This module will automatically work with IPv4-mapped IPv6 addresses as well to support node.js in IPv6-only mode. This means that you do not have to specify both `::ffff:a00:1` and `10.0.0.1`. As a convenience, this module also takes certain pre-defined names in addition to IP addresses, which expand into IP addresses: ```js proxyaddr(req, 'loopback') proxyaddr(req, ['loopback', 'fc00:ac:1ab5:fff::1/64']) ``` * `loopback`: IPv4 and IPv6 loopback addresses (like `::1` and `127.0.0.1`). * `linklocal`: IPv4 and IPv6 link-local addresses (like `fe80::1:1:1:1` and `169.254.0.1`). * `uniquelocal`: IPv4 private addresses and IPv6 unique-local addresses (like `fc00:ac:1ab5:fff::1` and `192.168.0.1`). When `trust` is specified as a function, it will be called for each address to determine if it is a trusted address. The function is given two arguments: `addr` and `i`, where `addr` is a string of the address to check and `i` is a number that represents the distance from the socket address. ### proxyaddr.all(req, [trust]) Return all the addresses of the request, optionally stopping at the first untrusted. This array is ordered from closest to furthest (i.e. `arr[0] === req.connection.remoteAddress`). ```js proxyaddr.all(req) ``` The optional `trust` argument takes the same arguments as `trust` does in `proxyaddr(req, trust)`. ```js proxyaddr.all(req, 'loopback') ``` ### proxyaddr.compile(val) Compiles argument `val` into a `trust` function. This function takes the same arguments as `trust` does in `proxyaddr(req, trust)` and returns a function suitable for `proxyaddr(req, trust)`. ```js var trust = proxyaddr.compile('loopback') var addr = proxyaddr(req, trust) ``` This function is meant to be optimized for use against every request. It is recommend to compile a trust function up-front for the trusted configuration and pass that to `proxyaddr(req, trust)` for each request. ## Testing ```sh $ npm test ``` ## Benchmarks ```sh $ npm run-script bench ``` ## License [MIT](LICENSE) [ci-image]: https://badgen.net/github/checks/jshttp/proxy-addr/master?label=ci [ci-url]: https://github.com/jshttp/proxy-addr/actions?query=workflow%3Aci [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/proxy-addr/master [coveralls-url]: https://coveralls.io/r/jshttp/proxy-addr?branch=master [node-image]: https://badgen.net/npm/node/proxy-addr [node-url]: https://nodejs.org/en/download [npm-downloads-image]: https://badgen.net/npm/dm/proxy-addr [npm-url]: https://npmjs.org/package/proxy-addr [npm-version-image]: https://badgen.net/npm/v/proxy-addr
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/proxy-addr/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/proxy-addr/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 4130 }
# pseudomap A thing that is a lot like ES6 `Map`, but without iterators, for use in environments where `for..of` syntax and `Map` are not available. If you need iterators, or just in general a more faithful polyfill to ES6 Maps, check out [es6-map](http://npm.im/es6-map). If you are in an environment where `Map` is supported, then that will be returned instead, unless `process.env.TEST_PSEUDOMAP` is set. You can use any value as keys, and any value as data. Setting again with the identical key will overwrite the previous value. Internally, data is stored on an `Object.create(null)` style object. The key is coerced to a string to generate the key on the internal data-bag object. The original key used is stored along with the data. In the event of a stringified-key collision, a new key is generated by appending an increasing number to the stringified-key until finding either the intended key or an empty spot. Note that because object traversal order of plain objects is not guaranteed to be identical to insertion order, the insertion order guarantee of `Map.prototype.forEach` is not guaranteed in this implementation. However, in all versions of Node.js and V8 where this module works, `forEach` does traverse data in insertion order. ## API Most of the [Map API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), with the following exceptions: 1. A `Map` object is not an iterator. 2. `values`, `keys`, and `entries` methods are not implemented, because they return iterators. 3. The argument to the constructor can be an Array of `[key, value]` pairs, or a `Map` or `PseudoMap` object. But, since iterators aren't used, passing any plain-old iterator won't initialize the map properly. ## USAGE Use just like a regular ES6 Map. ```javascript var PseudoMap = require('pseudomap') // optionally provide a pseudomap, or an array of [key,value] pairs // as the argument to initialize the map with var myMap = new PseudoMap() myMap.set(1, 'number 1') myMap.set('1', 'string 1') var akey = {} var bkey = {} myMap.set(akey, { some: 'data' }) myMap.set(bkey, { some: 'other data' }) ```
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/pseudomap/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/pseudomap/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2162 }
## **6.13.0** - [New] `parse`: add `strictDepth` option (#511) - [Tests] use `npm audit` instead of `aud` ## **6.12.3** - [Fix] `parse`: properly account for `strictNullHandling` when `allowEmptyArrays` - [meta] fix changelog indentation ## **6.12.2** - [Fix] `parse`: parse encoded square brackets (#506) - [readme] add CII best practices badge ## **6.12.1** - [Fix] `parse`: Disable `decodeDotInKeys` by default to restore previous behavior (#501) - [Performance] `utils`: Optimize performance under large data volumes, reduce memory usage, and speed up processing (#502) - [Refactor] `utils`: use `+=` - [Tests] increase coverage ## **6.12.0** - [New] `parse`/`stringify`: add `decodeDotInKeys`/`encodeDotKeys` options (#488) - [New] `parse`: add `duplicates` option - [New] `parse`/`stringify`: add `allowEmptyArrays` option to allow [] in object values (#487) - [Refactor] `parse`/`stringify`: move allowDots config logic to its own variable - [Refactor] `stringify`: move option-handling code into `normalizeStringifyOptions` - [readme] update readme, add logos (#484) - [readme] `stringify`: clarify default `arrayFormat` behavior - [readme] fix line wrapping - [readme] remove dead badges - [Deps] update `side-channel` - [meta] make the dist build 50% smaller - [meta] add `sideEffects` flag - [meta] run build in prepack, not prepublish - [Tests] `parse`: remove useless tests; add coverage - [Tests] `stringify`: increase coverage - [Tests] use `mock-property` - [Tests] `stringify`: improve coverage - [Dev Deps] update `@ljharb/eslint-config `, `aud`, `has-override-mistake`, `has-property-descriptors`, `mock-property`, `npmignore`, `object-inspect`, `tape` - [Dev Deps] pin `glob`, since v10.3.8+ requires a broken `jackspeak` - [Dev Deps] pin `jackspeak` since 2.1.2+ depends on npm aliases, which kill the install process in npm < 6 ## **6.11.2** - [Fix] `parse`: Fix parsing when the global Object prototype is frozen (#473) - [Tests] add passing test cases with empty keys (#473) ## **6.11.1** - [Fix] `stringify`: encode comma values more consistently (#463) - [readme] add usage of `filter` option for injecting custom serialization, i.e. of custom types (#447) - [meta] remove extraneous code backticks (#457) - [meta] fix changelog markdown - [actions] update checkout action - [actions] restrict action permissions - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` ## **6.11.0** - [New] [Fix] `stringify`: revert 0e903c0; add `commaRoundTrip` option (#442) - [readme] fix version badge ## **6.10.5** - [Fix] `stringify`: with `arrayFormat: comma`, properly include an explicit `[]` on a single-item array (#434) ## **6.10.4** - [Fix] `stringify`: with `arrayFormat: comma`, include an explicit `[]` on a single-item array (#441) - [meta] use `npmignore` to autogenerate an npmignore file - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbol`, `object-inspect`, `tape` ## **6.10.3** - [Fix] `parse`: ignore `__proto__` keys (#428) - [Robustness] `stringify`: avoid relying on a global `undefined` (#427) - [actions] reuse common workflows - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `tape` ## **6.10.2** - [Fix] `stringify`: actually fix cyclic references (#426) - [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) - [readme] remove travis badge; add github actions/codecov badges; update URLs - [Docs] add note and links for coercing primitive values (#408) - [actions] update codecov uploader - [actions] update workflows - [Tests] clean up stringify tests slightly - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `safe-publish-latest`, `tape` ## **6.10.1** - [Fix] `stringify`: avoid exception on repeated object values (#402) ## **6.10.0** - [New] `stringify`: throw on cycles, instead of an infinite loop (#395, #394, #393) - [New] `parse`: add `allowSparse` option for collapsing arrays with missing indices (#312) - [meta] fix README.md (#399) - [meta] only run `npm run dist` in publish, not install - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbols`, `tape` - [Tests] fix tests on node v0.6 - [Tests] use `ljharb/actions/node/install` instead of `ljharb/actions/node/run` - [Tests] Revert "[meta] ignore eclint transitive audit warning" ## **6.9.7** - [Fix] `parse`: ignore `__proto__` keys (#428) - [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) - [Robustness] `stringify`: avoid relying on a global `undefined` (#427) - [readme] remove travis badge; add github actions/codecov badges; update URLs - [Docs] add note and links for coercing primitive values (#408) - [Tests] clean up stringify tests slightly - [meta] fix README.md (#399) - Revert "[meta] ignore eclint transitive audit warning" - [actions] backport actions from main - [Dev Deps] backport updates from main ## **6.9.6** - [Fix] restore `dist` dir; mistakenly removed in d4f6c32 ## **6.9.5** - [Fix] `stringify`: do not encode parens for RFC1738 - [Fix] `stringify`: fix arrayFormat comma with empty array/objects (#350) - [Refactor] `format`: remove `util.assign` call - [meta] add "Allow Edits" workflow; update rebase workflow - [actions] switch Automatic Rebase workflow to `pull_request_target` event - [Tests] `stringify`: add tests for #378 - [Tests] migrate tests to Github Actions - [Tests] run `nyc` on all tests; use `tape` runner - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `mkdirp`, `object-inspect`, `tape`; add `aud` ## **6.9.4** - [Fix] `stringify`: when `arrayFormat` is `comma`, respect `serializeDate` (#364) - [Refactor] `stringify`: reduce branching (part of #350) - [Refactor] move `maybeMap` to `utils` - [Dev Deps] update `browserify`, `tape` ## **6.9.3** - [Fix] proper comma parsing of URL-encoded commas (#361) - [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336) ## **6.9.2** - [Fix] `parse`: Fix parsing array from object with `comma` true (#359) - [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) - [meta] ignore eclint transitive audit warning - [meta] fix indentation in package.json - [meta] add tidelift marketing copy - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `has-symbols`, `tape`, `mkdirp`, `iconv-lite` - [actions] add automatic rebasing / merge commit blocking ## **6.9.1** - [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335) - [Fix] `parse`: with comma true, do not split non-string values (#334) - [meta] add `funding` field - [Dev Deps] update `eslint`, `@ljharb/eslint-config` - [Tests] use shared travis-ci config ## **6.9.0** - [New] `parse`/`stringify`: Pass extra key/value argument to `decoder` (#333) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `evalmd` - [Tests] `parse`: add passing `arrayFormat` tests - [Tests] add `posttest` using `npx aud` to run `npm audit` without a lockfile - [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16` - [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray ## **6.8.3** - [Fix] `parse`: ignore `__proto__` keys (#428) - [Robustness] `stringify`: avoid relying on a global `undefined` (#427) - [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) - [readme] remove travis badge; add github actions/codecov badges; update URLs - [Tests] clean up stringify tests slightly - [Docs] add note and links for coercing primitive values (#408) - [meta] fix README.md (#399) - [actions] backport actions from main - [Dev Deps] backport updates from main - [Refactor] `stringify`: reduce branching - [meta] do not publish workflow files ## **6.8.2** - [Fix] proper comma parsing of URL-encoded commas (#361) - [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336) ## **6.8.1** - [Fix] `parse`: Fix parsing array from object with `comma` true (#359) - [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) - [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335) - [fix] `parse`: with comma true, do not split non-string values (#334) - [meta] add tidelift marketing copy - [meta] add `funding` field - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `evalmd`, `has-symbols`, `iconv-lite`, `mkdirp`, `object-inspect` - [Tests] `parse`: add passing `arrayFormat` tests - [Tests] use shared travis-ci configs - [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray - [actions] add automatic rebasing / merge commit blocking ## **6.8.0** - [New] add `depth=false` to preserve the original key; [Fix] `depth=0` should preserve the original key (#326) - [New] [Fix] stringify symbols and bigints - [Fix] ensure node 0.12 can stringify Symbols - [Fix] fix for an impossible situation: when the formatter is called with a non-string value - [Refactor] `formats`: tiny bit of cleanup. - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `safe-publish-latest`, `iconv-lite`, `tape` - [Tests] add tests for `depth=0` and `depth=false` behavior, both current and intuitive/intended (#326) - [Tests] use `eclint` instead of `editorconfig-tools` - [docs] readme: add security note - [meta] add github sponsorship - [meta] add FUNDING.yml - [meta] Clean up license text so it’s properly detected as BSD-3-Clause ## **6.7.3** - [Fix] `parse`: ignore `__proto__` keys (#428) - [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) - [Robustness] `stringify`: avoid relying on a global `undefined` (#427) - [readme] remove travis badge; add github actions/codecov badges; update URLs - [Docs] add note and links for coercing primitive values (#408) - [meta] fix README.md (#399) - [meta] do not publish workflow files - [actions] backport actions from main - [Dev Deps] backport updates from main - [Tests] use `nyc` for coverage - [Tests] clean up stringify tests slightly ## **6.7.2** - [Fix] proper comma parsing of URL-encoded commas (#361) - [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336) ## **6.7.1** - [Fix] `parse`: Fix parsing array from object with `comma` true (#359) - [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335) - [fix] `parse`: with comma true, do not split non-string values (#334) - [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) - [Fix] fix for an impossible situation: when the formatter is called with a non-string value - [Refactor] `formats`: tiny bit of cleanup. - readme: add security note - [meta] add tidelift marketing copy - [meta] add `funding` field - [meta] add FUNDING.yml - [meta] Clean up license text so it’s properly detected as BSD-3-Clause - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `evalmd`, `iconv-lite`, `mkdirp`, `object-inspect`, `browserify` - [Tests] `parse`: add passing `arrayFormat` tests - [Tests] use shared travis-ci configs - [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray - [Tests] add tests for `depth=0` and `depth=false` behavior, both current and intuitive/intended - [Tests] use `eclint` instead of `editorconfig-tools` - [actions] add automatic rebasing / merge commit blocking ## **6.7.0** - [New] `stringify`/`parse`: add `comma` as an `arrayFormat` option (#276, #219) - [Fix] correctly parse nested arrays (#212) - [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source, also with an array source - [Robustness] `stringify`: cache `Object.prototype.hasOwnProperty` - [Refactor] `utils`: `isBuffer`: small tweak; add tests - [Refactor] use cached `Array.isArray` - [Refactor] `parse`/`stringify`: make a function to normalize the options - [Refactor] `utils`: reduce observable [[Get]]s - [Refactor] `stringify`/`utils`: cache `Array.isArray` - [Tests] always use `String(x)` over `x.toString()` - [Tests] fix Buffer tests to work in node < 4.5 and node < 5.10 - [Tests] temporarily allow coverage to fail ## **6.6.1** - [Fix] `parse`: ignore `__proto__` keys (#428) - [Fix] fix for an impossible situation: when the formatter is called with a non-string value - [Fix] `utils.merge`: avoid a crash with a null target and an array source - [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source - [Fix] correctly parse nested arrays - [Robustness] `stringify`: avoid relying on a global `undefined` (#427) - [Robustness] `stringify`: cache `Object.prototype.hasOwnProperty` - [Refactor] `formats`: tiny bit of cleanup. - [Refactor] `utils`: `isBuffer`: small tweak; add tests - [Refactor]: `stringify`/`utils`: cache `Array.isArray` - [Refactor] `utils`: reduce observable [[Get]]s - [Refactor] use cached `Array.isArray` - [Refactor] `parse`/`stringify`: make a function to normalize the options - [readme] remove travis badge; add github actions/codecov badges; update URLs - [Docs] Clarify the need for "arrayLimit" option - [meta] fix README.md (#399) - [meta] do not publish workflow files - [meta] Clean up license text so it’s properly detected as BSD-3-Clause - [meta] add FUNDING.yml - [meta] Fixes typo in CHANGELOG.md - [actions] backport actions from main - [Tests] fix Buffer tests to work in node < 4.5 and node < 5.10 - [Tests] always use `String(x)` over `x.toString()` - [Dev Deps] backport from main ## **6.6.0** - [New] Add support for iso-8859-1, utf8 "sentinel" and numeric entities (#268) - [New] move two-value combine to a `utils` function (#189) - [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) - [Fix] when `parseArrays` is false, properly handle keys ending in `[]` (#260) - [Fix] `stringify`: do not crash in an obscure combo of `interpretNumericEntities`, a bad custom `decoder`, & `iso-8859-1` - [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided - [refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) - [Refactor] `parse`: only need to reassign the var once - [Refactor] `parse`/`stringify`: clean up `charset` options checking; fix defaults - [Refactor] add missing defaults - [Refactor] `parse`: one less `concat` call - [Refactor] `utils`: `compactQueue`: make it explicitly side-effecting - [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`, `iconv-lite`, `safe-publish-latest`, `tape` - [Tests] up to `node` `v10.10`, `v9.11`, `v8.12`, `v6.14`, `v4.9`; pin included builds to LTS ## **6.5.3** - [Fix] `parse`: ignore `__proto__` keys (#428) - [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source - [Fix] correctly parse nested arrays - [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) - [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided - [Fix] when `parseArrays` is false, properly handle keys ending in `[]` - [Fix] fix for an impossible situation: when the formatter is called with a non-string value - [Fix] `utils.merge`: avoid a crash with a null target and an array source - [Refactor] `utils`: reduce observable [[Get]]s - [Refactor] use cached `Array.isArray` - [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) - [Refactor] `parse`: only need to reassign the var once - [Robustness] `stringify`: avoid relying on a global `undefined` (#427) - [readme] remove travis badge; add github actions/codecov badges; update URLs - [Docs] Clean up license text so it’s properly detected as BSD-3-Clause - [Docs] Clarify the need for "arrayLimit" option - [meta] fix README.md (#399) - [meta] add FUNDING.yml - [actions] backport actions from main - [Tests] always use `String(x)` over `x.toString()` - [Tests] remove nonexistent tape option - [Dev Deps] backport from main ## **6.5.2** - [Fix] use `safer-buffer` instead of `Buffer` constructor - [Refactor] utils: `module.exports` one thing, instead of mutating `exports` (#230) - [Dev Deps] update `browserify`, `eslint`, `iconv-lite`, `safer-buffer`, `tape`, `browserify` ## **6.5.1** - [Fix] Fix parsing & compacting very deep objects (#224) - [Refactor] name utils functions - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` - [Tests] up to `node` `v8.4`; use `nvm install-latest-npm` so newer npm doesn’t break older node - [Tests] Use precise dist for Node.js 0.6 runtime (#225) - [Tests] make 0.6 required, now that it’s passing - [Tests] on `node` `v8.2`; fix npm on node 0.6 ## **6.5.0** - [New] add `utils.assign` - [New] pass default encoder/decoder to custom encoder/decoder functions (#206) - [New] `parse`/`stringify`: add `ignoreQueryPrefix`/`addQueryPrefix` options, respectively (#213) - [Fix] Handle stringifying empty objects with addQueryPrefix (#217) - [Fix] do not mutate `options` argument (#207) - [Refactor] `parse`: cache index to reuse in else statement (#182) - [Docs] add various badges to readme (#208) - [Dev Deps] update `eslint`, `browserify`, `iconv-lite`, `tape` - [Tests] up to `node` `v8.1`, `v7.10`, `v6.11`; npm v4.6 breaks on node < v1; npm v5+ breaks on node < v4 - [Tests] add `editorconfig-tools` ## **6.4.1** - [Fix] `parse`: ignore `__proto__` keys (#428) - [Fix] fix for an impossible situation: when the formatter is called with a non-string value - [Fix] use `safer-buffer` instead of `Buffer` constructor - [Fix] `utils.merge`: avoid a crash with a null target and an array source - [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source - [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) - [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided - [Fix] when `parseArrays` is false, properly handle keys ending in `[]` - [Robustness] `stringify`: avoid relying on a global `undefined` (#427) - [Refactor] use cached `Array.isArray` - [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) - [readme] remove travis badge; add github actions/codecov badges; update URLs - [Docs] Clarify the need for "arrayLimit" option - [meta] fix README.md (#399) - [meta] Clean up license text so it’s properly detected as BSD-3-Clause - [meta] add FUNDING.yml - [actions] backport actions from main - [Tests] remove nonexistent tape option - [Dev Deps] backport from main ## **6.4.0** - [New] `qs.stringify`: add `encodeValuesOnly` option - [Fix] follow `allowPrototypes` option during merge (#201, #201) - [Fix] support keys starting with brackets (#202, #200) - [Fix] chmod a-x - [Dev Deps] update `eslint` - [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds - [eslint] reduce warnings ## **6.3.3** - [Fix] `parse`: ignore `__proto__` keys (#428) - [Fix] fix for an impossible situation: when the formatter is called with a non-string value - [Fix] `utils.merge`: avoid a crash with a null target and an array source - [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source - [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) - [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided - [Fix] when `parseArrays` is false, properly handle keys ending in `[]` - [Robustness] `stringify`: avoid relying on a global `undefined` (#427) - [Refactor] use cached `Array.isArray` - [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) - [Docs] Clarify the need for "arrayLimit" option - [meta] fix README.md (#399) - [meta] Clean up license text so it’s properly detected as BSD-3-Clause - [meta] add FUNDING.yml - [actions] backport actions from main - [Tests] use `safer-buffer` instead of `Buffer` constructor - [Tests] remove nonexistent tape option - [Dev Deps] backport from main ## **6.3.2** - [Fix] follow `allowPrototypes` option during merge (#201, #200) - [Dev Deps] update `eslint` - [Fix] chmod a-x - [Fix] support keys starting with brackets (#202, #200) - [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds ## **6.3.1** - [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties (thanks, @snyk!) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `iconv-lite`, `qs-iconv`, `tape` - [Tests] on all node minors; improve test matrix - [Docs] document stringify option `allowDots` (#195) - [Docs] add empty object and array values example (#195) - [Docs] Fix minor inconsistency/typo (#192) - [Docs] document stringify option `sort` (#191) - [Refactor] `stringify`: throw faster with an invalid encoder - [Refactor] remove unnecessary escapes (#184) - Remove contributing.md, since `qs` is no longer part of `hapi` (#183) ## **6.3.0** - [New] Add support for RFC 1738 (#174, #173) - [New] `stringify`: Add `serializeDate` option to customize Date serialization (#159) - [Fix] ensure `utils.merge` handles merging two arrays - [Refactor] only constructors should be capitalized - [Refactor] capitalized var names are for constructors only - [Refactor] avoid using a sparse array - [Robustness] `formats`: cache `String#replace` - [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` - [Tests] up to `node` `v6.8`, `v4.6`; improve test matrix - [Tests] flesh out arrayLimit/arrayFormat tests (#107) - [Tests] skip Object.create tests when null objects are not available - [Tests] Turn on eslint for test files (#175) ## **6.2.4** - [Fix] `parse`: ignore `__proto__` keys (#428) - [Fix] `utils.merge`: avoid a crash with a null target and an array source - [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source - [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided - [Fix] when `parseArrays` is false, properly handle keys ending in `[]` - [Robustness] `stringify`: avoid relying on a global `undefined` (#427) - [Refactor] use cached `Array.isArray` - [Docs] Clarify the need for "arrayLimit" option - [meta] fix README.md (#399) - [meta] Clean up license text so it’s properly detected as BSD-3-Clause - [meta] add FUNDING.yml - [actions] backport actions from main - [Tests] use `safer-buffer` instead of `Buffer` constructor - [Tests] remove nonexistent tape option - [Dev Deps] backport from main ## **6.2.3** - [Fix] follow `allowPrototypes` option during merge (#201, #200) - [Fix] chmod a-x - [Fix] support keys starting with brackets (#202, #200) - [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds ## **6.2.2** - [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties ## **6.2.1** - [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values - [Refactor] Be explicit and use `Object.prototype.hasOwnProperty.call` - [Tests] remove `parallelshell` since it does not reliably report failures - [Tests] up to `node` `v6.3`, `v5.12` - [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`, `qs-iconv` ## [**6.2.0**](https://github.com/ljharb/qs/issues?milestone=36&state=closed) - [New] pass Buffers to the encoder/decoder directly (#161) - [New] add "encoder" and "decoder" options, for custom param encoding/decoding (#160) - [Fix] fix compacting of nested sparse arrays (#150) ## **6.1.2** - [Fix] follow `allowPrototypes` option during merge (#201, #200) - [Fix] chmod a-x - [Fix] support keys starting with brackets (#202, #200) - [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds ## **6.1.1** - [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties ## [**6.1.0**](https://github.com/ljharb/qs/issues?milestone=35&state=closed) - [New] allowDots option for `stringify` (#151) - [Fix] "sort" option should work at a depth of 3 or more (#151) - [Fix] Restore `dist` directory; will be removed in v7 (#148) ## **6.0.4** - [Fix] follow `allowPrototypes` option during merge (#201, #200) - [Fix] chmod a-x - [Fix] support keys starting with brackets (#202, #200) - [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds ## **6.0.3** - [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties - [Fix] Restore `dist` directory; will be removed in v7 (#148) ## [**6.0.2**](https://github.com/ljharb/qs/issues?milestone=33&state=closed) - Revert ES6 requirement and restore support for node down to v0.8. ## [**6.0.1**](https://github.com/ljharb/qs/issues?milestone=32&state=closed) - [**#127**](https://github.com/ljharb/qs/pull/127) Fix engines definition in package.json ## [**6.0.0**](https://github.com/ljharb/qs/issues?milestone=31&state=closed) - [**#124**](https://github.com/ljharb/qs/issues/124) Use ES6 and drop support for node < v4 ## **5.2.1** - [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values ## [**5.2.0**](https://github.com/ljharb/qs/issues?milestone=30&state=closed) - [**#64**](https://github.com/ljharb/qs/issues/64) Add option to sort object keys in the query string ## [**5.1.0**](https://github.com/ljharb/qs/issues?milestone=29&state=closed) - [**#117**](https://github.com/ljharb/qs/issues/117) make URI encoding stringified results optional - [**#106**](https://github.com/ljharb/qs/issues/106) Add flag `skipNulls` to optionally skip null values in stringify ## [**5.0.0**](https://github.com/ljharb/qs/issues?milestone=28&state=closed) - [**#114**](https://github.com/ljharb/qs/issues/114) default allowDots to false - [**#100**](https://github.com/ljharb/qs/issues/100) include dist to npm ## [**4.0.0**](https://github.com/ljharb/qs/issues?milestone=26&state=closed) - [**#98**](https://github.com/ljharb/qs/issues/98) make returning plain objects and allowing prototype overwriting properties optional ## [**3.1.0**](https://github.com/ljharb/qs/issues?milestone=24&state=closed) - [**#89**](https://github.com/ljharb/qs/issues/89) Add option to disable "Transform dot notation to bracket notation" ## [**3.0.0**](https://github.com/ljharb/qs/issues?milestone=23&state=closed) - [**#80**](https://github.com/ljharb/qs/issues/80) qs.parse silently drops properties - [**#77**](https://github.com/ljharb/qs/issues/77) Perf boost - [**#60**](https://github.com/ljharb/qs/issues/60) Add explicit option to disable array parsing - [**#74**](https://github.com/ljharb/qs/issues/74) Bad parse when turning array into object - [**#81**](https://github.com/ljharb/qs/issues/81) Add a `filter` option - [**#68**](https://github.com/ljharb/qs/issues/68) Fixed issue with recursion and passing strings into objects. - [**#66**](https://github.com/ljharb/qs/issues/66) Add mixed array and object dot notation support Closes: #47 - [**#76**](https://github.com/ljharb/qs/issues/76) RFC 3986 - [**#85**](https://github.com/ljharb/qs/issues/85) No equal sign - [**#84**](https://github.com/ljharb/qs/issues/84) update license attribute ## [**2.4.1**](https://github.com/ljharb/qs/issues?milestone=20&state=closed) - [**#73**](https://github.com/ljharb/qs/issues/73) Property 'hasOwnProperty' of object #<Object> is not a function ## [**2.4.0**](https://github.com/ljharb/qs/issues?milestone=19&state=closed) - [**#70**](https://github.com/ljharb/qs/issues/70) Add arrayFormat option ## [**2.3.3**](https://github.com/ljharb/qs/issues?milestone=18&state=closed) - [**#59**](https://github.com/ljharb/qs/issues/59) make sure array indexes are >= 0, closes #57 - [**#58**](https://github.com/ljharb/qs/issues/58) make qs usable for browser loader ## [**2.3.2**](https://github.com/ljharb/qs/issues?milestone=17&state=closed) - [**#55**](https://github.com/ljharb/qs/issues/55) allow merging a string into an object ## [**2.3.1**](https://github.com/ljharb/qs/issues?milestone=16&state=closed) - [**#52**](https://github.com/ljharb/qs/issues/52) Return "undefined" and "false" instead of throwing "TypeError". ## [**2.3.0**](https://github.com/ljharb/qs/issues?milestone=15&state=closed) - [**#50**](https://github.com/ljharb/qs/issues/50) add option to omit array indices, closes #46 ## [**2.2.5**](https://github.com/ljharb/qs/issues?milestone=14&state=closed) - [**#39**](https://github.com/ljharb/qs/issues/39) Is there an alternative to Buffer.isBuffer? - [**#49**](https://github.com/ljharb/qs/issues/49) refactor utils.merge, fixes #45 - [**#41**](https://github.com/ljharb/qs/issues/41) avoid browserifying Buffer, for #39 ## [**2.2.4**](https://github.com/ljharb/qs/issues?milestone=13&state=closed) - [**#38**](https://github.com/ljharb/qs/issues/38) how to handle object keys beginning with a number ## [**2.2.3**](https://github.com/ljharb/qs/issues?milestone=12&state=closed) - [**#37**](https://github.com/ljharb/qs/issues/37) parser discards first empty value in array - [**#36**](https://github.com/ljharb/qs/issues/36) Update to lab 4.x ## [**2.2.2**](https://github.com/ljharb/qs/issues?milestone=11&state=closed) - [**#33**](https://github.com/ljharb/qs/issues/33) Error when plain object in a value - [**#34**](https://github.com/ljharb/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty - [**#24**](https://github.com/ljharb/qs/issues/24) Changelog? Semver? ## [**2.2.1**](https://github.com/ljharb/qs/issues?milestone=10&state=closed) - [**#32**](https://github.com/ljharb/qs/issues/32) account for circular references properly, closes #31 - [**#31**](https://github.com/ljharb/qs/issues/31) qs.parse stackoverflow on circular objects ## [**2.2.0**](https://github.com/ljharb/qs/issues?milestone=9&state=closed) - [**#26**](https://github.com/ljharb/qs/issues/26) Don't use Buffer global if it's not present - [**#30**](https://github.com/ljharb/qs/issues/30) Bug when merging non-object values into arrays - [**#29**](https://github.com/ljharb/qs/issues/29) Don't call Utils.clone at the top of Utils.merge - [**#23**](https://github.com/ljharb/qs/issues/23) Ability to not limit parameters? ## [**2.1.0**](https://github.com/ljharb/qs/issues?milestone=8&state=closed) - [**#22**](https://github.com/ljharb/qs/issues/22) Enable using a RegExp as delimiter ## [**2.0.0**](https://github.com/ljharb/qs/issues?milestone=7&state=closed) - [**#18**](https://github.com/ljharb/qs/issues/18) Why is there arrayLimit? - [**#20**](https://github.com/ljharb/qs/issues/20) Configurable parametersLimit - [**#21**](https://github.com/ljharb/qs/issues/21) make all limits optional, for #18, for #20 ## [**1.2.2**](https://github.com/ljharb/qs/issues?milestone=6&state=closed) - [**#19**](https://github.com/ljharb/qs/issues/19) Don't overwrite null values ## [**1.2.1**](https://github.com/ljharb/qs/issues?milestone=5&state=closed) - [**#16**](https://github.com/ljharb/qs/issues/16) ignore non-string delimiters - [**#15**](https://github.com/ljharb/qs/issues/15) Close code block ## [**1.2.0**](https://github.com/ljharb/qs/issues?milestone=4&state=closed) - [**#12**](https://github.com/ljharb/qs/issues/12) Add optional delim argument - [**#13**](https://github.com/ljharb/qs/issues/13) fix #11: flattened keys in array are now correctly parsed ## [**1.1.0**](https://github.com/ljharb/qs/issues?milestone=3&state=closed) - [**#7**](https://github.com/ljharb/qs/issues/7) Empty values of a POST array disappear after being submitted - [**#9**](https://github.com/ljharb/qs/issues/9) Should not omit equals signs (=) when value is null - [**#6**](https://github.com/ljharb/qs/issues/6) Minor grammar fix in README ## [**1.0.2**](https://github.com/ljharb/qs/issues?milestone=2&state=closed) - [**#5**](https://github.com/ljharb/qs/issues/5) array holes incorrectly copied into object on large index
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/qs/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/qs/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 32067 }
BSD 3-Clause License Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/ljharb/qs/graphs/contributors) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/qs/LICENSE.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/qs/LICENSE.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1599 }
<p align="center"> <img alt="qs" src="./logos/banner_default.png" width="800" /> </p> # qs <sup>[![Version Badge][npm-version-svg]][package-url]</sup> [![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/9058/badge)](https://bestpractices.coreinfrastructure.org/projects/9058) [![npm badge][npm-badge-png]][package-url] A querystring parsing and stringifying library with some added security. Lead Maintainer: [Jordan Harband](https://github.com/ljharb) The **qs** module was originally created and maintained by [TJ Holowaychuk](https://github.com/visionmedia/node-querystring). ## Usage ```javascript var qs = require('qs'); var assert = require('assert'); var obj = qs.parse('a=c'); assert.deepEqual(obj, { a: 'c' }); var str = qs.stringify(obj); assert.equal(str, 'a=c'); ``` ### Parsing Objects [](#preventEval) ```javascript qs.parse(string, [options]); ``` **qs** allows you to create nested objects within your query strings, by surrounding the name of sub-keys with square brackets `[]`. For example, the string `'foo[bar]=baz'` converts to: ```javascript assert.deepEqual(qs.parse('foo[bar]=baz'), { foo: { bar: 'baz' } }); ``` When using the `plainObjects` option the parsed value is returned as a null object, created via `Object.create(null)` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like: ```javascript var nullObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); assert.deepEqual(nullObject, { a: { hasOwnProperty: 'b' } }); ``` By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use `plainObjects` as mentioned above, or set `allowPrototypes` to `true` which will allow user input to overwrite those properties. *WARNING* It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option. ```javascript var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }); assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } }); ``` URI encoded strings work too: ```javascript assert.deepEqual(qs.parse('a%5Bb%5D=c'), { a: { b: 'c' } }); ``` You can also nest your objects, like `'foo[bar][baz]=foobarbaz'`: ```javascript assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), { foo: { bar: { baz: 'foobarbaz' } } }); ``` By default, when nesting objects **qs** will only parse up to 5 children deep. This means if you attempt to parse a string like `'a[b][c][d][e][f][g][h][i]=j'` your resulting object will be: ```javascript var expected = { a: { b: { c: { d: { e: { f: { '[g][h][i]': 'j' } } } } } } }; var string = 'a[b][c][d][e][f][g][h][i]=j'; assert.deepEqual(qs.parse(string), expected); ``` This depth can be overridden by passing a `depth` option to `qs.parse(string, [options])`: ```javascript var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }); ``` You can configure **qs** to throw an error when parsing nested input beyond this depth using the `strictDepth` option (defaulted to false): ```javascript try { qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1, strictDepth: true }); } catch (err) { assert(err instanceof RangeError); assert.strictEqual(err.message, 'Input depth exceeded depth option of 1 and strictDepth is true'); } ``` The depth limit helps mitigate abuse when **qs** is used to parse user input, and it is recommended to keep it a reasonably small number. The strictDepth option adds a layer of protection by throwing an error when the limit is exceeded, allowing you to catch and handle such cases. For similar reasons, by default **qs** will only parse up to 1000 parameters. This can be overridden by passing a `parameterLimit` option: ```javascript var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); assert.deepEqual(limited, { a: 'b' }); ``` To bypass the leading question mark, use `ignoreQueryPrefix`: ```javascript var prefixed = qs.parse('?a=b&c=d', { ignoreQueryPrefix: true }); assert.deepEqual(prefixed, { a: 'b', c: 'd' }); ``` An optional delimiter can also be passed: ```javascript var delimited = qs.parse('a=b;c=d', { delimiter: ';' }); assert.deepEqual(delimited, { a: 'b', c: 'd' }); ``` Delimiters can be a regular expression too: ```javascript var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ }); assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' }); ``` Option `allowDots` can be used to enable dot notation: ```javascript var withDots = qs.parse('a.b=c', { allowDots: true }); assert.deepEqual(withDots, { a: { b: 'c' } }); ``` Option `decodeDotInKeys` can be used to decode dots in keys Note: it implies `allowDots`, so `parse` will error if you set `decodeDotInKeys` to `true`, and `allowDots` to `false`. ```javascript var withDots = qs.parse('name%252Eobj.first=John&name%252Eobj.last=Doe', { decodeDotInKeys: true }); assert.deepEqual(withDots, { 'name.obj': { first: 'John', last: 'Doe' }}); ``` Option `allowEmptyArrays` can be used to allowing empty array values in object ```javascript var withEmptyArrays = qs.parse('foo[]&bar=baz', { allowEmptyArrays: true }); assert.deepEqual(withEmptyArrays, { foo: [], bar: 'baz' }); ``` Option `duplicates` can be used to change the behavior when duplicate keys are encountered ```javascript assert.deepEqual(qs.parse('foo=bar&foo=baz'), { foo: ['bar', 'baz'] }); assert.deepEqual(qs.parse('foo=bar&foo=baz', { duplicates: 'combine' }), { foo: ['bar', 'baz'] }); assert.deepEqual(qs.parse('foo=bar&foo=baz', { duplicates: 'first' }), { foo: 'bar' }); assert.deepEqual(qs.parse('foo=bar&foo=baz', { duplicates: 'last' }), { foo: 'baz' }); ``` If you have to deal with legacy browsers or services, there's also support for decoding percent-encoded octets as iso-8859-1: ```javascript var oldCharset = qs.parse('a=%A7', { charset: 'iso-8859-1' }); assert.deepEqual(oldCharset, { a: '§' }); ``` Some services add an initial `utf8=✓` value to forms so that old Internet Explorer versions are more likely to submit the form as utf-8. Additionally, the server can check the value against wrong encodings of the checkmark character and detect that a query string or `application/x-www-form-urlencoded` body was *not* sent as utf-8, eg. if the form had an `accept-charset` parameter or the containing page had a different character set. **qs** supports this mechanism via the `charsetSentinel` option. If specified, the `utf8` parameter will be omitted from the returned object. It will be used to switch to `iso-8859-1`/`utf-8` mode depending on how the checkmark is encoded. **Important**: When you specify both the `charset` option and the `charsetSentinel` option, the `charset` will be overridden when the request contains a `utf8` parameter from which the actual charset can be deduced. In that sense the `charset` will behave as the default charset rather than the authoritative charset. ```javascript var detectedAsUtf8 = qs.parse('utf8=%E2%9C%93&a=%C3%B8', { charset: 'iso-8859-1', charsetSentinel: true }); assert.deepEqual(detectedAsUtf8, { a: 'ø' }); // Browsers encode the checkmark as &#10003; when submitting as iso-8859-1: var detectedAsIso8859_1 = qs.parse('utf8=%26%2310003%3B&a=%F8', { charset: 'utf-8', charsetSentinel: true }); assert.deepEqual(detectedAsIso8859_1, { a: 'ø' }); ``` If you want to decode the `&#...;` syntax to the actual character, you can specify the `interpretNumericEntities` option as well: ```javascript var detectedAsIso8859_1 = qs.parse('a=%26%239786%3B', { charset: 'iso-8859-1', interpretNumericEntities: true }); assert.deepEqual(detectedAsIso8859_1, { a: '☺' }); ``` It also works when the charset has been detected in `charsetSentinel` mode. ### Parsing Arrays **qs** can also parse arrays using a similar `[]` notation: ```javascript var withArray = qs.parse('a[]=b&a[]=c'); assert.deepEqual(withArray, { a: ['b', 'c'] }); ``` You may specify an index as well: ```javascript var withIndexes = qs.parse('a[1]=c&a[0]=b'); assert.deepEqual(withIndexes, { a: ['b', 'c'] }); ``` Note that the only difference between an index in an array and a key in an object is that the value between the brackets must be a number to create an array. When creating arrays with specific indices, **qs** will compact a sparse array to only the existing values preserving their order: ```javascript var noSparse = qs.parse('a[1]=b&a[15]=c'); assert.deepEqual(noSparse, { a: ['b', 'c'] }); ``` You may also use `allowSparse` option to parse sparse arrays: ```javascript var sparseArray = qs.parse('a[1]=2&a[3]=5', { allowSparse: true }); assert.deepEqual(sparseArray, { a: [, '2', , '5'] }); ``` Note that an empty string is also a value, and will be preserved: ```javascript var withEmptyString = qs.parse('a[]=&a[]=b'); assert.deepEqual(withEmptyString, { a: ['', 'b'] }); var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c'); assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] }); ``` **qs** will also limit specifying indices in an array to a maximum index of `20`. Any array members with an index of greater than `20` will instead be converted to an object with the index as the key. This is needed to handle cases when someone sent, for example, `a[999999999]` and it will take significant time to iterate over this huge array. ```javascript var withMaxIndex = qs.parse('a[100]=b'); assert.deepEqual(withMaxIndex, { a: { '100': 'b' } }); ``` This limit can be overridden by passing an `arrayLimit` option: ```javascript var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); ``` To disable array parsing entirely, set `parseArrays` to `false`. ```javascript var noParsingArrays = qs.parse('a[]=b', { parseArrays: false }); assert.deepEqual(noParsingArrays, { a: { '0': 'b' } }); ``` If you mix notations, **qs** will merge the two items into an object: ```javascript var mixedNotation = qs.parse('a[0]=b&a[b]=c'); assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } }); ``` You can also create arrays of objects: ```javascript var arraysOfObjects = qs.parse('a[][b]=c'); assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); ``` Some people use comma to join array, **qs** can parse it: ```javascript var arraysOfObjects = qs.parse('a=b,c', { comma: true }) assert.deepEqual(arraysOfObjects, { a: ['b', 'c'] }) ``` (_this cannot convert nested objects, such as `a={b:1},{c:d}`_) ### Parsing primitive/scalar values (numbers, booleans, null, etc) By default, all values are parsed as strings. This behavior will not change and is explained in [issue #91](https://github.com/ljharb/qs/issues/91). ```javascript var primitiveValues = qs.parse('a=15&b=true&c=null'); assert.deepEqual(primitiveValues, { a: '15', b: 'true', c: 'null' }); ``` If you wish to auto-convert values which look like numbers, booleans, and other values into their primitive counterparts, you can use the [query-types Express JS middleware](https://github.com/xpepermint/query-types) which will auto-convert all request query parameters. ### Stringifying [](#preventEval) ```javascript qs.stringify(object, [options]); ``` When stringifying, **qs** by default URI encodes output. Objects are stringified as you would expect: ```javascript assert.equal(qs.stringify({ a: 'b' }), 'a=b'); assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); ``` This encoding can be disabled by setting the `encode` option to `false`: ```javascript var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false }); assert.equal(unencoded, 'a[b]=c'); ``` Encoding can be disabled for keys by setting the `encodeValuesOnly` option to `true`: ```javascript var encodedValues = qs.stringify( { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, { encodeValuesOnly: true } ); assert.equal(encodedValues,'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h'); ``` This encoding can also be replaced by a custom encoding method set as `encoder` option: ```javascript var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str) { // Passed in values `a`, `b`, `c` return // Return encoded string }}) ``` _(Note: the `encoder` option does not apply if `encode` is `false`)_ Analogue to the `encoder` there is a `decoder` option for `parse` to override decoding of properties and values: ```javascript var decoded = qs.parse('x=z', { decoder: function (str) { // Passed in values `x`, `z` return // Return decoded string }}) ``` You can encode keys and values using different logic by using the type argument provided to the encoder: ```javascript var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str, defaultEncoder, charset, type) { if (type === 'key') { return // Encoded key } else if (type === 'value') { return // Encoded value } }}) ``` The type argument is also provided to the decoder: ```javascript var decoded = qs.parse('x=z', { decoder: function (str, defaultDecoder, charset, type) { if (type === 'key') { return // Decoded key } else if (type === 'value') { return // Decoded value } }}) ``` Examples beyond this point will be shown as though the output is not URI encoded for clarity. Please note that the return values in these cases *will* be URI encoded during real usage. When arrays are stringified, they follow the `arrayFormat` option, which defaults to `indices`: ```javascript qs.stringify({ a: ['b', 'c', 'd'] }); // 'a[0]=b&a[1]=c&a[2]=d' ``` You may override this by setting the `indices` option to `false`, or to be more explicit, the `arrayFormat` option to `repeat`: ```javascript qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }); // 'a=b&a=c&a=d' ``` You may use the `arrayFormat` option to specify the format of the output array: ```javascript qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }) // 'a[0]=b&a[1]=c' qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) // 'a[]=b&a[]=c' qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) // 'a=b&a=c' qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'comma' }) // 'a=b,c' ``` Note: when using `arrayFormat` set to `'comma'`, you can also pass the `commaRoundTrip` option set to `true` or `false`, to append `[]` on single-item arrays, so that they can round trip through a parse. When objects are stringified, by default they use bracket notation: ```javascript qs.stringify({ a: { b: { c: 'd', e: 'f' } } }); // 'a[b][c]=d&a[b][e]=f' ``` You may override this to use dot notation by setting the `allowDots` option to `true`: ```javascript qs.stringify({ a: { b: { c: 'd', e: 'f' } } }, { allowDots: true }); // 'a.b.c=d&a.b.e=f' ``` You may encode the dot notation in the keys of object with option `encodeDotInKeys` by setting it to `true`: Note: it implies `allowDots`, so `stringify` will error if you set `decodeDotInKeys` to `true`, and `allowDots` to `false`. Caveat: when `encodeValuesOnly` is `true` as well as `encodeDotInKeys`, only dots in keys and nothing else will be encoded. ```javascript qs.stringify({ "name.obj": { "first": "John", "last": "Doe" } }, { allowDots: true, encodeDotInKeys: true }) // 'name%252Eobj.first=John&name%252Eobj.last=Doe' ``` You may allow empty array values by setting the `allowEmptyArrays` option to `true`: ```javascript qs.stringify({ foo: [], bar: 'baz' }, { allowEmptyArrays: true }); // 'foo[]&bar=baz' ``` Empty strings and null values will omit the value, but the equals sign (=) remains in place: ```javascript assert.equal(qs.stringify({ a: '' }), 'a='); ``` Key with no values (such as an empty object or array) will return nothing: ```javascript assert.equal(qs.stringify({ a: [] }), ''); assert.equal(qs.stringify({ a: {} }), ''); assert.equal(qs.stringify({ a: [{}] }), ''); assert.equal(qs.stringify({ a: { b: []} }), ''); assert.equal(qs.stringify({ a: { b: {}} }), ''); ``` Properties that are set to `undefined` will be omitted entirely: ```javascript assert.equal(qs.stringify({ a: null, b: undefined }), 'a='); ``` The query string may optionally be prepended with a question mark: ```javascript assert.equal(qs.stringify({ a: 'b', c: 'd' }, { addQueryPrefix: true }), '?a=b&c=d'); ``` The delimiter may be overridden with stringify as well: ```javascript assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); ``` If you only want to override the serialization of `Date` objects, you can provide a `serializeDate` option: ```javascript var date = new Date(7); assert.equal(qs.stringify({ a: date }), 'a=1970-01-01T00:00:00.007Z'.replace(/:/g, '%3A')); assert.equal( qs.stringify({ a: date }, { serializeDate: function (d) { return d.getTime(); } }), 'a=7' ); ``` You may use the `sort` option to affect the order of parameter keys: ```javascript function alphabeticalSort(a, b) { return a.localeCompare(b); } assert.equal(qs.stringify({ a: 'c', z: 'y', b : 'f' }, { sort: alphabeticalSort }), 'a=c&b=f&z=y'); ``` Finally, you can use the `filter` option to restrict which keys will be included in the stringified output. If you pass a function, it will be called for each key to obtain the replacement value. Otherwise, if you pass an array, it will be used to select properties and array indices for stringification: ```javascript function filterFunc(prefix, value) { if (prefix == 'b') { // Return an `undefined` value to omit a property. return; } if (prefix == 'e[f]') { return value.getTime(); } if (prefix == 'e[g][0]') { return value * 2; } return value; } qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: filterFunc }); // 'a=b&c=d&e[f]=123&e[g][0]=4' qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] }); // 'a=b&e=f' qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] }); // 'a[0]=b&a[2]=d' ``` You could also use `filter` to inject custom serialization for user defined types. Consider you're working with some api that expects query strings of the format for ranges: ``` https://domain.com/endpoint?range=30...70 ``` For which you model as: ```javascript class Range { constructor(from, to) { this.from = from; this.to = to; } } ``` You could _inject_ a custom serializer to handle values of this type: ```javascript qs.stringify( { range: new Range(30, 70), }, { filter: (prefix, value) => { if (value instanceof Range) { return `${value.from}...${value.to}`; } // serialize the usual way return value; }, } ); // range=30...70 ``` ### Handling of `null` values By default, `null` values are treated like empty strings: ```javascript var withNull = qs.stringify({ a: null, b: '' }); assert.equal(withNull, 'a=&b='); ``` Parsing does not distinguish between parameters with and without equal signs. Both are converted to empty strings. ```javascript var equalsInsensitive = qs.parse('a&b='); assert.deepEqual(equalsInsensitive, { a: '', b: '' }); ``` To distinguish between `null` values and empty strings use the `strictNullHandling` flag. In the result string the `null` values have no `=` sign: ```javascript var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true }); assert.equal(strictNull, 'a&b='); ``` To parse values without `=` back to `null` use the `strictNullHandling` flag: ```javascript var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true }); assert.deepEqual(parsedStrictNull, { a: null, b: '' }); ``` To completely skip rendering keys with `null` values, use the `skipNulls` flag: ```javascript var nullsSkipped = qs.stringify({ a: 'b', c: null}, { skipNulls: true }); assert.equal(nullsSkipped, 'a=b'); ``` If you're communicating with legacy systems, you can switch to `iso-8859-1` using the `charset` option: ```javascript var iso = qs.stringify({ æ: 'æ' }, { charset: 'iso-8859-1' }); assert.equal(iso, '%E6=%E6'); ``` Characters that don't exist in `iso-8859-1` will be converted to numeric entities, similar to what browsers do: ```javascript var numeric = qs.stringify({ a: '☺' }, { charset: 'iso-8859-1' }); assert.equal(numeric, 'a=%26%239786%3B'); ``` You can use the `charsetSentinel` option to announce the character by including an `utf8=✓` parameter with the proper encoding if the checkmark, similar to what Ruby on Rails and others do when submitting forms. ```javascript var sentinel = qs.stringify({ a: '☺' }, { charsetSentinel: true }); assert.equal(sentinel, 'utf8=%E2%9C%93&a=%E2%98%BA'); var isoSentinel = qs.stringify({ a: 'æ' }, { charsetSentinel: true, charset: 'iso-8859-1' }); assert.equal(isoSentinel, 'utf8=%26%2310003%3B&a=%E6'); ``` ### Dealing with special character sets By default the encoding and decoding of characters is done in `utf-8`, and `iso-8859-1` support is also built in via the `charset` parameter. If you wish to encode querystrings to a different character set (i.e. [Shift JIS](https://en.wikipedia.org/wiki/Shift_JIS)) you can use the [`qs-iconv`](https://github.com/martinheidegger/qs-iconv) library: ```javascript var encoder = require('qs-iconv/encoder')('shift_jis'); var shiftJISEncoded = qs.stringify({ a: 'こんにちは!' }, { encoder: encoder }); assert.equal(shiftJISEncoded, 'a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I'); ``` This also works for decoding of query strings: ```javascript var decoder = require('qs-iconv/decoder')('shift_jis'); var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); assert.deepEqual(obj, { a: 'こんにちは!' }); ``` ### RFC 3986 and RFC 1738 space encoding RFC3986 used as default option and encodes ' ' to *%20* which is backward compatible. In the same time, output can be stringified as per RFC1738 with ' ' equal to '+'. ``` assert.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC3986' }), 'a=b%20c'); assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC1738' }), 'a=b+c'); ``` ## Security Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. ## qs for enterprise Available as part of the Tidelift Subscription The maintainers of qs and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-qs?utm_source=npm-qs&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) [package-url]: https://npmjs.org/package/qs [npm-version-svg]: https://versionbadg.es/ljharb/qs.svg [deps-svg]: https://david-dm.org/ljharb/qs.svg [deps-url]: https://david-dm.org/ljharb/qs [dev-deps-svg]: https://david-dm.org/ljharb/qs/dev-status.svg [dev-deps-url]: https://david-dm.org/ljharb/qs#info=devDependencies [npm-badge-png]: https://nodei.co/npm/qs.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/qs.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/qs.svg [downloads-url]: https://npm-stat.com/charts.html?package=qs [codecov-image]: https://codecov.io/gh/ljharb/qs/branch/main/graphs/badge.svg [codecov-url]: https://app.codecov.io/gh/ljharb/qs/ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/qs [actions-url]: https://github.com/ljharb/qs/actions ## Acknowledgements qs logo by [NUMI](https://github.com/numi-hq/open-design): [<img src="https://raw.githubusercontent.com/numi-hq/open-design/main/assets/numi-lockup.png" alt="NUMI Logo" style="width: 200px;"/>](https://numi.tech/?ref=qs)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/qs/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/qs/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 24512 }
# queue-microtask [![ci][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] [ci-image]: https://img.shields.io/github/workflow/status/feross/queue-microtask/ci/master [ci-url]: https://github.com/feross/queue-microtask/actions [npm-image]: https://img.shields.io/npm/v/queue-microtask.svg [npm-url]: https://npmjs.org/package/queue-microtask [downloads-image]: https://img.shields.io/npm/dm/queue-microtask.svg [downloads-url]: https://npmjs.org/package/queue-microtask [standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg [standard-url]: https://standardjs.com ### fast, tiny [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask) shim for modern engines - Use [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask) in all modern JS engines. - No dependencies. Less than 10 lines. No shims or complicated fallbacks. - Optimal performance in all modern environments - Uses `queueMicrotask` in modern environments - Fallback to `Promise.resolve().then(fn)` in Node.js 10 and earlier, and old browsers (same performance as `queueMicrotask`) ## install ``` npm install queue-microtask ``` ## usage ```js const queueMicrotask = require('queue-microtask') queueMicrotask(() => { /* this will run soon */ }) ``` ## What is `queueMicrotask` and why would one use it? The `queueMicrotask` function is a WHATWG standard. It queues a microtask to be executed prior to control returning to the event loop. A microtask is a short function which will run after the current task has completed its work and when there is no other code waiting to be run before control of the execution context is returned to the event loop. The code `queueMicrotask(fn)` is equivalent to the code `Promise.resolve().then(fn)`. It is also very similar to [`process.nextTick(fn)`](https://nodejs.org/api/process.html#process_process_nexttick_callback_args) in Node. Using microtasks lets code run without interfering with any other, potentially higher priority, code that is pending, but before the JS engine regains control over the execution context. See the [spec](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing) or [Node documentation](https://nodejs.org/api/globals.html#globals_queuemicrotask_callback) for more information. ## Who is this package for? This package allows you to use `queueMicrotask` safely in all modern JS engines. Use it if you prioritize small JS bundle size over support for old browsers. If you just need to support Node 12 and later, use `queueMicrotask` directly. If you need to support all versions of Node, use this package. ## Why not use `process.nextTick`? In Node, `queueMicrotask` and `process.nextTick` are [essentially equivalent](https://nodejs.org/api/globals.html#globals_queuemicrotask_callback), though there are [subtle differences](https://github.com/YuzuJS/setImmediate#macrotasks-and-microtasks) that don't matter in most situations. You can think of `queueMicrotask` as a standardized version of `process.nextTick` that works in the browser. No need to rely on your browser bundler to shim `process` for the browser environment. ## Why not use `setTimeout(fn, 0)`? This approach is the most compatible, but it has problems. Modern browsers throttle timers severely, so `setTimeout(…, 0)` usually takes at least 4ms to run. Furthermore, the throttling gets even worse if the page is backgrounded. If you have many `setTimeout` calls, then this can severely limit the performance of your program. ## Why not use a microtask library like [`immediate`](https://www.npmjs.com/package/immediate) or [`asap`](https://www.npmjs.com/package/asap)? These packages are great! However, if you prioritize small JS bundle size over optimal performance in old browsers then you may want to consider this package. This package (`queue-microtask`) is four times smaller than `immediate`, twice as small as `asap`, and twice as small as using `process.nextTick` and letting the browser bundler shim it automatically. Note: This package throws an exception in JS environments which lack `Promise` support -- which are usually very old browsers and Node.js versions. Since the `queueMicrotask` API is supported in Node.js, Chrome, Firefox, Safari, Opera, and Edge, **the vast majority of users will get optimal performance**. Any JS environment with `Promise`, which is almost all of them, also get optimal performance. If you need support for JS environments which lack `Promise` support, use one of the alternative packages. ## What is a shim? > In computer programming, a shim is a library that transparently intercepts API calls and changes the arguments passed, handles the operation itself or redirects the operation elsewhere. – [Wikipedia](https://en.wikipedia.org/wiki/Shim_(computing)) This package could also be described as a "ponyfill". > A ponyfill is almost the same as a polyfill, but not quite. Instead of patching functionality for older browsers, a ponyfill provides that functionality as a standalone module you can use. – [PonyFoo](https://ponyfoo.com/articles/polyfills-or-ponyfills) ## API ### `queueMicrotask(fn)` The `queueMicrotask()` method queues a microtask. The `fn` argument is a function to be executed after all pending tasks have completed but before yielding control to the browser's event loop. ## license MIT. Copyright (c) [Feross Aboukhadijeh](https://feross.org).
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/queue-microtask/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/queue-microtask/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 5621 }
1.0.0 / 2016-01-17 ================== * Initial release
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/random-bytes/HISTORY.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/random-bytes/HISTORY.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 58 }
# random-bytes [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Node.js Version][node-version-image]][node-version-url] [![Build Status][travis-image]][travis-url] [![Test Coverage][coveralls-image]][coveralls-url] Generate strong pseudo-random bytes. This module is a simple wrapper around the Node.js core `crypto.randomBytes` API, with the following additions: * A `Promise` interface for environments with promises. * For Node.js versions that do not wait for the PRNG to be seeded, this module will wait a bit. ## Installation ```sh $ npm install random-bytes ``` ## API ```js var randomBytes = require('random-bytes') ``` ### randomBytes(size, callback) Generates strong pseudo-random bytes. The `size` argument is a number indicating the number of bytes to generate. ```js randomBytes(12, function (error, bytes) { if (error) throw error // do something with the bytes }) ``` ### randomBytes(size) Generates strong pseudo-random bytes and return a `Promise`. The `size` argument is a number indicating the number of bytes to generate. **Note**: To use promises in Node.js _prior to 0.12_, promises must be "polyfilled" using `global.Promise = require('bluebird')`. ```js randomBytes(18).then(function (string) { // do something with the string }) ``` ### randomBytes.sync(size) A synchronous version of above. ```js var bytes = randomBytes.sync(18) ``` ## License [MIT](LICENSE) [npm-image]: https://img.shields.io/npm/v/random-bytes.svg [npm-url]: https://npmjs.org/package/random-bytes [node-version-image]: https://img.shields.io/node/v/random-bytes.svg [node-version-url]: http://nodejs.org/download/ [travis-image]: https://img.shields.io/travis/crypto-utils/random-bytes/master.svg [travis-url]: https://travis-ci.org/crypto-utils/random-bytes [coveralls-image]: https://img.shields.io/coveralls/crypto-utils/random-bytes/master.svg [coveralls-url]: https://coveralls.io/r/crypto-utils/random-bytes?branch=master [downloads-image]: https://img.shields.io/npm/dm/random-bytes.svg [downloads-url]: https://npmjs.org/package/random-bytes
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/random-bytes/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/random-bytes/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2124 }
1.2.1 / 2019-05-10 ================== * Improve error when `str` is not a string 1.2.0 / 2016-06-01 ================== * Add `combine` option to combine overlapping ranges 1.1.0 / 2016-05-13 ================== * Fix incorrectly returning -1 when there is at least one valid range * perf: remove internal function 1.0.3 / 2015-10-29 ================== * perf: enable strict mode 1.0.2 / 2014-09-08 ================== * Support Node.js 0.6 1.0.1 / 2014-09-07 ================== * Move repository to jshttp 1.0.0 / 2013-12-11 ================== * Add repository to package.json * Add MIT license 0.0.4 / 2012-06-17 ================== * Change ret -1 for unsatisfiable and -2 when invalid 0.0.3 / 2012-06-17 ================== * Fix last-byte-pos default to len - 1 0.0.2 / 2012-06-14 ================== * Add `.type` 0.0.1 / 2012-06-11 ================== * Initial release
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/range-parser/HISTORY.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/range-parser/HISTORY.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 916 }
# range-parser [![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] [![Node.js Version][node-image]][node-url] [![Build Status][travis-image]][travis-url] [![Test Coverage][coveralls-image]][coveralls-url] Range header field parser. ## Installation This is a [Node.js](https://nodejs.org/en/) module available through the [npm registry](https://www.npmjs.com/). Installation is done using the [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): ```sh $ npm install range-parser ``` ## API <!-- eslint-disable no-unused-vars --> ```js var parseRange = require('range-parser') ``` ### parseRange(size, header, options) Parse the given `header` string where `size` is the maximum size of the resource. An array of ranges will be returned or negative numbers indicating an error parsing. * `-2` signals a malformed header string * `-1` signals an unsatisfiable range <!-- eslint-disable no-undef --> ```js // parse header from request var range = parseRange(size, req.headers.range) // the type of the range if (range.type === 'bytes') { // the ranges range.forEach(function (r) { // do something with r.start and r.end }) } ``` #### Options These properties are accepted in the options object. ##### combine Specifies if overlapping & adjacent ranges should be combined, defaults to `false`. When `true`, ranges will be combined and returned as if they were specified that way in the header. <!-- eslint-disable no-undef --> ```js parseRange(100, 'bytes=50-55,0-10,5-10,56-60', { combine: true }) // => [ // { start: 0, end: 10 }, // { start: 50, end: 60 } // ] ``` ## License [MIT](LICENSE) [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/range-parser/master [coveralls-url]: https://coveralls.io/r/jshttp/range-parser?branch=master [node-image]: https://badgen.net/npm/node/range-parser [node-url]: https://nodejs.org/en/download [npm-downloads-image]: https://badgen.net/npm/dm/range-parser [npm-url]: https://npmjs.org/package/range-parser [npm-version-image]: https://badgen.net/npm/v/range-parser [travis-image]: https://badgen.net/travis/jshttp/range-parser/master [travis-url]: https://travis-ci.org/jshttp/range-parser
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/range-parser/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/range-parser/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2277 }
2.5.2 / 2023-02-21 ================== * Fix error message for non-stream argument 2.5.1 / 2022-02-28 ================== * Fix error on early async hooks implementations 2.5.0 / 2022-02-21 ================== * Prevent loss of async hooks context * Prevent hanging when stream is not readable * deps: [email protected] - deps: [email protected] - deps: [email protected] 2.4.3 / 2022-02-14 ================== * deps: [email protected] 2.4.2 / 2021-11-16 ================== * deps: [email protected] * deps: [email protected] - deps: [email protected] - deps: [email protected] 2.4.1 / 2019-06-25 ================== * deps: [email protected] - deps: [email protected] 2.4.0 / 2019-04-17 ================== * deps: [email protected] - Add petabyte (`pb`) support * deps: [email protected] - Set constructor name when possible - deps: [email protected] - deps: statuses@'>= 1.5.0 < 2' * deps: [email protected] - Added encoding MIK 2.3.3 / 2018-05-08 ================== * deps: [email protected] - deps: depd@~1.1.2 - deps: [email protected] - deps: statuses@'>= 1.3.1 < 2' * deps: [email protected] - Fix loading encoding with year appended - Fix deprecation warnings on Node.js 10+ 2.3.2 / 2017-09-09 ================== * deps: [email protected] - Fix ISO-8859-1 regression - Update Windows-1255 2.3.1 / 2017-09-07 ================== * deps: [email protected] * deps: [email protected] - deps: [email protected] * perf: skip buffer decoding on overage chunk 2.3.0 / 2017-08-04 ================== * Add TypeScript definitions * Use `http-errors` for standard emitted errors * deps: [email protected] * deps: [email protected] - Add support for React Native - Add a warning if not loaded as utf-8 - Fix CESU-8 decoding in Node.js 8 - Improve speed of ISO-8859-1 encoding 2.2.0 / 2017-01-02 ================== * deps: [email protected] - Added encoding MS-31J - Added encoding MS-932 - Added encoding MS-936 - Added encoding MS-949 - Added encoding MS-950 - Fix GBK/GB18030 handling of Euro character 2.1.7 / 2016-06-19 ================== * deps: [email protected] * perf: remove double-cleanup on happy path 2.1.6 / 2016-03-07 ================== * deps: [email protected] - Drop partial bytes on all parsed units - Fix parsing byte string that looks like hex 2.1.5 / 2015-11-30 ================== * deps: [email protected] * deps: [email protected] 2.1.4 / 2015-09-27 ================== * Fix masking critical errors from `iconv-lite` * deps: [email protected] - Fix CESU-8 decoding in Node.js 4.x 2.1.3 / 2015-09-12 ================== * Fix sync callback when attaching data listener causes sync read - Node.js 0.10 compatibility issue 2.1.2 / 2015-07-05 ================== * Fix error stack traces to skip `makeError` * deps: [email protected] - Add encoding CESU-8 2.1.1 / 2015-06-14 ================== * Use `unpipe` module for unpiping requests 2.1.0 / 2015-05-28 ================== * deps: [email protected] - Improved UTF-16 endianness detection - Leading BOM is now removed when decoding - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails 2.0.2 / 2015-05-21 ================== * deps: [email protected] - Slight optimizations 2.0.1 / 2015-05-10 ================== * Fix a false-positive when unpiping in Node.js 0.8 2.0.0 / 2015-05-08 ================== * Return a promise without callback instead of thunk * deps: [email protected] - units no longer case sensitive when parsing 1.3.4 / 2015-04-15 ================== * Fix hanging callback if request aborts during read * deps: [email protected] - Add encoding alias UNICODE-1-1-UTF-7 1.3.3 / 2015-02-08 ================== * deps: [email protected] - Gracefully support enumerables on `Object.prototype` 1.3.2 / 2015-01-20 ================== * deps: [email protected] - Fix rare aliases of single-byte encodings 1.3.1 / 2014-11-21 ================== * deps: [email protected] - Fix Windows-31J and X-SJIS encoding support 1.3.0 / 2014-07-20 ================== * Fully unpipe the stream on error - Fixes `Cannot switch to old mode now` error on Node.js 0.10+ 1.2.3 / 2014-07-20 ================== * deps: [email protected] - Added encoding UTF-7 1.2.2 / 2014-06-19 ================== * Send invalid encoding error to callback 1.2.1 / 2014-06-15 ================== * deps: [email protected] - Added encodings UTF-16BE and UTF-16 with BOM 1.2.0 / 2014-06-13 ================== * Passing string as `options` interpreted as encoding * Support all encodings from `iconv-lite` 1.1.7 / 2014-06-12 ================== * use `string_decoder` module from npm 1.1.6 / 2014-05-27 ================== * check encoding for old streams1 * support node.js < 0.10.6 1.1.5 / 2014-05-14 ================== * bump bytes 1.1.4 / 2014-04-19 ================== * allow true as an option * bump bytes 1.1.3 / 2014-03-02 ================== * fix case when length=null 1.1.2 / 2013-12-01 ================== * be less strict on state.encoding check 1.1.1 / 2013-11-27 ================== * add engines 1.1.0 / 2013-11-27 ================== * add err.statusCode and err.type * allow for encoding option to be true * pause the stream instead of dumping on error * throw if the stream's encoding is set 1.0.1 / 2013-11-19 ================== * dont support streams1, throw if dev set encoding 1.0.0 / 2013-11-17 ================== * rename `expected` option to `length` 0.2.0 / 2013-11-15 ================== * republish 0.1.1 / 2013-11-15 ================== * use bytes 0.1.0 / 2013-11-11 ================== * generator support 0.0.3 / 2013-10-10 ================== * update repo 0.0.2 / 2013-09-14 ================== * dump stream on bad headers * listen to events after defining received and buffers 0.0.1 / 2013-09-14 ================== * Initial release
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/raw-body/HISTORY.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/raw-body/HISTORY.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 6047 }
# raw-body [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Node.js Version][node-version-image]][node-version-url] [![Build status][github-actions-ci-image]][github-actions-ci-url] [![Test coverage][coveralls-image]][coveralls-url] Gets the entire buffer of a stream either as a `Buffer` or a string. Validates the stream's length against an expected length and maximum limit. Ideal for parsing request bodies. ## Install This is a [Node.js](https://nodejs.org/en/) module available through the [npm registry](https://www.npmjs.com/). Installation is done using the [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): ```sh $ npm install raw-body ``` ### TypeScript This module includes a [TypeScript](https://www.typescriptlang.org/) declaration file to enable auto complete in compatible editors and type information for TypeScript projects. This module depends on the Node.js types, so install `@types/node`: ```sh $ npm install @types/node ``` ## API ```js var getRawBody = require('raw-body') ``` ### getRawBody(stream, [options], [callback]) **Returns a promise if no callback specified and global `Promise` exists.** Options: - `length` - The length of the stream. If the contents of the stream do not add up to this length, an `400` error code is returned. - `limit` - The byte limit of the body. This is the number of bytes or any string format supported by [bytes](https://www.npmjs.com/package/bytes), for example `1000`, `'500kb'` or `'3mb'`. If the body ends up being larger than this limit, a `413` error code is returned. - `encoding` - The encoding to use to decode the body into a string. By default, a `Buffer` instance will be returned when no encoding is specified. Most likely, you want `utf-8`, so setting `encoding` to `true` will decode as `utf-8`. You can use any type of encoding supported by [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme). You can also pass a string in place of options to just specify the encoding. If an error occurs, the stream will be paused, everything unpiped, and you are responsible for correctly disposing the stream. For HTTP requests, you may need to finish consuming the stream if you want to keep the socket open for future requests. For streams that use file descriptors, you should `stream.destroy()` or `stream.close()` to prevent leaks. ## Errors This module creates errors depending on the error condition during reading. The error may be an error from the underlying Node.js implementation, but is otherwise an error created by this module, which has the following attributes: * `limit` - the limit in bytes * `length` and `expected` - the expected length of the stream * `received` - the received bytes * `encoding` - the invalid encoding * `status` and `statusCode` - the corresponding status code for the error * `type` - the error type ### Types The errors from this module have a `type` property which allows for the programmatic determination of the type of error returned. #### encoding.unsupported This error will occur when the `encoding` option is specified, but the value does not map to an encoding supported by the [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme) module. #### entity.too.large This error will occur when the `limit` option is specified, but the stream has an entity that is larger. #### request.aborted This error will occur when the request stream is aborted by the client before reading the body has finished. #### request.size.invalid This error will occur when the `length` option is specified, but the stream has emitted more bytes. #### stream.encoding.set This error will occur when the given stream has an encoding set on it, making it a decoded stream. The stream should not have an encoding set and is expected to emit `Buffer` objects. #### stream.not.readable This error will occur when the given stream is not readable. ## Examples ### Simple Express example ```js var contentType = require('content-type') var express = require('express') var getRawBody = require('raw-body') var app = express() app.use(function (req, res, next) { getRawBody(req, { length: req.headers['content-length'], limit: '1mb', encoding: contentType.parse(req).parameters.charset }, function (err, string) { if (err) return next(err) req.text = string next() }) }) // now access req.text ``` ### Simple Koa example ```js var contentType = require('content-type') var getRawBody = require('raw-body') var koa = require('koa') var app = koa() app.use(function * (next) { this.text = yield getRawBody(this.req, { length: this.req.headers['content-length'], limit: '1mb', encoding: contentType.parse(this.req).parameters.charset }) yield next }) // now access this.text ``` ### Using as a promise To use this library as a promise, simply omit the `callback` and a promise is returned, provided that a global `Promise` is defined. ```js var getRawBody = require('raw-body') var http = require('http') var server = http.createServer(function (req, res) { getRawBody(req) .then(function (buf) { res.statusCode = 200 res.end(buf.length + ' bytes submitted') }) .catch(function (err) { res.statusCode = 500 res.end(err.message) }) }) server.listen(3000) ``` ### Using with TypeScript ```ts import * as getRawBody from 'raw-body'; import * as http from 'http'; const server = http.createServer((req, res) => { getRawBody(req) .then((buf) => { res.statusCode = 200; res.end(buf.length + ' bytes submitted'); }) .catch((err) => { res.statusCode = err.statusCode; res.end(err.message); }); }); server.listen(3000); ``` ## License [MIT](LICENSE) [npm-image]: https://img.shields.io/npm/v/raw-body.svg [npm-url]: https://npmjs.org/package/raw-body [node-version-image]: https://img.shields.io/node/v/raw-body.svg [node-version-url]: https://nodejs.org/en/download/ [coveralls-image]: https://img.shields.io/coveralls/stream-utils/raw-body/master.svg [coveralls-url]: https://coveralls.io/r/stream-utils/raw-body?branch=master [downloads-image]: https://img.shields.io/npm/dm/raw-body.svg [downloads-url]: https://npmjs.org/package/raw-body [github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/stream-utils/raw-body/ci.yml?branch=master&label=ci [github-actions-ci-url]: https://github.com/jshttp/stream-utils/raw-body?query=workflow%3Aci
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/raw-body/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/raw-body/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 6552 }
# Security Policies and Procedures ## Reporting a Bug The `raw-body` team and community take all security bugs seriously. Thank you for improving the security of Express. We appreciate your efforts and responsible disclosure and will make every effort to acknowledge your contributions. Report security bugs by emailing the current owners of `raw-body`. This information can be found in the npm registry using the command `npm owner ls raw-body`. If unsure or unable to get the information from the above, open an issue in the [project issue tracker](https://github.com/stream-utils/raw-body/issues) asking for the current contact information. To ensure the timely response to your report, please ensure that the entirety of the report is contained within the email body and not solely behind a web link or an attachment. At least one owner will acknowledge your email within 48 hours, and will send a more detailed response within 48 hours indicating the next steps in handling your report. After the initial reply to your report, the owners will endeavor to keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/raw-body/SECURITY.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/raw-body/SECURITY.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1187 }
# React DayPicker [DayPicker](http://react-day-picker.js.org) is a date picker component for [React](https://reactjs.org). Renders a monthly calendar to select days. DayPicker is customizable, works great with input fields and can be styled to match any design. ➡️ **[react-day-picker.js.org](http://react-day-picker.js.org)** for guides, examples and API reference. <picture> <source media="(prefers-color-scheme: dark)" srcSet="https://user-images.githubusercontent.com/120693/188241991-19d0e8a1-230a-48c8-8477-3c90d4e36197.png"/> <source media="(prefers-color-scheme: light)" srcSet="https://user-images.githubusercontent.com/120693/188238076-311ec6d1-503d-4c21-8ffe-d89faa60e40f.png"/> <img alt="Shows a screenshot of the React DayPicker component in a browser’s window." width="900" /> </picture> ## Main features - ☀️ Select days, ranges or whatever - 🧘‍♀️ using [date-fns](http://date-fns.org) as date library - 🌎 Localizable into any language - ➡️ Keyboard navigation - ♿️ [WAI-ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) support - 🤖 Written in TypeScript - 🎨 Easy to style and customize - 🗓 Support multiple calendars - 📄 Easy to integrate input fields ## Installation ```shell npm install react-day-picker date-fns # using npm pnpm install react-day-picker date-fns # using pnpm yarn add react-day-picker date-fns # using yarn ``` <a href="https://www.npmjs.com/package/react-day-picker"><img src="https://img.shields.io/npm/v/react-day-picker.svg?style=flat-square" alt="npm version"/></a> <img src="https://img.shields.io/npm/dm/react-day-picker.svg?style=flat-square" alt="npm downloads"/> <img src="https://img.shields.io/bundlephobia/minzip/react-day-picker" alt="Min gzipped size"/> ## Example ```tsx import { useState } from 'react'; import { format } from 'date-fns'; import { DayPicker } from 'react-day-picker'; import 'react-day-picker/dist/style.css'; export default function Example() { const [selected, setSelected] = useState<Date>(); let footer = <p>Please pick a day.</p>; if (selected) { footer = <p>You picked {format(selected, 'PP')}.</p>; } return ( <DayPicker mode="single" selected={selected} onSelect={setSelected} footer={footer} /> ); } ``` ## Documentation See **[react-day-picker.js.org](http://react-day-picker.js.org)** for guides, examples and API reference of the latest version. <small>Docs for version 7 are at <a href="https://react-day-picker-v7.netlify.app" target="_blank">react-day-picker-v7.netlify.app</a>.</small>
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-day-picker/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-day-picker/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2566 }
# `react-dom` This package serves as the entry point to the DOM and server renderers for React. It is intended to be paired with the generic React package, which is shipped as `react` to npm. ## Installation ```sh npm install react react-dom ``` ## Usage ### In the browser ```js import { createRoot } from 'react-dom/client'; function App() { return <div>Hello World</div>; } const root = createRoot(document.getElementById('root')); root.render(<App />); ``` ### On the server ```js import { renderToPipeableStream } from 'react-dom/server'; function App() { return <div>Hello World</div>; } function handleRequest(res) { // ... in your server handler ... const stream = renderToPipeableStream(<App />, { onShellReady() { res.statusCode = 200; res.setHeader('Content-type', 'text/html'); stream.pipe(res); }, // ... }); } ``` ## API ### `react-dom` See https://reactjs.org/docs/react-dom.html ### `react-dom/client` See https://reactjs.org/docs/react-dom-client.html ### `react-dom/server` See https://reactjs.org/docs/react-dom-server.html
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-dom/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-dom/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1101 }
<div align="center"> <a href="https://react-hook-form.com" title="React Hook Form - Simple React forms validation"> <img src="https://raw.githubusercontent.com/react-hook-form/react-hook-form/master/docs/logo.png" alt="React Hook Form Logo - React hook custom hook for form validation" /> </a> </div> <div align="center"> [![npm downloads](https://img.shields.io/npm/dm/react-hook-form.svg?style=for-the-badge)](https://www.npmjs.com/package/react-hook-form) [![npm](https://img.shields.io/npm/dt/react-hook-form.svg?style=for-the-badge)](https://www.npmjs.com/package/react-hook-form) [![npm](https://img.shields.io/npm/l/react-hook-form?style=for-the-badge)](https://github.com/react-hook-form/react-hook-form/blob/master/LICENSE) [![Discord](https://img.shields.io/discord/754891658327359538.svg?style=for-the-badge&label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/yYv7GZ8) </div> <p align="center"> <a href="https://react-hook-form.com/get-started">Get started</a> | <a href="https://react-hook-form.com/docs">API</a> | <a href="https://react-hook-form.com/form-builder">Form Builder</a> | <a href="https://react-hook-form.com/faqs">FAQs</a> | <a href="https://github.com/react-hook-form/react-hook-form/tree/master/examples">Examples</a> </p> ### Features - Built with performance, UX and DX in mind - Embraces native HTML form [validation](https://react-hook-form.com/get-started#Applyvalidation) - Out of the box integration with [UI libraries](https://codesandbox.io/s/react-hook-form-v7-controller-5h1q5) - [Small size](https://bundlephobia.com/result?p=react-hook-form@latest) and no [dependencies](./package.json) - Support [Yup](https://github.com/jquense/yup), [Zod](https://github.com/colinhacks/zod), [AJV](https://github.com/ajv-validator/ajv), [Superstruct](https://github.com/ianstormtaylor/superstruct), [Joi](https://github.com/hapijs/joi) and [others](https://github.com/react-hook-form/resolvers) ### Install npm install react-hook-form ### Quickstart ```jsx import { useForm } from 'react-hook-form'; function App() { const { register, handleSubmit, formState: { errors }, } = useForm(); return ( <form onSubmit={handleSubmit((data) => console.log(data))}> <input {...register('firstName')} /> <input {...register('lastName', { required: true })} /> {errors.lastName && <p>Last name is required.</p>} <input {...register('age', { pattern: /\d+/ })} /> {errors.age && <p>Please enter number for age.</p>} <input type="submit" /> </form> ); } ``` <a href="https://ui.dev/bytes/?r=bill"> <img src="https://raw.githubusercontent.com/react-hook-form/react-hook-form/master/docs/ads-1.jpeg" /> </a> ### Sponsors Thanks go to these kind and lovely sponsors! <a target="_blank" href='https://route4me.com/'> <img width="94" src="https://images.opencollective.com/route4me/71fb6fa/avatar/256.png?height=256" /> </a> <a target="_blank" href='https://twicsy.com/'> <img width="94" src="https://images.opencollective.com/buy-instagram-followers-twicsy/b4c5d7f/logo/256.png?height=256" /> </a> <a target="_blank" href='https://toss.im'> <img width="94" src="https://images.opencollective.com/toss/3ed69b3/logo/256.png" /> </a> <a target="_blank" href='https://principal.com/about-us'> <img width="94" src="https://images.opencollective.com/principal/431e690/logo/256.png?height=256" /> </a> <a target="_blank" href="https://graphcms.com"> <img width="94" src="https://avatars.githubusercontent.com/u/31031438" /> </a> <a target="_blank" href="https://www.beekai.com/"> <img width="94" src="https://www.beekai.com/marketing/logo/logo.svg" /> </a> <a target="_blank" href="https://kanamekey.com"> <img width="94" src="https://images.opencollective.com/kaname/d15fd98/logo/256.png" /> </a> <a target="_blank" href="https://www.casinoreviews.net/"> <img width="94" src="https://images.opencollective.com/casinoreviews/f0877d1/logo/256.png" /> </a> ### Past sponsors <a href="https://www.leniolabs.com/" target="_blank"> <img src="https://images.opencollective.com/leniolabs_/63e9b6e/logo/256.png" width="48" height="48" /> </a> <a target="_blank" href="https://underbelly.is"> <img width="48" src="https://images.opencollective.com/underbelly/989a4a6/logo/256.png" /> </a> <a target="_blank" href="https://feathery.io"> <img width="48" src="https://images.opencollective.com/feathery1/c29b0a1/logo/256.png" /> </a> <a target="_blank" href="https://getform.io"> <img width="48" src="https://images.opencollective.com/getformio2/3c978c8/avatar/256.png" /> </a> <a href="https://marmelab.com/" target="_blank"> <img src="https://images.opencollective.com/marmelab/d7fd82f/logo/256.png" width="48" height="48" /> </a> <a target="_blank" href="https://formcarry.com/"> <img width="48" src="https://images.opencollective.com/formcarry/a40a4ea/logo/256.png" /> </a> <a target="_blank" href="https://fabform.io"> <img width="48" src="https://images.opencollective.com/fabform/2834037/logo/256.png" /> </a> <a target="_blank" href="https://www.thinkmill.com.au/"> <img width="48" src="https://images.opencollective.com/thinkmill/28910ec/logo/256.png" /> </a> <a target="_blank" href="https://kwork.studio/"> <img width="48" src="https://images.opencollective.com/knowledge-work/f91b72d/logo/256.png" /> </a> <a target="_blank" href="https://fiberplane.com/"> <img width="48" src="https://avatars.githubusercontent.com/u/61152955?s=200&v=4" /> </a> <a target="_blank" href="https://www.jetbrains.com/"> <img width="48" src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" /> </a> <a target="_blank" href="https://www.mirakl.com/"> <img width="48" src="https://images.opencollective.com/mirakl/0b191f0/logo/256.png" /> </a> <a target="_blank" href='https://wantedlyinc.com'> <img width="48" src="https://images.opencollective.com/wantedly/d94e44e/logo/256.png" /> </a> ### Backers Thanks go to all our backers! [[Become a backer](https://opencollective.com/react-hook-form#backer)]. <a href="https://opencollective.com/react-hook-form#backers"> <img src="https://opencollective.com/react-hook-form/backers.svg?width=950" /> </a> ### Contributors Thanks go to these wonderful people! [[Become a contributor](CONTRIBUTING.md)]. <a href="https://github.com/react-hook-form/react-hook-form/graphs/contributors"> <img src="https://opencollective.com/react-hook-form/contributors.svg?width=890&button=false" /> </a>
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-hook-form/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-hook-form/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 6597 }
<img src="https://raw.githubusercontent.com/react-icons/react-icons/master/react-icons.svg" width="120" alt="React Icons"> # [React Icons](https://react-icons.github.io/react-icons) [![npm][npm-image]][npm-url] [npm-image]: https://img.shields.io/npm/v/react-icons.svg?style=flat-square [npm-url]: https://www.npmjs.com/package/react-icons Include popular icons in your React projects easily with `react-icons`, which utilizes ES6 imports that allows you to include only the icons that your project is using. ## Installation (for standard modern project) ```bash yarn add react-icons # or npm install react-icons --save ``` example usage ```jsx import { FaBeer } from "react-icons/fa"; function Question() { return ( <h3> Lets go for a <FaBeer />? </h3> ); } ``` [View the documentation](https://react-icons.github.io/react-icons) for further usage examples and how to use icons from other packages. _NOTE_: each Icon package has it's own subfolder under `react-icons` you import from. For example, to use an icon from **Material Design**, your import would be: `import { ICON_NAME } from 'react-icons/md';` ## Installation (for meteorjs, gatsbyjs, etc) > **Note** > This option has not had a new release for some time. > More info https://github.com/react-icons/react-icons/issues/593 If your project grows in size, this option is available. This method has the trade-off that it takes a long time to install the package. ```bash yarn add @react-icons/all-files # or npm install @react-icons/all-files --save ``` example usage ```jsx import { FaBeer } from "@react-icons/all-files/fa/FaBeer"; function Question() { return ( <h3> Lets go for a <FaBeer />? </h3> ); } ``` ## Icons | Icon Library | License | Version | Count | | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ---------------------------------------- | ----: | | [Circum Icons](https://circumicons.com/) | [MPL-2.0 license](https://github.com/Klarr-Agency/Circum-Icons/blob/main/LICENSE) | 1.0.0 | 288 | | [Font Awesome 5](https://fontawesome.com/) | [CC BY 4.0 License](https://creativecommons.org/licenses/by/4.0/) | 5.15.4-3-gafecf2a | 1612 | | [Font Awesome 6](https://fontawesome.com/) | [CC BY 4.0 License](https://creativecommons.org/licenses/by/4.0/) | 6.5.2 | 2045 | | [Ionicons 4](https://ionicons.com/) | [MIT](https://github.com/ionic-team/ionicons/blob/master/LICENSE) | 4.6.3 | 696 | | [Ionicons 5](https://ionicons.com/) | [MIT](https://github.com/ionic-team/ionicons/blob/master/LICENSE) | 5.5.4 | 1332 | | [Material Design icons](http://google.github.io/material-design-icons/) | [Apache License Version 2.0](https://github.com/google/material-design-icons/blob/master/LICENSE) | 4.0.0-98-g9beae745bb | 4341 | | [Typicons](http://s-ings.com/typicons/) | [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) | 2.1.2 | 336 | | [Github Octicons icons](https://octicons.github.com/) | [MIT](https://github.com/primer/octicons/blob/master/LICENSE) | 18.3.0 | 264 | | [Feather](https://feathericons.com/) | [MIT](https://github.com/feathericons/feather/blob/master/LICENSE) | 4.29.1 | 287 | | [Lucide](https://lucide.dev/) | [ISC](https://github.com/lucide-icons/lucide/blob/main/LICENSE) | v5.1.0-6-g438f572e | 1215 | | [Game Icons](https://game-icons.net/) | [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/) | 12920d6565588f0512542a3cb0cdfd36a497f910 | 4040 | | [Weather Icons](https://erikflowers.github.io/weather-icons/) | [SIL OFL 1.1](http://scripts.sil.org/OFL) | 2.0.12 | 219 | | [Devicons](https://vorillaz.github.io/devicons/) | [MIT](https://opensource.org/licenses/MIT) | 1.8.0 | 192 | | [Ant Design Icons](https://github.com/ant-design/ant-design-icons) | [MIT](https://opensource.org/licenses/MIT) | 4.4.2 | 831 | | [Bootstrap Icons](https://github.com/twbs/icons) | [MIT](https://opensource.org/licenses/MIT) | 1.11.3 | 2716 | | [Remix Icon](https://github.com/Remix-Design/RemixIcon) | [Apache License Version 2.0](http://www.apache.org/licenses/) | 4.2.0 | 2860 | | [Flat Color Icons](https://github.com/icons8/flat-color-icons) | [MIT](https://opensource.org/licenses/MIT) | 1.0.2 | 329 | | [Grommet-Icons](https://github.com/grommet/grommet-icons) | [Apache License Version 2.0](http://www.apache.org/licenses/) | 4.12.1 | 635 | | [Heroicons](https://github.com/tailwindlabs/heroicons) | [MIT](https://opensource.org/licenses/MIT) | 1.0.6 | 460 | | [Heroicons 2](https://github.com/tailwindlabs/heroicons) | [MIT](https://opensource.org/licenses/MIT) | 2.1.3 | 888 | | [Simple Icons](https://simpleicons.org/) | [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/) | 12.14.0 | 3209 | | [Simple Line Icons](https://thesabbir.github.io/simple-line-icons/) | [MIT](https://opensource.org/licenses/MIT) | 2.5.5 | 189 | | [IcoMoon Free](https://github.com/Keyamoon/IcoMoon-Free) | [CC BY 4.0 License](https://github.com/Keyamoon/IcoMoon-Free/blob/master/License.txt) | d006795ede82361e1bac1ee76f215cf1dc51e4ca | 491 | | [BoxIcons](https://github.com/atisawd/boxicons) | [MIT](https://github.com/atisawd/boxicons/blob/master/LICENSE) | 2.1.4 | 1634 | | [css.gg](https://github.com/astrit/css.gg) | [MIT](https://opensource.org/licenses/MIT) | 2.1.1 | 704 | | [VS Code Icons](https://github.com/microsoft/vscode-codicons) | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) | 0.0.35 | 461 | | [Tabler Icons](https://github.com/tabler/tabler-icons) | [MIT](https://opensource.org/licenses/MIT) | 3.2.0 | 5237 | | [Themify Icons](https://github.com/lykmapipo/themify-icons) | [MIT](https://github.com/thecreation/standard-icons/blob/master/modules/themify-icons/LICENSE) | v0.1.2-2-g9600186 | 352 | | [Radix Icons](https://icons.radix-ui.com) | [MIT](https://github.com/radix-ui/icons/blob/master/LICENSE) | @radix-ui/[email protected] | 318 | | [Phosphor Icons](https://github.com/phosphor-icons/core) | [MIT](https://github.com/phosphor-icons/core/blob/main/LICENSE) | 2.1.1 | 9072 | | [Icons8 Line Awesome](https://icons8.com/line-awesome) | [MIT](https://github.com/icons8/line-awesome/blob/master/LICENSE.md) | 1.3.1 | 1544 | You can add more icons by submitting pull requests or creating issues. ## Configuration You can configure react-icons props using [React Context API](https://reactjs.org/docs/context.html). _Requires **React 16.3** or higher._ ```jsx import { IconContext } from "react-icons"; <IconContext.Provider value={{ color: "blue", className: "global-class-name" }}> <div> <FaFolder /> </div> </IconContext.Provider>; ``` | Key | Default | Notes | | ----------- | --------------------- | ---------------------------------- | | `color` | `undefined` (inherit) | | | `size` | `1em` | | | `className` | `undefined` | | | `style` | `undefined` | Can overwrite size and color | | `attr` | `undefined` | Overwritten by other attributes | | `title` | `undefined` | Icon description for accessibility | ## Migrating from version 2 -> 3 ### Change import style Import path has changed. You need to rewrite from the old style. ```jsx // OLD IMPORT STYLE import FaBeer from "react-icons/lib/fa/beer"; function Question() { return ( <h3> Lets go for a <FaBeer />? </h3> ); } ``` ```jsx // NEW IMPORT STYLE import { FaBeer } from "react-icons/fa"; function Question() { return ( <h3> Lets go for a <FaBeer />? </h3> ); } ``` Ending up with a large JS bundle? Check out [this issue](https://github.com/react-icons/react-icons/issues/154). ### Adjustment CSS From version 3, `vertical-align: middle` is not automatically given. Please use IconContext to specify className or specify an inline style. #### Global Inline Styling ```tsx <IconContext.Provider value={{ style: { verticalAlign: 'middle' } }}> ``` #### Global `className` Styling Component ```tsx <IconContext.Provider value={{ className: 'react-icons' }}> ``` CSS ```css .react-icons { vertical-align: middle; } ``` ### TypeScript native support Dependencies on `@types/react-icons` can be deleted. #### Yarn ```bash yarn remove @types/react-icons ``` #### NPM ```bash npm remove @types/react-icons ``` ## Contributing `./build-script.sh` will build the whole project. See also CI scripts for more information. ### Development ```bash yarn cd packages/react-icons yarn fetch # fetch icon sources yarn build ``` ### Add/Update icon set First, check the discussion to see if anyone would like to add an icon set. https://github.com/react-icons/react-icons/discussions/categories/new-icon-set The SVG files to be fetched are managed in this file. Edit this file and run `yarn fetch && yarn check && yarn build`. https://github.com/react-icons/react-icons/blob/master/packages/react-icons/src/icons/index.ts ### Preview > **Note** > The project is not actively accepting PR for the preview site at this time. The preview site is the [`react-icons`](https://react-icons.github.io/react-icons/) website, built in Astro+React. ```bash cd packages/react-icons yarn fetch yarn build cd ../preview-astro yarn start ``` ### Demo The demo is a [Create React App](https://create-react-app.dev/) boilerplate with `react-icons` added as a dependency for easy testing. ```bash cd packages/react-icons yarn fetch yarn build cd ../demo yarn start ``` ## Why React SVG components instead of fonts? SVG is [supported by all major browsers](http://caniuse.com/#search=svg). With `react-icons`, you can serve only the needed icons instead of one big font file to the users, helping you to recognize which icons are used in your project. ## Related Projects - [react-svg-morph](https://github.com/gorangajic/react-svg-morph/) ## Licence MIT - Icons are taken from the other projects so please check each project licences accordingly.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-icons/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-icons/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 13119 }
# `react-is` This package allows you to test arbitrary values and see if they're a particular React element type. ## Installation ```sh # Yarn yarn add react-is # NPM npm install react-is ``` ## Usage ### Determining if a Component is Valid ```js import React from "react"; import * as ReactIs from "react-is"; class ClassComponent extends React.Component { render() { return React.createElement("div"); } } const FunctionComponent = () => React.createElement("div"); const ForwardRefComponent = React.forwardRef((props, ref) => React.createElement(Component, { forwardedRef: ref, ...props }) ); const Context = React.createContext(false); ReactIs.isValidElementType("div"); // true ReactIs.isValidElementType(ClassComponent); // true ReactIs.isValidElementType(FunctionComponent); // true ReactIs.isValidElementType(ForwardRefComponent); // true ReactIs.isValidElementType(Context.Provider); // true ReactIs.isValidElementType(Context.Consumer); // true ReactIs.isValidElementType(React.createFactory("div")); // true ``` ### Determining an Element's Type #### Context ```js import React from "react"; import * as ReactIs from 'react-is'; const ThemeContext = React.createContext("blue"); ReactIs.isContextConsumer(<ThemeContext.Consumer />); // true ReactIs.isContextProvider(<ThemeContext.Provider />); // true ReactIs.typeOf(<ThemeContext.Provider />) === ReactIs.ContextProvider; // true ReactIs.typeOf(<ThemeContext.Consumer />) === ReactIs.ContextConsumer; // true ``` #### Element ```js import React from "react"; import * as ReactIs from 'react-is'; ReactIs.isElement(<div />); // true ReactIs.typeOf(<div />) === ReactIs.Element; // true ``` #### Fragment ```js import React from "react"; import * as ReactIs from 'react-is'; ReactIs.isFragment(<></>); // true ReactIs.typeOf(<></>) === ReactIs.Fragment; // true ``` #### Portal ```js import React from "react"; import ReactDOM from "react-dom"; import * as ReactIs from 'react-is'; const div = document.createElement("div"); const portal = ReactDOM.createPortal(<div />, div); ReactIs.isPortal(portal); // true ReactIs.typeOf(portal) === ReactIs.Portal; // true ``` #### StrictMode ```js import React from "react"; import * as ReactIs from 'react-is'; ReactIs.isStrictMode(<React.StrictMode />); // true ReactIs.typeOf(<React.StrictMode />) === ReactIs.StrictMode; // true ```
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-is/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-is/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2377 }
# react-refresh This package implements the wiring necessary to integrate Fast Refresh into bundlers. Fast Refresh is a feature that lets you edit React components in a running application without losing their state. It is similar to an old feature known as "hot reloading", but Fast Refresh is more reliable and officially supported by React. This package is primarily aimed at developers of bundler plugins. If you’re working on one, here is a [rough guide](https://github.com/facebook/react/issues/16604#issuecomment-528663101) for Fast Refresh integration using this package.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-refresh/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-refresh/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 581 }
<h1>react-remove-scroll-bar</h1> [![npm](https://img.shields.io/npm/v/react-remove-scroll-bar.svg)](https://www.npmjs.com/package/react-remove-scroll-bar) [![bundle size](https://badgen.net/bundlephobia/minzip/react-remove-scroll-bar)](https://bundlephobia.com/result?p=react-remove-scroll-bar) [![downloads](https://badgen.net/npm/dm/react-remove-scroll-bar)](https://www.npmtrends.com/react-remove-scroll-bar) <hr /> > v1+ for React 15, v2+ requires React 16.8+ Removes scroll bar (by setting `overflow: hidden` on body), and preserves the scroll bar "gap". Read - it just makes scroll bar invisible. Does nothing if scroll bar does not consume any space. # Usage ```js import {RemoveScrollBar} from 'react-remove-scroll-bar'; <RemoveScrollBar /> -> no scroll bar ``` ### The Right Border To prevent content jumps __position:fixed__ elements with `right:0` should have additional classname applied. It will just provide a _non-zero_ right, when it needed, to maintain the right "gap". ```js import {zeroRightClassName,fullWidthClassName, noScrollbarsClassName} from 'react-remove-scroll-bar'; // to set `right:0` on an element <div className={zeroRightClassName} /> // to set `width:100%` on an element <div className={fullWidthClassName} /> // to remove scrollbar from an element <div className={noScrollbarsClassName} /> ``` # Size 500b after compression (excluding tslib). # Scroll-Locky All code is a result of a [react-scroll-locky](https://github.com/theKashey/react-scroll-locky) refactoring. # Article There is a medium article about preventing the body scroll - [How to fight the <body> scroll](https://medium.com/@antonkorzunov/how-to-fight-the-body-scroll-2b00267b37ac) # License MIT
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-remove-scroll-bar/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-remove-scroll-bar/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1715 }
<div align="center"> <h1>React-remove-📜</h1> <br/> dont even scroll <br/> <a href="https://www.npmjs.com/package/react-remove-scroll"> <img src="https://img.shields.io/npm/v/react-remove-scroll.svg?style=flat-square" /> </a> <a href="https://travis-ci.org/theKashey/react-remove-scroll"> <img src="https://img.shields.io/travis/theKashey/react-remove-scroll.svg?style=flat-square" alt="Build status"> </a> <a href="https://www.npmjs.com/package/react-remove-scroll"> <img src="https://img.shields.io/npm/dm/react-remove-scroll.svg" alt="npm downloads"> </a> <a href="https://bundlephobia.com/result?p=react-remove-scroll"> <img src="https://img.shields.io/bundlephobia/minzip/react-remove-scroll.svg" alt="bundle size"> </a> <br/> </div> react-remove-scroll ==== [![NPM version](https://img.shields.io/npm/v/react-remove-scroll.svg)](https://www.npmjs.com/package/react-remove-scroll) Disables scroll outside of `children` node. - 🖱 mouse and touch devices friendly - 📈 vertical and horizontal - 📜 removes document scroll bar maintaining it space - ✅ support nested scrollable elements - 🕳 supports react-portals (uses React Event system) - ☠️ it could block literally any scroll anywhere # Usage Just wrap content, which should be scrollable, and everything else would not. ```js import {RemoveScroll} from 'react-remove-scroll'; <RemoveScroll> Only this content would be scrollable </RemoveScroll> ``` `RemoveScroll` accept following props - `children` - `[enabled]` - activate or deactivate component behaviour without removing it. - `[allowPinchZoom=false]` - enabled "pinch-n-zoom" behavior. By default it might be prevented. However - pinch and zoom might break "scroll isolation", and __disabled by default__. - `[noIsolation=false]` - disables outer event capturing. Event capturing is React friendly and unlikely be a problem. But if you are using _shadowbox_ of some sort - you dont need it. - `[inert=false]` - ☠️(be careful) disables events the rest of page completely using `pointer-events` except the Lock(+shards). React portals not friendly, might lead to production issues. Enable only for __rare__ cases, when you have to disable scrollbars somewhere on the page(except body, Lock and shards). - `[forwardProps]` - will forward all props to the `children` - `[className]` - className for an internal div - `[removeScrollBar]` - to control scroll bar removal. Set to false, if you prefer to keep it (wheel and touch scroll is still disabled). # Size - (🧩 full) 1.7kb after compression (excluding tslib). --- - (👁 UI) __400b__, visual elements only - (🚗 sidecar) 1.5kb, side effects ```js import {sidecar} from "react-remove-scroll"; import {RemoveScroll} from 'react-remove-scroll/UI'; const sidecar = sidecar(() => import('react-remove-scroll/sidecar')); <RemoveScroll sideCar={sidecar}> Will load logic from a sidecar when needed </RemoveScroll> ``` > Consider setting `-webkit-overflow-scrolling: touch;` on a document level for a proper mobile experience. ## Internal div But default RemoveScroll will create a div to handle and capture events. You may specify `className` for it, if you need, or __remove it__. The following code samples will produce the same output ```js <RemoveScroll className="scroll"> Only this content would be scrollable </RemoveScroll> ``` ```js <RemoveScroll forwardProps> <div className="scroll"> //RemoveScroll will inject props to this div Only this content would be scrollable </div> </RemoveScroll> ``` Pick the first one if you don't need a second. ## Position:fixed elements To properly size these elements please add a special className to them. ```jsx import {RemoveScroll} from 'react-remove-scroll'; // to make "width: 100%" <div className={cx(classWithPositionFixed, RemoveScroll.classNames.fullWidth)} /> // to make "right:0" <div className={cx(classWithPositionFixed, RemoveScroll.classNames.zeroRight)} /> ``` See [react-remove-scroll-bar](https://github.com/theKashey/react-remove-scroll-bar) documentation for details. ## More than one lock When stacked more is active (default) only one (last) component would be active. ## Over isolation That could happen - you disable scroll on the body, you are suppressing all scroll and wheel events, and you are ghosting the rest of the page by the `inert` prop. Only something inside Lock does exists for the browser, and that might be less than you expected. Dont forget about `shard`, dont forget - `inert` is not portals friendly, dont forget - you dont need over isolation in most of the cases. > just be careful! # Performance To do the job this library setup _non_ passive event listener. Chrome dev tools would complain about it, as a performance no-op. We have to use synchronous scroll/touch handler, and it may affect scrolling performance. Consider using `noIsolation` mode, if you have large scrollable areas. # Supported React versions - v1 supports React 15/16 - v2 requires 16.8.0+ (hooks) # Scroll-Locky This is a refactoring of another library - [react-scroll-locky](https://github.com/theKashey/react-scroll-locky) - to make package smaller and more react-portals friendly. ## See also - [react-focus-on](https://github.com/theKashey/react-focus-on) - Finite Modal creator (uses Scroll-Locky) underneath. - [react-locky](https://github.com/theKashey/react-locky) - React event canceler - [react-scrolllock](https://github.com/jossmac/react-scrolllock) - React scroll lock - [scroll-lock](https://github.com/FL3NKEY/scroll-lock) - DOM scroll lock - [body-scroll-lock](https://github.com/willmcpo/body-scroll-lock) - DOM scroll lock > This package is relative smaller(1), more react friendly(2), works with non zero body margins(3), and has a better "overscroll" management. # License MIT
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-remove-scroll/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-remove-scroll/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 5830 }
# Changelog # 2.1.6 - Removed `"engines"` block and replaced with `"packageManager"` - Don't read `document.direction` for RTL detection; use inherited style instead ## 2.1.5 - Add react v19 to peer deps ## 2.1.4 - Improve TypeScript HTML tag type generics (#407) - Edge case check to make sure resize handle hasn't been unmounted while dragging (#410) ## 2.1.3 - Edge case bug fix for a resize handle unmounting while being dragged (#402) ## 2.1.2 - Suppress invalid layout warning for empty panel groups (#396) ## 2.1.1 - Fix `onDragging` regression (#391) - Fix cursor icon behavior in nested panels (#390) ## 2.1.0 - Add opt-in support for setting the [`"nonce"` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) for the global cursor style (#386) - Support disabling global cursor styles (#387) ## 2.0.23 - Improve obfuscation for `React.useId` references (#382) ## 2.0.22 - Force eager layout re-calculation after panel added/removed (#375) ## 2.0.21 - Handle pointer event edge case with different origin iframes (#374) ## 2.0.20 - Reset global cursor if an active resize handle is unmounted (#313) - Resize handle supports (optional) `onFocus` or `onBlur` props (#370) ## 2.0.19 - Add optional `minSize` override param to panel `expand` imperative API ## 2.0.18 - Inline object `hitAreaMargins` will not trigger re-initialization logic unless inner values change (#342) ## 2.0.17 - Prevent pointer events handled by resize handles from triggering elements behind/underneath (#338) ## 2.0.16 - Replaced .toPrecision() with .toFixed() to avoid undesirable layout shift (#323) ## 2.0.15 - Better account for high-precision sizes with `onCollapse` and `onExpand` callbacks (#325) ## 2.0.14 - Better account for high-precision `collapsedSize` values (#325) ## 2.0.13 - Fix potential cycle in stacking-order logic for an unmounted node (#317) ## 2.0.12 - Improve resize for edge cases with collapsed panels; intermediate resize states should now fall back to the most recent valid layout rather than the initial layout (#311) ## 2.0.11 - Fix resize handle cursor hit detection when when viewport is scrolled (#305) ## 2.0.10 - Fix conditional layout edge case (#309) ## 2.0.9 - Fix Flex stacking context bug (#301) - Fix case where pointer event listeners were sometimes added to the document unnecessarily ## 2.0.8 - `Panel`/`PanelGroup`/`PanelResizeHandle`` pass "id" prop through to DOM (#299) - `Panel` attributes `data-panel-collapsible` and `data-panel-size` are no longer DEV-only (#297) ## 2.0.7 - Group default layouts use `toPrecision` to avoid small layout shifts due to floating point precision differences between initial server rendering and client hydration (#295) ## 2.0.6 - Replace `useLayoutEffect` usage with SSR-safe wrapper hook (#294) ## 2.0.5 - Resize handle hit detection considers [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context) when determining hit detection (#291) ## 2.0.4 - Fixed `PanelResizeHandle` `onDragging` prop to only be called for the handle being dragged (#289) ## 2.0.3 - Fix resize handle onDragging callback (#278) ## 2.0.2 - Fixed an issue where size might not be re-initialized correctly after a panel was hidden by the `unstable_Activity` (previously "Offscreen") API. ## 2.0.1 - Fixed a regression introduced in 2.0.0 that caused React `onClick` and `onMouseUp` handlers not to fire. ## 2.0.0 - Support resizing multiple (intersecting) panels at once (#274) This behavior can be customized using a new `hitAreaMargins` prop; defaults to a 15 pixel margin for _coarse_ inputs and a 5 pixel margin for _fine_ inputs. ## 1.0.10 - Fixed edge case constraints check bug that could cause a collapsed panel to re-expand unnecessarily (#273) ## 1.0.9 - DOM util methods scope param defaults to `document` (#262) - Updating a `Panel`'s pixel constraints will trigger revalidation of the `Panel`'s size (#266) ## 1.0.8 - Update component signature to declare `ReactElement` return type (rather than `ReactNode`) (#256) - Update `Panel` dev warning to avoid warning when `defaultSize === collapsedSize` for collapsible panels (#257) - Support shadow dom by removing direct references to / dependencies on the root `document` (#204) ## 1.0.7 - Narrow `tagName` prop to only allow `HTMLElement` names (rather than the broader `Element` type) (#251) ## 1.0.6 - Export internal DOM helper methods. ## 1.0.5 - Fix server rendering regression (#240); Panels will now render with their `defaultSize` during initial mount (if one is specified). This allows server-rendered components to store the most recent size in a cookie and use that value as the default for subsequent page visits. ## 1.0.4 - Edge case bug fix for `isCollapsed` panel method; previously an uninitialized `collapsedSize` value was not being initialized to `0`, which caused `isCollapsed` to incorrectly report `false` in some cases. ## 1.0.3 - Remember most recently expanded panel size in local storage (#234) ## 1.0.2 - Change local storage key for persisted sizes to avoid restoring pixel-based sizes (#233) ## 1.0.1 - Small bug fix to guard against saving an incorrect panel layout to local storage # 1.0.0 - Remove support for pixel-based Panel constraints; (props like `defaultSizePercentage` should now be `defaultSize`) - Replaced `dataAttributes` prop with `...rest` prop that supports all HTML attributes ## 0.0.63 - Change default (not-yet-registered) Panel flex-grow style from 0 to 1 ## 0.0.62 - Edge case expand/collapse invalid size guard (#220) ## 0.0.61 - Better unstable Offscreen/Activity API. ## 0.0.60 - Better support imperative API usage from mount effects. - Better support strict effects mode. - Better checks not to call `onResize` or `onLayout` more than once. ## 0.0.59 - Support imperative panel API usage on-mount. - Made PanelGroup bailout condition smarter (don't bailout for empty groups unless pixel constraints are used). - Improved window splitter compatibility by better handling "Enter" key. ## 0.0.58 - Change group layout to more thoroughly distribute resize delta to support more flexible group size configurations. - Add data attribute support to `Panel`, `PanelGroup`, and `PanelResizeHandle`. - Update API documentation to reflect changed imperative API method names. - `PanelOnResize` TypeScript def updated to reflect that previous size param is `undefined` the first time it is called. ## 0.0.57 - [#207](https://github.com/bvaughn/react-resizable-panels/pull/207): Fix DEV conditional error that broke data attributes (and selectors). ## 0.0.56 Support a mix of percentage and pixel based units at the `Panel` level: ```jsx <Panel defaultSizePixels={100} minSizePercentage={20} maxSizePercentage={50} /> ``` > **Note**: Pixel units require the use of a `ResizeObserver` to validate. Percentage based units are recommended when possible. ### Example migrating panels with percentage units <table> <thead> <tr> <th>v55</th> <th>v56</th> </tr> </thead> <tbody> <tr> <td> <pre lang="jsx"> &lt;Panel defaultSize={25} minSize={10} maxSize={50} /&gt; </pre> </td> <td> <pre lang="jsx"> &lt;Panel defaultSizePercentage={25} minSizePercentage={10} maxSizePercentage={50} /&gt; </pre> </td> </tr> </tbody> </table> ### Example migrating panels with pixel units <table> <thead> <tr> <th>v55</th> <th>v56</th> </tr> </thead> <tbody> <tr> <td> <pre lang="jsx"> &lt;PanelGroup direction="horizontal" units="pixels" &gt; &lt;Panel minSize={100} maxSize={200} /&gt; &lt;PanelResizeHandle /&gt; &lt;Panel /&gt; &lt;/PanelGroup&gt; </pre> </td> <td> <pre lang="jsx"> &lt;PanelGroup direction="horizontal"&gt; &lt;Panel minSizePixels={100} maxSizePixels={200} /&gt; &lt;PanelResizeHandle /&gt; &lt;Panel /&gt; &lt;/PanelGroup&gt; </pre> </td> </tr> </tbody> </table> For a complete list of supported properties and example usage, refer to the docs. ## 0.0.55 - New `units` prop added to `PanelGroup` to support pixel-based panel size constraints. This prop defaults to "percentage" but can be set to "pixels" for static, pixel based layout constraints. This can be used to add enable pixel-based min/max and default size values, e.g.: ```jsx <PanelGroup direction="horizontal" units="pixels"> {/* Will be constrained to 100-200 pixels (assuming group is large enough to permit this) */} <Panel minSize={100} maxSize={200} /> <PanelResizeHandle /> <Panel /> <PanelResizeHandle /> <Panel /> </PanelGroup> ``` Imperative API methods are also able to work with either pixels or percentages now. They default to whatever units the group has been configured to use, but can be overridden with an additional, optional parameter, e.g. ```ts panelRef.resize(100, "pixels"); panelGroupRef.setLayout([25, 50, 25], "percentages"); // Works for getters too, e.g. const percentage = panelRef.getSize("percentages"); const pixels = panelRef.getSize("pixels"); const layout = panelGroupRef.getLayout("pixels"); ``` ## 0.0.54 - [172](https://github.com/bvaughn/react-resizable-panels/issues/172): Development warning added to `PanelGroup` for conditionally-rendered `Panel`(s) that don't have `id` and `order` props - [156](https://github.com/bvaughn/react-resizable-panels/pull/156): Package exports now used to select between node (server-rendering) and browser (client-rendering) bundles ## 0.0.53 - Fix edge case race condition for `onResize` callbacks during initial mount ## 0.0.52 - [162](https://github.com/bvaughn/react-resizable-panels/issues/162): Add `Panel.collapsedSize` property to allow panels to be collapsed to custom, non-0 sizes - [161](https://github.com/bvaughn/react-resizable-panels/pull/161): Bug fix: `onResize` should be called for the initial `Panel` size regardless of the `onLayout` prop ## 0.0.51 - [154](https://github.com/bvaughn/react-resizable-panels/issues/154): `onResize` and `onCollapse` props are called in response to `PanelGroup.setLayout` - [123](https://github.com/bvaughn/react-resizable-panels/issues/123): `onResize` called when number of panels in a group change due to conditional rendering ## 0.0.50 - Improved panel size validation in `PanelGroup`. ## 0.0.49 - Improved development warnings and props validation checks in `PanelGroup`. ## 0.0.48 - [148](https://github.com/bvaughn/react-resizable-panels/pull/148): Build release bundle with Preconstruct ## 0.0.47 - Mimic VS COde behavior; collapse a panel if it's smaller than half of its min-size ## 0.0.46 - SSR: Avoid accessing default storage (`localStorage`) during initialization; avoid throwing error in browsers that have 3rd party cookies/storage disabled. ## 0.0.45 - SSR: Avoid layout shift by using `defaultSize` to set initial `flex-grow` style - SSR: Warn if `Panel` is server-rendered without a `defaultSize` prop - [#135](https://github.com/bvaughn/react-resizable-panels/issues/135): Support RTL layouts ## 0.0.44 - [#142](https://github.com/bvaughn/react-resizable-panels/pull/142): Avoid re-registering Panel when props change; this should reduce the number of scenarios requiring the `order` prop ## 0.0.43 - Add imperative `getLayout` API to `PanelGroup` - [#139](https://github.com/bvaughn/react-resizable-panels/pull/139): Fix edge case bug where simultaneous `localStorage` updates to multiple saved groups would drop some values ## 0.0.42 - Change cursor style from `col-resize`/`row-resize` to `ew-resize`/`ns-resize` to better match cursor style at edges of a panel. ## 0.0.41 - Add imperative `setLayout` API for `PanelGroup`. ## 0.0.40 - README changes ## 0.0.39 - [#118](https://github.com/bvaughn/react-resizable-panels/issues/118): Fix import regression from 0.0.38. ## 0.0.38 - [#117](https://github.com/bvaughn/react-resizable-panels/issues/117): `Panel` collapse behavior works better near viewport edges. - [#115](https://github.com/bvaughn/react-resizable-panels/pull/115): `PanelResizeHandle` logic calls `event.preventDefault` for events it handles. - [#82](https://github.com/bvaughn/react-resizable-panels/issues/82): `useId` import changed to avoid triggering errors with older versions of React. (Note this may have an impact on tree-shaking though it is presumed to be minimal, given the small `"react"` package size.) ## 0.0.37 - [#94](https://github.com/bvaughn/react-resizable-panels/issues/94): Add `onDragging` prop to `PanelResizeHandle` to be notified of when dragging starts/stops. ## 0.0.36 - [#96](https://github.com/bvaughn/react-resizable-panels/issues/96): No longer disable `pointer-events` during resize by default. This behavior can be re-enabled using the newly added `PanelGroup` prop `disablePointerEventsDuringResize`. ## 0.0.35 - [#92](https://github.com/bvaughn/react-resizable-panels/pull/92): Change `browserslist` so compiled module works with CRA 4.0.3 Babel config out of the box. ## 0.0.34 - [#85](https://github.com/bvaughn/react-resizable-panels/issues/85): Add optional `storage` prop to `PanelGroup` to make it easier to persist layouts somewhere other than `localStorage` (e.g. like a Cookie). - [#70](https://github.com/bvaughn/react-resizable-panels/issues/70): When resizing is done via mouse/touch event– some initial state is stored so that any panels that contract will also expand if drag direction is reversed. - [#86](https://github.com/bvaughn/react-resizable-panels/issues/86): Layout changes triggered by keyboard no longer affect the global cursor. - Fixed small cursor regression introduced in 0.0.33. ## 0.0.33 - Collapsible `Panel`s will always call `onCollapse` on-mount regardless of their collapsed state. - Fixed regression in b5d3ec1 where arrow keys may fail to expand a collapsed panel. ## 0.0.32 - [#75](https://github.com/bvaughn/react-resizable-panels/issues/75): Ensure `Panel` and `PanelGroup` callbacks are always called after mounting. ## 0.0.31 - [#71](https://github.com/bvaughn/react-resizable-panels/issues/71): Added `getSize` and `getCollapsed` to imperative API exposed by `Panel`. - [#67](https://github.com/bvaughn/react-resizable-panels/issues/67), [#72](https://github.com/bvaughn/react-resizable-panels/issues/72): Removed nullish coalescing operator (`??`) because it caused problems with default create-react-app configuration. - Fix edge case when expanding a panel via imperative API that was collapsed by user drag ## 0.0.30 - [#68](https://github.com/bvaughn/react-resizable-panels/pull/68): Reduce volume/frequency of local storage writes for `PanelGroup`s configured to _auto-save_. - Added `onLayout` prop to `PanelGroup` to be called when group layout changes. Note that some form of debouncing is recommended before processing these values (e.g. saving to a database). ## 0.0.29 - [#58](https://github.com/bvaughn/react-resizable-panels/pull/58): Add imperative `collapse`, `expand`, and `resize` methods to `Panel`. - [#64](https://github.com/bvaughn/react-resizable-panels/pull/64): Disable `pointer-events` inside of `Panel`s during resize. This avoid edge cases like nested iframes. - [#57](https://github.com/bvaughn/react-resizable-panels/pull/57): Improve server rendering check to include `window.document`. This more closely matches React's own check and avoids false positives for environments that alias `window` to some global object. ## 0.0.28 - [#53](https://github.com/bvaughn/react-resizable-panels/issues/53): Avoid `useLayoutEffect` warning when server rendering. Render panels with default style of `flex: 1 1 auto` during initial render. ## 0.0.27 - [#4](https://github.com/bvaughn/react-resizable-panels/issues/4): Add `collapsible` and `onCollapse` props to `Panel` to support auto-collapsing panels that resize beyond their `minSize` value (similar to VS Code's panel UX). ## 0.0.26 - Reduce style re-calc from resize-in-progress cursor style. ## 0.0.25 - While a resize is active, the global cursor style now reliably overrides per-element styles (to avoid flickering if you drag over e.g. an anchor element). ## 0.0.24 - [#49](https://github.com/bvaughn/react-resizable-panels/issues/49): Change cursor based on min/max boundaries. ## 0.0.23 - [#40](https://github.com/bvaughn/react-resizable-panels/issues/40): Add optional `maxSize` prop to `Panel`. - [#41](https://github.com/bvaughn/react-resizable-panels/issues/41): Add optional `onResize` prop to `Panel`. This prop can be used (along with `defaultSize`) to persistence layouts somewhere externally. - [#42](https://github.com/bvaughn/react-resizable-panels/issues/42): Don't cancel resize operations when exiting the window. Only cancel when a `"mouseup"` (or `"touchend"`) event is fired. ## 0.0.22 - Replaced the `"ew-resize"` and `"ns-resize"` cursor style with `"col-resize"` and `"row-resize"`. ## 0.0.21 - [#39](https://github.com/bvaughn/react-resizable-panels/issues/39): Fixed regression in TypeScript defs introduced in `0.0.20` ## 0.0.20 - Add `displayName` to `Panel`, `PanelGroup`, `PanelGroupContext`, and `PanelResizeHandle` to work around ParcelJS scope hoisting renaming. ## 0.0.19 - Add optional `style` and `tagName` props to `Panel`, `PanelGroup`, and `PanelResizeHandle` to simplify custom styling. - Add `data-panel-group-direction` attribute to `PanelGroup` and `PanelResizeHandle` to simplify custom drag handle styling. ## 0.0.18 - `Panel` and `PanelGroup` now use `overflow: hidden` style by default to avoid potential scrollbar flickers while resizing. ## 0.0.17 - Bug fix: `Panel` styles include `flex-basis`, `flex-shrink`, and `overflow` so that their sizes are not unintentionally impacted by their content. ## 0.0.16 - Bug fix: Resize handle ARIA attributes now rendering proper min/max/now values for Window Splitter. - Bug fix: Up/down arrows are ignored for _horizontal_ layouts and left/right arrows are ignored for _vertical_ layouts as per Window Splitter spec. - [#36](https://github.com/bvaughn/react-resizable-panels/issues/36): Removed `PanelContext` in favor of adding `data-resize-handle-active` attribute to active resize handles. This attribute can be used to update the style for active handles. ## 0.0.15 - [#30](https://github.com/bvaughn/react-resizable-panels/issues/30): `PanelGroup` uses `display: flex` rather than absolute positioning. This provides several benefits: (a) more responsive resizing for nested groups, (b) no explicit `width`/`height` props, and (c) `PanelResizeHandle` components can now be rendered directly within `PanelGroup` (rather than as children of `Panel`s). ## 0.0.14 - [#23](https://github.com/bvaughn/react-resizable-panels/issues/23): Fix small regression with `autoSaveId` that was introduced with non-deterministic `useId` ids. ## 0.0.13 - [#18](https://github.com/bvaughn/react-resizable-panels/issues/18): Support server-side rendering (e.g. Next JS) by using `useId` (when available). `Panel` components no longer _require_ a user-provided `id` prop and will also fall back to using `useId` when none is provided. - `PanelGroup` component now sets `position: relative` style by default, as well as an explicit `height` and `width` style. ## 0.0.12 - Bug fix: [#19](https://github.com/bvaughn/react-resizable-panels/issues/19): Fix initial "jump" that could occur when dragging started. - Bug fix: [#20](https://github.com/bvaughn/react-resizable-panels/issues/20): Stop resize/drag operation on "contextmenu" event. - Bug fix: [#21](https://github.com/bvaughn/react-resizable-panels/issues/21): Disable text selection while dragging active (Firefox only) ## 0.0.11 - Drag UX change: Reversing drag after dragging past the min/max size of a panel will no longer have an effect until the pointer overlaps with the resize handle. (Thanks @davidkpiano for the suggestion!) - Bug fix: Resize handles are no longer left in a "focused" state after a touch/mouse event. ## 0.0.10 - Corrupt build artifact. Don't use this version. ## 0.0.9 - [#13](https://github.com/bvaughn/react-resizable-panels/issues/13): `PanelResizeHandle` should declare "separator" role and implement the recommended ["Window Splitter" pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/) ## 0.0.8 - [#7](https://github.com/bvaughn/react-resizable-panels/issues/7): Support "touch" events for mobile compatibility. ## 0.0.7 - Add `PanelContext` with `activeHandleId` property identifying the resize handle currently being dragged (or `null`). This enables more customized UI/UX when resizing is in progress. ## 0.0.6 - [#5](https://github.com/bvaughn/react-resizable-panels/issues/5): Removed `panelBefore` and `panelAfter` props from `PanelResizeHandle`. `PanelGroup` now infers this based on position within the group. ## 0.0.5 - TypeScript props type fix for `PanelGroup`'s `children` prop. ## 0.0.4 - [#8](https://github.com/bvaughn/react-resizable-panels/issues/8): Added optional `order` prop to `Panel` to improve conditional rendering. ## 0.0.3 - [#3](https://github.com/bvaughn/react-resizable-panels/issues/3): `Panel`s can be conditionally rendered within a group. `PanelGroup` will persist separate layouts for each combination of visible panels. ## 0.0.2 - Documentation-only update. ## 0.0.1 - Initial release.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-resizable-panels/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-resizable-panels/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 21496 }
# react-resizable-panels React components for resizable panel groups/layouts ```jsx import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels"; <PanelGroup autoSaveId="example" direction="horizontal"> <Panel defaultSize={25}> <SourcesExplorer /> </Panel> <PanelResizeHandle /> <Panel> <SourceViewer /> </Panel> <PanelResizeHandle /> <Panel defaultSize={25}> <Console /> </Panel> </PanelGroup>; ``` ## If you like this project, 🎉 [become a sponsor](https://github.com/sponsors/bvaughn/) or ☕ [buy me a coffee](http://givebrian.coffee/) ## Props ### `PanelGroup` | prop | type | description | | :----------- | :--------------------------- | :--------------------------------------------------------------- | | `autoSaveId` | `?string` | Unique id used to auto-save group arrangement via `localStorage` | | `children` | `ReactNode` | Arbitrary React element(s) | | `className` | `?string` | Class name to attach to root element | | `direction` | `"horizontal" \| "vertical"` | Group orientation | | `id` | `?string` | Group id; falls back to `useId` when not provided | | `onLayout` | `?(sizes: number[]) => void` | Called when group layout changes | | `storage` | `?PanelGroupStorage` | Custom storage API; defaults to `localStorage` <sup>1</sup> | | `style` | `?CSSProperties` | CSS style to attach to root element | | `tagName` | `?string = "div"` | HTML element tag name for root element | <sup>1</sup>: Storage API must define the following _synchronous_ methods: - `getItem: (name:string) => string` - `setItem: (name: string, value: string) => void` `PanelGroup` components also expose an imperative API for manual resizing: | method | description | | :---------------------------- | :--------------------------------------------------------------- | | `getId(): string` | Gets the panel group's ID. | | `getLayout(): number[]` | Gets the panel group's current _layout_ (`[1 - 100, ...]`). | | `setLayout(layout: number[])` | Resize panel group to the specified _layout_ (`[1 - 100, ...]`). | ### `Panel` | prop | type | description | | :-------------- | :------------------------ | :-------------------------------------------------------------------------------------------- | | `children` | `ReactNode` | Arbitrary React element(s) | | `className` | `?string` | Class name to attach to root element | | `collapsedSize` | `?number=0` | Panel should collapse to this size | | `collapsible` | `?boolean=false` | Panel should collapse when resized beyond its `minSize` | | `defaultSize` | `?number` | Initial size of panel (numeric value between 1-100) | | `id` | `?string` | Panel id (unique within group); falls back to `useId` when not provided | | `maxSize` | `?number = 100` | Maximum allowable size of panel (numeric value between 1-100); defaults to `100` | | `minSize` | `?number = 10` | Minimum allowable size of panel (numeric value between 1-100); defaults to `10` | | `onCollapse` | `?() => void` | Called when panel is collapsed | | `onExpand` | `?() => void` | Called when panel is expanded | | `onResize` | `?(size: number) => void` | Called when panel is resized; `size` parameter is a numeric value between 1-100. <sup>1</sup> | | `order` | `?number` | Order of panel within group; required for groups with conditionally rendered panels | | `style` | `?CSSProperties` | CSS style to attach to root element | | `tagName` | `?string = "div"` | HTML element tag name for root element | <sup>1</sup>: If any `Panel` has an `onResize` callback, the `order` prop should be provided for all `Panel`s. `Panel` components also expose an imperative API for manual resizing: | method | description | | :----------------------- | :--------------------------------------------------------------------------------- | | `collapse()` | If panel is `collapsible`, collapse it fully. | | `expand()` | If panel is currently _collapsed_, expand it to its most recent size. | | `getId(): string` | Gets the ID of the panel. | | `getSize(): number` | Gets the current size of the panel as a percentage (`1 - 100`). | | `isCollapsed(): boolean` | Returns `true` if the panel is currently _collapsed_ (`size === 0`). | | `isExpanded(): boolean` | Returns `true` if the panel is currently _not collapsed_ (`!isCollapsed()`). | | `getSize(): number` | Returns the most recently committed size of the panel as a percentage (`1 - 100`). | | `resize(size: number)` | Resize panel to the specified _percentage_ (`1 - 100`). | ### `PanelResizeHandle` | prop | type | description | | :--------------- | :-------------------------------------------- | :------------------------------------------------------------------------------ | | `children` | `?ReactNode` | Custom drag UI; can be any arbitrary React element(s) | | `className` | `?string` | Class name to attach to root element | | `hitAreaMargins` | `?{ coarse: number = 15; fine: number = 5; }` | Allow this much margin when determining resizable handle hit detection | | `disabled` | `?boolean` | Disable drag handle | | `id` | `?string` | Resize handle id (unique within group); falls back to `useId` when not provided | | `onDragging` | `?(isDragging: boolean) => void` | Called when group layout changes | | `style` | `?CSSProperties` | CSS style to attach to root element | | `tagName` | `?string = "div"` | HTML element tag name for root element | --- ## FAQ ### Can panel sizes be specified in pixels? No. Pixel-based constraints [added significant complexity](https://github.com/bvaughn/react-resizable-panels/pull/176) to the initialization and validation logic and so I've decided not to support them. You may be able to implement a version of this yourself following [a pattern like this](https://github.com/bvaughn/react-resizable-panels/issues/46#issuecomment-1368108416) but it is not officially supported by this library. ### How can I fix layout/sizing problems with conditionally rendered panels? The `Panel` API doesn't _require_ `id` and `order` props because they aren't necessary for static layouts. When panels are conditionally rendered though, it's best to supply these values. ```tsx <PanelGroup direction="horizontal"> {renderSideBar && ( <> <Panel id="sidebar" minSize={25} order={1}> <Sidebar /> </Panel> <PanelResizeHandle /> </> )} <Panel minSize={25} order={2}> <Main /> </Panel> </PanelGroup> ``` ### Can a attach a ref to the DOM elements? No. I think exposing two refs (one for the component's imperative API and one for a DOM element) would be awkward. This library does export several utility methods for accessing the underlying DOM elements though. For example: ```tsx import { getPanelElement, getPanelGroupElement, getResizeHandleElement, Panel, PanelGroup, PanelResizeHandle, } from "react-resizable-panels"; export function Example() { const refs = useRef(); useEffect(() => { const groupElement = getPanelGroupElement("group"); const leftPanelElement = getPanelElement("left-panel"); const rightPanelElement = getPanelElement("right-panel"); const resizeHandleElement = getResizeHandleElement("resize-handle"); // If you want to, you can store them in a ref to pass around refs.current = { groupElement, leftPanelElement, rightPanelElement, resizeHandleElement, }; }, []); return ( <PanelGroup direction="horizontal" id="group"> <Panel id="left-panel">{/* ... */}</Panel> <PanelResizeHandle id="resize-handle" /> <Panel id="right-panel">{/* ... */}</Panel> </PanelGroup> ); } ``` ### Why don't I see any resize UI? This likely means that you haven't applied any CSS to style the resize handles. By default, a resize handle is just an empty DOM element. To add styling, use the `className` or `style` props: ```tsx // Tailwind example <PanelResizeHandle className="w-2 bg-blue-800" /> ``` ### How can I use persistent layouts with SSR? By default, this library uses `localStorage` to persist layouts. With server rendering, this can cause a flicker when the default layout (rendered on the server) is replaced with the persisted layout (in `localStorage`). The way to avoid this flicker is to also persist the layout with a cookie like so: #### Server component ```tsx import ResizablePanels from "@/app/ResizablePanels"; import { cookies } from "next/headers"; export function ServerComponent() { const layout = cookies().get("react-resizable-panels:layout"); let defaultLayout; if (layout) { defaultLayout = JSON.parse(layout.value); } return <ClientComponent defaultLayout={defaultLayout} />; } ``` #### Client component ```tsx "use client"; import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels"; export function ClientComponent({ defaultLayout = [33, 67], }: { defaultLayout: number[] | undefined; }) { const onLayout = (sizes: number[]) => { document.cookie = `react-resizable-panels:layout=${JSON.stringify(sizes)}`; }; return ( <PanelGroup direction="horizontal" onLayout={onLayout}> <Panel defaultSize={defaultLayout[0]}>{/* ... */}</Panel> <PanelResizeHandle className="w-2 bg-blue-800" /> <Panel defaultSize={defaultLayout[1]}>{/* ... */}</Panel> </PanelGroup> ); } ``` > [!NOTE] > Be sure to specify a `defaultSize` prop for **every** `Panel` component to avoid layout flicker. A demo of this is available [here](https://github.com/bvaughn/react-resizable-panels-demo-ssr). #### How can I set the [CSP `"nonce"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) attribute? ```js import { setNonce } from "react-resizable-panels"; setNonce("your-nonce-value-here"); ``` #### How can I disable global cursor styles? ```js import { disableGlobalCursorStyles } from "react-resizable-panels"; disableGlobalCursorStyles(); ```
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-resizable-panels/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-resizable-panels/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 12311 }
## 3.0.0 / 2023-10-18 ### refactor / chore - upgrade dependencies # BREAKING CHANGE Remove some unused/unneeded code which drops support for older browser versions. Results in slightly decreased bundle size. - remove unneeded polyfill for translateStyle - [browser support since 2017](https://caniuse.com/?search=transforms) - remove unneeded polyfill for `Number.isFinite` - [browser support since 2015](https://caniuse.com/?search=Number.isFinite) AND polyfilled by babel/core-js ## 2.0.5 / 2023-10-10 ### fix - Check if `requestAnimationFrame` is defined in shouldUpdate ## 2.0.4 / 2023-09-12 ### fix - call `onAnimationEnd` on unmount ## 2.0.3 / 2023-05-08 ### fix - treat `duration={0}` as if animation is not active by doing a check and returning early. This fixes a bug where NaN can cause a crash in the browser. ## 2.0.2 / 2023-02-23 ### chore - upgrade `fast-equals` to latest. No breaking changes - see https://github.com/planttheidea/fast-equals/blob/master/CHANGELOG.md - don't upgrade `react-transition-group` in minor release as this requires dropping support for react <16.6 - upgrade devDependencies - update babel config - update deprecated eslint parser ## 2.0.1 / 2022-06-27 ### feat - feat: allow React 18 - Remove raf polyfill for IE9 ## 2.0.0 / 2021-03-21 ### chore (#48) - Changed peerDeps to react 15,16,17 - Removed karma,chai,enzyme blablabla... and used only Jest and Testing-Library. - Updated devDependencies and cleared some. ## 1.0.2 / 2018-10-02 ### fix - fix babelrc ## 1.0.1 / 2018-10-02 ### fix - update babel, webpack, karma, etc. - fix import error ## 1.0.0 / 2017-11-06 ### feat - Support React 16 ## 0.1.17 / 2016-12-02 ### fix - change scripts ## 0.1.16 / 2016-11-25 ### fix - update lodash ## 0.1.15 / 2016-10-31 ### fix - fix isMounted to mounted ## 0.1.14 / 2016-10-28 ### fix - fix: judge isMounted ## 0.1.12-0.1.13 / 2016-10-27 ### fix - fix script ## 0.1.10 / 2016-07-07 ### fix - add onAnimationReStart validation ## 0.1.8-0.1.9 / 2016-05-05 ### feat - add onAniamtionStart prop ## 0.1.7 / 2016-04-21 ### fix - fix Animate trigger animate when isActive is false ## 0.1.6 / 2016-04-15 ### fix - fix Animate not pipe props when Animate not active ## 0.1.5 / 2016-04-13 ### fix - remove pure-render-decorator ## 0.1.4 / 2016-04-12 ### fix - change transition-group addons to dependencies ## 0.1.3 / 2016-04-12 ### refactor - refactor AnimateManager ## 0.1.2 / 2016-04-12 ### feat - use owe PureRender util ### fix - update react to 15.0.0 ## 0.1.1 / 2016-04-05 ### feat - add shouldReAnimate prop ## 0.1.0 / 2016-03-16 ### feat - use webpack 2 ## 0.0.13-0.0.15 / 2016-03-15 ### fix - using isEqual in lodash and remove isEqual in utils ## 0.0.13-0.0.14 / 2016-03-15 ### fix - fix update animation judgement ## 0.0.12 / 2016-03-15 ### fix - fix compatable prefix in transition property ### refactor - refactor some function in utils - using JSX instead of createElement ## 0.0.11 / 2016-03-01 ### fix - fix haven't unsubscribe handleStyleChange ## 0.0.10 / 2016-02-17 ### refactor - remove lodash compose method - refactor configUpdate.js ## 0.0.9 / 2016-02-05 ### fix - fix don't build on npm publish ## 0.0.8 / 2016-02-05 ### fix - fix lodash minify problem ## 0.0.7 / 2016-02-04 ### fix - optimize npm script commands ## 0.0.6 / 2016-02-04 ### fix - set min time longer ## 0.0.5 / 2016-02-04 ### fix - fix animation not valid for set css styles too quick. ## 0.0.4 / 2016-02-02 ### fix - support onAnimationEnd in js animation ## 0.0.3 / 2016-02-02 ### refactor - refactor the import path of lodash function - update webpack.config.js ## 0.0.2 / 2016-02-02 ### feat - support js animation - support bezier and spring timing function - support group animation ## 0.0.1 / 2016-01-21 - Init the project
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-smooth/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-smooth/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 3868 }
# react-smooth react-smooth is a animation library work on React. [![npm version](https://badge.fury.io/js/react-smooth.png)](https://badge.fury.io/js/react-smooth) [![build status](https://travis-ci.org/recharts/react-smooth.svg)](https://travis-ci.org/recharts/react-smooth) [![npm downloads](https://img.shields.io/npm/dt/react-smooth.svg?style=flat-square)](https://www.npmjs.com/package/react-smooth) [![Gitter](https://badges.gitter.im/recharts/react-smooth.svg)](https://gitter.im/recharts/react-smooth?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) ## install ``` npm install --save react-smooth ``` ## Usage simple animation ```jsx <Animate to="0" from="1" attributeName="opacity"> <div /> </Animate> ``` steps animation ```jsx const steps = [{ style: { opacity: 0, }, duration: 400, }, { style: { opacity: 1, transform: 'translate(0, 0)', }, duration: 1000, }, { style: { transform: 'translate(100px, 100px)', }, duration: 1200, }]; <Animate steps={steps}> <div /> </Animate> ``` children can be a function ```jsx <Animate from={{ opacity: 0 }} to={{ opacity: 1 }} easing="ease-in" > { ({ opacity }) => <div style={{ opacity }}></div> } </Animate> ``` you can configure js timing function ```js const easing = configureBezier(0.1, 0.1, 0.5, 0.8); const easing = configureSpring({ stiff: 170, damping: 20 }); ``` group animation ```jsx const appear = { from: 0, to: 1, attributeName: 'opacity', }; const leave = { steps: [{ style: { transform: 'translateX(0)', }, }, { duration: 1000, style: { transform: 'translateX(300)', height: 50, }, }, { duration: 2000, style: { height: 0, }, }] } <AnimateGroup appear={appear} leave={leave}> { list } </AnimateGroup> /* * @description: add compatible prefix in style * * style = { transform: xxx, ...others }; * * translatedStyle = { * WebkitTransform: xxx, * MozTransform: xxx, * OTransform: xxx, * msTransform: xxx, * ...others, * }; */ const translatedStyle = translateStyle(style); ``` ## API ### Animate <table class="table table-bordered table-striped"> <thead> <tr> <th style="width: 50px">name</th> <th style="width: 100px">type</th> <th style="width: 50px">default</th> <th style="width: 50px">description</th> </tr> </thead> <tbody> <tr> <td>from</td> <td>string or object</td> <td>''</td> <td>set the initial style of the children</td> </tr> <tr> <td>to</td> <td>string or object</td> <td>''</td> <td>set the final style of the children</td> </tr> <tr> <td>canBegin</td> <td>boolean</td> <td>true</td> <td>whether the animation is start</td> </tr> <tr> <td>begin</td> <td>number</td> <td>0</td> <td>animation delay time</td> </tr> <tr> <td>duration</td> <td>number</td> <td>1000</td> <td>animation duration</td> </tr> <tr> <td>steps</td> <td>array</td> <td>[]</td> <td>animation keyframes</td> </tr> <tr> <td>onAnimationEnd</td> <td>function</td> <td>() => null</td> <td>called when animation finished</td> </tr> <tr> <td>attributeName</td> <td>string</td> <td>''</td> <td>style property</td> </tr> <tr> <td>easing</td> <td>string</td> <td>'ease'</td> <td>the animation timing function, support css timing function temporary</td> </tr> <tr> <td>isActive</td> <td>boolean</td> <td>true</td> <td>whether the animation is active</td> </tr> <tr> <td>children</td> <td>element</td> <td></td> <td>support only child temporary</td> </tr> </tbody> </table> ### AnimateGroup <table class="table table-bordered table-striped animate-group"> <thead> <tr> <th style="width: 40px">name</th> <th style="width: 40px">type</th> <th style="width: 40px">default</th> <th style="width: 100px">description</th> </tr> </thead> <tbody> <tr> <td>appear</td> <td>object</td> <td>undefined</td> <td>configure element appear animation</td> </tr> <tr> <td>enter</td> <td>object</td> <td>undefined</td> <td>configure element appear animation</td> </tr> <tr> <td>leave</td> <td>object</td> <td>undefined</td> <td>configure element appear animation</td> </tr> </tbody> </table> ## License [MIT](http://opensource.org/licenses/MIT) Copyright (c) 2015-2021 Recharts Group
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-smooth/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-smooth/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 5087 }
react-style-singleton ==== __300b__ with all dependencies, minified and gzipped Creates a style component with internal _tracker_. - Adds styles to the browser on the __first__ instance mount. - Removes after the __last__ instance unmount. - Thus helps you deliver styles you need to the customer, and clean up later. - Is not server-side rendering compatible! # API ## Component ```js import {styleSingleton} from 'react-style-singleton' const Style = styleSingleton(); export const App = () => ( <Style styles={'body {color:red}'} /> ); ``` ## Hook ```js import {styleHookSingleton} from 'react-style-singleton'; const useStyle = styleHookSingleton(); const useAnotherStyle = styleHookSingleton(); export const App = () => { useStyle('div {color:red}'); useAnotherStyle('body { background-color:red }'); return (<div />); } ```
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-style-singleton/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-style-singleton/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 850 }
# react-transition-group [![npm][npm-badge]][npm] > **ATTENTION!** To address many issues that have come up over the years, the API in v2 and above is not backwards compatible with the original [`React addon (v1-stable)`](https://github.com/reactjs/react-transition-group/tree/v1-stable). > > **For a drop-in replacement for `react-addons-transition-group` and `react-addons-css-transition-group`, use the v1 release. Documentation and code for that release are available on the [`v1-stable`](https://github.com/reactjs/react-transition-group/tree/v1-stable) branch.** > > We are no longer updating the v1 codebase, please upgrade to the latest version when possible A set of components for managing component states (including mounting and unmounting) over time, specifically designed with animation in mind. ## Documentation - [**Main documentation**](https://reactcommunity.org/react-transition-group/) - [Migration guide from v1](/Migration.md) ## TypeScript TypeScript definitions are published via [**DefinitelyTyped**](https://github.com/DefinitelyTyped/DefinitelyTyped) and can be installed via the following command: ``` npm install @types/react-transition-group ``` ## Examples Clone the repo first: ``` [email protected]:reactjs/react-transition-group.git ``` Then run `npm install` (or `yarn`), and finally `npm run storybook` to start a storybook instance that you can navigate to in your browser to see the examples. [npm-badge]: https://img.shields.io/npm/v/react-transition-group.svg [npm]: https://www.npmjs.org/package/react-transition-group
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react-transition-group/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react-transition-group/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1567 }
# `react` React is a JavaScript library for creating user interfaces. The `react` package contains only the functionality necessary to define React components. It is typically used together with a React renderer like `react-dom` for the web, or `react-native` for the native environments. **Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. Don't forget to use the [production build](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) when deploying your application. ## Usage ```js import { useState } from 'react'; import { createRoot } from 'react-dom/client'; function Counter() { const [count, setCount] = useState(0); return ( <> <h1>{count}</h1> <button onClick={() => setCount(count + 1)}> Increment </button> </> ); } const root = createRoot(document.getElementById('root')); root.render(<App />); ``` ## Documentation See https://reactjs.org/ ## API See https://reactjs.org/docs/react-api.html
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/react/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/react/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1161 }
# read-cache [![Build Status](https://travis-ci.org/TrySound/read-cache.svg?branch=master)](https://travis-ci.org/TrySound/read-cache) Reads and caches the entire contents of a file until it is modified. ## Install ``` $ npm i read-cache ``` ## Usage ```js // foo.js var readCache = require('read-cache'); readCache('foo.js').then(function (contents) { console.log(contents); }); ``` ## API ### readCache(path[, encoding]) Returns a promise that resolves with the file's contents. ### readCache.sync(path[, encoding]) Returns the content of the file. ### readCache.get(path[, encoding]) Returns the content of cached file or null. ### readCache.clear() Clears the contents of the cache. ## License MIT © [Bogdan Chadkin](mailto:[email protected])
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/read-cache/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/read-cache/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 769 }
# readdirp [![Weekly downloads](https://img.shields.io/npm/dw/readdirp.svg)](https://github.com/paulmillr/readdirp) Recursive version of [fs.readdir](https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback). Exposes a **stream API** and a **promise API**. ```sh npm install readdirp ``` ```javascript const readdirp = require('readdirp'); // Use streams to achieve small RAM & CPU footprint. // 1) Streams example with for-await. for await (const entry of readdirp('.')) { const {path} = entry; console.log(`${JSON.stringify({path})}`); } // 2) Streams example, non for-await. // Print out all JS files along with their size within the current folder & subfolders. readdirp('.', {fileFilter: '*.js', alwaysStat: true}) .on('data', (entry) => { const {path, stats: {size}} = entry; console.log(`${JSON.stringify({path, size})}`); }) // Optionally call stream.destroy() in `warn()` in order to abort and cause 'close' to be emitted .on('warn', error => console.error('non-fatal error', error)) .on('error', error => console.error('fatal error', error)) .on('end', () => console.log('done')); // 3) Promise example. More RAM and CPU than streams / for-await. const files = await readdirp.promise('.'); console.log(files.map(file => file.path)); // Other options. readdirp('test', { fileFilter: '*.js', directoryFilter: ['!.git', '!*modules'] // directoryFilter: (di) => di.basename.length === 9 type: 'files_directories', depth: 1 }); ``` For more examples, check out `examples` directory. ## API `const stream = readdirp(root[, options])` — **Stream API** - Reads given root recursively and returns a `stream` of [entry infos](#entryinfo) - Optionally can be used like `for await (const entry of stream)` with node.js 10+ (`asyncIterator`). - `on('data', (entry) => {})` [entry info](#entryinfo) for every file / dir. - `on('warn', (error) => {})` non-fatal `Error` that prevents a file / dir from being processed. Example: inaccessible to the user. - `on('error', (error) => {})` fatal `Error` which also ends the stream. Example: illegal options where passed. - `on('end')` — we are done. Called when all entries were found and no more will be emitted. - `on('close')` — stream is destroyed via `stream.destroy()`. Could be useful if you want to manually abort even on a non fatal error. At that point the stream is no longer `readable` and no more entries, warning or errors are emitted - To learn more about streams, consult the very detailed [nodejs streams documentation](https://nodejs.org/api/stream.html) or the [stream-handbook](https://github.com/substack/stream-handbook) `const entries = await readdirp.promise(root[, options])` — **Promise API**. Returns a list of [entry infos](#entryinfo). First argument is awalys `root`, path in which to start reading and recursing into subdirectories. ### options - `fileFilter: ["*.js"]`: filter to include or exclude files. A `Function`, Glob string or Array of glob strings. - **Function**: a function that takes an entry info as a parameter and returns true to include or false to exclude the entry - **Glob string**: a string (e.g., `*.js`) which is matched using [picomatch](https://github.com/micromatch/picomatch), so go there for more information. Globstars (`**`) are not supported since specifying a recursive pattern for an already recursive function doesn't make sense. Negated globs (as explained in the minimatch documentation) are allowed, e.g., `!*.txt` matches everything but text files. - **Array of glob strings**: either need to be all inclusive or all exclusive (negated) patterns otherwise an error is thrown. `['*.json', '*.js']` includes all JavaScript and Json files. `['!.git', '!node_modules']` includes all directories except the '.git' and 'node_modules'. - Directories that do not pass a filter will not be recursed into. - `directoryFilter: ['!.git']`: filter to include/exclude directories found and to recurse into. Directories that do not pass a filter will not be recursed into. - `depth: 5`: depth at which to stop recursing even if more subdirectories are found - `type: 'files'`: determines if data events on the stream should be emitted for `'files'` (default), `'directories'`, `'files_directories'`, or `'all'`. Setting to `'all'` will also include entries for other types of file descriptors like character devices, unix sockets and named pipes. - `alwaysStat: false`: always return `stats` property for every file. Default is `false`, readdirp will return `Dirent` entries. Setting it to `true` can double readdir execution time - use it only when you need file `size`, `mtime` etc. Cannot be enabled on node <10.10.0. - `lstat: false`: include symlink entries in the stream along with files. When `true`, `fs.lstat` would be used instead of `fs.stat` ### `EntryInfo` Has the following properties: - `path: 'assets/javascripts/react.js'`: path to the file/directory (relative to given root) - `fullPath: '/Users/dev/projects/app/assets/javascripts/react.js'`: full path to the file/directory found - `basename: 'react.js'`: name of the file/directory - `dirent: fs.Dirent`: built-in [dir entry object](https://nodejs.org/api/fs.html#fs_class_fs_dirent) - only with `alwaysStat: false` - `stats: fs.Stats`: built in [stat object](https://nodejs.org/api/fs.html#fs_class_fs_stats) - only with `alwaysStat: true` ## Changelog - 3.5 (Oct 13, 2020) disallows recursive directory-based symlinks. Before, it could have entered infinite loop. - 3.4 (Mar 19, 2020) adds support for directory-based symlinks. - 3.3 (Dec 6, 2019) stabilizes RAM consumption and enables perf management with `highWaterMark` option. Fixes race conditions related to `for-await` looping. - 3.2 (Oct 14, 2019) improves performance by 250% and makes streams implementation more idiomatic. - 3.1 (Jul 7, 2019) brings `bigint` support to `stat` output on Windows. This is backwards-incompatible for some cases. Be careful. It you use it incorrectly, you'll see "TypeError: Cannot mix BigInt and other types, use explicit conversions". - 3.0 brings huge performance improvements and stream backpressure support. - Upgrading 2.x to 3.x: - Signature changed from `readdirp(options)` to `readdirp(root, options)` - Replaced callback API with promise API. - Renamed `entryType` option to `type` - Renamed `entryType: 'both'` to `'files_directories'` - `EntryInfo` - Renamed `stat` to `stats` - Emitted only when `alwaysStat: true` - `dirent` is emitted instead of `stats` by default with `alwaysStat: false` - Renamed `name` to `basename` - Removed `parentDir` and `fullParentDir` properties - Supported node.js versions: - 3.x: node 8+ - 2.x: node 0.6+ ## License Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (<https://paulmillr.com>) MIT License, see [LICENSE](LICENSE) file.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/readdirp/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/readdirp/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 6933 }
## 0.4.5 (Mar 25, 2021) ### chore - fix: previous release ## 0.4.4 (Mar 18, 2021) ### chore - bring up all dev deps (incl. eslint and webpack) to the latest - move CI to Github actions - add linting and building to ci pipeline (in addition to unit testing) ## 0.4.0 (Seq 28, 2018) ### feat - use `decimal.js-light` to handle large number or high precision ## 0.3.2 (Aug 21, 2017) ### fix - fix `getNiceTickValues` when the number is a scientific notation ## 0.3.1 (Jun 11, 2017) ### fix - fix `getDigitCount` when the number is a scientific notation ## 0.3.0 (Mar 01, 2017) ### feat - Add new ticks function `getTickValuesFixedDomain` ## 0.2.3 (Feb 28, 2017) ### fix - Fix calculation precision of calculateStep, add Arithmetic.modulo ## 0.2.2 (Feb 28, 2017) ### fix - Fix calculation precision of calculateStep ## 0.2.1 (July 25, 2016) ### fix - Fix the precision of ticks for decimals ## 0.2.0 (July 25, 2016) ### feat - Support `allowDecimals` option ## 0.1.11 (July 19, 2016) ### fix - Tweak the strategy of calculating step of ticks ## 0.1.10 (July 07, 2016) ### deps - update deps and fix lint error ## 0.1.9 (April 08, 2016) ### fix - Fix ticks for interval [0, 0] ## 0.1.8 (Feb 04, 2016) ### refactor - Refactor the export method ## 0.1.7 (Feb 04, 2016) ### chore - Optimize npm script commands
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/recharts-scale/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/recharts-scale/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1346 }
# recharts-scale [![Build Status](https://github.com/recharts/recharts-scale/workflows/ci/badge.svg)](https://github.com/recharts/recharts-scale/actions) Scale of Cartesian Coordinates
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/recharts-scale/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/recharts-scale/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 186 }
## ⚠️ Next versions change notes are available only on the [GitHub Releases](https://github.com/recharts/recharts/releases) page ⚠️ ## 2.2.0 (Dec 8, 2022) ### feat - Support keyboard navigation in pie chart (#2923) - Allow reversing the tooltip direction (#3056) ### fix - fix rounding leading to hairline gaps (#3075) - fix: do not override zero brush end index (#3076) - fix: allow dragging brush when the mouse is outside (#3072) - fix: add label type to line props (#3068) - Ensure LabelList generic extends Data interface (#2954) ## 2.1.16 (Oct 29, 2022) ### fix - Fix incorrect date in CHAGELOG (#3016) - Let formatter function run even when value is falsy (#3026) - Fix(Sankey): update tooltip active state by trigger type(hover/click) (#3021) - Fix Area's `baseValue` prop (#3013) ## 2.1.15 (Oct 12, 2022) ### fix - Fix scroll on hover - DefaultTooltipContent.tsx Solving type error for entry.value and entry.name ### chore - Revert D3 version ## 2.1.14 (Sep 7, 2022) ### fix - Add inactiveShape prop to Pie component (#2900) - Revert "chore: move type deps into devDependencies (#2843)" (#2942) - Fix typing of default tooltip formatter (#2924) - Take letter-spacing and font-size into consideration while rendering ticks (#2898) - Add formatter function type to tooltip props (#2916) - doc: Update CHANGELOG.md about d3 7.x (#2919) ## 2.1.13 (Jul 26, 2022) ### fix - set animate flag before chart data update (#2911) - Error bar domain fix (#2863) - fix: fix "recharts@… doesn't provide prop-types, requested by react-smooth" warning (#2895) ### chore - upgrade d3 (#2893) ## 2.1.12 (Jun 27, 2022) ### fix - update react-smooth version - update d3 from 6.x to 7.x it may break some tools like jest fix config for jest is to add the following configuration ```javascript const path = require('path'); // took from d3/package.json const d3Pkgs = [ 'd3', 'd3-array', 'd3-axis', 'd3-brush', 'd3-chord', 'd3-color', 'd3-contour', 'd3-delaunay', 'd3-dispatch', 'd3-drag', 'd3-dsv', 'd3-ease', 'd3-fetch', 'd3-force', 'd3-format', 'd3-geo', 'd3-hierarchy', 'd3-interpolate', 'd3-path', 'd3-polygon', 'd3-quadtree', 'd3-random', 'd3-scale', 'd3-scale-chromatic', 'd3-selection', 'd3-shape', 'd3-time', 'd3-time-format', 'd3-timer', 'd3-transition', 'd3-zoom', ]; // option 1 map module to an bundled version of the package which is es5 const moduleNameMapper = d3Pkgs.reduce((acc, pkg) => { acc[`^${pkg}$`] = path.join(require.resolve(pkg), `../../dist/${pkg}.min.js`); return acc; }, {}); module.exports = { moduleNameMapper: { // option 1 // ...moduleNameMapper }, transform: { // match mjs js jsx ts tsx '^.+\\.m?[jt]sx?$': 'babel-jest', }, // stop ignore node_modules transform since d3 and others start to put es6 as main of packages transformIgnorePatterns: [ // option 2, stop ignore transform on es6 packages `/node_modules/(?!${d3Pkgs.join('|')}|internmap|d3-delaunay|delaunator|robust-predicates)`, // option 3, stop ignore transform on all node_modules // `/node_modules/(?!.*)`, ], }; ``` ## 2.1.11 (Jun 24, 2022) ### feat - Adds react `^18.0.0` as valid peerDependency (#2820) ## 2.1.10 (May 19, 2022) ### feat - Add ARIA1.2 attributes to the SvgElementPropKeys filter array - Added Storybook Badge (#2840) - Handling of undefined values and type checks in DefaultTooltipContent ### fix - Axis scale=band no longer works as of Recharts 2.x.x (#2742) ### chore - chore: move type deps into devDependencies (#2843) ## 2.1.9 (Feb 10, 2022) ### feat - feat: allow axis domain to accept a callback (#2770) - Categorical chart callback types (#2739) ### fix - Fixing types in strict mode (#2745) (#2747) - Fix: removes overlapping legend for categorical charts (#2752) - Categorical chart callback types (#2739) ## 2.1.8 (dec 14, 2021) ### fix - Must use import to load ES Module (#2658) ## 2.1.7 (dec 14, 2021) ### fix - Treemap do not render depth (#2718 #2719) - Update PolarRadiusAxis.tsx (#2720) ### chore - Update d3-interpolate, d3-scale and d3-shape (#2707) ## 2.1.6 (oct 26, 2021) ### fix - Fix types folder missing ## 2.1.5 (oct 15, 2021) ### fix - Fixed types for legend events (#2267 #2269) - Fix the react-is version (#2670) - Fix type declaration errors when tsc (#2675) - Fix(build-umd): add webpack output options libraryTarget (#2684) ## 2.1.4 (sep 19, 2021) ### fix - Fix: ResponsiveContainer makes legend overlapping with chart when re-rendering (#2660) - Fix: rendering of a single bar when maxBarSize is absent and barSize is present (#2659) ## 2.1.3 (sep 18, 2021) ### fix - fix: Customized component has no key (#2637) - Fix XAxis scale property type (#2641) ## 2.1.2 (aug 24, 2021) ### fix - Fixes undefined field reference when optional variables not supplied (#2630) - Fix fragment children (#2481) ## 2.1.1 (aug 21, 2021) ### fix - Fix: responsive container ## 2.1.0 (aug 10, 2021) ### feat - Wrap ResponsiveContainer with forwardRef ### fix - Fix for recharts issue #1787 - Add chart type to tooltip payload ## 2.0.10 (jul 13, 2021) ### feat - Feat: Allow automated axis padding for "gap" and "no-gap" for barcharts with continuous axis #2457 - Passthrough position attribute on createLabeledScales ### fix - fix: barchart for a single data point #2512 - fix: the bar label type definition #2582 - fix: show scatter chart tooltip cross cursor #2592 ## 2.0.9 (mar 24, 2021) ### chore - update test config and webpack, etc ## fix - fix for missing sankey tooltips, fix #2496 - added polyfill for ReactResizeDetector, fix #2504 - fix condition to actually remove the listener, fix #2498 - fix typing of <Area type /> prop, fix #2471 ## 2.0.8 (Feb 24, 2021) ### feat - allow to show tooltip when hover or click bar item for <BarChart /> and <RadialBarChart /> - add api `getXScales`, `getYScales`, `getXScaleByAxisId`, `getYScaleByAxisId`, `getItemByXY` to chart, fix #2422 - Add SyncMethod to categorical charts - `findAllByType` searches for match inside of a fragment - allow to add customized `polarAngles` and `polarRadius` to <PolarGrid />, fix #2452 ### fix - fix Tooltip receive wrong payload when mouse enter <Line />, .etc, fix #2394 - fix Treemap tooltip when use `dataKey` to specify value, fix #2428 ### deps - update react-resize-detector to 6.6.0, fix #2431 ## 2.0.7 (Feb 18, 2021) ### fix - add missed type definition of tickMargin in XAxis, YAxis, fix #2427 - filter out nil elements of chart - ensures `id="undefined"` is not rendered to the DOM when use ResponsiveContainer - fix auto scale type of ComposedChart, fix #2403 - Fix .d.ts types that relay on d3 ## 2.0.6 (Feb 08, 2021) ### fix - fix types error in npm pkg, fix #2398 ## 2.0.5 (Feb 08, 2021) ### feat - defer when syncing to other charts ### fix - Fix Customized component types - fix child event not dispatched, fix #2414 ## 2.0.4 (Jan 27, 2021) ### feat - add maxLines prop to Text component ### fix - Add `payload` to `Payload` interface - prevent rerender errors in ResponsiveContainer - Add PieLabel, PieLabelRenderProps types ### deps - Upgrade react-resize-detector(4.x => 5.x) types to match the library ## 2.0.3 (Jan 13, 2021) ### refactor - use `getDerivedStateFromProps` to replace `UNSAFE_componentWillReceiveProps`, support react@17, #2385 ## 2.0.2 (Jan 12, 2021) ### fix - fix lint error ## 2.0.1 (Jan 12, 2021) ### fix - Fix typo, createLabeldScales -> createLabeledScales - Prefer Number.isFinite if available - fix types error - fix(package.json): disable side effects explicitly ### feat - Add aria-hidden to measurementSpan ## 2.0.0 (Dec 29, 2020) ### fix - fix minAngle for 0 in PieChart, fix ##2237 - fix type error of <Bar />, fix #2335 - fix type error of cursor in <Tooltip />, fix #2178 - fix Props of XAxis, fix #2128 - export Props of components, fix #2319, #2156, #2203 - Fix typo, getRectangePath -> getRectanglePath in Rectangle - allow Duplicated Category for bar charts not using correct entries for custom tool tips - fixing typescript array coalesce - fix types error of sankey, fix #2280 - Fixed SVG path for pie charts when corner radius is set to a value other than zero (#2331) ### feat - add props `reversed` to `<Funnel />` - add `breakAll` props to `<Text />` to allow break all for chinese - fix width of labelList in Funnel; fix #2056, #1866 - support range RadarChart and add props `connectNulls` to <Radar />, fix #1890 - add ability to pass in custom legend icon. ### deps - upgrade react-resize-detector to 5.2.0 and fix ts error, fix #2300 - update react-smooth to 1.0.6 to fix bug after upgrading d3 - upgrade d3 packages ## 2.0.0-beta.8 (Nov 16, 2020) ### fix - Add color change for inactive legend label - fix stackOffset="sign" in #2292, and add props stackOffset="positive" to fix #1667 ### refactor - update `filterSvgElements` and `renderByOrder` - Replace core-js polyfill and remove babel-polyfill ## 2.0.0-beta.7 (Sep 08, 2020) ### fix - Fix flickering tooltip by keeping the isTooltipActive flag from the previous state - fix(AreaDot Type): add option to use a function that returns a react element - Fix typescript error in polar radar - Fix typos in Label.renderCallByParent - Add type definition for label prop on XAxis, YAxis and ZAxis ### feat - Pass tickFormatter as a prop to customized tick component - Allow array value for last data element in Funnel to set bottom width instead of forcing 0 - Add payloadIndex to cursor props ## 2.0.0-beta.6 (May 12, 2020) ### fix - fix error of Brush when data is empty, but chart width or height or Brush update, fix #2093 - fix build error , fix #2120 - fix attrs of <Label />, reverts previous change: now `positionAttrs` is again after `attrs` - Get legend wrapper boundingRect to correctly compute legend offset, fix #2062 ### feat - support customized traveller of Brush, fix #1600 ## 2.0.0-beta.5 (Mar 26, 2020) ### fix - fix types of generateCategoricalChart - fix position of tooltip when the categorical axis has time scale - fix position of tooltip when direction is rtl - fix name of Scatter in tooltip - Fix outerArcAngle and innerArcAngle when cornerIsExternal == true - fix IE 11 supoort because of [email protected] ### feat - add Global setting, include "isSsr" - support tooltip trigger by click event - add static method `registerSymbol` to Symbols - add payload to formatter and labelFormatter in Tooltip - allow domain of axis to change the order of categories ## 2.0.0-beta.4 (Mar 17, 2020) ### fix - fix error of <Curve /> when add child to <Line />, fix #2051 - fix Stack AreaChart when some values is negative, fix #1667 - fix stack AreaChart when some values is nill, fix #1601 ### dep - Upgrade reduce-css-calc ### chore - add types ## 2.0.0-beta.3 (Mar 13, 2020) ### fix - fix range of ReferenceArea of BarChart, fix #2045 - fix className of axis line, fix ##2024 - fix ComposedChart when has multiple <Bar/>, fix #2031 - fix ComposedChart when specify scale of <XAxis />, fix #2010 ### chore - update eslint and add .prettierrc ## 2.0.0-beta.2 (Mar 10, 2020) ### fix - Do word line calculation only when needed - Fixes arc angles when `cornerIsExternal` is used - Invert cartesian label position based on negative values - Fix usage of hooks in Tooltip, Label, Legend and Customized - Move draging-end listener to the window for brush - Fix trigger after mouse leave - Added the angle as key which need to be used in the Label align - Rewrite index.js to index.ts, update scripts in package.json ### feat - Added index to tickFormatter - Allow axis line customization through axisLine prop ## 2.0.0-beta.1 (Dec 03, 2019) ### fix - fix error parameters in `appendOffsetOfLegend` - fix style of <Area /> ## 2.0.0-beta.0 (Dec 03, 2019) ### feat - Only support react@16 - Use typescript to rewrite src/ ## 1.8.5 (Oct 22, 2019) ### fix - revert [PR#1916](https://github.com/recharts/recharts/pull/1916) - fix Text update, fix #1914 ## 1.8.4 (Oct 22, 2019) ### fix - Adding Composed chart to rescaled charts, to fix #1887 ## 1.8.3 (Oct 17, 2019) ### fix - fix: rollback to componentWillReceiveProps, fix crash in react@15 ## 1.8.2 (Oct 17, 2019) ### fix - Used UNSAFE_componentWillReceiveProps to replace componentDidUpdate ## 1.8.1 (Oct 16, 2019) ### fix - Fixed Text Component crash - Fixed eslint errors in src/ ### feat - Add props of <Brush /> to always show text - Add onClick event to sankey chart - Shape prop can be used without any other prop in reference area ## 1.8.0 (Oct 15, 2019) ### refactor - react unsafe methods refactored ## 1.7.1 (Aug 13, 2019) ### fix - Fix bar chart tooltip (#1837) ## 1.7.0 (Aug 08, 2019) ### feat - allow events on Text and Label components - Enable Tooltip's `translate` style - Added position props for ReferenceLine to allow to control offset of it ### fix - handle `dataKey` as function, get correct data array for tooltip - fix style of legend in case of area and radar use fill for fallback color ## 1.6.2 (May 22, 2019) ### feat - Add cornerIsExternal prop to center rounded corner at radial bar edge - Add new component `Customized` to render customized content which can user internal state and props - Add props `tooltipType="none"` to hide tooltip data for Area, Bar, Line, Scatter, Funnel, Pie, Radar, RadialBar ### fix - fix the order of tooltip items when not specify itemSorter - Fix typo in example of RadialBarChart ## 1.6.1 (May 20, 2019) ### fix - fix "Maximum call stack size exceeded" error when use label={<Label />} - fix bug of "Cannot read property reduce of undefined in Text.js" - fix `getDomainOfDataByKey` when all the values are null or undefined ## 1.6.0(May 14, 2019) ### fix - Use y-axis ticks to determine y-axis category - fix bug in ThreeMap inside ResponsiveContainer, fix #1692 - Avoid same keys on label and line, fixes #1302 - use _.max to replace Math.max.apply, use _.min to replace Math.min.apply ### feat - Adds forceCornerRadius prop to RadialBar - calculate width with aspect and height when width is falsey ## 1.5.0(Feb 15, 2019) ### fix - fix the bug of ReferenceLine when calculate coordinates, fix #1643 - fix bug of Scatter in ComposedChart ### feat - allow aria-* attributes and "role", "focusable", "tabIndex" of charts, fix #1226, fix #1584 - add new props "paylodUniqBy" to Tooltip and Legend ## 1.4.4(Feb 15, 2019) ### fix - fix the bug of automatically calculate the y-coordinate of yAxis tick when tick has unit, fix #1623 - render clipPath in <defs />, fix bug in generateCategoricalChart, fix #1592 - remove React.Fragment in DefaultTooltipContent, fix #1645 ## 1.4.3(Feb 12, 2019) ### fix - fix bug of <Rectangle /> when width < 0 && `radius` is not null, fix #1596 - fix paddingAngle of Pie when render only <Pie /> not <PieChart /> - fix onMouseEnter and Tooltip for Pie on FireFox ### feat - Make the timeOut timer for the brush configurable through props - Allow to format name in Tooltips ### dep - Update lodash version to 4.17.5 and install [email protected] dev dependency - Updated package.json to mark effectful modules - chore: update version of sinon, from 4.x to 7.x ## 1.4.2(Dec 21, 2018) ### refactor - Refactor transition of <Area />, <Line />, <Radar />, make transition more smoothly when the length of dataset changes ### fix - replace lodash isFinite with Number.isFinite, meanwhile add polyfill core-js's Number polyfill in order to use Number.usFinite directly - updated area chart to cut off dots on left most axis ## 1.4.1(Nov 16, 2018) ### fix - Fix height of TreeMap ## 1.4.0(Nov 15, 2018) ### feat - Add FunnelChart and Trapezoid - Add nested Treemap ## 1.3.6(Nov 07, 2018) ### fix - Fix bug preventing use of functions or custom components for the Bar background prop - Fix incorrect sort logic in stripe rendering ### feat - Added animateNewValues property to Line ## 1.3.5(Oct 25, 2018) ### fix - use lodash _.values instead of Object.values - perfer YAxis which has finite domain and nice ticks when a chart has many YAxes - fix <Area /> for expected length height attribute ### chore - add babel-plugin-lodash in babelrc - update webpack.config.js to remove sourceMap in umd/Recharts.min.js ## 1.3.4(Oct 13, 2018) ### fix - Fix domain calculation with 0 values (#1519) ## 1.3.3(Oct 10, 2018) ### feat - find yAxisWithNiceTicks and choose it over getAnyElementOfObject ### fix - update recharts-scale to 0.4.2 to fix bug of DecimalError when data is Inifinity, fix #1493 ## 1.3.2(Oct 07, 2018) ### fix - Fix axis type error - Fix add sideEffects flag to enable tree-shaing ## 1.3.1(Sep 29, 2018) ### fix - Fix the react-resize-detector don't match react 15 ## 1.3.0(Sep 28, 2018) ### feat - upgrade recharts-scale to 0.4.0, to fix the calculation of big float ## 1.2.0(Sep 7, 2018) ### feat - Add blendStroke prop to Pie component - Adding contentStyle prop to Tooltip for styling DefaultTooltipContent ### fix - Fixed typo of playload -> payload in Radar chart - Fix PieChart animation event handlers not firing - Fix alwaysShow warn() condition in ReferenceLine - Fix Tooltip disappears when using setState() ## 1.1.0(Jul 19, 2018) ### feat - Allow reference areas which extend past the canvas bounds - Allow to add more classes in tooltips - Reference line segment by specifying a pair of endpoints ## 1.0.1(Jul 05, 2018) ### fix - only use babel-es in es6/, fix #1372 ## 1.0.0(Jul 05, 2018) ### fix - #1195 Replace axis scale value `utcTime` with `utc` - remove wrapperStyle on DefaultTooltipContent - Clip dots of <Line /> - Move style spread to after default styles to allow overriding - Fixing range area chart bottom bound. Base line needed to be filterted for connecting null - Fix tooltips that disappear while mouse still over a scatter point ### refactor - use lodash-es for es6 build - Factor out some scale- and rect-related functions ### feat - Add touchStart & touchEnd event handling - Add explicit prop `defaultShowTooltip` to activate tooltip - Position the 'top' label outside the element for negative heights ## 1.0.0-beta.10(Jan 31, 2018) ### fix - fix Scatter Chart:lineType 'fitting' does not work - Update to allow CSP compliance on setting styles - Remove react-transition-group from peerDependencies ### refactor - Replace flatmap of reduce to _.flatmap in getDomainOfDataByKey ### feat - Add the gap of props for brush ## 1.0.0-beta.9(Jan 09, 2018) ### fix - Fix `verticalFill` and `horizontalFill` in `<CartesianGrid />` when points are unordered ## 1.0.0-beta.8(Jan 09, 2018) ### feat - Add props `useTranslate3d` to control whether use translate3d or translate in <Tooltip /> - Add props `verticalFill` and `horizontalFill` in `<CartesianGrid />` to show grid background - Add `visibleTicksCount` in props of customized tick of `<CartesianAxis />` ### fix - Replace lodash _.get with simple Array.prototype.find - Prevent texts from being selected when dragging the brush - Add try...catch... when getTotalLength is called by a svg path to fix IE bug ## 1.0.0-beta.7(Dec 21, 2017) ### feat - Add props `allowDuplicatedCategory` to XAxis, YAxis, PolarAngleAxis, PolarRadiusAxis, to remove duplicated category when type="category" - Add props id in `<Area />`, `<Bar />`, `<Line />`, `<Scatter />`, `<Label />`, `<LabelList />` for SSR - Support specify domain of category type axis when allowDuplicatedCategory is false, add cooresponding "xAis", "yAxis", "zAxis" to the props or customized shape of Scatter ### fix - Fx sanketartAngle and endAngle of RadarChart diagram not re-rendering when updating data prop - Fix animation of AreaChart when baseLine is NaN / undefined - Fix default startAngle and endAngle of RadarChart - Use cloneElement to create Legend ## 1.0.0-beta.6(Dec 02, 2017) ### feat - Add props `background` to support background rectange in `<Bar />` - add props `tickMargin` which set the space between text and tick line ### fix - update PRESENTATION_ATTRIBUTES to allow set the radius of each `<Rectangle />` of BarChart - render Legend when all values of Pie is 0 - fix animation of intial `<Bar />` ## 1.0.0-beta.5(Nov 24, 2017) ### fix - fix `isChildrenEqual` when chart has a single child in an array - support LabelList in ScatterChart ## 1.0.0-beta.4(Nov 24, 2017) ### fix - fix Label when content is a function and return simple string - add name to propTypes of Scatter - fix ** error of lib/ ## 1.0.0-beta.3(Nov 23, 2017) ### feat - Add datakey to proops of customized dot ### fix - Removed the use of `Children.only` from the isSingleChildEqual call. Appears to resolve the issue logged at https://github.com/recharts/recharts/issues/935 - Fix Line Animation with given Magic Number - Don't break text contents on non-breaking spaces - Support for "strokeDasharray" in <Legend/> - Fix Bar Animation with the given Magic Number - Fix position of `<Label />` - Fix exception of AreaChart when all the values are null - Fix the orders of polar angle ticks in RadarChart - Replace ** width Math.pow ## 1.0.0-beta.2(Nov 17, 2017) ### fix - fix attributes order of `<Label />` - fix the domain of Axis when specify `ticks` ### feat - allow set x, y, width, height, horizontalPoints, verticalPoints of CartesianGrid - add props to the parameters of callbacks ### refactor - add id prop to Pie Component - Update Bar and Line to allow them to recognise multiple ErrorBars ## 1.0.0-beta.1(Nov 06, 2017) ### feat - Add index to line props in Pie - Update ReferenceDot.js ### chore - update react-resize-detector, react-smooth to support react16 ## 1.0.0-beta.0(Oct 24, 2017) ### feat - Allow ReferenceArea to cover available space - Support React 16 ### fix - Fix bug of animation when toggle the value of `isAnimationActive` ## 1.0.0-alpha.6(Oct 10, 2017) ### feat - Add props `reverseStackOrder` to reverse the order of stacked items - Allow an arbirary domain for cartesian X and Y axes - Added className prop for Label ### fix - Fix confused parameter `startX` in `<Brush />` - Fix ScatterChart when the type of XAxis is "category" ### docs - Fix typo initilaState -> initialState ## 1.0.0-alpha.5(Sep 16, 2017) ### fix - Don't check for animation when it is disabled - fix bug of paddingAngle when isAnimationActive is true ### feat - add props filterNull to `Tooltip`, null values will not be filtered when filterNull = false ### refactor - Allowing length in different unit in ResponsiveContainer By allowing type: String on 'minHeight', 'minWidth', 'maxHeight' property, developers can use length in different units like em, pt etc. - Render curve with fill first in Area ### dep - remove react-transition-group in peer dependencies - Updates resize-detector to 0.6, close #705, fix the problem with strange scrollbars appearing over the charts ## 1.0.0-alpha.4(Aug 21, 2017) ### fix - Fix error 'Cannot read property 'map' of undefined' in Pie - Fix bug of parsing the width of Brush - Don't render any path when width === 0 || height === 0 in Rectangle ### refactor - Avoid calculating ticks if tick is set to false - Update the order of parsing data in mixed components ### feat - Render unit when the props unit of XAxis, YAxis is specified - Add default nameKey to "name" property in Pie - Add props className and id to ResponsiveContainer ### dep - Update recharts-scale to fix bug of ticks ## 1.0.0-alpha.3(Aug 12, 2017) ### fix - fix bug of isChildrenEqual - fix "hide" props of YAxis ## 1.0.0-alpha.2(Jul 10, 2017) ### feat - Add props className to ReferenceLine, ReferenceDot, ReferenceArea - Specify the contents of LabelList by `dataKey` ### fix - Fix faulty logic check in inRange function - onTouchMove event call method that handle tooltip and active dot draw - Show tooltip on drag movement on touch devices - Fix viewBox of Label when render implicit label - Fix label of Pie - Fix events of Pie and PieChart - Fix bug of interplateNumber - Fix the bug of parsing "dataMin - 0.05" like domain ## 1.0.0-alpha.1(Jun 11, 2017) ### fix - update the propType of the props data or Bar - fix the type of Curve - fix connectNulls of `Line` - update version of recharts-scale to fix #713 - fix valueKey of Pie temporarily and add logs when use deprecated "valueKey" - bind events to Radar - fix animation of active-dot ## 1.0.0-alpha.0(May 24, 2017) ### refactor - refactor PolarCharts - refactor Animation - refactor Label and LabelLis ### fix - fix scale of ErrorBar ## 0.22.4 (Apr 26, 2017) ### fix - fix dot customized className ### dep - update react-smooth, and react-transition-group ## 0.22.3 (Apr 19, 2017) ### refactor - add mathSign in DataUtils to replace Math.sign ## 0.22.2 (Apr 18, 2017) ### fix - fix spelling error of fillOpacity - fix bug of axis when has duplicated ticks ## 0.22.1 (Apr 13, 2017) ### feat - Add legendType: ‘none’ to not render coresponding legend item - use prop-types instead of React.PropTypes ### fix - Fix re-rendering element bug when adding new elements - Fix circular dependence of Brush.js and LineChart.js ## 0.22.0 (Apr 05, 2017) ### feat - Add event handlers to component Dot - Support embedded chart as a panoram in Brush - Add props reversed to `XAxis` and `YAxis` to reverse the range of axis ### fix - Fix error or time scale ## 0.21.2 (Mar 01, 2017) ### fix - fix ticks for specified domain ## 0.21.1 (Feb 28, 2017) ### fix - Update recharts-scale to fix bug of ticks ## 0.21.0 (Feb 28, 2017) ### feat - Support band area and band bar - support customized horizontal line and vertical line in CartesianGrid - support customized events in ReferenceArea, ReferenceLine - add formatter in `Legend` ### fix - Fix empty tick when category axis has nil values - fix the propTypes of fontSize - support props dx and dy in Text - fix bug of stacked bar when spcify domain of axis - fix the barSize of bars in `<Bar />` when too many bars ## 0.20.8 (Feb 15, 2017) ### fix - Fix bug when onBBoxUpdate of Legend is null ## 0.20.7 (Feb 15, 2017) ### fix - Fix stack chart when only have one stacked element - Fix the offset when the boundary box update - Fix position of XAxis in ScatterChart when the orientation is right - Use DataUtils.uniqueId to replace lodash.uniqueId ### feat - Add props `mirror` in XAxis and YAxis, support mirror ticks - Add props iconType to the props of Legend which can specify the icon type of legend ## 0.20.6 (Feb 08, 2017) ### fix - Fix `dataStartIndex` and `dataEndIndex` of synchronized chart - Use lodash.uniqueId to produce the id of Pie ## 0.20.5 (Jan 17, 2017) ### fix - fix "Maximum call stack size exceeded error" caused by Tooltip update ## 0.20.4 (Jan 17, 2017) ### fix - Animate of Tooltip may crash browser sometimes, use style transition to do the animation of tooltip ## 0.20.3 (Jan 17, 2017) ### fix - Fix Tooltip in ScatterChart - Fix radius of Rectangle when height < 0 ### feat - Add clip path in Area, Bar and Scatter - Add onMouseDown and onMouseUp hooks in generateCategoricalChart ### chore - Disable babel transform es2015 modules to commonjs for es6 build - Use cross-env to support windows builds, likewise downgrade linebreak-style to warning - Update release.sh ## 0.20.2 (Jan 05, 2017) ### fix - remove opacity in ErrorBar - fix `Tooltip` when `coordinate` is null ### feat - add props `basevalue` in `AreaChart` - add clipPath when xAxis or yAxis of `Line` allow data overflow - allow dataKey to be a map function - support Tooltip in Sankey and Tooltip - Allow Brush to set default startIndex and endIndex ## 0.20.1 (Dec 27, 2016) ### fix - Fix bug of `isChildrenEqual` when component has child `null` - Adjust `barGap` when `bandSize` is too small to display bars ### feat - Add props `payload` and `value`, update props `index` in `activeDot` of `Line`, `Area` ### refactor - Move polyfill of `Math.sign` to polyfill.js ## 0.20.0 (Dec 26, 2016) ### feat - Support `ErrorBar` in `Line`, `Area`, `Bar`, `Scatter` - Support touch event in `LineChart`, `AreaChart`, `BarChart` - Add props `throttleDelay` in `LineChart`, `AreaChart`, `BarChart` for performance - Support cornerRadius in Sector, RadialBar and Pie - Support events in CartesianAxis, PolarAngleAxis, PolarRadiusAxis - Support touch events in Brush ### refactor - Use `getStringSize` to calculate the width of `Text` - Refactor children comparsion in `generateCategoricalChart`, and add updateId to force Brush update when children update - Refactor `getMouseInfo` to remove some duplicated codes in `generateCategoricalChart` - Refactor Tooltip and Legend, remove react-dom-server ### fix - Fix the `chartId` in `handleReceiveSyncEvent` of `generateCategoricalChart` ## 0.19.1(Dec 15, 2016) ### fix - Adding missing event propTypes - support x, y of `Text` are number or text - fix proptypes of Scatter to allow that the props `data` can be a array of array - fix server side render check `isSsr` - remove duplicated "square" in legendType - fix `getStringSize` when server side rendering check fails - fix animation error when update Line which has props stroke-dasharray - fix bug of BarChart when add stackId in only one Bar and update test cases ## 0.19.0 (Nov 23, 2016) ### refactor - remove unneed `Animate` in `Bar` and `Rectangle` - refactor interval of `CartesianAxis`, support "preserveStart", "preserveEnd", "preserveStartEnd" - add payload in the `Tooltip` and `Scatter` of `ScatterChart`, and unify the payload of Components ### feat - `RadialBar` support events triggered on the entire bar - support customized lable in `RadialBar` - support `maxHeight` in `ResponsiveContianer` ### fix - fix multiple y-axes breaks chart when plotting only single datum - Relax propTypes.ticks in CartesianAxis ## 0.18.0 (Nov 15, 2016) ### feat - support customized scale function of categorical charts - support customized events in Legend ### refactor - refactor ResponsiveContainer with ReactResizeDetector - change the default value of isAnimationActive - remove some unneed default attributes of Components ### fix - fix wrong written default props - fix twice triggered event in Bar - fix treemap stroke pollution cause by defaultProps ## 0.17.0 | 0.17.1 (Nov 08, 2016) ### fix - fix strokeDasharray of Line - add payload in Legend payload item - fix position of vertical Legend - Recalculate points after width or height change ### refactor - refactor ticks filter algorithm of CartesianAxis - change order of stacked BarChart and AreaChart - refactor event handlers of PieChart, RadarChart, Brush, RadialBarChart - support onMouseEnter, onMouseLeave, onMouseMove, onClick in categorical chart ## 0.16.2 (Nov 04, 2016) ### fix - fix dash line animation - fix the bug when the children of categorical chart change ### feat - support shape in ReferenceLine ### refactor - render Bar, Area, Line according to the order of Bar, Area, Line in ComposedChart ## 0.16.1 (Nov 03, 2016) ### fix - refactor to treat NaN like undefined or null, fix #303 - fix tranform origin of Bar, fix #292 ### feat - support customized position of Tooltip, fix #31 ### docs - fix LodashModuleReplacementPlugin ## 0.16.0 (Nov 03, 2016) ### refactor - Major Performance Change - Re-Use Expensive To Generate Data ### feat - support both x-axis and y-axis are numerical axis, fix #183 - add animation events in `Line`, `Area`, `Bar` ### fix - fix angle of PolorRadiusAxis ## 0.15.3 (Oct 28, 2016) ### feat - Add angle property to PRESENTATION_ATTRIBUTES (#307) ### Dev - chore: update istanbul plugin and add yarn.lock ## 0.15.2 (Oct 13, 2016) ### Fix - support empty margin in generateCategoricalChart - fix the label of RadialBarChart - fix the bug of `<Text>{0}</Text>` - fix the bug of ScatterChart when margin lose some attributes ### Feat - support maxBarSize in BarChart and Bar - support fill in CartesianGrid ### Refactor - simplify the calculation of width and height when specified aspect ## 0.15.1 (Sep 26, 2016) ### fix - Fix label/tick vertical alignment of Text ## 0.15.0 (Sep 23, 2016) ### feat - New Component `Text` ### refactor - Fix possible memory leak warning of events ### fix - minPointSize working when value is 0 - Restored support for discrete values in Line and Area charts - Allowed for strings to be used as axis id in the ScatterChart ## 0.14.2 (Sep 19, 2016) ### Fix - Stop caching span in memory of getStringSize - Fix the bug of LineChart and ScaterChart when some data is null or undefined ### feat - ScatterChart support for attributes using data and Cell ## 0.14.1 (Sep 12, 2016) - Fix webpack.config.js ## 0.14.0 (Sep 12, 2016) ### Feat - allow label function to return a string - Pass entry to formatter function - Support labels in ScatterChart axis - Add dataKey in the payload of Legend - support allowDataOverflow in XAxis, YAxis, PolarRadiusAxis ### Refactor - Refactor the received props of Surface ### Fix - Fixed up handling of nulls for domain creation - Stopped domain calculation reverting to 0 for missing data points - Fix the bug of stacked areas which have yAxisId different from "0" - Fix the spelling error of AniamtionDecorator ### Docs - Update webpack.config.js, to support AMD ## 0.13.4 (Aug 24, 2016) ### Feat - Add cartesian Component ReferenceArea ### Refactor - Refactor ResponsiveContainer and support minHeight, minWidth, aspect in ResponsiveContainer ### Fix - Fix the position of Bar for charts which have multiple y-axes ## 0.13.3 (Aug 17, 2016) ### Feat - Support the functionality that syncs multiple categorical charts when mouse enter, move, leave a chart, or when change the brush of one chart ### Fix - Fix the bug of stack offset function - "sign" - Fix the propTypes or legendType ## 0.13.2 (Aug 15, 2016) ### Feat - Add an option "sign" to the props stackOffset in BarChart and AreaChart which allows the bars and areas to be stacked according to the sign of value. ### Fix - Fix the the bug of legend in ScatterChart and refactor symbols. ## 0.13.1 (Aug 08, 2016) ### Fix - Fix the bug that tooltip did not show up for pie chart while using nameKey and valueKey ### Refactor - Refactor Brush as controlled component ## 0.13.0 (Aug 03, 2016) ### Fix - Ensured all tooltip-related state gets reset upon receiving new data for all the charts ### feat - Support smooth curve in Scatter - Support props connectNulls in Area, Line, and Curve, ### refactor - Refactor animation of Area ## 0.12.8 (Aug 01, 2016) ### fix - Fix the bug of getTicksOfScale - Fix the bug of radius of ClipPath is so small that some texts of Pie is covered ## 0.12.7 (July 25, 2016) ### feat - Add itemSorter to tooltips - add props allowDecimals in XAxis and YAxis ## 0.12.6 (July 21, 2016) ### feat - Support Tooltip of RadarChart ### fix - Fix the initial value of state isAnimationFinished in Line and Area - Fix the spelling error, pressentation => presentation (CartesianAxis) - Tweak text in RadarSpec ## 0.12.5 (July 12, 2016) ### feat - Add paddingAngle in Pie, fix #142 ### deps - update version of react, fix #138, fix #103 ## 0.12.4 (July 8, 2016) ### fix - Fix the bug of calculation accuracy in IE(Sector) - Remove unneed props "formatter" in Area and Bar - Fix props which can be supported by html tags and svg tags ### refactor - Support multiple activeIndex in Pie ### deps - Update d3-scale and d3-shape to the latest version - Update version of react-smooth and recharts-scale - Restrict the version of react to '~15.1.0' ## 0.12.3 (June 30, 2016) ### fix - Fix the bug that no animation when data change, but points of Line are the same ### refactor - Remove xAxisMap and yAxisMap in ReferenceDot and ReferenceLine ## 0.12.2 (June 29, 2016) ### feat - Add margin props in Sankey to avoid outer-clip - Add shape props in ReferenceDot ### fix - Fix the width and height of wrapper ## 0.12.1 (June 24, 2016) ### fix - Fix the bug with a hack method that global css will affect the width and height of Legend, Tooltip ## 0.12.0 (June 23, 2016) ### feat - Add padding in XAxis and YAxis - Support minPointSize in Bar - Support "dataMin - 110" and "dataMax + 100" in the domain of numeric axis ### refactor - Refactor Treemap, change ratio to aspectRatio ### fix - Fix the bug of axisId in BarChart - Fix the bug of tooltip's position in BarChart - Fix PropTypes of `type` in `Area` ## 0.11.0 (June 17, 2016) ### feat - Add Sankey ### fix - Fix the bug of Area when the data break off in some points - Fix the bug of ticks when 0 in ticks ### refactor - Refactor the payload of tooltip, and the props of activeDot in AreaChart ## 0.10.10 (June 13, 2016) ### fix - Fix the position of labels in Bar ## 0.10.9 (June 12, 2016) ### refactor - Use react-container-dimensions to refactor ResponsiveContainer, close #104, close #105 ## 0.10.8 (June 2, 2016) ### feat - Support any svg elements in the charts, such as defs, linearGradient ## 0.10.7 (May 30, 2016) ### fix - Fix the bug of Brush when data or the size of container changes. ## 0.10.6 (May 25, 2016) ### feat - Add customized event handlers in BarChart - Add curveMonotoneX and curveMonotoneY in Curve and Line - Pass stackOffset type as an optional parameter for categorical chart - Add `isFront` in ReferenceLine and ReferenceDot to support auxiliary information at differents z-index ### fix - Fix legend position with margin ## 0.10.5 (May 9, 2016) ### feat - Support more interpolations in Curve, Line - Allow to set custom tick formatter function for Brush start/end index ## 0.10.4 (May 5, 2016) ### feat - support animation when data update ### refactor - refactor event handlers in charts ### fix - fix tooltip position in BarChart ## 0.10.3 (May 4, 2016) ### fix - fix bug of ReactUtils in Firefox 31 ## 0.10.2 (May 4, 2016) ### refactor - refactor data in Pie which was modified internally ## 0.10.1 (April 27, 2016) ### feat - Support Tooltip in Treemap ### fix - Rename `Symbol` to `Symbols` - Fix the key of `activeDot` in `AreaChart` ## 0.10.0 (April 21, 2016) ### refactor - Refactor *ticks* specified in `XAxis`, `YAxis` - Use area of `Symbol` to show the size of number in ScatterChart - Refactor the `activeShape` in `Scatter` ### feat - Add `Symbol` and support different `Symbol` in ScatterChart ### fix - Fix the content of legend in `PieChart` - Fix the crush bug when categorical axis has duplicate labels - Fix the bug of calculating tick width ## 0.9.3 (April 12, 2016) ### deps - Update react-smooth to 0.1.4 ## 0.9.2 (April 12, 2016) ### deps - Update react to 15.0.0 ## 0.9.1 (April 8, 2016) ### fix - Fix the bug of bar animation ### deps - update version of rechats-scale, and babel-eslint ## 0.9.0 (April 7, 2016) ### refactor - Remove default event handler in Pie, and add `activeIndex` to let user control the active sector - Remove detectElementResize - Add activeDot in Line and Area ### fix - Fix the bug of updating line when the length of line is zero at first - Fix the base value of AreaChart which was set to be 0 before ## 0.8.8 (March 25, 2016) ### refactor - Support fixed value of width or height in ResponsiveContainer ## 0.8.7 (March 21, 2016) ### refactor - Don't overwrite payload in Legend when customized payload has been setted ## 0.8.6 (March 09, 2016) ### refactor - Use detectElementResize in react-virtualized to refactor ResponsiveContainer ### fix - Fix ssr render bug of CartesianAxis ## 0.8.5 (March 08, 2016) ### feat - Add support of function type customized element ### fix - fix the props labelLine in Pie - fix the bug of PureRender ### test - Add more test cases ## 0.8.4 (March 02, 2016) ### refactor - Refactor the implementation type of renderPolygon in `Radar` - Refactor code in `Treemap` - Remove `invariant` and add `LogUtils` ### feat - Add animation of Area, Radar, RadialBar, Scatter - Add label formatter to default tooltip - Add props labelLine in `Pie` - Add Cell of `Pie` to set different options for each sector - Add Cell support in `Bar`, `RadialBar` ### fix - Fix Pie chart Label position, When using custom label It was not rendering as part of the curve group. - Fix `isAnimationActive` props in `Area` ## 0.8.3 (February 25, 2016) ### refactor - refactor CartesianChart to a high order component, move some function to /util/CartesianUtils which can be used in ScatterChart. - Simplify ComposedChart, remove duplicated code - use `filterEventAttributes` to add events props - cancel selecting line and area in LineChart, AreaChart, ComposedChart ## 0.8.2 (February 24, 2016) ### fix - rollback last fix of Line animation from value ## 0.8.1 (February 24, 2016) ### fix - fix the bug of Line animation from value ## 0.8.0 (February 22, 2016) ### feat - implement ReferenceDot in cartesian charts - support alwaysShow of ReferenceLine and ReferenceDot ### refactor - refactor domain of CartesianAxis and PolarRadiusAxis - refactor this props name in ReferenceLine ### fix - fix the bug of calculate extent in RadarChart - fix some bugs of server side rendering when document is called ## 0.7.0 (February 17, 2016) ### UI - feat: support dasharray line animation - refactor(CartesianAxis, PolarAngleAxis, PolarRadiusAxis):rename label to tick - feat(label): add label of CartesianAxis, PolarRadiusAxis, ReferenceLine - feat: Implement tooltip for PieChart - feat:Implement tooltip for RadialBarChart - deps(d3-scale,d3-shape,oui-dom-util): 1.update version of d3-scale, d3-shape, oui-dom-util 2.update some api of d3-scale ## 0.6.3 (February 10, 2016) ### UI - refactor(Legend): refactor the location of legend - fix(CartesianChart,CartesianAxis): 1. fix the bug of dataStartIndex && dataEndIndex when the length of data was changed 2. fix the default value of tickFormatter - fix(cartesian/Line.js): fix Line animation bug ## 0.6.2 (February 9, 2016) ### UI - feat: use lodash `isEqual` write new pureRender ## 0.6.1 (February 5, 2016) ### UI - fix(Pie, RadialBarChart): fix the default value of cx, cy, innerRadius, outerRadius ## 0.6.0 (February 5, 2016) ### UI - refactor: rename AdaptionWrapper to ResponsiveContainer - refactor: delete some repeated codes, and use polarToCartesian in PolarUtils - fix: update the defaultProps of cx, cy, innerRadius, outerRadius - fix(Sector, AdaptionWrapper):1. fix the bug of Sector when innerRadius is 0 2. fix the bug of unbind event when component is unmounted - feat(util): use lodash replace utils ## 0.5.2 (February 4, 2016) ### UI - fix(RadarChart): fix the bug of unreasonable default value for radius in PolarAngleAxis ### Docs - chore: change main and jsnext:main in package.json ## 0.5.1 (February 4, 2016) ### UI - feat: support percentage string in the props(cx, cy, innerRadius, outerRadius) of RadarChart, PieChart, RadialChart - fix(PolarRadiusAxis): add props domain - refactor(CartesianAxis): remove unneeded props domain ### Docs - chore: optimize npm script commands - chore: update pkg ## 0.5.0 (February 3, 2016) ### UI - feat(AdaptionWrapper): add AdaptionWrapper to make charts adapt to the size of parent dom - refactor: directory structure adjustment - fix(LineChart, CartesianChart): 1.fix the bug of margin when only part of the attributes are specified 2.fix the bug of number axis when domain is specified 3.fix the bug of category number when no dataKey is specified 4.format the code in README.md - refactor(treemap): support tree structure data; changed props that pass to shape ### Test - test: 1.rename some test files 2.add test case of LodashUtil - test(treemap): modified treemap test ### Docs - deps: add dependence oui-dom-utils - chore(README.md): add syntax highlighting to the readme - chore(package.json): add keyword react-component ## 0.4.9 (February 2, 2016) ### UI - refactor(CartesianAxis, PolarAngleAxis): change props name "orient" to "orientation" - refactor(Line, Bar, Pie): refactor animation using new react-smooth - refactor(Pie, RidalBar): remove the props clockWise, and add the props endAngle ### Test - test(Line, Bar, Radar, Scatter): add test case ## 0.4.7 (February 1, 2016) ### UI - refactor(RadarChart, Radar, PolarAngleAxis, PolarRadiusAxis): refactor the components of Radar - refactor(classNames): refactor the method of package a className - refactor(Pie): add nameKey in Pie ## 0.4.6 (January 29, 2016) ### UI - refactor(Legend): refactor the legend in all the charts, change the location method of legend - feat(radar): add new RadarChart with the new component used in Chart, like PolarAngleAxis PolarRadiusAxis PolarGrid Polygon ex ### Test - feat(test): add test for charts, chartWrappers, components, and shapes ## 0.4.5 (January 29, 2016) ### UI - fix(Curve): fix the bug of curve defined function - fix(ComposedChart): fix the bug of bar position when a line and a bar display a same group of data. - chore(webpack.config.js): add react, react-dom, react-dom-server to external - deps(react, react-dom): update version to v0.14.7 ## 0.4.4 (January 28, 2016) ### Dev - chore(webpack.config.js): add build command ## 0.4.3 (January 28, 2016) ### UI - deps(recharts-scale, react-smooth): update version of recharts-scale and react-smooth - refactor(Bar, RadialBar, TreemapChart, Tooltip): rename the props customContent ## 0.4.2 (January 28, 2016) ### UI - Add support of stack value in BarChart, AreaChart, ComposedChart ## 0.4.1 (January 27, 2016) ### UI - Change name of the props in Tooltip, Legend - Fix the bug of customized label element in CartesianAxis - Remove repeated, meaningless constructor functions ## 0.4.0 (January 26, 2016) ### UI - Refactor some components, include CartesianAxis, Legend, Tooltip etc, to unify some props name.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/recharts/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/recharts/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 45881 }
# Contributing to Recharts We'd love for you to contribute to our source code and to make Recharts even better than it is today! Here are the guidelines we'd like you to follow: - [Issues and Bugs](#issues) - [Testing](#testing) - [Pull Requests](#pr) - [Code Guide](#code) - [License](#license) ## Ongoing Initiatives We use Github Discussion to organize our discussion along new initiatives and organize ourselves. Please do check the [announcements](https://github.com/recharts/recharts/discussions/categories/announcements) section for an overview of recent initiatives. ## <a name="issues"></a>Issues and Bugs ### Where to Find Known Issues We will be using [GitHub Issues](https://github.com/recharts/recharts/issues) for our bugs and feature requests. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new task, try to make sure your problem doesn't already exist. ### Reporting New Issues The best way to get your bug fixed is to provide a reduced test case. codesandbox provide a way to give live examples. You can fork our example in [recharts.org](http://recharts.org/) to show your case. ## <a name="testing"></a>Testing We do cherish tests. They help us move swiftly, and release with confidence. In our repo, you will find three types of tests: Unit tests, rendering tests with RTL, and user interaction tests in storybook. Wherever possible we prefer the simplest tests - unit tests. Only where needed / useful we would use RTL or storybook tests. ### Unit tests When implementing a new feature we would prefer to extract pure helper function for data processing. Such functions are found a few utils files. An example is `test/util/ShallowEqual.spec.ts` ### React Testing Library Some behaviour must be tested upon rendering, such as interactions between components (Line, Tooltip), see `test/component/Tooltip.spec.tsx` for an example. ### Storybook Test Runner Storybook also has a great interface for adding tests. By default every story in storybook is a smoke test (rendering without error logs means the test passed). Additionally, it is possible to add actual tests as play functions with an assert to a story. This will often be easier than using React Testing Library, because the natural test debugging tool is Storybook itself. See for example `storybook/stories/Examples/cartesian/ReferenceLine/ReferenceLineIfOverflow.stories.tsx` ### Performance tests Recharts uses (https://callstack.github.io/reassure/)[Reassure] to run performance tests. Here is how to use: 1. Before making code changes, run `npm run test:perf:baseline`. This will generate baseline data. You only do this once for each change. 2. Make your code changes now 3. Run `npm test:perf`. Reassure will run tests again, compare with the baseline from step 1. and print results to the console. If you wish you can also review the results in a markdown file in path `./reassure/output.md`. 4. If you are satisfied with the performance impact then go ahead and commit! If you wish to make more changes go back to step 2. Reassure will look for `*.perf-test.tsx` files by default. Also be aware that the performance tests might take a long time to run; up to several minutes. ## <a name="pr"></a>Pull Requests **Working on your first Pull Request?** You can learn how from this _free_ series [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github) _Before_ submitting a pull request, please make sure the following is done… - Search [GitHub](https://github.com/recharts/recharts/pulls) for an open or closed Pull Request that relates to your submission. You don't want to duplicate effort. - Fork the repo and create your branch from `master`. - If you have added functionality or changed existing functionality, be sure to add a test. Ideally a unit test for helper function, or a test that includes rendering with RTL. - If you've changed APIs, make sure that the stories in Storybook are working as expected. - Ensure the test suite passes (`npm run test`). - Make sure your code lints (`npm run lint`) - we've done our best to make sure these rules match our internal linting guidelines. ## <a name="code"></a>Code Guide Our linter will catch most styling issues that may exist in your code. You can check the status of your code styling by running: `npm run lint` However, there are still some styles that the linter cannot pick up. If you are unsure about something, looking at [Airbnb's Style Guide](https://github.com/airbnb/javascript) will guide you in the right direction. ## <a name="license"></a>License By contributing to Recharts, you agree that your contributions will be licensed under its MIT license.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/recharts/CONTRIBUTING.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/recharts/CONTRIBUTING.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 4796 }
# Recharts [![storybook](https://raw.githubusercontent.com/storybooks/brand/master/badge/badge-storybook.svg)](https://release--63da8268a0da9970db6992aa.chromatic.com/) [![Build Status](https://github.com/recharts/recharts/workflows/Node.js%20CI/badge.svg)](https://github.com/recharts/recharts/actions) [![Coverage Status](https://coveralls.io/repos/recharts/recharts/badge.svg?branch=master&service=github)](https://coveralls.io/github/recharts/recharts?branch=master) [![npm version](https://badge.fury.io/js/recharts.svg)](http://badge.fury.io/js/recharts) [![npm downloads](https://img.shields.io/npm/dm/recharts.svg?style=flat-square)](https://www.npmjs.com/package/recharts) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](/LICENSE) ## Introduction Recharts is a **Redefined** chart library built with [React](https://facebook.github.io/react/) and [D3](http://d3js.org). The main purpose of this library is to help you to write charts in React applications without any pain. Main principles of Recharts are: 1. **Simply** deploy with React components. 2. **Native** SVG support, lightweight depending only on some D3 submodules. 3. **Declarative** components, components of charts are purely presentational. Documentation at [recharts.org](https://recharts.org) and our [storybook (WIP)](https://release--63da8268a0da9970db6992aa.chromatic.com/) Please see [the wiki](https://github.com/recharts/recharts/wiki) for FAQ. All development is done on the `master` branch. The current latest release and storybook documentation reflects what is on the `release` branch. ## Examples ```jsx <LineChart width={400} height={400} data={data} margin={{ top: 5, right: 20, left: 10, bottom: 5 }}> <XAxis dataKey="name" /> <Tooltip /> <CartesianGrid stroke="#f5f5f5" /> <Line type="monotone" dataKey="uv" stroke="#ff7300" yAxisId={0} /> <Line type="monotone" dataKey="pv" stroke="#387908" yAxisId={1} /> </LineChart> ``` All the components of Recharts are clearly separated. The lineChart is composed of x axis, tooltip, grid, and line items, and each of them is an independent React Component. The clear separation and composition of components is one of the principle Recharts follows. ## Installation ### npm NPM is the easiest and fastest way to get started using Recharts. It is also the recommended installation method when building single-page applications (SPAs). It pairs nicely with a CommonJS module bundler such as Webpack. ```sh # latest stable $ npm install recharts ``` ### umd The UMD build is also available on unpkg.com: ```html <script src="https://unpkg.com/react/umd/react.production.min.js"></script> <script src="https://unpkg.com/react-dom/umd/react-dom.production.min.js"></script> <script src="https://unpkg.com/recharts/umd/Recharts.min.js"></script> ``` Then you can find the library on `window.Recharts`. ### dev build ```sh $ git clone https://github.com/recharts/recharts.git $ cd recharts $ npm install $ npm run build ``` ## Demo To examine the demos in your local build, execute: ```sh $ npm run[-script] demo ``` and then browse to http://localhost:3000. ## Storybook We are in the process of unifying documentation and examples in storybook. To run it locally, execute ```sh $ npm run[-script] storybook ``` and then browse to http://localhost:6006. ## Releases [Releases](https://github.com/recharts/recharts/releases) are automated via GH Actions - when a new release is created in GH, CI will trigger that: 1. Runs a build 2. Runs tests 3. Runs `npm publish` Version increments and tagging are not automated at this time. ### Release testing Until we can automate more, it should be preferred to test as close to the results of `npm publish` as we possibly can. This ensures we don't publish unintended breaking changes. One way to do that is using `yalc` - `npm i -g yalc`. 1. Make your changes in recharts 2. `yalc publish` in recharts 3. `yalc add recharts` in your test package (ex: in a vite or webpack reach app with recharts installed, imported, and your recent changes used) 4. `npm install` 5. Test a local run, a build, etc. ## Module Formats - [babel-plugin-recharts](https://github.com/recharts/babel-plugin-recharts) A simple transform to cherry-pick Recharts modules so you don’t have to. **Note: this plugin is out of date and may not work with 2.x** ## Thanks <a href="https://www.chromatic.com/"><img src="https://user-images.githubusercontent.com/321738/84662277-e3db4f80-af1b-11ea-88f5-91d67a5e59f6.png" width="153" height="30" alt="Chromatic" /></a> Thanks to [Chromatic](https://www.chromatic.com/) for providing the visual testing platform that helps us review UI changes and catch visual regressions. ## License [MIT](http://opensource.org/licenses/MIT) Copyright (c) 2015-2023 Recharts Group.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/recharts/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/recharts/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 4835 }
# regenerator-runtime Standalone runtime for [Regenerator](https://github.com/facebook/regenerator)-compiled generator and `async` functions. To import the runtime as a module (recommended), either of the following import styles will work: ```js // CommonJS const regeneratorRuntime = require("regenerator-runtime"); // ECMAScript 2015 import regeneratorRuntime from "regenerator-runtime"; ``` To ensure that `regeneratorRuntime` is defined globally, either of the following styles will work: ```js // CommonJS require("regenerator-runtime/runtime"); // ECMAScript 2015 import "regenerator-runtime/runtime.js"; ``` To get the absolute file system path of `runtime.js`, evaluate the following expression: ```js require("regenerator-runtime/path").path ```
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/regenerator-runtime/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/regenerator-runtime/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 760 }
# regexparam [![CI](https://github.com/lukeed/regexparam/actions/workflows/ci.yml/badge.svg)](https://github.com/lukeed/regexparam/actions/workflows/ci.yml) > A tiny (399B) utility that converts route patterns into RegExp. Limited alternative to [`path-to-regexp`](https://github.com/pillarjs/path-to-regexp) 🙇 With `regexparam`, you may turn a pathing string (eg, `/users/:id`) into a regular expression. An object with shape of `{ keys, pattern }` is returned, where `pattern` is the `RegExp` and `keys` is an array of your parameter name(s) in the order that they appeared. Unlike [`path-to-regexp`](https://github.com/pillarjs/path-to-regexp), this module does not create a `keys` dictionary, nor mutate an existing variable. Also, this only ships a parser, which only accept strings. Similarly, and most importantly, `regexparam` **only** handles basic pathing operators: * Static (`/foo`, `/foo/bar`) * Parameter (`/:title`, `/books/:title`, `/books/:genre/:title`) * Parameter w/ Suffix (`/movies/:title.mp4`, `/movies/:title.(mp4|mov)`) * Optional Parameters (`/:title?`, `/books/:title?`, `/books/:genre/:title?`) * Wildcards (`*`, `/books/*`, `/books/:genre/*`) * Optional Wildcard (`/books/*?`) This module exposes three module definitions: * **CommonJS**: [`dist/index.js`](https://unpkg.com/regexparam/dist/index.js) * **ESModule**: [`dist/index.mjs`](https://unpkg.com/regexparam/dist/index.mjs) * **UMD**: [`dist/index.min.js`](https://unpkg.com/regexparam/dist/index.min.js) ## Install ``` $ npm install --save regexparam ``` ## Usage ```js import { parse, inject } from 'regexparam'; // Example param-assignment function exec(path, result) { let i=0, out={}; let matches = result.pattern.exec(path); while (i < result.keys.length) { out[ result.keys[i] ] = matches[++i] || null; } return out; } // Parameter, with Optional Parameter // --- let foo = parse('/books/:genre/:title?') // foo.pattern => /^\/books\/([^\/]+?)(?:\/([^\/]+?))?\/?$/i // foo.keys => ['genre', 'title'] foo.pattern.test('/books/horror'); //=> true foo.pattern.test('/books/horror/goosebumps'); //=> true exec('/books/horror', foo); //=> { genre: 'horror', title: null } exec('/books/horror/goosebumps', foo); //=> { genre: 'horror', title: 'goosebumps' } // Parameter, with suffix // --- let bar = parse('/movies/:title.(mp4|mov)'); // bar.pattern => /^\/movies\/([^\/]+?)\.(mp4|mov)\/?$/i // bar.keys => ['title'] bar.pattern.test('/movies/narnia'); //=> false bar.pattern.test('/movies/narnia.mp3'); //=> false bar.pattern.test('/movies/narnia.mp4'); //=> true exec('/movies/narnia.mp4', bar); //=> { title: 'narnia' } // Wildcard // --- let baz = parse('users/*'); // baz.pattern => /^\/users\/(.*)\/?$/i // baz.keys => ['*'] baz.pattern.test('/users'); //=> false baz.pattern.test('/users/lukeed'); //=> true baz.pattern.test('/users/'); //=> true // Optional Wildcard // --- let baz = parse('/users/*?'); // baz.pattern => /^\/users(?:\/(.*))?(?=$|\/)/i // baz.keys => ['*'] baz.pattern.test('/users'); //=> true baz.pattern.test('/users/lukeed'); //=> true baz.pattern.test('/users/'); //=> true // Injecting // --- inject('/users/:id', { id: 'lukeed' }); //=> '/users/lukeed' inject('/movies/:title.mp4', { title: 'narnia' }); //=> '/movies/narnia.mp4' inject('/:foo/:bar?/:baz?', { foo: 'aaa' }); //=> '/aaa' inject('/:foo/:bar?/:baz?', { foo: 'aaa', baz: 'ccc' }); //=> '/aaa/ccc' inject('/posts/:slug/*', { slug: 'hello', }); //=> '/posts/hello' inject('/posts/:slug/*', { slug: 'hello', '*': 'x/y/z', }); //=> '/posts/hello/x/y/z' // Missing non-optional value // ~> keeps the pattern in output inject('/hello/:world', { abc: 123 }); //=> '/hello/:world' ``` > **Important:** When matching/testing against a generated RegExp, your path **must** begin with a leading slash (`"/"`)! ## Regular Expressions For fine-tuned control, you may pass a `RegExp` value directly to `regexparam` as its only parameter. In these situations, `regexparam` **does not** parse nor manipulate your pattern in any way! Because of this, `regexparam` has no "insight" on your route, and instead trusts your input fully. In code, this means that the return value's `keys` is always equal to `false` and the `pattern` is identical to your input value. This also means that you must manage and parse your own `keys`~!<br> You may use [named capture groups](https://javascript.info/regexp-groups#named-groups) or traverse the matched segments manually the "old-fashioned" way: > **Important:** Please check your target browsers' and target [Node.js runtimes' support](https://node.green/#ES2018-features--RegExp-named-capture-groups)! ```js // Named capture group const named = regexparam.parse(/^\/posts[/](?<year>[0-9]{4})[/](?<month>[0-9]{2})[/](?<title>[^\/]+)/i); const { groups } = named.pattern.exec('/posts/2019/05/hello-world'); console.log(groups); //=> { year: '2019', month: '05', title: 'hello-world' } // Widely supported / "Old-fashioned" const named = regexparam.parse(/^\/posts[/]([0-9]{4})[/]([0-9]{2})[/]([^\/]+)/i); const [url, year, month, title] = named.pattern.exec('/posts/2019/05/hello-world'); console.log(year, month, title); //=> 2019 05 hello-world ``` ## API ### regexparam.parse(input: RegExp) ### regexparam.parse(input: string, loose?: boolean) Returns: `Object` Parse a route pattern into an equivalent RegExp pattern. Also collects the names of pattern's parameters as a `keys` array. An `input` that's already a RegExp is kept as is, and `regexparam` makes no additional insights. Returns a `{ keys, pattern }` object, where `pattern` is always a `RegExp` instance and `keys` is either `false` or a list of extracted parameter names. > **Important:** The `keys` will _always_ be `false` when `input` is a RegExp and it will _always_ be an Array when `input` is a string. #### input Type: `string` or `RegExp` When `input` is a string, it's treated as a route pattern and an equivalent RegExp is generated. > **Note:** It does not matter if `input` strings begin with a `/` &mdash; it will be added if missing. When `input` is a RegExp, it will be used **as is** – no modifications will be made. #### loose Type: `boolean`<br> Default: `false` Should the `RegExp` match URLs that are longer than the [`str`](#str) pattern itself?<br> By default, the generated `RegExp` will test that the URL begins and _ends with_ the pattern. > **Important:** When `input` is a RegExp, the `loose` argument is ignored! ```js const { parse } = require('regexparam'); parse('/users').pattern.test('/users/lukeed'); //=> false parse('/users', true).pattern.test('/users/lukeed'); //=> true parse('/users/:name').pattern.test('/users/lukeed/repos'); //=> false parse('/users/:name', true).pattern.test('/users/lukeed/repos'); //=> true ``` ### regexparam.inject(pattern: string, values: object) Returns: `string` Returns a new string by replacing the `pattern` segments/parameters with their matching values. > **Important:** Named segments (eg, `/:name`) that _do not_ have a `values` match will be kept in the output. This is true _except for_ optional segments (eg, `/:name?`) and wildcard segments (eg, `/*`). #### pattern Type: `string` The route pattern that to receive injections. #### values Type: `Record<string, string>` The values to be injected. The keys within `values` must match the `pattern`'s segments in order to be replaced. > **Note:** To replace a wildcard segment (eg, `/*`), define a `values['*']` key. ## Deno As of version `1.3.0`, you may use `regexparam` with Deno. These options are all valid: ```ts // The official Deno registry: import regexparam from 'https://deno.land/x/regexparam/src/index.js'; // Third-party CDNs with ESM support: import regexparam from 'https://cdn.skypack.dev/regexparam'; import regexparam from 'https://esm.sh/regexparam'; ``` > **Note:** All registries support versioned URLs, if desired. <br>The above examples always resolve to the latest published version. ## Related - [trouter](https://github.com/lukeed/trouter) - A server-side HTTP router that extends from this module. - [matchit](https://github.com/lukeed/matchit) - Similar (650B) library, but relies on String comparison instead of `RegExp`s. ## License MIT © [Luke Edwards](https://lukeed.com)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/regexparam/readme.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/regexparam/readme.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 8317 }
# resolve-pkg-maps Utils to resolve `package.json` subpath & conditional [`exports`](https://nodejs.org/api/packages.html#exports)/[`imports`](https://nodejs.org/api/packages.html#imports) in resolvers. Implements the [ESM resolution algorithm](https://nodejs.org/api/esm.html#resolver-algorithm-specification). Tested [against Node.js](/tests/) for accuracy. <sub>Support this project by ⭐️ starring and sharing it. [Follow me](https://github.com/privatenumber) to see what other cool projects I'm working on! ❤️</sub> ## Usage ### Resolving `exports` _utils/package.json_ ```json5 { // ... "exports": { "./reverse": { "require": "./file.cjs", "default": "./file.mjs" } }, // ... } ``` ```ts import { resolveExports } from 'resolve-pkg-maps' const [packageName, packageSubpath] = parseRequest('utils/reverse') const resolvedPaths: string[] = resolveExports( getPackageJson(packageName).exports, packageSubpath, ['import', ...otherConditions] ) // => ['./file.mjs'] ``` ### Resolving `imports` _package.json_ ```json5 { // ... "imports": { "#supports-color": { "node": "./index.js", "default": "./browser.js" } }, // ... } ``` ```ts import { resolveImports } from 'resolve-pkg-maps' const resolvedPaths: string[] = resolveImports( getPackageJson('.').imports, '#supports-color', ['node', ...otherConditions] ) // => ['./index.js'] ``` ## API ### resolveExports(exports, request, conditions) Returns: `string[]` Resolves the `request` based on `exports` and `conditions`. Returns an array of paths (e.g. in case a fallback array is matched). #### exports Type: ```ts type Exports = PathOrMap | readonly PathOrMap[] type PathOrMap = string | PathConditionsMap type PathConditionsMap = { [condition: string]: PathConditions | null } ``` The [`exports` property](https://nodejs.org/api/packages.html#exports) value in `package.json`. #### request Type: `string` The package subpath to resolve. Assumes a normalized path is passed in (eg. [repeating slashes `//`](https://github.com/nodejs/node/issues/44316)). It _should not_ start with `/` or `./`. Example: if the full import path is `some-package/subpath/file`, the request is `subpath/file`. #### conditions Type: `readonly string[]` An array of conditions to use when resolving the request. For reference, Node.js's default conditions are [`['node', 'import']`](https://nodejs.org/api/esm.html#:~:text=defaultConditions%20is%20the%20conditional%20environment%20name%20array%2C%20%5B%22node%22%2C%20%22import%22%5D.). The order of this array does not matter; the order of condition keys in the export map is what matters instead. Not all conditions in the array need to be met to resolve the request. It just needs enough to resolve to a path. --- ### resolveImports(imports, request, conditions) Returns: `string[]` Resolves the `request` based on `imports` and `conditions`. Returns an array of paths (e.g. in case a fallback array is matched). #### imports Type: ```ts type Imports = { [condition: string]: PathOrMap | readonly PathOrMap[] | null } type PathOrMap = string | Imports ``` The [`imports` property](https://nodejs.org/api/packages.html#imports) value in `package.json`. #### request Type: `string` The request resolve. Assumes a normalized path is passed in (eg. [repeating slashes `//`](https://github.com/nodejs/node/issues/44316)). > **Note:** In Node.js, imports resolutions are limited to requests prefixed with `#`. However, this package does not enforce that requirement in case you want to add custom support for non-prefixed entries. #### conditions Type: `readonly string[]` An array of conditions to use when resolving the request. For reference, Node.js's default conditions are [`['node', 'import']`](https://nodejs.org/api/esm.html#:~:text=defaultConditions%20is%20the%20conditional%20environment%20name%20array%2C%20%5B%22node%22%2C%20%22import%22%5D.). The order of this array does not matter; the order of condition keys in the import map is what matters instead. Not all conditions in the array need to be met to resolve the request. It just needs enough to resolve to a path. --- ### Errors #### `ERR_PACKAGE_PATH_NOT_EXPORTED` - If the request is not exported by the export map #### `ERR_PACKAGE_IMPORT_NOT_DEFINED` - If the request is not defined by the import map #### `ERR_INVALID_PACKAGE_CONFIG` - If an object contains properties that are both paths and conditions (e.g. start with and without `.`) - If an object contains numeric properties #### `ERR_INVALID_PACKAGE_TARGET` - If a resolved exports path is not a valid path (e.g. not relative or has protocol) - If a resolved path includes `..` or `node_modules` - If a resolved path is a type that cannot be parsed ## FAQ ### Why do the APIs return an array of paths? `exports`/`imports` supports passing in a [fallback array](https://github.com/jkrems/proposal-pkg-exports/#:~:text=Whenever%20there%20is,to%20new%20cases.) to provide fallback paths if the previous one is invalid: ```json5 { "exports": { "./feature": [ "./file.js", "./fallback.js" ] } } ``` Node.js's implementation [picks the first valid path (without attempting to resolve it)](https://github.com/nodejs/node/issues/44282#issuecomment-1220151715) and throws an error if it can't be resolved. Node.js's fallback array is designed for [forward compatibility with features](https://github.com/jkrems/proposal-pkg-exports/#:~:text=providing%20forwards%20compatiblitiy%20for%20new%20features) (e.g. protocols) that can be immediately/inexpensively validated: ```json5 { "exports": { "./core-polyfill": ["std:core-module", "./core-polyfill.js"] } } ``` However, [Webpack](https://webpack.js.org/guides/package-exports/#alternatives) and [TypeScript](https://github.com/microsoft/TypeScript/blob/71e852922888337ef51a0e48416034a94a6c34d9/src/compiler/moduleSpecifiers.ts#L695) have deviated from this behavior and attempts to resolve the next path if a path cannot be resolved. By returning an array of matched paths instead of just the first one, the user can decide which behavior to adopt. ### How is it different from [`resolve.exports`](https://github.com/lukeed/resolve.exports)? `resolve.exports` only resolves `exports`, whereas this package resolves both `exports` & `imports`. This comparison will only cover resolving `exports`. - Despite it's name, `resolve.exports` handles more than just `exports`. It takes in the entire `package.json` object to handle resolving `.` and [self-references](https://nodejs.org/api/packages.html#self-referencing-a-package-using-its-name). This package only accepts `exports`/`imports` maps from `package.json` and is scoped to only resolving what's defined in the maps. - `resolve.exports` accepts the full request (e.g. `foo/bar`), whereas this package only accepts the requested subpath (e.g. `bar`). - `resolve.exports` only returns the first result in a fallback array. This package returns an array of results for the user to decide how to handle it. - `resolve.exports` supports [subpath folder mapping](https://nodejs.org/docs/latest-v16.x/api/packages.html#subpath-folder-mappings) (deprecated in Node.js v16 & removed in v17) but seems to [have a bug](https://github.com/lukeed/resolve.exports/issues/7). This package does not support subpath folder mapping because Node.js has removed it in favor of using subpath patterns. - Neither resolvers rely on a file-system This package also addresses many of the bugs in `resolve.exports`, demonstrated in [this test](/tests/exports/compare-resolve.exports.ts).
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/resolve-pkg-maps/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/resolve-pkg-maps/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 7764 }
# Security Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/resolve/SECURITY.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/resolve/SECURITY.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 156 }
# reusify [![npm version][npm-badge]][npm-url] [![Build Status][travis-badge]][travis-url] [![Coverage Status][coveralls-badge]][coveralls-url] Reuse your objects and functions for maximum speed. This technique will make any function run ~10% faster. You call your functions a lot, and it adds up quickly in hot code paths. ``` $ node benchmarks/createNoCodeFunction.js Total time 53133 Total iterations 100000000 Iteration/s 1882069.5236482036 $ node benchmarks/reuseNoCodeFunction.js Total time 50617 Total iterations 100000000 Iteration/s 1975620.838848608 ``` The above benchmark uses fibonacci to simulate a real high-cpu load. The actual numbers might differ for your use case, but the difference should not. The benchmark was taken using Node v6.10.0. This library was extracted from [fastparallel](http://npm.im/fastparallel). ## Example ```js var reusify = require('reusify') var fib = require('reusify/benchmarks/fib') var instance = reusify(MyObject) // get an object from the cache, // or creates a new one when cache is empty var obj = instance.get() // set the state obj.num = 100 obj.func() // reset the state. // if the state contains any external object // do not use delete operator (it is slow) // prefer set them to null obj.num = 0 // store an object in the cache instance.release(obj) function MyObject () { // you need to define this property // so V8 can compile MyObject into an // hidden class this.next = null this.num = 0 var that = this // this function is never reallocated, // so it can be optimized by V8 this.func = function () { if (null) { // do nothing } else { // calculates fibonacci fib(that.num) } } } ``` The above example was intended for synchronous code, let's see async: ```js var reusify = require('reusify') var instance = reusify(MyObject) for (var i = 0; i < 100; i++) { getData(i, console.log) } function getData (value, cb) { var obj = instance.get() obj.value = value obj.cb = cb obj.run() } function MyObject () { this.next = null this.value = null var that = this this.run = function () { asyncOperation(that.value, that.handle) } this.handle = function (err, result) { that.cb(err, result) that.value = null that.cb = null instance.release(that) } } ``` Also note how in the above examples, the code, that consumes an istance of `MyObject`, reset the state to initial condition, just before storing it in the cache. That's needed so that every subsequent request for an instance from the cache, could get a clean instance. ## Why It is faster because V8 doesn't have to collect all the functions you create. On a short-lived benchmark, it is as fast as creating the nested function, but on a longer time frame it creates less pressure on the garbage collector. ## Other examples If you want to see some complex example, checkout [middie](https://github.com/fastify/middie) and [steed](https://github.com/mcollina/steed). ## Acknowledgements Thanks to [Trevor Norris](https://github.com/trevnorris) for getting me down the rabbit hole of performance, and thanks to [Mathias Buss](http://github.com/mafintosh) for suggesting me to share this trick. ## License MIT [npm-badge]: https://badge.fury.io/js/reusify.svg [npm-url]: https://badge.fury.io/js/reusify [travis-badge]: https://api.travis-ci.org/mcollina/reusify.svg [travis-url]: https://travis-ci.org/mcollina/reusify [coveralls-badge]: https://coveralls.io/repos/mcollina/reusify/badge.svg?branch=master&service=github [coveralls-url]: https://coveralls.io/github/mcollina/reusify?branch=master
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/reusify/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/reusify/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 3632 }
# Rollup core license Rollup is released under the MIT license: The MIT License (MIT) Copyright (c) 2017 [these people](https://github.com/rollup/rollup/graphs/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # Licenses of bundled dependencies The published Rollup artifact additionally contains code with the following licenses: MIT, ISC # Bundled dependencies: ## @jridgewell/sourcemap-codec License: MIT By: Rich Harris Repository: git+https://github.com/jridgewell/sourcemap-codec.git > The MIT License > > Copyright (c) 2015 Rich Harris > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## @rollup/pluginutils License: MIT By: Rich Harris Repository: rollup/plugins > The MIT License (MIT) > > Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors) > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## anymatch License: ISC By: Elan Shanker Repository: https://github.com/micromatch/anymatch > The ISC License > > Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com) > > Permission to use, copy, modify, and/or distribute this software for any > purpose with or without fee is hereby granted, provided that the above > copyright notice and this permission notice appear in all copies. > > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR > IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --------------------------------------- ## binary-extensions License: MIT By: Sindre Sorhus Repository: sindresorhus/binary-extensions > MIT License > > Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) > Copyright (c) Paul Miller (https://paulmillr.com) > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## braces License: MIT By: Jon Schlinkert, Brian Woodward, Elan Shanker, Eugene Sharygin, hemanth.hm Repository: micromatch/braces > The MIT License (MIT) > > Copyright (c) 2014-present, Jon Schlinkert. > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## builtin-modules License: MIT By: Sindre Sorhus Repository: sindresorhus/builtin-modules > MIT License > > Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## chokidar License: MIT By: Paul Miller, Elan Shanker Repository: git+https://github.com/paulmillr/chokidar.git > The MIT License (MIT) > > Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the “Software”), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## colorette License: MIT By: Jorge Bucaran Repository: jorgebucaran/colorette > Copyright © Jorge Bucaran <<https://jorgebucaran.com>> > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## date-time License: MIT By: Sindre Sorhus Repository: sindresorhus/date-time > MIT License > > Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## fill-range License: MIT By: Jon Schlinkert, Edo Rivai, Paul Miller, Rouven Weßling Repository: jonschlinkert/fill-range > The MIT License (MIT) > > Copyright (c) 2014-present, Jon Schlinkert. > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## flru License: MIT By: Luke Edwards Repository: lukeed/flru > MIT License > > Copyright (c) Luke Edwards <[email protected]> (lukeed.com) > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## glob-parent License: ISC By: Gulp Team, Elan Shanker, Blaine Bublitz Repository: gulpjs/glob-parent > The ISC License > > Copyright (c) 2015, 2019 Elan Shanker > > Permission to use, copy, modify, and/or distribute this software for any > purpose with or without fee is hereby granted, provided that the above > copyright notice and this permission notice appear in all copies. > > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR > IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --------------------------------------- ## is-binary-path License: MIT By: Sindre Sorhus Repository: sindresorhus/is-binary-path > MIT License > > Copyright (c) 2019 Sindre Sorhus <[email protected]> (https://sindresorhus.com), Paul Miller (https://paulmillr.com) > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## is-extglob License: MIT By: Jon Schlinkert Repository: jonschlinkert/is-extglob > The MIT License (MIT) > > Copyright (c) 2014-2016, Jon Schlinkert > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## is-glob License: MIT By: Jon Schlinkert, Brian Woodward, Daniel Perez Repository: micromatch/is-glob > The MIT License (MIT) > > Copyright (c) 2014-2017, Jon Schlinkert. > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## is-number License: MIT By: Jon Schlinkert, Olsten Larck, Rouven Weßling Repository: jonschlinkert/is-number > The MIT License (MIT) > > Copyright (c) 2014-present, Jon Schlinkert. > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## is-reference License: MIT By: Rich Harris Repository: git+https://github.com/Rich-Harris/is-reference.git --------------------------------------- ## locate-character License: MIT By: Rich Harris Repository: git+https://gitlab.com/Rich-Harris/locate-character.git --------------------------------------- ## magic-string License: MIT By: Rich Harris Repository: https://github.com/rich-harris/magic-string > Copyright 2018 Rich Harris > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## normalize-path License: MIT By: Jon Schlinkert, Blaine Bublitz Repository: jonschlinkert/normalize-path > The MIT License (MIT) > > Copyright (c) 2014-2018, Jon Schlinkert. > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## parse-ms License: MIT By: Sindre Sorhus Repository: sindresorhus/parse-ms > MIT License > > Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## picomatch License: MIT By: Jon Schlinkert Repository: micromatch/picomatch > The MIT License (MIT) > > Copyright (c) 2017-present, Jon Schlinkert. > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## pretty-bytes License: MIT By: Sindre Sorhus Repository: sindresorhus/pretty-bytes > MIT License > > Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## pretty-ms License: MIT By: Sindre Sorhus Repository: sindresorhus/pretty-ms > MIT License > > Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## readdirp License: MIT By: Thorsten Lorenz, Paul Miller Repository: git://github.com/paulmillr/readdirp.git > MIT License > > Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com) > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all > copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > SOFTWARE. --------------------------------------- ## signal-exit License: ISC By: Ben Coe Repository: https://github.com/tapjs/signal-exit.git > The ISC License > > Copyright (c) 2015-2023 Benjamin Coe, Isaac Z. Schlueter, and Contributors > > Permission to use, copy, modify, and/or distribute this software > for any purpose with or without fee is hereby granted, provided > that the above copyright notice and this permission notice > appear in all copies. > > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES > OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE > LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES > OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, > WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, > ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --------------------------------------- ## time-zone License: MIT By: Sindre Sorhus Repository: sindresorhus/time-zone > MIT License > > Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com) > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------- ## to-regex-range License: MIT By: Jon Schlinkert, Rouven Weßling Repository: micromatch/to-regex-range > The MIT License (MIT) > > Copyright (c) 2015-present, Jon Schlinkert. > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal > in the Software without restriction, including without limitation the rights > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. --------------------------------------- ## yargs-parser License: ISC By: Ben Coe Repository: https://github.com/yargs/yargs-parser.git > Copyright (c) 2016, Contributors > > Permission to use, copy, modify, and/or distribute this software > for any purpose with or without fee is hereby granted, provided > that the above copyright notice and this permission notice > appear in all copies. > > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES > OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE > LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES > OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, > WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, > ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/rollup/LICENSE.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/rollup/LICENSE.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 34665 }
<p align="center"> <a href="https://rollupjs.org/"><img src="https://rollupjs.org/rollup-logo.svg" width="150" /></a> </p> <p align="center"> <a href="https://www.npmjs.com/package/rollup"> <img src="https://img.shields.io/npm/v/rollup.svg" alt="npm version" > </a> <a href="https://nodejs.org/en/about/previous-releases"> <img src="https://img.shields.io/node/v/rollup.svg" alt="node compatibility"> </a> <a href="https://packagephobia.now.sh/result?p=rollup"> <img src="https://packagephobia.now.sh/badge?p=rollup" alt="install size" > </a> <a href="https://codecov.io/gh/rollup/rollup"> <img src="https://codecov.io/gh/rollup/rollup/graph/badge.svg" alt="code coverage" > </a> <a href="#backers" alt="sponsors on Open Collective"> <img src="https://opencollective.com/rollup/backers/badge.svg" alt="backers" > </a> <a href="#sponsors" alt="Sponsors on Open Collective"> <img src="https://opencollective.com/rollup/sponsors/badge.svg" alt="sponsors" > </a> <a href="https://github.com/rollup/rollup/blob/master/LICENSE.md"> <img src="https://img.shields.io/npm/l/rollup.svg" alt="license"> </a> <a href='https://is.gd/rollup_chat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge'> <img src='https://img.shields.io/discord/466787075518365708?color=778cd1&label=chat' alt='Join the chat at https://is.gd/rollup_chat'> </a> </p> <h1 align="center">Rollup</h1> ## Overview Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library or application. It uses the standardized ES module format for code, instead of previous idiosyncratic solutions such as CommonJS and AMD. ES modules let you freely and seamlessly combine the most useful individual functions from your favorite libraries. Rollup can optimize ES modules for faster native loading in modern browsers, or output a legacy module format allowing ES module workflows today. ## Quick Start Guide Install with `npm install --global rollup`. Rollup can be used either through a [command line interface](https://rollupjs.org/command-line-interface/) with an optional configuration file or else through its [JavaScript API](https://rollupjs.org/javascript-api/). Run `rollup --help` to see the available options and parameters. The starter project templates, [rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) and [rollup-starter-app](https://github.com/rollup/rollup-starter-app), demonstrate common configuration options, and more detailed instructions are available throughout the [user guide](https://rollupjs.org/introduction/). ### Commands These commands assume the entry point to your application is named main.js, and that you'd like all imports compiled into a single file named bundle.js. For browsers: ```bash # compile to a <script> containing a self-executing function rollup main.js --format iife --name "myBundle" --file bundle.js ``` For Node.js: ```bash # compile to a CommonJS module rollup main.js --format cjs --file bundle.js ``` For both browsers and Node.js: ```bash # UMD format requires a bundle name rollup main.js --format umd --name "myBundle" --file bundle.js ``` ## Why Developing software is usually easier if you break your project into smaller separate pieces, since that often removes unexpected interactions and dramatically reduces the complexity of the problems you'll need to solve, and simply writing smaller projects in the first place [isn't necessarily the answer](https://medium.com/@Rich_Harris/small-modules-it-s-not-quite-that-simple-3ca532d65de4). Unfortunately, JavaScript has not historically included this capability as a core feature in the language. This finally changed with ES modules support in JavaScript, which provides a syntax for importing and exporting functions and data so they can be shared between separate scripts. Most browsers and Node.js support ES modules. However, Node.js releases before 12.17 support ES modules only behind the `--experimental-modules` flag, and older browsers like Internet Explorer do not support ES modules at all. Rollup allows you to write your code using ES modules, and run your application even in environments that do not support ES modules natively. For environments that support them, Rollup can output optimized ES modules; for environments that don't, Rollup can compile your code to other formats such as CommonJS modules, AMD modules, and IIFE-style scripts. This means that you get to _write future-proof code_, and you also get the tremendous benefits of... ## Tree Shaking In addition to enabling the use of ES modules, Rollup also statically analyzes and optimizes the code you are importing, and will exclude anything that isn't actually used. This allows you to build on top of existing tools and modules without adding extra dependencies or bloating the size of your project. For example, with CommonJS, the _entire tool or library must be imported_. ```js // import the entire utils object with CommonJS var utils = require('node:utils'); var query = 'Rollup'; // use the ajax method of the utils object utils.ajax('https://api.example.com?search=' + query).then(handleResponse); ``` But with ES modules, instead of importing the whole `utils` object, we can just import the one `ajax` function we need: ```js // import the ajax function with an ES import statement import { ajax } from 'node:utils'; var query = 'Rollup'; // call the ajax function ajax('https://api.example.com?search=' + query).then(handleResponse); ``` Because Rollup includes the bare minimum, it results in lighter, faster, and less complicated libraries and applications. Since this approach is based on explicit `import` and `export` statements, it is vastly more effective than simply running an automated minifier to detect unused variables in the compiled output code. ## Compatibility ### Importing CommonJS Rollup can import existing CommonJS modules [through a plugin](https://github.com/rollup/plugins/tree/master/packages/commonjs). ### Publishing ES Modules To make sure your ES modules are immediately usable by tools that work with CommonJS such as Node.js and webpack, you can use Rollup to compile to UMD or CommonJS format, and then point to that compiled version with the `main` property in your `package.json` file. If your `package.json` file also has a `module` field, ES-module-aware tools like Rollup and [webpack](https://webpack.js.org/) will [import the ES module version](https://github.com/rollup/rollup/wiki/pkg.module) directly. ## Contributors This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. <a href="https://github.com/rollup/rollup/graphs/contributors"><img src="https://opencollective.com/rollup/contributors.svg?width=890" /></a>. If you want to contribute yourself, head over to the [contribution guidelines](CONTRIBUTING.md). ## Backers Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/rollup#backer)] <a href="https://opencollective.com/rollup#backers" target="_blank"><img src="https://opencollective.com/rollup/backers.svg?width=890"></a> ## Sponsors Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/rollup#sponsor)] <a href="https://opencollective.com/rollup/sponsor/0/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/1/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/2/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/3/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/4/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/5/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/6/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/7/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/8/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/9/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/9/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/10/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/10/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/11/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/11/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/12/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/12/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/13/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/13/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/14/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/14/avatar.svg"></a> ## Special Sponsor <a href="https://www.tngtech.com/en/index.html" target="_blank"><img src="https://www.tngtech.com/fileadmin/Public/Images/Logos/TNG_Logo_medium_400x64.svg" alt="TNG Logo" width="280"/></a> TNG has been supporting the work of [Lukas Taegert-Atkinson](https://github.com/lukastaegert) on Rollup since 2017. ## License [MIT](https://github.com/rollup/rollup/blob/master/LICENSE.md)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/rollup/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/rollup/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 10037 }
# run-parallel [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] [travis-image]: https://img.shields.io/travis/feross/run-parallel/master.svg [travis-url]: https://travis-ci.org/feross/run-parallel [npm-image]: https://img.shields.io/npm/v/run-parallel.svg [npm-url]: https://npmjs.org/package/run-parallel [downloads-image]: https://img.shields.io/npm/dm/run-parallel.svg [downloads-url]: https://npmjs.org/package/run-parallel [standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg [standard-url]: https://standardjs.com ### Run an array of functions in parallel ![parallel](https://raw.githubusercontent.com/feross/run-parallel/master/img.png) [![Sauce Test Status](https://saucelabs.com/browser-matrix/run-parallel.svg)](https://saucelabs.com/u/run-parallel) ### install ``` npm install run-parallel ``` ### usage #### parallel(tasks, [callback]) Run the `tasks` array of functions in parallel, without waiting until the previous function has completed. If any of the functions pass an error to its callback, the main `callback` is immediately called with the value of the error. Once the `tasks` have completed, the results are passed to the final `callback` as an array. It is also possible to use an object instead of an array. Each property will be run as a function and the results will be passed to the final `callback` as an object instead of an array. This can be a more readable way of handling the results. ##### arguments - `tasks` - An array or object containing functions to run. Each function is passed a `callback(err, result)` which it must call on completion with an error `err` (which can be `null`) and an optional `result` value. - `callback(err, results)` - An optional callback to run once all the functions have completed. This function gets a results array (or object) containing all the result arguments passed to the task callbacks. ##### example ```js var parallel = require('run-parallel') parallel([ function (callback) { setTimeout(function () { callback(null, 'one') }, 200) }, function (callback) { setTimeout(function () { callback(null, 'two') }, 100) } ], // optional callback function (err, results) { // the results array will equal ['one','two'] even though // the second function had a shorter timeout. }) ``` This module is basically equavalent to [`async.parallel`](https://github.com/caolan/async#paralleltasks-callback), but it's handy to just have the one function you need instead of the kitchen sink. Modularity! Especially handy if you're serving to the browser and need to reduce your javascript bundle size. Works great in the browser with [browserify](http://browserify.org/)! ### see also - [run-auto](https://github.com/feross/run-auto) - [run-parallel-limit](https://github.com/feross/run-parallel-limit) - [run-series](https://github.com/feross/run-series) - [run-waterfall](https://github.com/feross/run-waterfall) ### license MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/run-parallel/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/run-parallel/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 3156 }
# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] [travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg [travis-url]: https://travis-ci.org/feross/safe-buffer [npm-image]: https://img.shields.io/npm/v/safe-buffer.svg [npm-url]: https://npmjs.org/package/safe-buffer [downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg [downloads-url]: https://npmjs.org/package/safe-buffer [standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg [standard-url]: https://standardjs.com #### Safer Node.js Buffer API **Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`, `Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** **Uses the built-in implementation when available.** ## install ``` npm install safe-buffer ``` ## usage The goal of this package is to provide a safe replacement for the node.js `Buffer`. It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to the top of your node.js modules: ```js var Buffer = require('safe-buffer').Buffer // Existing buffer code will continue to work without issues: new Buffer('hey', 'utf8') new Buffer([1, 2, 3], 'utf8') new Buffer(obj) new Buffer(16) // create an uninitialized buffer (potentially unsafe) // But you can use these new explicit APIs to make clear what you want: Buffer.from('hey', 'utf8') // convert from many types to a Buffer Buffer.alloc(16) // create a zero-filled buffer (safe) Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe) ``` ## api ### Class Method: Buffer.from(array) <!-- YAML added: v3.0.0 --> * `array` {Array} Allocates a new `Buffer` using an `array` of octets. ```js const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); // creates a new Buffer containing ASCII bytes // ['b','u','f','f','e','r'] ``` A `TypeError` will be thrown if `array` is not an `Array`. ### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) <!-- YAML added: v5.10.0 --> * `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or a `new ArrayBuffer()` * `byteOffset` {Number} Default: `0` * `length` {Number} Default: `arrayBuffer.length - byteOffset` When passed a reference to the `.buffer` property of a `TypedArray` instance, the newly created `Buffer` will share the same allocated memory as the TypedArray. ```js const arr = new Uint16Array(2); arr[0] = 5000; arr[1] = 4000; const buf = Buffer.from(arr.buffer); // shares the memory with arr; console.log(buf); // Prints: <Buffer 88 13 a0 0f> // changing the TypedArray changes the Buffer also arr[1] = 6000; console.log(buf); // Prints: <Buffer 88 13 70 17> ``` The optional `byteOffset` and `length` arguments specify a memory range within the `arrayBuffer` that will be shared by the `Buffer`. ```js const ab = new ArrayBuffer(10); const buf = Buffer.from(ab, 0, 2); console.log(buf.length); // Prints: 2 ``` A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. ### Class Method: Buffer.from(buffer) <!-- YAML added: v3.0.0 --> * `buffer` {Buffer} Copies the passed `buffer` data onto a new `Buffer` instance. ```js const buf1 = Buffer.from('buffer'); const buf2 = Buffer.from(buf1); buf1[0] = 0x61; console.log(buf1.toString()); // 'auffer' console.log(buf2.toString()); // 'buffer' (copy is not changed) ``` A `TypeError` will be thrown if `buffer` is not a `Buffer`. ### Class Method: Buffer.from(str[, encoding]) <!-- YAML added: v5.10.0 --> * `str` {String} String to encode. * `encoding` {String} Encoding to use, Default: `'utf8'` Creates a new `Buffer` containing the given JavaScript string `str`. If provided, the `encoding` parameter identifies the character encoding. If not provided, `encoding` defaults to `'utf8'`. ```js const buf1 = Buffer.from('this is a tést'); console.log(buf1.toString()); // prints: this is a tést console.log(buf1.toString('ascii')); // prints: this is a tC)st const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); console.log(buf2.toString()); // prints: this is a tést ``` A `TypeError` will be thrown if `str` is not a string. ### Class Method: Buffer.alloc(size[, fill[, encoding]]) <!-- YAML added: v5.10.0 --> * `size` {Number} * `fill` {Value} Default: `undefined` * `encoding` {String} Default: `utf8` Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be *zero-filled*. ```js const buf = Buffer.alloc(5); console.log(buf); // <Buffer 00 00 00 00 00> ``` The `size` must be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will be created if a `size` less than or equal to 0 is specified. If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`. See [`buf.fill()`][] for more information. ```js const buf = Buffer.alloc(5, 'a'); console.log(buf); // <Buffer 61 61 61 61 61> ``` If both `fill` and `encoding` are specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill, encoding)`. For example: ```js const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); console.log(buf); // <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64> ``` Calling `Buffer.alloc(size)` can be significantly slower than the alternative `Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance contents will *never contain sensitive data*. A `TypeError` will be thrown if `size` is not a number. ### Class Method: Buffer.allocUnsafe(size) <!-- YAML added: v5.10.0 --> * `size` {Number} Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will be created if a `size` less than or equal to 0 is specified. The underlying memory for `Buffer` instances created in this way is *not initialized*. The contents of the newly created `Buffer` are unknown and *may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such `Buffer` instances to zeroes. ```js const buf = Buffer.allocUnsafe(5); console.log(buf); // <Buffer 78 e0 82 02 01> // (octets will be different, every time) buf.fill(0); console.log(buf); // <Buffer 00 00 00 00 00> ``` A `TypeError` will be thrown if `size` is not a number. Note that the `Buffer` module pre-allocates an internal `Buffer` instance of size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated `new Buffer(size)` constructor) only when `size` is less than or equal to `Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default value of `Buffer.poolSize` is `8192` but can be modified. Use of this pre-allocated internal memory pool is a key difference between calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The difference is subtle but can be important when an application requires the additional performance that `Buffer.allocUnsafe(size)` provides. ### Class Method: Buffer.allocUnsafeSlow(size) <!-- YAML added: v5.10.0 --> * `size` {Number} Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The `size` must be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will be created if a `size` less than or equal to 0 is specified. The underlying memory for `Buffer` instances created in this way is *not initialized*. The contents of the newly created `Buffer` are unknown and *may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such `Buffer` instances to zeroes. When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, allocations under 4KB are, by default, sliced from a single pre-allocated `Buffer`. This allows applications to avoid the garbage collection overhead of creating many individually allocated Buffers. This approach improves both performance and memory usage by eliminating the need to track and cleanup as many `Persistent` objects. However, in the case where a developer may need to retain a small chunk of memory from a pool for an indeterminate amount of time, it may be appropriate to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then copy out the relevant bits. ```js // need to keep around a few small chunks of memory const store = []; socket.on('readable', () => { const data = socket.read(); // allocate for retained data const sb = Buffer.allocUnsafeSlow(10); // copy the data into the new allocation data.copy(sb, 0, 0, 10); store.push(sb); }); ``` Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after* a developer has observed undue memory retention in their applications. A `TypeError` will be thrown if `size` is not a number. ### All the Rest The rest of the `Buffer` API is exactly the same as in node.js. [See the docs](https://nodejs.org/api/buffer.html). ## Related links - [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) - [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4) ## Why is `Buffer` unsafe? Today, the node.js `Buffer` constructor is overloaded to handle many different argument types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.), `ArrayBuffer`, and also `Number`. The API is optimized for convenience: you can throw any type at it, and it will try to do what you want. Because the Buffer constructor is so powerful, you often see code like this: ```js // Convert UTF-8 strings to hex function toHex (str) { return new Buffer(str).toString('hex') } ``` ***But what happens if `toHex` is called with a `Number` argument?*** ### Remote Memory Disclosure If an attacker can make your program call the `Buffer` constructor with a `Number` argument, then they can make it allocate uninitialized memory from the node.js process. This could potentially disclose TLS private keys, user data, or database passwords. When the `Buffer` constructor is passed a `Number` argument, it returns an **UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like this, you **MUST** overwrite the contents before returning it to the user. From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size): > `new Buffer(size)` > > - `size` Number > > The underlying memory for `Buffer` instances created in this way is not initialized. > **The contents of a newly created `Buffer` are unknown and could contain sensitive > data.** Use `buf.fill(0)` to initialize a Buffer to zeroes. (Emphasis our own.) Whenever the programmer intended to create an uninitialized `Buffer` you often see code like this: ```js var buf = new Buffer(16) // Immediately overwrite the uninitialized buffer with data from another buffer for (var i = 0; i < buf.length; i++) { buf[i] = otherBuf[i] } ``` ### Would this ever be a problem in real code? Yes. It's surprisingly common to forget to check the type of your variables in a dynamically-typed language like JavaScript. Usually the consequences of assuming the wrong type is that your program crashes with an uncaught exception. But the failure mode for forgetting to check the type of arguments to the `Buffer` constructor is more catastrophic. Here's an example of a vulnerable service that takes a JSON payload and converts it to hex: ```js // Take a JSON payload {str: "some string"} and convert it to hex var server = http.createServer(function (req, res) { var data = '' req.setEncoding('utf8') req.on('data', function (chunk) { data += chunk }) req.on('end', function () { var body = JSON.parse(data) res.end(new Buffer(body.str).toString('hex')) }) }) server.listen(8080) ``` In this example, an http client just has to send: ```json { "str": 1000 } ``` and it will get back 1,000 bytes of uninitialized memory from the server. This is a very serious bug. It's similar in severity to the [the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process memory by remote attackers. ### Which real-world packages were vulnerable? #### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht) [Mathias Buus](https://github.com/mafintosh) and I ([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages, [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get them to reveal 20 bytes at a time of uninitialized memory from the node.js process. Here's [the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8) that fixed it. We released a new fixed version, created a [Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all vulnerable versions on npm so users will get a warning to upgrade to a newer version. #### [`ws`](https://www.npmjs.com/package/ws) That got us wondering if there were other vulnerable packages. Sure enough, within a short period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the most popular WebSocket implementation in node.js. If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as expected, then uninitialized server memory would be disclosed to the remote peer. These were the vulnerable methods: ```js socket.send(number) socket.ping(number) socket.pong(number) ``` Here's a vulnerable socket server with some echo functionality: ```js server.on('connection', function (socket) { socket.on('message', function (message) { message = JSON.parse(message) if (message.type === 'echo') { socket.send(message.data) // send back the user's message } }) }) ``` `socket.send(number)` called on the server, will disclose server memory. Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue was fixed, with a more detailed explanation. Props to [Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the [Node Security Project disclosure](https://nodesecurity.io/advisories/67). ### What's the solution? It's important that node.js offers a fast way to get memory otherwise performance-critical applications would needlessly get a lot slower. But we need a better way to *signal our intent* as programmers. **When we want uninitialized memory, we should request it explicitly.** Sensitive functionality should not be packed into a developer-friendly API that loosely accepts many different types. This type of API encourages the lazy practice of passing variables in without checking the type very carefully. #### A new API: `Buffer.allocUnsafe(number)` The functionality of creating buffers with uninitialized memory should be part of another API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that frequently gets user input of all sorts of different types passed into it. ```js var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory! // Immediately overwrite the uninitialized buffer with data from another buffer for (var i = 0; i < buf.length; i++) { buf[i] = otherBuf[i] } ``` ### How do we fix node.js core? We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as `semver-major`) which defends against one case: ```js var str = 16 new Buffer(str, 'utf8') ``` In this situation, it's implied that the programmer intended the first argument to be a string, since they passed an encoding as a second argument. Today, node.js will allocate uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not what the programmer intended. But this is only a partial solution, since if the programmer does `new Buffer(variable)` (without an `encoding` parameter) there's no way to know what they intended. If `variable` is sometimes a number, then uninitialized memory will sometimes be returned. ### What's the real long-term fix? We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when we need uninitialized memory. But that would break 1000s of packages. ~~We believe the best solution is to:~~ ~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~ ~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~ #### Update We now support adding three new APIs: - `Buffer.from(value)` - convert from any type to a buffer - `Buffer.alloc(size)` - create a zero-filled buffer - `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size This solves the core problem that affected `ws` and `bittorrent-dht` which is `Buffer(variable)` getting tricked into taking a number argument. This way, existing code continues working and the impact on the npm ecosystem will be minimal. Over time, npm maintainers can migrate performance-critical code to use `Buffer.allocUnsafe(number)` instead of `new Buffer(number)`. ### Conclusion We think there's a serious design issue with the `Buffer` API as it exists today. It promotes insecure software by putting high-risk functionality into a convenient API with friendly "developer ergonomics". This wasn't merely a theoretical exercise because we found the issue in some of the most popular npm packages. Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of `buffer`. ```js var Buffer = require('safe-buffer').Buffer ``` Eventually, we hope that node.js core can switch to this new, safer behavior. We believe the impact on the ecosystem would be minimal since it's not a breaking change. Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while older, insecure packages would magically become safe from this attack vector. ## links - [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514) - [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67) - [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68) ## credit The original issues in `bittorrent-dht` ([disclosure](https://nodesecurity.io/advisories/68)) and `ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by [Mathias Buus](https://github.com/mafintosh) and [Feross Aboukhadijeh](http://feross.org/). Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues and for his work running the [Node Security Project](https://nodesecurity.io/). Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and auditing the code. ## license MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/safe-buffer/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/safe-buffer/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 19551 }
# Porting to the Buffer.from/Buffer.alloc API <a id="overview"></a> ## Overview - [Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x.](#variant-1) (*recommended*) - [Variant 2: Use a polyfill](#variant-2) - [Variant 3: manual detection, with safeguards](#variant-3) ### Finding problematic bits of code using grep Just run `grep -nrE '[^a-zA-Z](Slow)?Buffer\s*\(' --exclude-dir node_modules`. It will find all the potentially unsafe places in your own code (with some considerably unlikely exceptions). ### Finding problematic bits of code using Node.js 8 If you’re using Node.js ≥ 8.0.0 (which is recommended), Node.js exposes multiple options that help with finding the relevant pieces of code: - `--trace-warnings` will make Node.js show a stack trace for this warning and other warnings that are printed by Node.js. - `--trace-deprecation` does the same thing, but only for deprecation warnings. - `--pending-deprecation` will show more types of deprecation warnings. In particular, it will show the `Buffer()` deprecation warning, even on Node.js 8. You can set these flags using an environment variable: ```console $ export NODE_OPTIONS='--trace-warnings --pending-deprecation' $ cat example.js 'use strict'; const foo = new Buffer('foo'); $ node example.js (node:7147) [DEP0005] DeprecationWarning: The Buffer() and new Buffer() constructors are not recommended for use due to security and usability concerns. Please use the new Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() construction methods instead. at showFlaggedDeprecation (buffer.js:127:13) at new Buffer (buffer.js:148:3) at Object.<anonymous> (/path/to/example.js:2:13) [... more stack trace lines ...] ``` ### Finding problematic bits of code using linters Eslint rules [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) or [node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) also find calls to deprecated `Buffer()` API. Those rules are included in some pre-sets. There is a drawback, though, that it doesn't always [work correctly](https://github.com/chalker/safer-buffer#why-not-safe-buffer) when `Buffer` is overriden e.g. with a polyfill, so recommended is a combination of this and some other method described above. <a id="variant-1"></a> ## Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x. This is the recommended solution nowadays that would imply only minimal overhead. The Node.js 5.x release line has been unsupported since July 2016, and the Node.js 4.x release line reaches its End of Life in April 2018 (→ [Schedule](https://github.com/nodejs/Release#release-schedule)). This means that these versions of Node.js will *not* receive any updates, even in case of security issues, so using these release lines should be avoided, if at all possible. What you would do in this case is to convert all `new Buffer()` or `Buffer()` calls to use `Buffer.alloc()` or `Buffer.from()`, in the following way: - For `new Buffer(number)`, replace it with `Buffer.alloc(number)`. - For `new Buffer(string)` (or `new Buffer(string, encoding)`), replace it with `Buffer.from(string)` (or `Buffer.from(string, encoding)`). - For all other combinations of arguments (these are much rarer), also replace `new Buffer(...arguments)` with `Buffer.from(...arguments)`. Note that `Buffer.alloc()` is also _faster_ on the current Node.js versions than `new Buffer(size).fill(0)`, which is what you would otherwise need to ensure zero-filling. Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) or [node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) is recommended to avoid accidential unsafe Buffer API usage. There is also a [JSCodeshift codemod](https://github.com/joyeecheung/node-dep-codemod#dep005) for automatically migrating Buffer constructors to `Buffer.alloc()` or `Buffer.from()`. Note that it currently only works with cases where the arguments are literals or where the constructor is invoked with two arguments. _If you currently support those older Node.js versions and dropping them would be a semver-major change for you, or if you support older branches of your packages, consider using [Variant 2](#variant-2) or [Variant 3](#variant-3) on older branches, so people using those older branches will also receive the fix. That way, you will eradicate potential issues caused by unguarded Buffer API usage and your users will not observe a runtime deprecation warning when running your code on Node.js 10._ <a id="variant-2"></a> ## Variant 2: Use a polyfill Utilize [safer-buffer](https://www.npmjs.com/package/safer-buffer) as a polyfill to support older Node.js versions. You would take exacly the same steps as in [Variant 1](#variant-1), but with a polyfill `const Buffer = require('safer-buffer').Buffer` in all files where you use the new `Buffer` api. Make sure that you do not use old `new Buffer` API — in any files where the line above is added, using old `new Buffer()` API will _throw_. It will be easy to notice that in CI, though. Alternatively, you could use [buffer-from](https://www.npmjs.com/package/buffer-from) and/or [buffer-alloc](https://www.npmjs.com/package/buffer-alloc) [ponyfills](https://ponyfill.com/) — those are great, the only downsides being 4 deps in the tree and slightly more code changes to migrate off them (as you would be using e.g. `Buffer.from` under a different name). If you need only `Buffer.from` polyfilled — `buffer-from` alone which comes with no extra dependencies. _Alternatively, you could use [safe-buffer](https://www.npmjs.com/package/safe-buffer) — it also provides a polyfill, but takes a different approach which has [it's drawbacks](https://github.com/chalker/safer-buffer#why-not-safe-buffer). It will allow you to also use the older `new Buffer()` API in your code, though — but that's arguably a benefit, as it is problematic, can cause issues in your code, and will start emitting runtime deprecation warnings starting with Node.js 10._ Note that in either case, it is important that you also remove all calls to the old Buffer API manually — just throwing in `safe-buffer` doesn't fix the problem by itself, it just provides a polyfill for the new API. I have seen people doing that mistake. Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) or [node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) is recommended. _Don't forget to drop the polyfill usage once you drop support for Node.js < 4.5.0._ <a id="variant-3"></a> ## Variant 3 — manual detection, with safeguards This is useful if you create Buffer instances in only a few places (e.g. one), or you have your own wrapper around them. ### Buffer(0) This special case for creating empty buffers can be safely replaced with `Buffer.concat([])`, which returns the same result all the way down to Node.js 0.8.x. ### Buffer(notNumber) Before: ```js var buf = new Buffer(notNumber, encoding); ``` After: ```js var buf; if (Buffer.from && Buffer.from !== Uint8Array.from) { buf = Buffer.from(notNumber, encoding); } else { if (typeof notNumber === 'number') throw new Error('The "size" argument must be of type number.'); buf = new Buffer(notNumber, encoding); } ``` `encoding` is optional. Note that the `typeof notNumber` before `new Buffer` is required (for cases when `notNumber` argument is not hard-coded) and _is not caused by the deprecation of Buffer constructor_ — it's exactly _why_ the Buffer constructor is deprecated. Ecosystem packages lacking this type-check caused numereous security issues — situations when unsanitized user input could end up in the `Buffer(arg)` create problems ranging from DoS to leaking sensitive information to the attacker from the process memory. When `notNumber` argument is hardcoded (e.g. literal `"abc"` or `[0,1,2]`), the `typeof` check can be omitted. Also note that using TypeScript does not fix this problem for you — when libs written in `TypeScript` are used from JS, or when user input ends up there — it behaves exactly as pure JS, as all type checks are translation-time only and are not present in the actual JS code which TS compiles to. ### Buffer(number) For Node.js 0.10.x (and below) support: ```js var buf; if (Buffer.alloc) { buf = Buffer.alloc(number); } else { buf = new Buffer(number); buf.fill(0); } ``` Otherwise (Node.js ≥ 0.12.x): ```js const buf = Buffer.alloc ? Buffer.alloc(number) : new Buffer(number).fill(0); ``` ## Regarding Buffer.allocUnsafe Be extra cautious when using `Buffer.allocUnsafe`: * Don't use it if you don't have a good reason to * e.g. you probably won't ever see a performance difference for small buffers, in fact, those might be even faster with `Buffer.alloc()`, * if your code is not in the hot code path — you also probably won't notice a difference, * keep in mind that zero-filling minimizes the potential risks. * If you use it, make sure that you never return the buffer in a partially-filled state, * if you are writing to it sequentially — always truncate it to the actuall written length Errors in handling buffers allocated with `Buffer.allocUnsafe` could result in various issues, ranged from undefined behaviour of your code to sensitive data (user input, passwords, certs) leaking to the remote attacker. _Note that the same applies to `new Buffer` usage without zero-filling, depending on the Node.js version (and lacking type checks also adds DoS to the list of potential problems)._ <a id="faq"></a> ## FAQ <a id="design-flaws"></a> ### What is wrong with the `Buffer` constructor? The `Buffer` constructor could be used to create a buffer in many different ways: - `new Buffer(42)` creates a `Buffer` of 42 bytes. Before Node.js 8, this buffer contained *arbitrary memory* for performance reasons, which could include anything ranging from program source code to passwords and encryption keys. - `new Buffer('abc')` creates a `Buffer` that contains the UTF-8-encoded version of the string `'abc'`. A second argument could specify another encoding: For example, `new Buffer(string, 'base64')` could be used to convert a Base64 string into the original sequence of bytes that it represents. - There are several other combinations of arguments. This meant that, in code like `var buffer = new Buffer(foo);`, *it is not possible to tell what exactly the contents of the generated buffer are* without knowing the type of `foo`. Sometimes, the value of `foo` comes from an external source. For example, this function could be exposed as a service on a web server, converting a UTF-8 string into its Base64 form: ``` function stringToBase64(req, res) { // The request body should have the format of `{ string: 'foobar' }` const rawBytes = new Buffer(req.body.string) const encoded = rawBytes.toString('base64') res.end({ encoded: encoded }) } ``` Note that this code does *not* validate the type of `req.body.string`: - `req.body.string` is expected to be a string. If this is the case, all goes well. - `req.body.string` is controlled by the client that sends the request. - If `req.body.string` is the *number* `50`, the `rawBytes` would be 50 bytes: - Before Node.js 8, the content would be uninitialized - After Node.js 8, the content would be `50` bytes with the value `0` Because of the missing type check, an attacker could intentionally send a number as part of the request. Using this, they can either: - Read uninitialized memory. This **will** leak passwords, encryption keys and other kinds of sensitive information. (Information leak) - Force the program to allocate a large amount of memory. For example, when specifying `500000000` as the input value, each request will allocate 500MB of memory. This can be used to either exhaust the memory available of a program completely and make it crash, or slow it down significantly. (Denial of Service) Both of these scenarios are considered serious security issues in a real-world web server context. when using `Buffer.from(req.body.string)` instead, passing a number will always throw an exception instead, giving a controlled behaviour that can always be handled by the program. <a id="ecosystem-usage"></a> ### The `Buffer()` constructor has been deprecated for a while. Is this really an issue? Surveys of code in the `npm` ecosystem have shown that the `Buffer()` constructor is still widely used. This includes new code, and overall usage of such code has actually been *increasing*.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/safer-buffer/Porting-Buffer.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/safer-buffer/Porting-Buffer.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 12751 }
# safer-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![javascript style guide][standard-image]][standard-url] [![Security Responsible Disclosure][secuirty-image]][secuirty-url] [travis-image]: https://travis-ci.org/ChALkeR/safer-buffer.svg?branch=master [travis-url]: https://travis-ci.org/ChALkeR/safer-buffer [npm-image]: https://img.shields.io/npm/v/safer-buffer.svg [npm-url]: https://npmjs.org/package/safer-buffer [standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg [standard-url]: https://standardjs.com [secuirty-image]: https://img.shields.io/badge/Security-Responsible%20Disclosure-green.svg [secuirty-url]: https://github.com/nodejs/security-wg/blob/master/processes/responsible_disclosure_template.md Modern Buffer API polyfill without footguns, working on Node.js from 0.8 to current. ## How to use? First, port all `Buffer()` and `new Buffer()` calls to `Buffer.alloc()` and `Buffer.from()` API. Then, to achieve compatibility with outdated Node.js versions (`<4.5.0` and 5.x `<5.9.0`), use `const Buffer = require('safer-buffer').Buffer` in all files where you make calls to the new Buffer API. _Use `var` instead of `const` if you need that for your Node.js version range support._ Also, see the [porting Buffer](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) guide. ## Do I need it? Hopefully, not — dropping support for outdated Node.js versions should be fine nowdays, and that is the recommended path forward. You _do_ need to port to the `Buffer.alloc()` and `Buffer.from()` though. See the [porting guide](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) for a better description. ## Why not [safe-buffer](https://npmjs.com/safe-buffer)? _In short: while `safe-buffer` serves as a polyfill for the new API, it allows old API usage and itself contains footguns._ `safe-buffer` could be used safely to get the new API while still keeping support for older Node.js versions (like this module), but while analyzing ecosystem usage of the old Buffer API I found out that `safe-buffer` is itself causing problems in some cases. For example, consider the following snippet: ```console $ cat example.unsafe.js console.log(Buffer(20)) $ ./node-v6.13.0-linux-x64/bin/node example.unsafe.js <Buffer 0a 00 00 00 00 00 00 00 28 13 de 02 00 00 00 00 05 00 00 00> $ standard example.unsafe.js standard: Use JavaScript Standard Style (https://standardjs.com) /home/chalker/repo/safer-buffer/example.unsafe.js:2:13: 'Buffer()' was deprecated since v6. Use 'Buffer.alloc()' or 'Buffer.from()' (use 'https://www.npmjs.com/package/safe-buffer' for '<4.5.0') instead. ``` This is allocates and writes to console an uninitialized chunk of memory. [standard](https://www.npmjs.com/package/standard) linter (among others) catch that and warn people to avoid using unsafe API. Let's now throw in `safe-buffer`! ```console $ cat example.safe-buffer.js const Buffer = require('safe-buffer').Buffer console.log(Buffer(20)) $ standard example.safe-buffer.js $ ./node-v6.13.0-linux-x64/bin/node example.safe-buffer.js <Buffer 08 00 00 00 00 00 00 00 28 58 01 82 fe 7f 00 00 00 00 00 00> ``` See the problem? Adding in `safe-buffer` _magically removes the lint warning_, but the behavior remains identiсal to what we had before, and when launched on Node.js 6.x LTS — this dumps out chunks of uninitialized memory. _And this code will still emit runtime warnings on Node.js 10.x and above._ That was done by design. I first considered changing `safe-buffer`, prohibiting old API usage or emitting warnings on it, but that significantly diverges from `safe-buffer` design. After some discussion, it was decided to move my approach into a separate package, and _this is that separate package_. This footgun is not imaginary — I observed top-downloaded packages doing that kind of thing, «fixing» the lint warning by blindly including `safe-buffer` without any actual changes. Also in some cases, even if the API _was_ migrated to use of safe Buffer API — a random pull request can bring unsafe Buffer API usage back to the codebase by adding new calls — and that could go unnoticed even if you have a linter prohibiting that (becase of the reason stated above), and even pass CI. _I also observed that being done in popular packages._ Some examples: * [webdriverio](https://github.com/webdriverio/webdriverio/commit/05cbd3167c12e4930f09ef7cf93b127ba4effae4#diff-124380949022817b90b622871837d56cR31) (a module with 548 759 downloads/month), * [websocket-stream](https://github.com/maxogden/websocket-stream/commit/c9312bd24d08271687d76da0fe3c83493871cf61) (218 288 d/m, fix in [maxogden/websocket-stream#142](https://github.com/maxogden/websocket-stream/pull/142)), * [node-serialport](https://github.com/node-serialport/node-serialport/commit/e8d9d2b16c664224920ce1c895199b1ce2def48c) (113 138 d/m, fix in [node-serialport/node-serialport#1510](https://github.com/node-serialport/node-serialport/pull/1510)), * [karma](https://github.com/karma-runner/karma/commit/3d94b8cf18c695104ca195334dc75ff054c74eec) (3 973 193 d/m, fix in [karma-runner/karma#2947](https://github.com/karma-runner/karma/pull/2947)), * [spdy-transport](https://github.com/spdy-http2/spdy-transport/commit/5375ac33f4a62a4f65bcfc2827447d42a5dbe8b1) (5 970 727 d/m, fix in [spdy-http2/spdy-transport#53](https://github.com/spdy-http2/spdy-transport/pull/53)). * And there are a lot more over the ecosystem. I filed a PR at [mysticatea/eslint-plugin-node#110](https://github.com/mysticatea/eslint-plugin-node/pull/110) to partially fix that (for cases when that lint rule is used), but it is a semver-major change for linter rules and presets, so it would take significant time for that to reach actual setups. _It also hasn't been released yet (2018-03-20)._ Also, `safer-buffer` discourages the usage of `.allocUnsafe()`, which is often done by a mistake. It still supports it with an explicit concern barier, by placing it under `require('safer-buffer/dangereous')`. ## But isn't throwing bad? Not really. It's an error that could be noticed and fixed early, instead of causing havoc later like unguarded `new Buffer()` calls that end up receiving user input can do. This package affects only the files where `var Buffer = require('safer-buffer').Buffer` was done, so it is really simple to keep track of things and make sure that you don't mix old API usage with that. Also, CI should hint anything that you might have missed. New commits, if tested, won't land new usage of unsafe Buffer API this way. _Node.js 10.x also deals with that by printing a runtime depecation warning._ ### Would it affect third-party modules? No, unless you explicitly do an awful thing like monkey-patching or overriding the built-in `Buffer`. Don't do that. ### But I don't want throwing… That is also fine! Also, it could be better in some cases when you don't comprehensive enough test coverage. In that case — just don't override `Buffer` and use `var SaferBuffer = require('safer-buffer').Buffer` instead. That way, everything using `Buffer` natively would still work, but there would be two drawbacks: * `Buffer.from`/`Buffer.alloc` won't be polyfilled — use `SaferBuffer.from` and `SaferBuffer.alloc` instead. * You are still open to accidentally using the insecure deprecated API — use a linter to catch that. Note that using a linter to catch accidential `Buffer` constructor usage in this case is strongly recommended. `Buffer` is not overriden in this usecase, so linters won't get confused. ## «Without footguns»? Well, it is still possible to do _some_ things with `Buffer` API, e.g. accessing `.buffer` property on older versions and duping things from there. You shouldn't do that in your code, probabably. The intention is to remove the most significant footguns that affect lots of packages in the ecosystem, and to do it in the proper way. Also, this package doesn't protect against security issues affecting some Node.js versions, so for usage in your own production code, it is still recommended to update to a Node.js version [supported by upstream](https://github.com/nodejs/release#release-schedule).
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/safer-buffer/Readme.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/safer-buffer/Readme.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 8237 }
# `scheduler` This is a package for cooperative scheduling in a browser environment. It is currently used internally by React, but we plan to make it more generic. The public API for this package is not yet finalized. ### Thanks The React team thanks [Anton Podviaznikov](https://podviaznikov.com/) for donating the `scheduler` package name.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/scheduler/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/scheduler/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 345 }
semver(1) -- The semantic versioner for npm =========================================== ## Install ```bash npm install semver ```` ## Usage As a node module: ```js const semver = require('semver') semver.valid('1.2.3') // '1.2.3' semver.valid('a.b.c') // null semver.clean(' =v1.2.3 ') // '1.2.3' semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true semver.gt('1.2.3', '9.8.7') // false semver.lt('1.2.3', '9.8.7') // true semver.minVersion('>=1.0.0') // '1.0.0' semver.valid(semver.coerce('v2')) // '2.0.0' semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' ``` As a command-line utility: ``` $ semver -h A JavaScript implementation of the https://semver.org/ specification Copyright Isaac Z. Schlueter Usage: semver [options] <version> [<version> [...]] Prints valid versions sorted by SemVer precedence Options: -r --range <range> Print versions that match the specified range. -i --increment [<level>] Increment a version by the specified level. Level can be one of: major, minor, patch, premajor, preminor, prepatch, or prerelease. Default level is 'patch'. Only one version may be specified. --preid <identifier> Identifier to be used to prefix premajor, preminor, prepatch or prerelease version increments. -l --loose Interpret versions and ranges loosely -p --include-prerelease Always include prerelease versions in range matching -c --coerce Coerce a string into SemVer if possible (does not imply --loose) --rtl Coerce version strings right to left --ltr Coerce version strings left to right (default) Program exits successfully if any valid version satisfies all supplied ranges, and prints all satisfying versions. If no satisfying versions are found, then exits failure. Versions are printed in ascending order, so supplying multiple versions to the utility will just sort them. ``` ## Versions A "version" is described by the `v2.0.0` specification found at <https://semver.org/>. A leading `"="` or `"v"` character is stripped off and ignored. ## Ranges A `version range` is a set of `comparators` which specify versions that satisfy the range. A `comparator` is composed of an `operator` and a `version`. The set of primitive `operators` is: * `<` Less than * `<=` Less than or equal to * `>` Greater than * `>=` Greater than or equal to * `=` Equal. If no operator is specified, then equality is assumed, so this operator is optional, but MAY be included. For example, the comparator `>=1.2.7` would match the versions `1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` or `1.1.0`. Comparators can be joined by whitespace to form a `comparator set`, which is satisfied by the **intersection** of all of the comparators it includes. A range is composed of one or more comparator sets, joined by `||`. A version matches a range if and only if every comparator in at least one of the `||`-separated comparator sets is satisfied by the version. For example, the range `>=1.2.7 <1.3.0` would match the versions `1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, or `1.1.0`. The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, `1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. ### Prerelease Tags If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then it will only be allowed to satisfy comparator sets if at least one comparator with the same `[major, minor, patch]` tuple also has a prerelease tag. For example, the range `>1.2.3-alpha.3` would be allowed to match the version `1.2.3-alpha.7`, but it would *not* be satisfied by `3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater than" `1.2.3-alpha.3` according to the SemVer sort rules. The version range only accepts prerelease tags on the `1.2.3` version. The version `3.4.5` *would* satisfy the range, because it does not have a prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. The purpose for this behavior is twofold. First, prerelease versions frequently are updated very quickly, and contain many breaking changes that are (by the author's design) not yet fit for public consumption. Therefore, by default, they are excluded from range matching semantics. Second, a user who has opted into using a prerelease version has clearly indicated the intent to use *that specific* set of alpha/beta/rc versions. By including a prerelease tag in the range, the user is indicating that they are aware of the risk. However, it is still not appropriate to assume that they have opted into taking a similar risk on the *next* set of prerelease versions. Note that this behavior can be suppressed (treating all prerelease versions as if they were normal versions, for the purpose of range matching) by setting the `includePrerelease` flag on the options object to any [functions](https://github.com/npm/node-semver#functions) that do range matching. #### Prerelease Identifiers The method `.inc` takes an additional `identifier` string argument that will append the value of the string as a prerelease identifier: ```javascript semver.inc('1.2.3', 'prerelease', 'beta') // '1.2.4-beta.0' ``` command-line example: ```bash $ semver 1.2.3 -i prerelease --preid beta 1.2.4-beta.0 ``` Which then can be used to increment further: ```bash $ semver 1.2.4-beta.0 -i prerelease 1.2.4-beta.1 ``` ### Advanced Range Syntax Advanced range syntax desugars to primitive comparators in deterministic ways. Advanced ranges may be combined in the same way as primitive comparators using white space or `||`. #### Hyphen Ranges `X.Y.Z - A.B.C` Specifies an inclusive set. * `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` If a partial version is provided as the first version in the inclusive range, then the missing pieces are replaced with zeroes. * `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` If a partial version is provided as the second version in the inclusive range, then all versions that start with the supplied parts of the tuple are accepted, but nothing that would be greater than the provided tuple parts. * `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` * `1.2.3 - 2` := `>=1.2.3 <3.0.0` #### X-Ranges `1.2.x` `1.X` `1.2.*` `*` Any of `X`, `x`, or `*` may be used to "stand in" for one of the numeric values in the `[major, minor, patch]` tuple. * `*` := `>=0.0.0` (Any version satisfies) * `1.x` := `>=1.0.0 <2.0.0` (Matching major version) * `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) A partial version range is treated as an X-Range, so the special character is in fact optional. * `""` (empty string) := `*` := `>=0.0.0` * `1` := `1.x.x` := `>=1.0.0 <2.0.0` * `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` #### Tilde Ranges `~1.2.3` `~1.2` `~1` Allows patch-level changes if a minor version is specified on the comparator. Allows minor-level changes if not. * `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` * `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) * `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) * `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` * `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) * `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) * `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in the `1.2.3` version will be allowed, if they are greater than or equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but `1.2.4-beta.2` would not, because it is a prerelease of a different `[major, minor, patch]` tuple. #### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` Allows changes that do not modify the left-most non-zero element in the `[major, minor, patch]` tuple. In other words, this allows patch and minor updates for versions `1.0.0` and above, patch updates for versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. Many authors treat a `0.x` version as if the `x` were the major "breaking-change" indicator. Caret ranges are ideal when an author may make breaking changes between `0.2.4` and `0.3.0` releases, which is a common practice. However, it presumes that there will *not* be breaking changes between `0.2.4` and `0.2.5`. It allows for changes that are presumed to be additive (but non-breaking), according to commonly observed practices. * `^1.2.3` := `>=1.2.3 <2.0.0` * `^0.2.3` := `>=0.2.3 <0.3.0` * `^0.0.3` := `>=0.0.3 <0.0.4` * `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in the `1.2.3` version will be allowed, if they are greater than or equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but `1.2.4-beta.2` would not, because it is a prerelease of a different `[major, minor, patch]` tuple. * `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the `0.0.3` version *only* will be allowed, if they are greater than or equal to `beta`. So, `0.0.3-pr.2` would be allowed. When parsing caret ranges, a missing `patch` value desugars to the number `0`, but will allow flexibility within that value, even if the major and minor versions are both `0`. * `^1.2.x` := `>=1.2.0 <2.0.0` * `^0.0.x` := `>=0.0.0 <0.1.0` * `^0.0` := `>=0.0.0 <0.1.0` A missing `minor` and `patch` values will desugar to zero, but also allow flexibility within those values, even if the major version is zero. * `^1.x` := `>=1.0.0 <2.0.0` * `^0.x` := `>=0.0.0 <1.0.0` ### Range Grammar Putting all this together, here is a Backus-Naur grammar for ranges, for the benefit of parser authors: ```bnf range-set ::= range ( logical-or range ) * logical-or ::= ( ' ' ) * '||' ( ' ' ) * range ::= hyphen | simple ( ' ' simple ) * | '' hyphen ::= partial ' - ' partial simple ::= primitive | partial | tilde | caret primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? xr ::= 'x' | 'X' | '*' | nr nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * tilde ::= '~' partial caret ::= '^' partial qualifier ::= ( '-' pre )? ( '+' build )? pre ::= parts build ::= parts parts ::= part ( '.' part ) * part ::= nr | [-0-9A-Za-z]+ ``` ## Functions All methods and classes take a final `options` object argument. All options in this object are `false` by default. The options supported are: - `loose` Be more forgiving about not-quite-valid semver strings. (Any resulting output will always be 100% strict compliant, of course.) For backwards compatibility reasons, if the `options` argument is a boolean value instead of an object, it is interpreted to be the `loose` param. - `includePrerelease` Set to suppress the [default behavior](https://github.com/npm/node-semver#prerelease-tags) of excluding prerelease tagged versions from ranges unless they are explicitly opted into. Strict-mode Comparators and Ranges will be strict about the SemVer strings that they parse. * `valid(v)`: Return the parsed version, or null if it's not valid. * `inc(v, release)`: Return the version incremented by the release type (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), or null if it's not valid * `premajor` in one call will bump the version up to the next major version and down to a prerelease of that major version. `preminor`, and `prepatch` work the same way. * If called from a non-prerelease version, the `prerelease` will work the same as `prepatch`. It increments the patch version, then makes a prerelease. If the input version is already a prerelease it simply increments it. * `prerelease(v)`: Returns an array of prerelease components, or null if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` * `major(v)`: Return the major version number. * `minor(v)`: Return the minor version number. * `patch(v)`: Return the patch version number. * `intersects(r1, r2, loose)`: Return true if the two supplied ranges or comparators intersect. * `parse(v)`: Attempt to parse a string as a semantic version, returning either a `SemVer` object or `null`. ### Comparison * `gt(v1, v2)`: `v1 > v2` * `gte(v1, v2)`: `v1 >= v2` * `lt(v1, v2)`: `v1 < v2` * `lte(v1, v2)`: `v1 <= v2` * `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings. * `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. * `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call the corresponding function above. `"==="` and `"!=="` do simple string comparison, but are included for completeness. Throws if an invalid comparison string is provided. * `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. * `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions in descending order when passed to `Array.sort()`. * `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions are equal. Sorts in ascending order if passed to `Array.sort()`. `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. * `diff(v1, v2)`: Returns difference between two versions by the release type (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), or null if the versions are the same. ### Comparators * `intersects(comparator)`: Return true if the comparators intersect ### Ranges * `validRange(range)`: Return the valid range or null if it's not valid * `satisfies(version, range)`: Return true if the version satisfies the range. * `maxSatisfying(versions, range)`: Return the highest version in the list that satisfies the range, or `null` if none of them do. * `minSatisfying(versions, range)`: Return the lowest version in the list that satisfies the range, or `null` if none of them do. * `minVersion(range)`: Return the lowest version that can possibly match the given range. * `gtr(version, range)`: Return `true` if version is greater than all the versions possible in the range. * `ltr(version, range)`: Return `true` if version is less than all the versions possible in the range. * `outside(version, range, hilo)`: Return true if the version is outside the bounds of the range in either the high or low direction. The `hilo` argument must be either the string `'>'` or `'<'`. (This is the function called by `gtr` and `ltr`.) * `intersects(range)`: Return true if any of the ranges comparators intersect Note that, since ranges may be non-contiguous, a version might not be greater than a range, less than a range, *or* satisfy a range! For example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` until `2.0.0`, so the version `1.2.10` would not be greater than the range (because `2.0.1` satisfies, which is higher), nor less than the range (since `1.2.8` satisfies, which is lower), and it also does not satisfy the range. If you want to know if a version satisfies or does not satisfy a range, use the `satisfies(version, range)` function. ### Coercion * `coerce(version, options)`: Coerces a string to semver if possible This aims to provide a very forgiving translation of a non-semver string to semver. It looks for the first digit in a string, and consumes all remaining characters which satisfy at least a partial semver (e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`). Only text which lacks digits will fail coercion (`version one` is not valid). The maximum length for any semver component considered for coercion is 16 characters; longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value components are invalid (`9999999999999999.4.7.4` is likely invalid). If the `options.rtl` flag is set, then `coerce` will return the right-most coercible tuple that does not share an ending index with a longer coercible tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not `4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of any other overlapping SemVer tuple. ### Clean * `clean(version)`: Clean a string to be a valid semver if possible This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges. ex. * `s.clean(' = v 2.1.5foo')`: `null` * `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` * `s.clean(' = v 2.1.5-foo')`: `null` * `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` * `s.clean('=v2.1.5')`: `'2.1.5'` * `s.clean(' =v2.1.5')`: `2.1.5` * `s.clean(' 2.1.5 ')`: `'2.1.5'` * `s.clean('~1.0.0')`: `null`
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/semver/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/semver/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 16973 }
0.19.0 / 2024-09-10 =================== * Remove link renderization in html while redirecting 0.18.0 / 2022-03-23 =================== * Fix emitted 416 error missing headers property * Limit the headers removed for 304 response * deps: [email protected] - Replace internal `eval` usage with `Function` constructor - Use instance methods on `process` to check for listeners * deps: [email protected] * deps: [email protected] - deps: [email protected] - deps: [email protected] * deps: [email protected] * deps: [email protected] 0.17.2 / 2021-12-11 =================== * pref: ignore empty http tokens * deps: [email protected] - deps: [email protected] - deps: [email protected] - deps: [email protected] * deps: [email protected] 0.17.1 / 2019-05-10 =================== * Set stricter CSP header in redirect & error responses * deps: range-parser@~1.2.1 0.17.0 / 2019-05-03 =================== * deps: http-errors@~1.7.2 - Set constructor name when possible - Use `toidentifier` module to make class names - deps: depd@~1.1.2 - deps: [email protected] - deps: statuses@'>= 1.5.0 < 2' * deps: [email protected] - Add extensions for JPEG-2000 images - Add new `font/*` types from IANA - Add WASM mapping - Update `.bdoc` to `application/bdoc` - Update `.bmp` to `image/bmp` - Update `.m4a` to `audio/mp4` - Update `.rtf` to `application/rtf` - Update `.wav` to `audio/wav` - Update `.xml` to `application/xml` - Update generic extensions to `application/octet-stream`: `.deb`, `.dll`, `.dmg`, `.exe`, `.iso`, `.msi` - Use mime-score module to resolve extension conflicts * deps: [email protected] - Add `week`/`w` support - Fix negative number handling * deps: statuses@~1.5.0 * perf: remove redundant `path.normalize` call 0.16.2 / 2018-02-07 =================== * Fix incorrect end tag in default error & redirects * deps: depd@~1.1.2 - perf: remove argument reassignment * deps: encodeurl@~1.0.2 - Fix encoding `%` as last character * deps: statuses@~1.4.0 0.16.1 / 2017-09-29 =================== * Fix regression in edge-case behavior for empty `path` 0.16.0 / 2017-09-27 =================== * Add `immutable` option * Fix missing `</html>` in default error & redirects * Use instance methods on steam to check for listeners * deps: [email protected] - Add 70 new types for file extensions - Set charset as "UTF-8" for .js and .json * perf: improve path validation speed 0.15.6 / 2017-09-22 =================== * deps: [email protected] * perf: improve `If-Match` token parsing 0.15.5 / 2017-09-20 =================== * deps: etag@~1.8.1 - perf: replace regular expression with substring * deps: [email protected] - Fix handling of modified headers with invalid dates - perf: improve ETag match loop - perf: improve `If-None-Match` token parsing 0.15.4 / 2017-08-05 =================== * deps: [email protected] * deps: depd@~1.1.1 - Remove unnecessary `Buffer` loading * deps: http-errors@~1.6.2 - deps: [email protected] 0.15.3 / 2017-05-16 =================== * deps: [email protected] - deps: [email protected] * deps: [email protected] 0.15.2 / 2017-04-26 =================== * deps: [email protected] - Fix `DEBUG_MAX_ARRAY_LENGTH` - deps: [email protected] * deps: [email protected] 0.15.1 / 2017-03-04 =================== * Fix issue when `Date.parse` does not return `NaN` on invalid date * Fix strict violation in broken environments 0.15.0 / 2017-02-25 =================== * Support `If-Match` and `If-Unmodified-Since` headers * Add `res` and `path` arguments to `directory` event * Remove usage of `res._headers` private field - Improves compatibility with Node.js 8 nightly * Send complete HTML document in redirect & error responses * Set default CSP header in redirect & error responses * Use `res.getHeaderNames()` when available * Use `res.headersSent` when available * deps: [email protected] - Allow colors in workers - Deprecated `DEBUG_FD` environment variable set to `3` or higher - Fix error when running under React Native - Use same color for same namespace - deps: [email protected] * deps: etag@~1.8.0 * deps: [email protected] - Fix false detection of `no-cache` request directive - Fix incorrect result when `If-None-Match` has both `*` and ETags - Fix weak `ETag` matching to match spec - perf: delay reading header values until needed - perf: enable strict mode - perf: hoist regular expressions - perf: remove duplicate conditional - perf: remove unnecessary boolean coercions - perf: skip checking modified time if ETag check failed - perf: skip parsing `If-None-Match` when no `ETag` header - perf: use `Date.parse` instead of `new Date` * deps: http-errors@~1.6.1 - Make `message` property enumerable for `HttpError`s - deps: [email protected] 0.14.2 / 2017-01-23 =================== * deps: http-errors@~1.5.1 - deps: [email protected] - deps: [email protected] - deps: statuses@'>= 1.3.1 < 2' * deps: [email protected] * deps: statuses@~1.3.1 0.14.1 / 2016-06-09 =================== * Fix redirect error when `path` contains raw non-URL characters * Fix redirect when `path` starts with multiple forward slashes 0.14.0 / 2016-06-06 =================== * Add `acceptRanges` option * Add `cacheControl` option * Attempt to combine multiple ranges into single range * Correctly inherit from `Stream` class * Fix `Content-Range` header in 416 responses when using `start`/`end` options * Fix `Content-Range` header missing from default 416 responses * Ignore non-byte `Range` headers * deps: http-errors@~1.5.0 - Add `HttpError` export, for `err instanceof createError.HttpError` - Support new code `421 Misdirected Request` - Use `setprototypeof` module to replace `__proto__` setting - deps: [email protected] - deps: statuses@'>= 1.3.0 < 2' - perf: enable strict mode * deps: range-parser@~1.2.0 - Fix incorrectly returning -1 when there is at least one valid range - perf: remove internal function * deps: statuses@~1.3.0 - Add `421 Misdirected Request` - perf: enable strict mode * perf: remove argument reassignment 0.13.2 / 2016-03-05 =================== * Fix invalid `Content-Type` header when `send.mime.default_type` unset 0.13.1 / 2016-01-16 =================== * deps: depd@~1.1.0 - Support web browser loading - perf: enable strict mode * deps: destroy@~1.0.4 - perf: enable strict mode * deps: escape-html@~1.0.3 - perf: enable strict mode - perf: optimize string replacement - perf: use faster string coercion * deps: range-parser@~1.0.3 - perf: enable strict mode 0.13.0 / 2015-06-16 =================== * Allow Node.js HTTP server to set `Date` response header * Fix incorrectly removing `Content-Location` on 304 response * Improve the default redirect response headers * Send appropriate headers on default error response * Use `http-errors` for standard emitted errors * Use `statuses` instead of `http` module for status messages * deps: [email protected] * deps: etag@~1.7.0 - Improve stat performance by removing hashing * deps: [email protected] - Add weak `ETag` matching support * deps: on-finished@~2.3.0 - Add defined behavior for HTTP `CONNECT` requests - Add defined behavior for HTTP `Upgrade` requests - deps: [email protected] * perf: enable strict mode * perf: remove unnecessary array allocations 0.12.3 / 2015-05-13 =================== * deps: debug@~2.2.0 - deps: [email protected] * deps: depd@~1.0.1 * deps: etag@~1.6.0 - Improve support for JXcore - Support "fake" stats objects in environments without `fs` * deps: [email protected] - Prevent extraordinarily long inputs * deps: on-finished@~2.2.1 0.12.2 / 2015-03-13 =================== * Throw errors early for invalid `extensions` or `index` options * deps: debug@~2.1.3 - Fix high intensity foreground color for bold - deps: [email protected] 0.12.1 / 2015-02-17 =================== * Fix regression sending zero-length files 0.12.0 / 2015-02-16 =================== * Always read the stat size from the file * Fix mutating passed-in `options` * deps: [email protected] 0.11.1 / 2015-01-20 =================== * Fix `root` path disclosure 0.11.0 / 2015-01-05 =================== * deps: debug@~2.1.1 * deps: etag@~1.5.1 - deps: [email protected] * deps: [email protected] - Add `milliseconds` - Add `msecs` - Add `secs` - Add `mins` - Add `hrs` - Add `yrs` * deps: on-finished@~2.2.0 0.10.1 / 2014-10-22 =================== * deps: on-finished@~2.1.1 - Fix handling of pipelined requests 0.10.0 / 2014-10-15 =================== * deps: debug@~2.1.0 - Implement `DEBUG_FD` env variable support * deps: depd@~1.0.0 * deps: etag@~1.5.0 - Improve string performance - Slightly improve speed for weak ETags over 1KB 0.9.3 / 2014-09-24 ================== * deps: etag@~1.4.0 - Support "fake" stats objects 0.9.2 / 2014-09-15 ================== * deps: [email protected] * deps: etag@~1.3.1 * deps: range-parser@~1.0.2 0.9.1 / 2014-09-07 ================== * deps: [email protected] 0.9.0 / 2014-09-07 ================== * Add `lastModified` option * Use `etag` to generate `ETag` header * deps: debug@~2.0.0 0.8.5 / 2014-09-04 ================== * Fix malicious path detection for empty string path 0.8.4 / 2014-09-04 ================== * Fix a path traversal issue when using `root` 0.8.3 / 2014-08-16 ================== * deps: [email protected] - renamed from dethroy * deps: [email protected] 0.8.2 / 2014-08-14 ================== * Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` * deps: [email protected] 0.8.1 / 2014-08-05 ================== * Fix `extensions` behavior when file already has extension 0.8.0 / 2014-08-05 ================== * Add `extensions` option 0.7.4 / 2014-08-04 ================== * Fix serving index files without root dir 0.7.3 / 2014-07-29 ================== * Fix incorrect 403 on Windows and Node.js 0.11 0.7.2 / 2014-07-27 ================== * deps: [email protected] - Work-around v8 generating empty stack traces 0.7.1 / 2014-07-26 ================== * deps: [email protected] - Fix exception when global `Error.stackTraceLimit` is too low 0.7.0 / 2014-07-20 ================== * Deprecate `hidden` option; use `dotfiles` option * Add `dotfiles` option * deps: [email protected] * deps: [email protected] - Add `TRACE_DEPRECATION` environment variable - Remove non-standard grey color from color output - Support `--no-deprecation` argument - Support `--trace-deprecation` argument 0.6.0 / 2014-07-11 ================== * Deprecate `from` option; use `root` option * Deprecate `send.etag()` -- use `etag` in `options` * Deprecate `send.hidden()` -- use `hidden` in `options` * Deprecate `send.index()` -- use `index` in `options` * Deprecate `send.maxage()` -- use `maxAge` in `options` * Deprecate `send.root()` -- use `root` in `options` * Cap `maxAge` value to 1 year * deps: [email protected] - Add support for multiple wildcards in namespaces 0.5.0 / 2014-06-28 ================== * Accept string for `maxAge` (converted by `ms`) * Add `headers` event * Include link in default redirect response * Use `EventEmitter.listenerCount` to count listeners 0.4.3 / 2014-06-11 ================== * Do not throw un-catchable error on file open race condition * Use `escape-html` for HTML escaping * deps: [email protected] - fix some debugging output colors on node.js 0.8 * deps: [email protected] * deps: [email protected] 0.4.2 / 2014-06-09 ================== * fix "event emitter leak" warnings * deps: [email protected] * deps: [email protected] 0.4.1 / 2014-06-02 ================== * Send `max-age` in `Cache-Control` in correct format 0.4.0 / 2014-05-27 ================== * Calculate ETag with md5 for reduced collisions * Fix wrong behavior when index file matches directory * Ignore stream errors after request ends - Goodbye `EBADF, read` * Skip directories in index file search * deps: [email protected] 0.3.0 / 2014-04-24 ================== * Fix sending files with dots without root set * Coerce option types * Accept API options in options object * Set etags to "weak" * Include file path in etag * Make "Can't set headers after they are sent." catchable * Send full entity-body for multi range requests * Default directory access to 403 when index disabled * Support multiple index paths * Support "If-Range" header * Control whether to generate etags * deps: [email protected] 0.2.0 / 2014-01-29 ================== * update range-parser and fresh 0.1.4 / 2013-08-11 ================== * update fresh 0.1.3 / 2013-07-08 ================== * Revert "Fix fd leak" 0.1.2 / 2013-07-03 ================== * Fix fd leak 0.1.0 / 2012-08-25 ================== * add options parameter to send() that is passed to fs.createReadStream() [kanongil] 0.0.4 / 2012-08-16 ================== * allow custom "Accept-Ranges" definition 0.0.3 / 2012-07-16 ================== * fix normalization of the root directory. Closes #3 0.0.2 / 2012-07-09 ================== * add passing of req explicitly for now (YUCK) 0.0.1 / 2010-01-03 ================== * Initial release
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/send/HISTORY.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/send/HISTORY.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 13396 }
# send [![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] [![Linux Build][github-actions-ci-image]][github-actions-ci-url] [![Windows Build][appveyor-image]][appveyor-url] [![Test Coverage][coveralls-image]][coveralls-url] Send is a library for streaming files from the file system as a http response supporting partial responses (Ranges), conditional-GET negotiation (If-Match, If-Unmodified-Since, If-None-Match, If-Modified-Since), high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework. Looking to serve up entire folders mapped to URLs? Try [serve-static](https://www.npmjs.org/package/serve-static). ## Installation This is a [Node.js](https://nodejs.org/en/) module available through the [npm registry](https://www.npmjs.com/). Installation is done using the [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): ```bash $ npm install send ``` ## API ```js var send = require('send') ``` ### send(req, path, [options]) Create a new `SendStream` for the given path to send to a `res`. The `req` is the Node.js HTTP request and the `path` is a urlencoded path to send (urlencoded, not the actual file-system path). #### Options ##### acceptRanges Enable or disable accepting ranged requests, defaults to true. Disabling this will not send `Accept-Ranges` and ignore the contents of the `Range` request header. ##### cacheControl Enable or disable setting `Cache-Control` response header, defaults to true. Disabling this will ignore the `immutable` and `maxAge` options. ##### dotfiles Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot ("."). Note this check is done on the path itself without checking if the path actually exists on the disk. If `root` is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny"). - `'allow'` No special treatment for dotfiles. - `'deny'` Send a 403 for any request for a dotfile. - `'ignore'` Pretend like the dotfile does not exist and 404. The default value is _similar_ to `'ignore'`, with the exception that this default will not ignore the files within a directory that begins with a dot, for backward-compatibility. ##### end Byte offset at which the stream ends, defaults to the length of the file minus 1. The end is inclusive in the stream, meaning `end: 3` will include the 4th byte in the stream. ##### etag Enable or disable etag generation, defaults to true. ##### extensions If a given file doesn't exist, try appending one of the given extensions, in the given order. By default, this is disabled (set to `false`). An example value that will serve extension-less HTML files: `['html', 'htm']`. This is skipped if the requested file already has an extension. ##### immutable Enable or disable the `immutable` directive in the `Cache-Control` response header, defaults to `false`. If set to `true`, the `maxAge` option should also be specified to enable caching. The `immutable` directive will prevent supported clients from making conditional requests during the life of the `maxAge` option to check if the file has changed. ##### index By default send supports "index.html" files, to disable this set `false` or to supply a new index pass a string or an array in preferred order. ##### lastModified Enable or disable `Last-Modified` header, defaults to true. Uses the file system's last modified value. ##### maxAge Provide a max-age in milliseconds for http caching, defaults to 0. This can also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme) module. ##### root Serve files relative to `path`. ##### start Byte offset at which the stream starts, defaults to 0. The start is inclusive, meaning `start: 2` will include the 3rd byte in the stream. #### Events The `SendStream` is an event emitter and will emit the following events: - `error` an error occurred `(err)` - `directory` a directory was requested `(res, path)` - `file` a file was requested `(path, stat)` - `headers` the headers are about to be set on a file `(res, path, stat)` - `stream` file streaming has started `(stream)` - `end` streaming has completed #### .pipe The `pipe` method is used to pipe the response into the Node.js HTTP response object, typically `send(req, path, options).pipe(res)`. ### .mime The `mime` export is the global instance of of the [`mime` npm module](https://www.npmjs.com/package/mime). This is used to configure the MIME types that are associated with file extensions as well as other options for how to resolve the MIME type of a file (like the default type to use for an unknown file extension). ## Error-handling By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc. ## Caching It does _not_ perform internal caching, you should use a reverse proxy cache such as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;). ## Debugging To enable `debug()` instrumentation output export __DEBUG__: ``` $ DEBUG=send node app ``` ## Running tests ``` $ npm install $ npm test ``` ## Examples ### Serve a specific file This simple example will send a specific file to all requests. ```js var http = require('http') var send = require('send') var server = http.createServer(function onRequest (req, res) { send(req, '/path/to/index.html') .pipe(res) }) server.listen(3000) ``` ### Serve all files from a directory This simple example will just serve up all the files in a given directory as the top-level. For example, a request `GET /foo.txt` will send back `/www/public/foo.txt`. ```js var http = require('http') var parseUrl = require('parseurl') var send = require('send') var server = http.createServer(function onRequest (req, res) { send(req, parseUrl(req).pathname, { root: '/www/public' }) .pipe(res) }) server.listen(3000) ``` ### Custom file types ```js var http = require('http') var parseUrl = require('parseurl') var send = require('send') // Default unknown types to text/plain send.mime.default_type = 'text/plain' // Add a custom type send.mime.define({ 'application/x-my-type': ['x-mt', 'x-mtt'] }) var server = http.createServer(function onRequest (req, res) { send(req, parseUrl(req).pathname, { root: '/www/public' }) .pipe(res) }) server.listen(3000) ``` ### Custom directory index view This is a example of serving up a structure of directories with a custom function to render a listing of a directory. ```js var http = require('http') var fs = require('fs') var parseUrl = require('parseurl') var send = require('send') // Transfer arbitrary files from within /www/example.com/public/* // with a custom handler for directory listing var server = http.createServer(function onRequest (req, res) { send(req, parseUrl(req).pathname, { index: false, root: '/www/public' }) .once('directory', directory) .pipe(res) }) server.listen(3000) // Custom directory handler function directory (res, path) { var stream = this // redirect to trailing slash for consistent url if (!stream.hasTrailingSlash()) { return stream.redirect(path) } // get directory list fs.readdir(path, function onReaddir (err, list) { if (err) return stream.error(err) // render an index for the directory res.setHeader('Content-Type', 'text/plain; charset=UTF-8') res.end(list.join('\n') + '\n') }) } ``` ### Serving from a root directory with custom error-handling ```js var http = require('http') var parseUrl = require('parseurl') var send = require('send') var server = http.createServer(function onRequest (req, res) { // your custom error-handling logic: function error (err) { res.statusCode = err.status || 500 res.end(err.message) } // your custom headers function headers (res, path, stat) { // serve all files for download res.setHeader('Content-Disposition', 'attachment') } // your custom directory handling logic: function redirect () { res.statusCode = 301 res.setHeader('Location', req.url + '/') res.end('Redirecting to ' + req.url + '/') } // transfer arbitrary files from within // /www/example.com/public/* send(req, parseUrl(req).pathname, { root: '/www/public' }) .on('error', error) .on('directory', redirect) .on('headers', headers) .pipe(res) }) server.listen(3000) ``` ## License [MIT](LICENSE) [appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/send/master?label=windows [appveyor-url]: https://ci.appveyor.com/project/dougwilson/send [coveralls-image]: https://badgen.net/coveralls/c/github/pillarjs/send/master [coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master [github-actions-ci-image]: https://badgen.net/github/checks/pillarjs/send/master?label=linux [github-actions-ci-url]: https://github.com/pillarjs/send/actions/workflows/ci.yml [node-image]: https://badgen.net/npm/node/send [node-url]: https://nodejs.org/en/download/ [npm-downloads-image]: https://badgen.net/npm/dm/send [npm-url]: https://npmjs.org/package/send [npm-version-image]: https://badgen.net/npm/v/send
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/send/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/send/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 9475 }
# Security Policies and Procedures ## Reporting a Bug The `send` team and community take all security bugs seriously. Thank you for improving the security of Express. We appreciate your efforts and responsible disclosure and will make every effort to acknowledge your contributions. Report security bugs by emailing the current owner(s) of `send`. This information can be found in the npm registry using the command `npm owner ls send`. If unsure or unable to get the information from the above, open an issue in the [project issue tracker](https://github.com/pillarjs/send/issues) asking for the current contact information. To ensure the timely response to your report, please ensure that the entirety of the report is contained within the email body and not solely behind a web link or an attachment. At least one owner will acknowledge your email within 48 hours, and will send a more detailed response within 48 hours indicating the next steps in handling your report. After the initial reply to your report, the owners will endeavor to keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/send/SECURITY.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/send/SECURITY.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1169 }
1.16.2 / 2024-09-11 =================== * deps: encodeurl@~2.0.0 1.16.1 / 2024-09-11 =================== * deps: [email protected] 1.16.0 / 2024-09-10 =================== * Remove link renderization in html while redirecting 1.15.0 / 2022-03-24 =================== * deps: [email protected] - Fix emitted 416 error missing headers property - Limit the headers removed for 304 response - deps: [email protected] - deps: [email protected] - deps: [email protected] - deps: [email protected] - deps: [email protected] 1.14.2 / 2021-12-15 =================== * deps: [email protected] - deps: [email protected] - deps: [email protected] - pref: ignore empty http tokens 1.14.1 / 2019-05-10 =================== * Set stricter CSP header in redirect response * deps: [email protected] - deps: range-parser@~1.2.1 1.14.0 / 2019-05-07 =================== * deps: parseurl@~1.3.3 * deps: [email protected] - deps: http-errors@~1.7.2 - deps: [email protected] - deps: [email protected] - deps: statuses@~1.5.0 - perf: remove redundant `path.normalize` call 1.13.2 / 2018-02-07 =================== * Fix incorrect end tag in redirects * deps: encodeurl@~1.0.2 - Fix encoding `%` as last character * deps: [email protected] - deps: depd@~1.1.2 - deps: encodeurl@~1.0.2 - deps: statuses@~1.4.0 1.13.1 / 2017-09-29 =================== * Fix regression when `root` is incorrectly set to a file * deps: [email protected] 1.13.0 / 2017-09-27 =================== * deps: [email protected] - Add 70 new types for file extensions - Add `immutable` option - Fix missing `</html>` in default error & redirects - Set charset as "UTF-8" for .js and .json - Use instance methods on steam to check for listeners - deps: [email protected] - perf: improve path validation speed 1.12.6 / 2017-09-22 =================== * deps: [email protected] - deps: [email protected] - perf: improve `If-Match` token parsing * perf: improve slash collapsing 1.12.5 / 2017-09-21 =================== * deps: parseurl@~1.3.2 - perf: reduce overhead for full URLs - perf: unroll the "fast-path" `RegExp` * deps: [email protected] - Fix handling of modified headers with invalid dates - deps: etag@~1.8.1 - deps: [email protected] 1.12.4 / 2017-08-05 =================== * deps: [email protected] - deps: [email protected] - deps: depd@~1.1.1 - deps: http-errors@~1.6.2 1.12.3 / 2017-05-16 =================== * deps: [email protected] - deps: [email protected] 1.12.2 / 2017-04-26 =================== * deps: [email protected] - deps: [email protected] 1.12.1 / 2017-03-04 =================== * deps: [email protected] - Fix issue when `Date.parse` does not return `NaN` on invalid date - Fix strict violation in broken environments 1.12.0 / 2017-02-25 =================== * Send complete HTML document in redirect response * Set default CSP header in redirect response * deps: [email protected] - Fix false detection of `no-cache` request directive - Fix incorrect result when `If-None-Match` has both `*` and ETags - Fix weak `ETag` matching to match spec - Remove usage of `res._headers` private field - Support `If-Match` and `If-Unmodified-Since` headers - Use `res.getHeaderNames()` when available - Use `res.headersSent` when available - deps: [email protected] - deps: etag@~1.8.0 - deps: [email protected] - deps: http-errors@~1.6.1 1.11.2 / 2017-01-23 =================== * deps: [email protected] - deps: http-errors@~1.5.1 - deps: [email protected] - deps: statuses@~1.3.1 1.11.1 / 2016-06-10 =================== * Fix redirect error when `req.url` contains raw non-URL characters * deps: [email protected] 1.11.0 / 2016-06-07 =================== * Use status code 301 for redirects * deps: [email protected] - Add `acceptRanges` option - Add `cacheControl` option - Attempt to combine multiple ranges into single range - Correctly inherit from `Stream` class - Fix `Content-Range` header in 416 responses when using `start`/`end` options - Fix `Content-Range` header missing from default 416 responses - Ignore non-byte `Range` headers - deps: http-errors@~1.5.0 - deps: range-parser@~1.2.0 - deps: statuses@~1.3.0 - perf: remove argument reassignment 1.10.3 / 2016-05-30 =================== * deps: [email protected] - Fix invalid `Content-Type` header when `send.mime.default_type` unset 1.10.2 / 2016-01-19 =================== * deps: parseurl@~1.3.1 - perf: enable strict mode 1.10.1 / 2016-01-16 =================== * deps: escape-html@~1.0.3 - perf: enable strict mode - perf: optimize string replacement - perf: use faster string coercion * deps: [email protected] - deps: depd@~1.1.0 - deps: destroy@~1.0.4 - deps: escape-html@~1.0.3 - deps: range-parser@~1.0.3 1.10.0 / 2015-06-17 =================== * Add `fallthrough` option - Allows declaring this middleware is the final destination - Provides better integration with Express patterns * Fix reading options from options prototype * Improve the default redirect response headers * deps: [email protected] * deps: [email protected] - Allow Node.js HTTP server to set `Date` response header - Fix incorrectly removing `Content-Location` on 304 response - Improve the default redirect response headers - Send appropriate headers on default error response - Use `http-errors` for standard emitted errors - Use `statuses` instead of `http` module for status messages - deps: [email protected] - deps: etag@~1.7.0 - deps: [email protected] - deps: on-finished@~2.3.0 - perf: enable strict mode - perf: remove unnecessary array allocations * perf: enable strict mode * perf: remove argument reassignment 1.9.3 / 2015-05-14 ================== * deps: [email protected] - deps: debug@~2.2.0 - deps: depd@~1.0.1 - deps: etag@~1.6.0 - deps: [email protected] - deps: on-finished@~2.2.1 1.9.2 / 2015-03-14 ================== * deps: [email protected] - Throw errors early for invalid `extensions` or `index` options - deps: debug@~2.1.3 1.9.1 / 2015-02-17 ================== * deps: [email protected] - Fix regression sending zero-length files 1.9.0 / 2015-02-16 ================== * deps: [email protected] - Always read the stat size from the file - Fix mutating passed-in `options` - deps: [email protected] 1.8.1 / 2015-01-20 ================== * Fix redirect loop in Node.js 0.11.14 * deps: [email protected] - Fix root path disclosure 1.8.0 / 2015-01-05 ================== * deps: [email protected] - deps: debug@~2.1.1 - deps: etag@~1.5.1 - deps: [email protected] - deps: on-finished@~2.2.0 1.7.2 / 2015-01-02 ================== * Fix potential open redirect when mounted at root 1.7.1 / 2014-10-22 ================== * deps: [email protected] - deps: on-finished@~2.1.1 1.7.0 / 2014-10-15 ================== * deps: [email protected] - deps: debug@~2.1.0 - deps: depd@~1.0.0 - deps: etag@~1.5.0 1.6.5 / 2015-02-04 ================== * Fix potential open redirect when mounted at root - Back-ported from v1.7.2 1.6.4 / 2014-10-08 ================== * Fix redirect loop when index file serving disabled 1.6.3 / 2014-09-24 ================== * deps: [email protected] - deps: etag@~1.4.0 1.6.2 / 2014-09-15 ================== * deps: [email protected] - deps: [email protected] - deps: etag@~1.3.1 - deps: range-parser@~1.0.2 1.6.1 / 2014-09-07 ================== * deps: [email protected] - deps: [email protected] 1.6.0 / 2014-09-07 ================== * deps: [email protected] - Add `lastModified` option - Use `etag` to generate `ETag` header - deps: debug@~2.0.0 1.5.4 / 2014-09-04 ================== * deps: [email protected] - Fix a path traversal issue when using `root` - Fix malicious path detection for empty string path 1.5.3 / 2014-08-17 ================== * deps: [email protected] 1.5.2 / 2014-08-14 ================== * deps: [email protected] - Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` 1.5.1 / 2014-08-09 ================== * Fix parsing of weird `req.originalUrl` values * deps: parseurl@~1.3.0 * deps: [email protected] 1.5.0 / 2014-08-05 ================== * deps: [email protected] - Add `extensions` option 1.4.4 / 2014-08-04 ================== * deps: [email protected] - Fix serving index files without root dir 1.4.3 / 2014-07-29 ================== * deps: [email protected] - Fix incorrect 403 on Windows and Node.js 0.11 1.4.2 / 2014-07-27 ================== * deps: [email protected] - deps: [email protected] 1.4.1 / 2014-07-26 ================== * deps: [email protected] - deps: [email protected] 1.4.0 / 2014-07-21 ================== * deps: parseurl@~1.2.0 - Cache URLs based on original value - Remove no-longer-needed URL mis-parse work-around - Simplify the "fast-path" `RegExp` * deps: [email protected] - Add `dotfiles` option - deps: [email protected] - deps: [email protected] 1.3.2 / 2014-07-11 ================== * deps: [email protected] - Cap `maxAge` value to 1 year - deps: [email protected] 1.3.1 / 2014-07-09 ================== * deps: parseurl@~1.1.3 - faster parsing of href-only URLs 1.3.0 / 2014-06-28 ================== * Add `setHeaders` option * Include HTML link in redirect response * deps: [email protected] - Accept string for `maxAge` (converted by `ms`) 1.2.3 / 2014-06-11 ================== * deps: [email protected] - Do not throw un-catchable error on file open race condition - Use `escape-html` for HTML escaping - deps: [email protected] - deps: [email protected] - deps: [email protected] 1.2.2 / 2014-06-09 ================== * deps: [email protected] - fix "event emitter leak" warnings - deps: [email protected] - deps: [email protected] 1.2.1 / 2014-06-02 ================== * use `escape-html` for escaping * deps: [email protected] - Send `max-age` in `Cache-Control` in correct format 1.2.0 / 2014-05-29 ================== * deps: [email protected] - Calculate ETag with md5 for reduced collisions - Fix wrong behavior when index file matches directory - Ignore stream errors after request ends - Skip directories in index file search - deps: [email protected] 1.1.0 / 2014-04-24 ================== * Accept options directly to `send` module * deps: [email protected] 1.0.4 / 2014-04-07 ================== * Resolve relative paths at middleware setup * Use parseurl to parse the URL from request 1.0.3 / 2014-03-20 ================== * Do not rely on connect-like environments 1.0.2 / 2014-03-06 ================== * deps: [email protected] 1.0.1 / 2014-03-05 ================== * Add mime export for back-compat 1.0.0 / 2014-03-05 ================== * Genesis from `connect`
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/serve-static/HISTORY.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/serve-static/HISTORY.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 10762 }
# serve-static [![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] [![Linux Build][github-actions-ci-image]][github-actions-ci-url] [![Windows Build][appveyor-image]][appveyor-url] [![Test Coverage][coveralls-image]][coveralls-url] ## Install This is a [Node.js](https://nodejs.org/en/) module available through the [npm registry](https://www.npmjs.com/). Installation is done using the [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): ```sh $ npm install serve-static ``` ## API ```js var serveStatic = require('serve-static') ``` ### serveStatic(root, options) Create a new middleware function to serve files from within a given root directory. The file to serve will be determined by combining `req.url` with the provided root directory. When a file is not found, instead of sending a 404 response, this module will instead call `next()` to move on to the next middleware, allowing for stacking and fall-backs. #### Options ##### acceptRanges Enable or disable accepting ranged requests, defaults to true. Disabling this will not send `Accept-Ranges` and ignore the contents of the `Range` request header. ##### cacheControl Enable or disable setting `Cache-Control` response header, defaults to true. Disabling this will ignore the `immutable` and `maxAge` options. ##### dotfiles Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot ("."). Note this check is done on the path itself without checking if the path actually exists on the disk. If `root` is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when set to "deny"). - `'allow'` No special treatment for dotfiles. - `'deny'` Deny a request for a dotfile and 403/`next()`. - `'ignore'` Pretend like the dotfile does not exist and 404/`next()`. The default value is similar to `'ignore'`, with the exception that this default will not ignore the files within a directory that begins with a dot. ##### etag Enable or disable etag generation, defaults to true. ##### extensions Set file extension fallbacks. When set, if a file is not found, the given extensions will be added to the file name and search for. The first that exists will be served. Example: `['html', 'htm']`. The default value is `false`. ##### fallthrough Set the middleware to have client errors fall-through as just unhandled requests, otherwise forward a client error. The difference is that client errors like a bad request or a request to a non-existent file will cause this middleware to simply `next()` to your next middleware when this value is `true`. When this value is `false`, these errors (even 404s), will invoke `next(err)`. Typically `true` is desired such that multiple physical directories can be mapped to the same web address or for routes to fill in non-existent files. The value `false` can be used if this middleware is mounted at a path that is designed to be strictly a single file system directory, which allows for short-circuiting 404s for less overhead. This middleware will also reply to all methods. The default value is `true`. ##### immutable Enable or disable the `immutable` directive in the `Cache-Control` response header, defaults to `false`. If set to `true`, the `maxAge` option should also be specified to enable caching. The `immutable` directive will prevent supported clients from making conditional requests during the life of the `maxAge` option to check if the file has changed. ##### index By default this module will send "index.html" files in response to a request on a directory. To disable this set `false` or to supply a new index pass a string or an array in preferred order. ##### lastModified Enable or disable `Last-Modified` header, defaults to true. Uses the file system's last modified value. ##### maxAge Provide a max-age in milliseconds for http caching, defaults to 0. This can also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme) module. ##### redirect Redirect to trailing "/" when the pathname is a dir. Defaults to `true`. ##### setHeaders Function to set custom headers on response. Alterations to the headers need to occur synchronously. The function is called as `fn(res, path, stat)`, where the arguments are: - `res` the response object - `path` the file path that is being sent - `stat` the stat object of the file that is being sent ## Examples ### Serve files with vanilla node.js http server ```js var finalhandler = require('finalhandler') var http = require('http') var serveStatic = require('serve-static') // Serve up public/ftp folder var serve = serveStatic('public/ftp', { index: ['index.html', 'index.htm'] }) // Create server var server = http.createServer(function onRequest (req, res) { serve(req, res, finalhandler(req, res)) }) // Listen server.listen(3000) ``` ### Serve all files as downloads ```js var contentDisposition = require('content-disposition') var finalhandler = require('finalhandler') var http = require('http') var serveStatic = require('serve-static') // Serve up public/ftp folder var serve = serveStatic('public/ftp', { index: false, setHeaders: setHeaders }) // Set header to force download function setHeaders (res, path) { res.setHeader('Content-Disposition', contentDisposition(path)) } // Create server var server = http.createServer(function onRequest (req, res) { serve(req, res, finalhandler(req, res)) }) // Listen server.listen(3000) ``` ### Serving using express #### Simple This is a simple example of using Express. ```js var express = require('express') var serveStatic = require('serve-static') var app = express() app.use(serveStatic('public/ftp', { index: ['default.html', 'default.htm'] })) app.listen(3000) ``` #### Multiple roots This example shows a simple way to search through multiple directories. Files are searched for in `public-optimized/` first, then `public/` second as a fallback. ```js var express = require('express') var path = require('path') var serveStatic = require('serve-static') var app = express() app.use(serveStatic(path.join(__dirname, 'public-optimized'))) app.use(serveStatic(path.join(__dirname, 'public'))) app.listen(3000) ``` #### Different settings for paths This example shows how to set a different max age depending on the served file type. In this example, HTML files are not cached, while everything else is for 1 day. ```js var express = require('express') var path = require('path') var serveStatic = require('serve-static') var app = express() app.use(serveStatic(path.join(__dirname, 'public'), { maxAge: '1d', setHeaders: setCustomCacheControl })) app.listen(3000) function setCustomCacheControl (res, path) { if (serveStatic.mime.lookup(path) === 'text/html') { // Custom Cache-Control for HTML files res.setHeader('Cache-Control', 'public, max-age=0') } } ``` ## License [MIT](LICENSE) [appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/serve-static/master?label=windows [appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-static [coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/serve-static/master [coveralls-url]: https://coveralls.io/r/expressjs/serve-static?branch=master [github-actions-ci-image]: https://badgen.net/github/checks/expressjs/serve-static/master?label=linux [github-actions-ci-url]: https://github.com/expressjs/serve-static/actions/workflows/ci.yml [node-image]: https://badgen.net/npm/node/serve-static [node-url]: https://nodejs.org/en/download/ [npm-downloads-image]: https://badgen.net/npm/dm/serve-static [npm-url]: https://npmjs.org/package/serve-static [npm-version-image]: https://badgen.net/npm/v/serve-static
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/serve-static/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/serve-static/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 7811 }
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [v1.2.2](https://github.com/ljharb/set-function-length/compare/v1.2.1...v1.2.2) - 2024-03-09 ### Commits - [types] use shared config [`027032f`](https://github.com/ljharb/set-function-length/commit/027032fe9cc439644a07248ea6a8d813fcc767cb) - [actions] remove redundant finisher; use reusable workflow [`1fd4fb1`](https://github.com/ljharb/set-function-length/commit/1fd4fb1c58bd5170f0dcff7e320077c0aa2ffdeb) - [types] use a handwritten d.ts file instead of emit [`01b9761`](https://github.com/ljharb/set-function-length/commit/01b9761742c95e1118e8c2d153ce2ae43d9731aa) - [Deps] update `define-data-property`, `get-intrinsic`, `has-property-descriptors` [`bee8eaf`](https://github.com/ljharb/set-function-length/commit/bee8eaf7749f325357ade85cffeaeef679e513d4) - [Dev Deps] update `call-bind`, `tape` [`5dae579`](https://github.com/ljharb/set-function-length/commit/5dae579fdc3aab91b14ebb58f9c19ee3f509d434) - [Tests] use `@arethetypeswrong/cli` [`7e22425`](https://github.com/ljharb/set-function-length/commit/7e22425d15957fd3d6da0b6bca4afc0c8d255d2d) ## [v1.2.1](https://github.com/ljharb/set-function-length/compare/v1.2.0...v1.2.1) - 2024-02-06 ### Commits - [Dev Deps] update `call-bind`, `tape`, `typescript` [`d9a4601`](https://github.com/ljharb/set-function-length/commit/d9a460199c4c1fa37da9ebe055e2c884128f0738) - [Deps] update `define-data-property`, `get-intrinsic` [`38d39ae`](https://github.com/ljharb/set-function-length/commit/38d39aed13a757ed36211d5b0437b88485090c6b) - [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`b4bfe5a`](https://github.com/ljharb/set-function-length/commit/b4bfe5ae0953b906d55b85f867eca5e7f673ebf4) ## [v1.2.0](https://github.com/ljharb/set-function-length/compare/v1.1.1...v1.2.0) - 2024-01-14 ### Commits - [New] add types [`f6d9088`](https://github.com/ljharb/set-function-length/commit/f6d9088b9283a3112b21c6776e8bef6d1f30558a) - [Fix] ensure `env` properties are always booleans [`0c42f84`](https://github.com/ljharb/set-function-length/commit/0c42f84979086389b3229e1b4272697fd352275a) - [Dev Deps] update `aud`, `call-bind`, `npmignore`, `tape` [`2b75f75`](https://github.com/ljharb/set-function-length/commit/2b75f75468093a4bb8ce8ca989b2edd2e80d95d1) - [Deps] update `get-intrinsic`, `has-property-descriptors` [`19bf0fc`](https://github.com/ljharb/set-function-length/commit/19bf0fc4ffaa5ad425acbfa150516be9f3b6263a) - [meta] add `sideEffects` flag [`8bb9b78`](https://github.com/ljharb/set-function-length/commit/8bb9b78c11c621123f725c9470222f43466c01d0) ## [v1.1.1](https://github.com/ljharb/set-function-length/compare/v1.1.0...v1.1.1) - 2023-10-19 ### Fixed - [Fix] move `define-data-property` to runtime deps [`#2`](https://github.com/ljharb/set-function-length/issues/2) ### Commits - [Dev Deps] update `object-inspect`; add missing `call-bind` [`5aecf79`](https://github.com/ljharb/set-function-length/commit/5aecf79e7d6400957a5d9bd9ac20d4528908ca18) ## [v1.1.0](https://github.com/ljharb/set-function-length/compare/v1.0.1...v1.1.0) - 2023-10-13 ### Commits - [New] add `env` entry point [`475c87a`](https://github.com/ljharb/set-function-length/commit/475c87aa2f59b700aaed589d980624ec596acdcb) - [Tests] add coverage with `nyc` [`14f0bf8`](https://github.com/ljharb/set-function-length/commit/14f0bf8c145ae60bf14a026420a06bb7be132c36) - [eslint] fix linting failure [`fb516f9`](https://github.com/ljharb/set-function-length/commit/fb516f93c664057138c53559ef63c8622a093335) - [Deps] update `define-data-property` [`d727e7c`](https://github.com/ljharb/set-function-length/commit/d727e7c6c9a40d7bf26797694e500ea68741feea) ## [v1.0.1](https://github.com/ljharb/set-function-length/compare/v1.0.0...v1.0.1) - 2023-10-12 ### Commits - [Refactor] use `get-intrinsic`, since it‘s in the dep graph anyways [`278a954`](https://github.com/ljharb/set-function-length/commit/278a954a06cd849051c569ff7aee56df6798933e) - [meta] add `exports` [`72acfe5`](https://github.com/ljharb/set-function-length/commit/72acfe5a0310071fb205a72caba5ecbab24336a0) ## v1.0.0 - 2023-10-12 ### Commits - Initial implementation, tests, readme [`fce14e1`](https://github.com/ljharb/set-function-length/commit/fce14e17586460e4f294405173be72b6ffdf7e5f) - Initial commit [`ca7ba85`](https://github.com/ljharb/set-function-length/commit/ca7ba857c7c283f9d26e21f14e71cd388f2cb722) - npm init [`6a7e493`](https://github.com/ljharb/set-function-length/commit/6a7e493927736cebcaf5c1a84e69b8e6b7b744d8) - Only apps should have lockfiles [`d2bf6c4`](https://github.com/ljharb/set-function-length/commit/d2bf6c43de8a51b02a0aa53e8d62cb50c4a2b0da)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/set-function-length/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/set-function-length/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 4873 }
# set-function-length <sup>[![Version Badge][npm-version-svg]][package-url]</sup> [![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][npm-badge-png]][package-url] Set a function’s length. Arguments: - `fn`: the function - `length`: the new length. Must be an integer between 0 and 2**32. - `loose`: Optional. If true, and the length fails to be set, do not throw. Default false. Returns `fn`. ## Usage ```javascript var setFunctionLength = require('set-function-length'); var assert = require('assert'); function zero() {} function one(_) {} function two(_, __) {} assert.equal(zero.length, 0); assert.equal(one.length, 1); assert.equal(two.length, 2); assert.equal(setFunctionLength(zero, 10), zero); assert.equal(setFunctionLength(one, 11), one); assert.equal(setFunctionLength(two, 12), two); assert.equal(zero.length, 10); assert.equal(one.length, 11); assert.equal(two.length, 12); ``` [package-url]: https://npmjs.org/package/set-function-length [npm-version-svg]: https://versionbadg.es/ljharb/set-function-length.svg [deps-svg]: https://david-dm.org/ljharb/set-function-length.svg [deps-url]: https://david-dm.org/ljharb/set-function-length [dev-deps-svg]: https://david-dm.org/ljharb/set-function-length/dev-status.svg [dev-deps-url]: https://david-dm.org/ljharb/set-function-length#info=devDependencies [npm-badge-png]: https://nodei.co/npm/set-function-length.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/set-function-length.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/set-function-length.svg [downloads-url]: https://npm-stat.com/charts.html?package=set-function-length [codecov-image]: https://codecov.io/gh/ljharb/set-function-length/branch/main/graphs/badge.svg [codecov-url]: https://app.codecov.io/gh/ljharb/set-function-length/ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/set-function-length [actions-url]: https://github.com/ljharb/set-function-length/actions
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/set-function-length/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/set-function-length/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2164 }
# Polyfill for `Object.setPrototypeOf` [![NPM Version](https://img.shields.io/npm/v/setprototypeof.svg)](https://npmjs.org/package/setprototypeof) [![NPM Downloads](https://img.shields.io/npm/dm/setprototypeof.svg)](https://npmjs.org/package/setprototypeof) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/standard/standard) A simple cross platform implementation to set the prototype of an instianted object. Supports all modern browsers and at least back to IE8. ## Usage: ``` $ npm install --save setprototypeof ``` ```javascript var setPrototypeOf = require('setprototypeof') var obj = {} setPrototypeOf(obj, { foo: function () { return 'bar' } }) obj.foo() // bar ``` TypeScript is also supported: ```typescript import setPrototypeOf from 'setprototypeof' ```
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/setprototypeof/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/setprototypeof/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 843 }
# shebang-command [![Build Status](https://travis-ci.org/kevva/shebang-command.svg?branch=master)](https://travis-ci.org/kevva/shebang-command) > Get the command from a shebang ## Install ``` $ npm install shebang-command ``` ## Usage ```js const shebangCommand = require('shebang-command'); shebangCommand('#!/usr/bin/env node'); //=> 'node' shebangCommand('#!/bin/bash'); //=> 'bash' ``` ## API ### shebangCommand(string) #### string Type: `string` String containing a shebang.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/shebang-command/readme.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/shebang-command/readme.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 494 }
# shebang-regex [![Build Status](https://travis-ci.org/sindresorhus/shebang-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/shebang-regex) > Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line ## Install ``` $ npm install shebang-regex ``` ## Usage ```js const shebangRegex = require('shebang-regex'); const string = '#!/usr/bin/env node\nconsole.log("unicorns");'; shebangRegex.test(string); //=> true shebangRegex.exec(string)[0]; //=> '#!/usr/bin/env node' shebangRegex.exec(string)[1]; //=> '/usr/bin/env node' ``` ## License MIT © [Sindre Sorhus](https://sindresorhus.com)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/shebang-regex/readme.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/shebang-regex/readme.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 647 }
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [v1.0.6](https://github.com/ljharb/side-channel/compare/v1.0.5...v1.0.6) - 2024-02-29 ### Commits - add types [`9beef66`](https://github.com/ljharb/side-channel/commit/9beef6643e6d717ea57bedabf86448123a7dd9e9) - [meta] simplify `exports` [`4334cf9`](https://github.com/ljharb/side-channel/commit/4334cf9df654151504c383b62a2f9ebdc8d9d5ac) - [Deps] update `call-bind` [`d6043c4`](https://github.com/ljharb/side-channel/commit/d6043c4d8f4d7be9037dd0f0419c7a2e0e39ec6a) - [Dev Deps] update `tape` [`6aca376`](https://github.com/ljharb/side-channel/commit/6aca3761868dc8cd5ff7fd9799bf6b95e09a6eb0) ## [v1.0.5](https://github.com/ljharb/side-channel/compare/v1.0.4...v1.0.5) - 2024-02-06 ### Commits - [actions] reuse common workflows [`3d2e1ff`](https://github.com/ljharb/side-channel/commit/3d2e1ffd16dd6eaaf3e40ff57951f840d2d63c04) - [meta] use `npmignore` to autogenerate an npmignore file [`04296ea`](https://github.com/ljharb/side-channel/commit/04296ea17d1544b0a5d20fd5bfb31aa4f6513eb9) - [meta] add `.editorconfig`; add `eclint` [`130f0a6`](https://github.com/ljharb/side-channel/commit/130f0a6adbc04d385c7456a601d38344dce3d6a9) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`d480c2f`](https://github.com/ljharb/side-channel/commit/d480c2fbe757489ae9b4275491ffbcc3ac4725e9) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ecbe70e`](https://github.com/ljharb/side-channel/commit/ecbe70e53a418234081a77971fec1fdfae20c841) - [actions] update rebase action [`75240b9`](https://github.com/ljharb/side-channel/commit/75240b9963b816e8846400d2287cb68f88c7fba7) - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`ae8d281`](https://github.com/ljharb/side-channel/commit/ae8d281572430099109870fd9430d2ca3f320b8d) - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`7125b88`](https://github.com/ljharb/side-channel/commit/7125b885fd0eacad4fee9b073b72d14065ece278) - [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`82577c9`](https://github.com/ljharb/side-channel/commit/82577c9796304519139a570f82a317211b5f3b86) - [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`550aadf`](https://github.com/ljharb/side-channel/commit/550aadf20475a6081fd70304cc54f77259a5c8a8) - [Tests] increase coverage [`5130877`](https://github.com/ljharb/side-channel/commit/5130877a7b27c862e64e6d1c12a178b28808859d) - [Deps] update `get-intrinsic`, `object-inspect` [`ba0194c`](https://github.com/ljharb/side-channel/commit/ba0194c505b1a8a0427be14cadd5b8a46d4d01b8) - [meta] add missing `engines.node` [`985fd24`](https://github.com/ljharb/side-channel/commit/985fd249663cb06617a693a94fe08cad12f5cb70) - [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`40227a8`](https://github.com/ljharb/side-channel/commit/40227a87b01709ad2c0eebf87eb4223a800099b9) - [Deps] update `get-intrinsic` [`a989b40`](https://github.com/ljharb/side-channel/commit/a989b4024958737ae7be9fbffdeff2078f33a0fd) - [Deps] update `object-inspect` [`aec42d2`](https://github.com/ljharb/side-channel/commit/aec42d2ec541a31aaa02475692c87d489237d9a3) ## [v1.0.4](https://github.com/ljharb/side-channel/compare/v1.0.3...v1.0.4) - 2020-12-29 ### Commits - [Tests] migrate tests to Github Actions [`10909cb`](https://github.com/ljharb/side-channel/commit/10909cbf8ce9c0bf96f604cf13d7ffd5a22c2d40) - [Refactor] Use a linked list rather than an array, and move accessed nodes to the beginning [`195613f`](https://github.com/ljharb/side-channel/commit/195613f28b5c1e6072ef0b61b5beebaf2b6a304e) - [meta] do not publish github action workflow files [`290ec29`](https://github.com/ljharb/side-channel/commit/290ec29cd21a60585145b4a7237ec55228c52c27) - [Tests] run `nyc` on all tests; use `tape` runner [`ea6d030`](https://github.com/ljharb/side-channel/commit/ea6d030ff3fe6be2eca39e859d644c51ecd88869) - [actions] add "Allow Edits" workflow [`d464d8f`](https://github.com/ljharb/side-channel/commit/d464d8fe52b5eddf1504a0ed97f0941a90f32c15) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`02daca8`](https://github.com/ljharb/side-channel/commit/02daca87c6809821c97be468d1afa2f5ef447383) - [Refactor] use `call-bind` and `get-intrinsic` instead of `es-abstract` [`e09d481`](https://github.com/ljharb/side-channel/commit/e09d481528452ebafa5cdeae1af665c35aa2deee) - [Deps] update `object.assign` [`ee83aa8`](https://github.com/ljharb/side-channel/commit/ee83aa81df313b5e46319a63adb05cf0c179079a) - [actions] update rebase action to use checkout v2 [`7726b0b`](https://github.com/ljharb/side-channel/commit/7726b0b058b632fccea709f58960871defaaa9d7) ## [v1.0.3](https://github.com/ljharb/side-channel/compare/v1.0.2...v1.0.3) - 2020-08-23 ### Commits - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`1f10561`](https://github.com/ljharb/side-channel/commit/1f105611ef3acf32dec8032ae5c0baa5e56bb868) - [Deps] update `es-abstract`, `object-inspect` [`bc20159`](https://github.com/ljharb/side-channel/commit/bc201597949a505e37cef9eaf24c7010831e6f03) - [Dev Deps] update `@ljharb/eslint-config`, `tape` [`b9b2b22`](https://github.com/ljharb/side-channel/commit/b9b2b225f9e0ea72a6ec2b89348f0bd690bc9ed1) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`7055ab4`](https://github.com/ljharb/side-channel/commit/7055ab4de0860606efd2003674a74f1fe6ebc07e) - [Dev Deps] update `auto-changelog`; add `aud` [`d278c37`](https://github.com/ljharb/side-channel/commit/d278c37d08227be4f84aa769fcd919e73feeba40) - [actions] switch Automatic Rebase workflow to `pull_request_target` event [`3bcf982`](https://github.com/ljharb/side-channel/commit/3bcf982faa122745b39c33ce83d32fdf003741c6) - [Tests] only audit prod deps [`18d01c4`](https://github.com/ljharb/side-channel/commit/18d01c4015b82a3d75044c4d5ba7917b2eac01ec) - [Deps] update `es-abstract` [`6ab096d`](https://github.com/ljharb/side-channel/commit/6ab096d9de2b482cf5e0717e34e212f5b2b9bc9a) - [Dev Deps] update `tape` [`9dc174c`](https://github.com/ljharb/side-channel/commit/9dc174cc651dfd300b4b72da936a0a7eda5f9452) - [Deps] update `es-abstract` [`431d0f0`](https://github.com/ljharb/side-channel/commit/431d0f0ff11fbd2ae6f3115582a356d3a1cfce82) - [Deps] update `es-abstract` [`49869fd`](https://github.com/ljharb/side-channel/commit/49869fd323bf4453f0ba515c0fb265cf5ab7b932) - [meta] Add package.json to package's exports [`77d9cdc`](https://github.com/ljharb/side-channel/commit/77d9cdceb2a9e47700074f2ae0c0a202e7dac0d4) ## [v1.0.2](https://github.com/ljharb/side-channel/compare/v1.0.1...v1.0.2) - 2019-12-20 ### Commits - [Dev Deps] update `@ljharb/eslint-config`, `tape` [`4a526df`](https://github.com/ljharb/side-channel/commit/4a526df44e4701566ed001ec78546193f818b082) - [Deps] update `es-abstract` [`d4f6e62`](https://github.com/ljharb/side-channel/commit/d4f6e629b6fb93a07415db7f30d3c90fd7f264fe) ## [v1.0.1](https://github.com/ljharb/side-channel/compare/v1.0.0...v1.0.1) - 2019-12-01 ### Commits - [Fix] add missing "exports" [`d212907`](https://github.com/ljharb/side-channel/commit/d2129073abf0701a5343bf28aa2145617604dc2e) ## v1.0.0 - 2019-12-01 ### Commits - Initial implementation [`dbebd3a`](https://github.com/ljharb/side-channel/commit/dbebd3a4b5ed64242f9a6810efe7c4214cd8cde4) - Initial tests [`73bdefe`](https://github.com/ljharb/side-channel/commit/73bdefe568c9076cf8c0b8719bc2141aec0e19b8) - Initial commit [`43c03e1`](https://github.com/ljharb/side-channel/commit/43c03e1c2849ec50a87b7a5cd76238a62b0b8770) - npm init [`5c090a7`](https://github.com/ljharb/side-channel/commit/5c090a765d66a5527d9889b89aeff78dee91348c) - [meta] add `auto-changelog` [`a5c4e56`](https://github.com/ljharb/side-channel/commit/a5c4e5675ec02d5eb4d84b4243aeea2a1d38fbec) - [actions] add automatic rebasing / merge commit blocking [`bab1683`](https://github.com/ljharb/side-channel/commit/bab1683d8f9754b086e94397699fdc645e0d7077) - [meta] add `funding` field; create FUNDING.yml [`63d7aea`](https://github.com/ljharb/side-channel/commit/63d7aeaf34f5650650ae97ca4b9fae685bd0937c) - [Tests] add `npm run lint` [`46a5a81`](https://github.com/ljharb/side-channel/commit/46a5a81705cd2664f83df232c01dbbf2ee952885) - Only apps should have lockfiles [`8b16b03`](https://github.com/ljharb/side-channel/commit/8b16b0305f00895d90c4e2e5773c854cfea0e448) - [meta] add `safe-publish-latest` [`2f098ef`](https://github.com/ljharb/side-channel/commit/2f098ef092a39399cfe548b19a1fc03c2fd2f490)
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/side-channel/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/side-channel/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 8801 }
# side-channel Store information about any JS value in a side channel. Uses WeakMap if available.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/side-channel/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/side-channel/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 97 }
# signal-exit When you want to fire an event no matter how a process exits: - reaching the end of execution. - explicitly having `process.exit(code)` called. - having `process.kill(pid, sig)` called. - receiving a fatal signal from outside the process Use `signal-exit`. ```js // Hybrid module, either works import { onExit } from 'signal-exit' // or: // const { onExit } = require('signal-exit') onExit((code, signal) => { console.log('process exited!', code, signal) }) ``` ## API `remove = onExit((code, signal) => {}, options)` The return value of the function is a function that will remove the handler. Note that the function _only_ fires for signals if the signal would cause the process to exit. That is, there are no other listeners, and it is a fatal signal. If the global `process` object is not suitable for this purpose (ie, it's unset, or doesn't have an `emit` method, etc.) then the `onExit` function is a no-op that returns a no-op `remove` method. ### Options - `alwaysLast`: Run this handler after any other signal or exit handlers. This causes `process.emit` to be monkeypatched. ### Capturing Signal Exits If the handler returns an exact boolean `true`, and the exit is a due to signal, then the signal will be considered handled, and will _not_ trigger a synthetic `process.kill(process.pid, signal)` after firing the `onExit` handlers. In this case, it your responsibility as the caller to exit with a signal (for example, by calling `process.kill()`) if you wish to preserve the same exit status that would otherwise have occurred. If you do not, then the process will likely exit gracefully with status 0 at some point, assuming that no other terminating signal or other exit trigger occurs. Prior to calling handlers, the `onExit` machinery is unloaded, so any subsequent exits or signals will not be handled, even if the signal is captured and the exit is thus prevented. Note that numeric code exits may indicate that the process is already committed to exiting, for example due to a fatal exception or unhandled promise rejection, and so there is no way to prevent it safely. ### Browser Fallback The `'signal-exit/browser'` module is the same fallback shim that just doesn't do anything, but presents the same function interface. Patches welcome to add something that hooks onto `window.onbeforeunload` or similar, but it might just not be a thing that makes sense there.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/signal-exit/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/signal-exit/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 2425 }
# Source Map JS [![NPM](https://nodei.co/npm/source-map-js.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map-js) Difference between original [source-map](https://github.com/mozilla/source-map): > TL,DR: it's fork of original [email protected], but with perfomance optimizations. This journey starts from [[email protected]](https://github.com/mozilla/source-map/blob/master/CHANGELOG.md#070). Some part of it was rewritten to Rust and WASM and API became async. It's still a major block for many libraries like PostCSS or Sass for example because they need to migrate the whole API to the async way. This is the reason why 0.6.1 has 2x more downloads than 0.7.3 while it's faster several times. ![Downloads count](media/downloads.png) More important that WASM version has some optimizations in JS code too. This is why [community asked to create branch for 0.6 version](https://github.com/mozilla/source-map/issues/324) and port these optimizations but, sadly, the answer was «no». A bit later I discovered [the issue](https://github.com/mozilla/source-map/issues/370) created by [Ben Rothman (@benthemonkey)](https://github.com/benthemonkey) with no response at all. [Roman Dvornov (@lahmatiy)](https://github.com/lahmatiy) wrote a [serveral posts](https://t.me/gorshochekvarit/76) (russian, only, sorry) about source-map library in his own Telegram channel. He mentioned the article [«Maybe you don't need Rust and WASM to speed up your JS»](https://mrale.ph/blog/2018/02/03/maybe-you-dont-need-rust-to-speed-up-your-js.html) written by [Vyacheslav Egorov (@mraleph)](https://github.com/mraleph). This article contains optimizations and hacks that lead to almost the same performance compare to WASM implementation. I decided to fork the original source-map and port these optimizations from the article and several others PR from the original source-map. --------- This is a library to generate and consume the source map format [described here][format]. [format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit ## Use with Node $ npm install source-map-js <!-- ## Use on the Web <script src="https://raw.githubusercontent.com/mozilla/source-map/master/dist/source-map.min.js" defer></script> --> -------------------------------------------------------------------------------- <!-- `npm run toc` to regenerate the Table of Contents --> <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> ## Table of Contents - [Examples](#examples) - [Consuming a source map](#consuming-a-source-map) - [Generating a source map](#generating-a-source-map) - [With SourceNode (high level API)](#with-sourcenode-high-level-api) - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api) - [API](#api) - [SourceMapConsumer](#sourcemapconsumer) - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap) - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans) - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition) - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition) - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition) - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources) - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing) - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order) - [SourceMapGenerator](#sourcemapgenerator) - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap) - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer) - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping) - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent) - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath) - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring) - [SourceNode](#sourcenode) - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name) - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath) - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk) - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk) - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent) - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn) - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn) - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep) - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement) - [SourceNode.prototype.toString()](#sourcenodeprototypetostring) - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap) <!-- END doctoc generated TOC please keep comment here to allow auto update --> ## Examples ### Consuming a source map ```js var rawSourceMap = { version: 3, file: 'min.js', names: ['bar', 'baz', 'n'], sources: ['one.js', 'two.js'], sourceRoot: 'http://example.com/www/js/', mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA' }; var smc = new SourceMapConsumer(rawSourceMap); console.log(smc.sources); // [ 'http://example.com/www/js/one.js', // 'http://example.com/www/js/two.js' ] console.log(smc.originalPositionFor({ line: 2, column: 28 })); // { source: 'http://example.com/www/js/two.js', // line: 2, // column: 10, // name: 'n' } console.log(smc.generatedPositionFor({ source: 'http://example.com/www/js/two.js', line: 2, column: 10 })); // { line: 2, column: 28 } smc.eachMapping(function (m) { // ... }); ``` ### Generating a source map In depth guide: [**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/) #### With SourceNode (high level API) ```js function compile(ast) { switch (ast.type) { case 'BinaryExpression': return new SourceNode( ast.location.line, ast.location.column, ast.location.source, [compile(ast.left), " + ", compile(ast.right)] ); case 'Literal': return new SourceNode( ast.location.line, ast.location.column, ast.location.source, String(ast.value) ); // ... default: throw new Error("Bad AST"); } } var ast = parse("40 + 2", "add.js"); console.log(compile(ast).toStringWithSourceMap({ file: 'add.js' })); // { code: '40 + 2', // map: [object SourceMapGenerator] } ``` #### With SourceMapGenerator (low level API) ```js var map = new SourceMapGenerator({ file: "source-mapped.js" }); map.addMapping({ generated: { line: 10, column: 35 }, source: "foo.js", original: { line: 33, column: 2 }, name: "christopher" }); console.log(map.toString()); // '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}' ``` ## API Get a reference to the module: ```js // Node.js var sourceMap = require('source-map'); // Browser builds var sourceMap = window.sourceMap; // Inside Firefox const sourceMap = require("devtools/toolkit/sourcemap/source-map.js"); ``` ### SourceMapConsumer A SourceMapConsumer instance represents a parsed source map which we can query for information about the original file positions by giving it a file position in the generated source. #### new SourceMapConsumer(rawSourceMap) The only parameter is the raw source map (either as a string which can be `JSON.parse`'d, or an object). According to the spec, source maps have the following attributes: * `version`: Which version of the source map spec this map is following. * `sources`: An array of URLs to the original source files. * `names`: An array of identifiers which can be referenced by individual mappings. * `sourceRoot`: Optional. The URL root from which all sources are relative. * `sourcesContent`: Optional. An array of contents of the original source files. * `mappings`: A string of base64 VLQs which contain the actual mappings. * `file`: Optional. The generated filename this source map is associated with. ```js var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData); ``` #### SourceMapConsumer.prototype.computeColumnSpans() Compute the last column for each generated mapping. The last column is inclusive. ```js // Before: consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) // [ { line: 2, // column: 1 }, // { line: 2, // column: 10 }, // { line: 2, // column: 20 } ] consumer.computeColumnSpans(); // After: consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) // [ { line: 2, // column: 1, // lastColumn: 9 }, // { line: 2, // column: 10, // lastColumn: 19 }, // { line: 2, // column: 20, // lastColumn: Infinity } ] ``` #### SourceMapConsumer.prototype.originalPositionFor(generatedPosition) Returns the original source, line, and column information for the generated source's line and column positions provided. The only argument is an object with the following properties: * `line`: The line number in the generated source. Line numbers in this library are 1-based (note that the underlying source map specification uses 0-based line numbers -- this library handles the translation). * `column`: The column number in the generated source. Column numbers in this library are 0-based. * `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest element that is smaller than or greater than the one we are searching for, respectively, if the exact element cannot be found. Defaults to `SourceMapConsumer.GREATEST_LOWER_BOUND`. and an object is returned with the following properties: * `source`: The original source file, or null if this information is not available. * `line`: The line number in the original source, or null if this information is not available. The line number is 1-based. * `column`: The column number in the original source, or null if this information is not available. The column number is 0-based. * `name`: The original identifier, or null if this information is not available. ```js consumer.originalPositionFor({ line: 2, column: 10 }) // { source: 'foo.coffee', // line: 2, // column: 2, // name: null } consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 }) // { source: null, // line: null, // column: null, // name: null } ``` #### SourceMapConsumer.prototype.generatedPositionFor(originalPosition) Returns the generated line and column information for the original source, line, and column positions provided. The only argument is an object with the following properties: * `source`: The filename of the original source. * `line`: The line number in the original source. The line number is 1-based. * `column`: The column number in the original source. The column number is 0-based. and an object is returned with the following properties: * `line`: The line number in the generated source, or null. The line number is 1-based. * `column`: The column number in the generated source, or null. The column number is 0-based. ```js consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 }) // { line: 1, // column: 56 } ``` #### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition) Returns all generated line and column information for the original source, line, and column provided. If no column is provided, returns all mappings corresponding to a either the line we are searching for or the next closest line that has any mappings. Otherwise, returns all mappings corresponding to the given line and either the column we are searching for or the next closest column that has any offsets. The only argument is an object with the following properties: * `source`: The filename of the original source. * `line`: The line number in the original source. The line number is 1-based. * `column`: Optional. The column number in the original source. The column number is 0-based. and an array of objects is returned, each with the following properties: * `line`: The line number in the generated source, or null. The line number is 1-based. * `column`: The column number in the generated source, or null. The column number is 0-based. ```js consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) // [ { line: 2, // column: 1 }, // { line: 2, // column: 10 }, // { line: 2, // column: 20 } ] ``` #### SourceMapConsumer.prototype.hasContentsOfAllSources() Return true if we have the embedded source content for every source listed in the source map, false otherwise. In other words, if this method returns `true`, then `consumer.sourceContentFor(s)` will succeed for every source `s` in `consumer.sources`. ```js // ... if (consumer.hasContentsOfAllSources()) { consumerReadyCallback(consumer); } else { fetchSources(consumer, consumerReadyCallback); } // ... ``` #### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing]) Returns the original source content for the source provided. The only argument is the URL of the original source file. If the source content for the given source is not found, then an error is thrown. Optionally, pass `true` as the second param to have `null` returned instead. ```js consumer.sources // [ "my-cool-lib.clj" ] consumer.sourceContentFor("my-cool-lib.clj") // "..." consumer.sourceContentFor("this is not in the source map"); // Error: "this is not in the source map" is not in the source map consumer.sourceContentFor("this is not in the source map", true); // null ``` #### SourceMapConsumer.prototype.eachMapping(callback, context, order) Iterate over each mapping between an original source/line/column and a generated line/column in this source map. * `callback`: The function that is called with each mapping. Mappings have the form `{ source, generatedLine, generatedColumn, originalLine, originalColumn, name }` * `context`: Optional. If specified, this object will be the value of `this` every time that `callback` is called. * `order`: Either `SourceMapConsumer.GENERATED_ORDER` or `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over the mappings sorted by the generated file's line/column order or the original's source/line/column order, respectively. Defaults to `SourceMapConsumer.GENERATED_ORDER`. ```js consumer.eachMapping(function (m) { console.log(m); }) // ... // { source: 'illmatic.js', // generatedLine: 1, // generatedColumn: 0, // originalLine: 1, // originalColumn: 0, // name: null } // { source: 'illmatic.js', // generatedLine: 2, // generatedColumn: 0, // originalLine: 2, // originalColumn: 0, // name: null } // ... ``` ### SourceMapGenerator An instance of the SourceMapGenerator represents a source map which is being built incrementally. #### new SourceMapGenerator([startOfSourceMap]) You may pass an object with the following properties: * `file`: The filename of the generated source that this source map is associated with. * `sourceRoot`: A root for all relative URLs in this source map. * `skipValidation`: Optional. When `true`, disables validation of mappings as they are added. This can improve performance but should be used with discretion, as a last resort. Even then, one should avoid using this flag when running tests, if possible. * `ignoreInvalidMapping`: Optional. When `true`, instead of throwing error on invalid mapping, it will be ignored. ```js var generator = new sourceMap.SourceMapGenerator({ file: "my-generated-javascript-file.js", sourceRoot: "http://example.com/app/js/" }); ``` #### SourceMapGenerator.fromSourceMap(sourceMapConsumer, sourceMapGeneratorOptions) Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance. * `sourceMapConsumer` The SourceMap. * `sourceMapGeneratorOptions` options that will be passed to the SourceMapGenerator constructor which used under the hood. ```js var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer, { ignoreInvalidMapping: true, }); ``` #### SourceMapGenerator.prototype.addMapping(mapping) Add a single mapping from original source line and column to the generated source's line and column for this source map being created. The mapping object should have the following properties: * `generated`: An object with the generated line and column positions. * `original`: An object with the original line and column positions. * `source`: The original source file (relative to the sourceRoot). * `name`: An optional original token name for this mapping. ```js generator.addMapping({ source: "module-one.scm", original: { line: 128, column: 0 }, generated: { line: 3, column: 456 } }) ``` #### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent) Set the source content for an original source file. * `sourceFile` the URL of the original source file. * `sourceContent` the content of the source file. ```js generator.setSourceContent("module-one.scm", fs.readFileSync("path/to/module-one.scm")) ``` #### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]]) Applies a SourceMap for a source file to the SourceMap. Each mapping to the supplied source file is rewritten using the supplied SourceMap. Note: The resolution for the resulting mappings is the minimum of this map and the supplied map. * `sourceMapConsumer`: The SourceMap to be applied. * `sourceFile`: Optional. The filename of the source file. If omitted, sourceMapConsumer.file will be used, if it exists. Otherwise an error will be thrown. * `sourceMapPath`: Optional. The dirname of the path to the SourceMap to be applied. If relative, it is relative to the SourceMap. This parameter is needed when the two SourceMaps aren't in the same directory, and the SourceMap to be applied contains relative source paths. If so, those relative source paths need to be rewritten relative to the SourceMap. If omitted, it is assumed that both SourceMaps are in the same directory, thus not needing any rewriting. (Supplying `'.'` has the same effect.) #### SourceMapGenerator.prototype.toString() Renders the source map being generated to a string. ```js generator.toString() // '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}' ``` ### SourceNode SourceNodes provide a way to abstract over interpolating and/or concatenating snippets of generated JavaScript source code, while maintaining the line and column information associated between those snippets and the original source code. This is useful as the final intermediate representation a compiler might use before outputting the generated JS and source map. #### new SourceNode([line, column, source[, chunk[, name]]]) * `line`: The original line number associated with this source node, or null if it isn't associated with an original line. The line number is 1-based. * `column`: The original column number associated with this source node, or null if it isn't associated with an original column. The column number is 0-based. * `source`: The original source's filename; null if no filename is provided. * `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see below. * `name`: Optional. The original identifier. ```js var node = new SourceNode(1, 2, "a.cpp", [ new SourceNode(3, 4, "b.cpp", "extern int status;\n"), new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"), new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"), ]); ``` #### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath]) Creates a SourceNode from generated code and a SourceMapConsumer. * `code`: The generated code * `sourceMapConsumer` The SourceMap for the generated code * `relativePath` The optional path that relative sources in `sourceMapConsumer` should be relative to. ```js var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8")); var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"), consumer); ``` #### SourceNode.prototype.add(chunk) Add a chunk of generated JS to this source node. * `chunk`: A string snippet of generated JS code, another instance of `SourceNode`, or an array where each member is one of those things. ```js node.add(" + "); node.add(otherNode); node.add([leftHandOperandNode, " + ", rightHandOperandNode]); ``` #### SourceNode.prototype.prepend(chunk) Prepend a chunk of generated JS to this source node. * `chunk`: A string snippet of generated JS code, another instance of `SourceNode`, or an array where each member is one of those things. ```js node.prepend("/** Build Id: f783haef86324gf **/\n\n"); ``` #### SourceNode.prototype.setSourceContent(sourceFile, sourceContent) Set the source content for a source file. This will be added to the `SourceMap` in the `sourcesContent` field. * `sourceFile`: The filename of the source file * `sourceContent`: The content of the source file ```js node.setSourceContent("module-one.scm", fs.readFileSync("path/to/module-one.scm")) ``` #### SourceNode.prototype.walk(fn) Walk over the tree of JS snippets in this node and its children. The walking function is called once for each snippet of JS and is passed that snippet and the its original associated source's line/column location. * `fn`: The traversal function. ```js var node = new SourceNode(1, 2, "a.js", [ new SourceNode(3, 4, "b.js", "uno"), "dos", [ "tres", new SourceNode(5, 6, "c.js", "quatro") ] ]); node.walk(function (code, loc) { console.log("WALK:", code, loc); }) // WALK: uno { source: 'b.js', line: 3, column: 4, name: null } // WALK: dos { source: 'a.js', line: 1, column: 2, name: null } // WALK: tres { source: 'a.js', line: 1, column: 2, name: null } // WALK: quatro { source: 'c.js', line: 5, column: 6, name: null } ``` #### SourceNode.prototype.walkSourceContents(fn) Walk over the tree of SourceNodes. The walking function is called for each source file content and is passed the filename and source content. * `fn`: The traversal function. ```js var a = new SourceNode(1, 2, "a.js", "generated from a"); a.setSourceContent("a.js", "original a"); var b = new SourceNode(1, 2, "b.js", "generated from b"); b.setSourceContent("b.js", "original b"); var c = new SourceNode(1, 2, "c.js", "generated from c"); c.setSourceContent("c.js", "original c"); var node = new SourceNode(null, null, null, [a, b, c]); node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); }) // WALK: a.js : original a // WALK: b.js : original b // WALK: c.js : original c ``` #### SourceNode.prototype.join(sep) Like `Array.prototype.join` except for SourceNodes. Inserts the separator between each of this source node's children. * `sep`: The separator. ```js var lhs = new SourceNode(1, 2, "a.rs", "my_copy"); var operand = new SourceNode(3, 4, "a.rs", "="); var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()"); var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]); var joinedNode = node.join(" "); ``` #### SourceNode.prototype.replaceRight(pattern, replacement) Call `String.prototype.replace` on the very right-most source snippet. Useful for trimming white space from the end of a source node, etc. * `pattern`: The pattern to replace. * `replacement`: The thing to replace the pattern with. ```js // Trim trailing white space. node.replaceRight(/\s*$/, ""); ``` #### SourceNode.prototype.toString() Return the string representation of this source node. Walks over the tree and concatenates all the various snippets together to one string. ```js var node = new SourceNode(1, 2, "a.js", [ new SourceNode(3, 4, "b.js", "uno"), "dos", [ "tres", new SourceNode(5, 6, "c.js", "quatro") ] ]); node.toString() // 'unodostresquatro' ``` #### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap]) Returns the string representation of this tree of source nodes, plus a SourceMapGenerator which contains all the mappings between the generated and original sources. The arguments are the same as those to `new SourceMapGenerator`. ```js var node = new SourceNode(1, 2, "a.js", [ new SourceNode(3, 4, "b.js", "uno"), "dos", [ "tres", new SourceNode(5, 6, "c.js", "quatro") ] ]); node.toStringWithSourceMap({ file: "my-output-file.js" }) // { code: 'unodostresquatro', // map: [object SourceMapGenerator] } ```
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/source-map-js/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/source-map-js/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 26035 }
The MIT License (MIT) Copyright (c) 2014 Evan Wallace Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/source-map-support/LICENSE.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/source-map-support/LICENSE.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1078 }
# Source Map Support [![Build Status](https://travis-ci.org/evanw/node-source-map-support.svg?branch=master)](https://travis-ci.org/evanw/node-source-map-support) This module provides source map support for stack traces in node via the [V8 stack trace API](https://github.com/v8/v8/wiki/Stack-Trace-API). It uses the [source-map](https://github.com/mozilla/source-map) module to replace the paths and line numbers of source-mapped files with their original paths and line numbers. The output mimics node's stack trace format with the goal of making every compile-to-JS language more of a first-class citizen. Source maps are completely general (not specific to any one language) so you can use source maps with multiple compile-to-JS languages in the same node process. ## Installation and Usage #### Node support ``` $ npm install source-map-support ``` Source maps can be generated using libraries such as [source-map-index-generator](https://github.com/twolfson/source-map-index-generator). Once you have a valid source map, place a source mapping comment somewhere in the file (usually done automatically or with an option by your transpiler): ``` //# sourceMappingURL=path/to/source.map ``` If multiple sourceMappingURL comments exist in one file, the last sourceMappingURL comment will be respected (e.g. if a file mentions the comment in code, or went through multiple transpilers). The path should either be absolute or relative to the compiled file. From here you have two options. ##### CLI Usage ```bash node -r source-map-support/register compiled.js ``` ##### Programmatic Usage Put the following line at the top of the compiled file. ```js require('source-map-support').install(); ``` It is also possible to install the source map support directly by requiring the `register` module which can be handy with ES6: ```js import 'source-map-support/register' // Instead of: import sourceMapSupport from 'source-map-support' sourceMapSupport.install() ``` Note: if you're using babel-register, it includes source-map-support already. It is also very useful with Mocha: ``` $ mocha --require source-map-support/register tests/ ``` #### Browser support This library also works in Chrome. While the DevTools console already supports source maps, the V8 engine doesn't and `Error.prototype.stack` will be incorrect without this library. Everything will just work if you deploy your source files using [browserify](http://browserify.org/). Just make sure to pass the `--debug` flag to the browserify command so your source maps are included in the bundled code. This library also works if you use another build process or just include the source files directly. In this case, include the file `browser-source-map-support.js` in your page and call `sourceMapSupport.install()`. It contains the whole library already bundled for the browser using browserify. ```html <script src="browser-source-map-support.js"></script> <script>sourceMapSupport.install();</script> ``` This library also works if you use AMD (Asynchronous Module Definition), which is used in tools like [RequireJS](http://requirejs.org/). Just list `browser-source-map-support` as a dependency: ```html <script> define(['browser-source-map-support'], function(sourceMapSupport) { sourceMapSupport.install(); }); </script> ``` ## Options This module installs two things: a change to the `stack` property on `Error` objects and a handler for uncaught exceptions that mimics node's default exception handler (the handler can be seen in the demos below). You may want to disable the handler if you have your own uncaught exception handler. This can be done by passing an argument to the installer: ```js require('source-map-support').install({ handleUncaughtExceptions: false }); ``` This module loads source maps from the filesystem by default. You can provide alternate loading behavior through a callback as shown below. For example, [Meteor](https://github.com/meteor) keeps all source maps cached in memory to avoid disk access. ```js require('source-map-support').install({ retrieveSourceMap: function(source) { if (source === 'compiled.js') { return { url: 'original.js', map: fs.readFileSync('compiled.js.map', 'utf8') }; } return null; } }); ``` The module will by default assume a browser environment if XMLHttpRequest and window are defined. If either of these do not exist it will instead assume a node environment. In some rare cases, e.g. when running a browser emulation and where both variables are also set, you can explictly specify the environment to be either 'browser' or 'node'. ```js require('source-map-support').install({ environment: 'node' }); ``` To support files with inline source maps, the `hookRequire` options can be specified, which will monitor all source files for inline source maps. ```js require('source-map-support').install({ hookRequire: true }); ``` This monkey patches the `require` module loading chain, so is not enabled by default and is not recommended for any sort of production usage. ## Demos #### Basic Demo original.js: ```js throw new Error('test'); // This is the original code ``` compiled.js: ```js require('source-map-support').install(); throw new Error('test'); // This is the compiled code // The next line defines the sourceMapping. //# sourceMappingURL=compiled.js.map ``` compiled.js.map: ```json { "version": 3, "file": "compiled.js", "sources": ["original.js"], "names": [], "mappings": ";;AAAA,MAAM,IAAI" } ``` Run compiled.js using node (notice how the stack trace uses original.js instead of compiled.js): ``` $ node compiled.js original.js:1 throw new Error('test'); // This is the original code ^ Error: test at Object.<anonymous> (original.js:1:7) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:901:3 ``` #### TypeScript Demo demo.ts: ```typescript declare function require(name: string); require('source-map-support').install(); class Foo { constructor() { this.bar(); } bar() { throw new Error('this is a demo'); } } new Foo(); ``` Compile and run the file using the TypeScript compiler from the terminal: ``` $ npm install source-map-support typescript $ node_modules/typescript/bin/tsc -sourcemap demo.ts $ node demo.js demo.ts:5 bar() { throw new Error('this is a demo'); } ^ Error: this is a demo at Foo.bar (demo.ts:5:17) at new Foo (demo.ts:4:24) at Object.<anonymous> (demo.ts:7:1) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:901:3 ``` There is also the option to use `-r source-map-support/register` with typescript, without the need add the `require('source-map-support').install()` in the code base: ``` $ npm install source-map-support typescript $ node_modules/typescript/bin/tsc -sourcemap demo.ts $ node -r source-map-support/register demo.js demo.ts:5 bar() { throw new Error('this is a demo'); } ^ Error: this is a demo at Foo.bar (demo.ts:5:17) at new Foo (demo.ts:4:24) at Object.<anonymous> (demo.ts:7:1) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:901:3 ``` #### CoffeeScript Demo demo.coffee: ```coffee require('source-map-support').install() foo = -> bar = -> throw new Error 'this is a demo' bar() foo() ``` Compile and run the file using the CoffeeScript compiler from the terminal: ```sh $ npm install source-map-support coffeescript $ node_modules/.bin/coffee --map --compile demo.coffee $ node demo.js demo.coffee:3 bar = -> throw new Error 'this is a demo' ^ Error: this is a demo at bar (demo.coffee:3:22) at foo (demo.coffee:4:3) at Object.<anonymous> (demo.coffee:5:1) at Object.<anonymous> (demo.coffee:1:1) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) ``` ## Tests This repo contains both automated tests for node and manual tests for the browser. The automated tests can be run using mocha (type `mocha` in the root directory). To run the manual tests: * Build the tests using `build.js` * Launch the HTTP server (`npm run serve-tests`) and visit * http://127.0.0.1:1336/amd-test * http://127.0.0.1:1336/browser-test * http://127.0.0.1:1336/browserify-test - **Currently not working** due to a bug with browserify (see [pull request #66](https://github.com/evanw/node-source-map-support/pull/66) for details). * For `header-test`, run `server.js` inside that directory and visit http://127.0.0.1:1337/ ## License This code is available under the [MIT license](http://opensource.org/licenses/MIT).
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/source-map-support/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/source-map-support/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 9458 }
# Change Log ## 0.5.6 * Fix for regression when people were using numbers as names in source maps. See #236. ## 0.5.5 * Fix "regression" of unsupported, implementation behavior that half the world happens to have come to depend on. See #235. * Fix regression involving function hoisting in SpiderMonkey. See #233. ## 0.5.4 * Large performance improvements to source-map serialization. See #228 and #229. ## 0.5.3 * Do not include unnecessary distribution files. See commit ef7006f8d1647e0a83fdc60f04f5a7ca54886f86. ## 0.5.2 * Include browser distributions of the library in package.json's `files`. See issue #212. ## 0.5.1 * Fix latent bugs in IndexedSourceMapConsumer.prototype._parseMappings. See ff05274becc9e6e1295ed60f3ea090d31d843379. ## 0.5.0 * Node 0.8 is no longer supported. * Use webpack instead of dryice for bundling. * Big speedups serializing source maps. See pull request #203. * Fix a bug with `SourceMapConsumer.prototype.sourceContentFor` and sources that explicitly start with the source root. See issue #199. ## 0.4.4 * Fix an issue where using a `SourceMapGenerator` after having created a `SourceMapConsumer` from it via `SourceMapConsumer.fromSourceMap` failed. See issue #191. * Fix an issue with where `SourceMapGenerator` would mistakenly consider different mappings as duplicates of each other and avoid generating them. See issue #192. ## 0.4.3 * A very large number of performance improvements, particularly when parsing source maps. Collectively about 75% of time shaved off of the source map parsing benchmark! * Fix a bug in `SourceMapConsumer.prototype.allGeneratedPositionsFor` and fuzzy searching in the presence of a column option. See issue #177. * Fix a bug with joining a source and its source root when the source is above the root. See issue #182. * Add the `SourceMapConsumer.prototype.hasContentsOfAllSources` method to determine when all sources' contents are inlined into the source map. See issue #190. ## 0.4.2 * Add an `.npmignore` file so that the benchmarks aren't pulled down by dependent projects. Issue #169. * Add an optional `column` argument to `SourceMapConsumer.prototype.allGeneratedPositionsFor` and better handle lines with no mappings. Issues #172 and #173. ## 0.4.1 * Fix accidentally defining a global variable. #170. ## 0.4.0 * The default direction for fuzzy searching was changed back to its original direction. See #164. * There is now a `bias` option you can supply to `SourceMapConsumer` to control the fuzzy searching direction. See #167. * About an 8% speed up in parsing source maps. See #159. * Added a benchmark for parsing and generating source maps. ## 0.3.0 * Change the default direction that searching for positions fuzzes when there is not an exact match. See #154. * Support for environments using json2.js for JSON serialization. See #156. ## 0.2.0 * Support for consuming "indexed" source maps which do not have any remote sections. See pull request #127. This introduces a minor backwards incompatibility if you are monkey patching `SourceMapConsumer.prototype` methods. ## 0.1.43 * Performance improvements for `SourceMapGenerator` and `SourceNode`. See issue #148 for some discussion and issues #150, #151, and #152 for implementations. ## 0.1.42 * Fix an issue where `SourceNode`s from different versions of the source-map library couldn't be used in conjunction with each other. See issue #142. ## 0.1.41 * Fix a bug with getting the source content of relative sources with a "./" prefix. See issue #145 and [Bug 1090768](bugzil.la/1090768). * Add the `SourceMapConsumer.prototype.computeColumnSpans` method to compute the column span of each mapping. * Add the `SourceMapConsumer.prototype.allGeneratedPositionsFor` method to find all generated positions associated with a given original source and line. ## 0.1.40 * Performance improvements for parsing source maps in SourceMapConsumer. ## 0.1.39 * Fix a bug where setting a source's contents to null before any source content had been set before threw a TypeError. See issue #131. ## 0.1.38 * Fix a bug where finding relative paths from an empty path were creating absolute paths. See issue #129. ## 0.1.37 * Fix a bug where if the source root was an empty string, relative source paths would turn into absolute source paths. Issue #124. ## 0.1.36 * Allow the `names` mapping property to be an empty string. Issue #121. ## 0.1.35 * A third optional parameter was added to `SourceNode.fromStringWithSourceMap` to specify a path that relative sources in the second parameter should be relative to. Issue #105. * If no file property is given to a `SourceMapGenerator`, then the resulting source map will no longer have a `null` file property. The property will simply not exist. Issue #104. * Fixed a bug where consecutive newlines were ignored in `SourceNode`s. Issue #116. ## 0.1.34 * Make `SourceNode` work with windows style ("\r\n") newlines. Issue #103. * Fix bug involving source contents and the `SourceMapGenerator.prototype.applySourceMap`. Issue #100. ## 0.1.33 * Fix some edge cases surrounding path joining and URL resolution. * Add a third parameter for relative path to `SourceMapGenerator.prototype.applySourceMap`. * Fix issues with mappings and EOLs. ## 0.1.32 * Fixed a bug where SourceMapConsumer couldn't handle negative relative columns (issue 92). * Fixed test runner to actually report number of failed tests as its process exit code. * Fixed a typo when reporting bad mappings (issue 87). ## 0.1.31 * Delay parsing the mappings in SourceMapConsumer until queried for a source location. * Support Sass source maps (which at the time of writing deviate from the spec in small ways) in SourceMapConsumer. ## 0.1.30 * Do not join source root with a source, when the source is a data URI. * Extend the test runner to allow running single specific test files at a time. * Performance improvements in `SourceNode.prototype.walk` and `SourceMapConsumer.prototype.eachMapping`. * Source map browser builds will now work inside Workers. * Better error messages when attempting to add an invalid mapping to a `SourceMapGenerator`. ## 0.1.29 * Allow duplicate entries in the `names` and `sources` arrays of source maps (usually from TypeScript) we are parsing. Fixes github issue 72. ## 0.1.28 * Skip duplicate mappings when creating source maps from SourceNode; github issue 75. ## 0.1.27 * Don't throw an error when the `file` property is missing in SourceMapConsumer, we don't use it anyway. ## 0.1.26 * Fix SourceNode.fromStringWithSourceMap for empty maps. Fixes github issue 70. ## 0.1.25 * Make compatible with browserify ## 0.1.24 * Fix issue with absolute paths and `file://` URIs. See https://bugzilla.mozilla.org/show_bug.cgi?id=885597 ## 0.1.23 * Fix issue with absolute paths and sourcesContent, github issue 64. ## 0.1.22 * Ignore duplicate mappings in SourceMapGenerator. Fixes github issue 21. ## 0.1.21 * Fixed handling of sources that start with a slash so that they are relative to the source root's host. ## 0.1.20 * Fixed github issue #43: absolute URLs aren't joined with the source root anymore. ## 0.1.19 * Using Travis CI to run tests. ## 0.1.18 * Fixed a bug in the handling of sourceRoot. ## 0.1.17 * Added SourceNode.fromStringWithSourceMap. ## 0.1.16 * Added missing documentation. * Fixed the generating of empty mappings in SourceNode. ## 0.1.15 * Added SourceMapGenerator.applySourceMap. ## 0.1.14 * The sourceRoot is now handled consistently. ## 0.1.13 * Added SourceMapGenerator.fromSourceMap. ## 0.1.12 * SourceNode now generates empty mappings too. ## 0.1.11 * Added name support to SourceNode. ## 0.1.10 * Added sourcesContent support to the customer and generator.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/source-map/CHANGELOG.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/source-map/CHANGELOG.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 7883 }
# Source Map [![Build Status](https://travis-ci.org/mozilla/source-map.png?branch=master)](https://travis-ci.org/mozilla/source-map) [![NPM](https://nodei.co/npm/source-map.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map) This is a library to generate and consume the source map format [described here][format]. [format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit ## Use with Node $ npm install source-map ## Use on the Web <script src="https://raw.githubusercontent.com/mozilla/source-map/master/dist/source-map.min.js" defer></script> -------------------------------------------------------------------------------- <!-- `npm run toc` to regenerate the Table of Contents --> <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> ## Table of Contents - [Examples](#examples) - [Consuming a source map](#consuming-a-source-map) - [Generating a source map](#generating-a-source-map) - [With SourceNode (high level API)](#with-sourcenode-high-level-api) - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api) - [API](#api) - [SourceMapConsumer](#sourcemapconsumer) - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap) - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans) - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition) - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition) - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition) - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources) - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing) - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order) - [SourceMapGenerator](#sourcemapgenerator) - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap) - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer) - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping) - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent) - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath) - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring) - [SourceNode](#sourcenode) - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name) - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath) - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk) - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk) - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent) - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn) - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn) - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep) - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement) - [SourceNode.prototype.toString()](#sourcenodeprototypetostring) - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap) <!-- END doctoc generated TOC please keep comment here to allow auto update --> ## Examples ### Consuming a source map ```js var rawSourceMap = { version: 3, file: 'min.js', names: ['bar', 'baz', 'n'], sources: ['one.js', 'two.js'], sourceRoot: 'http://example.com/www/js/', mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA' }; var smc = new SourceMapConsumer(rawSourceMap); console.log(smc.sources); // [ 'http://example.com/www/js/one.js', // 'http://example.com/www/js/two.js' ] console.log(smc.originalPositionFor({ line: 2, column: 28 })); // { source: 'http://example.com/www/js/two.js', // line: 2, // column: 10, // name: 'n' } console.log(smc.generatedPositionFor({ source: 'http://example.com/www/js/two.js', line: 2, column: 10 })); // { line: 2, column: 28 } smc.eachMapping(function (m) { // ... }); ``` ### Generating a source map In depth guide: [**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/) #### With SourceNode (high level API) ```js function compile(ast) { switch (ast.type) { case 'BinaryExpression': return new SourceNode( ast.location.line, ast.location.column, ast.location.source, [compile(ast.left), " + ", compile(ast.right)] ); case 'Literal': return new SourceNode( ast.location.line, ast.location.column, ast.location.source, String(ast.value) ); // ... default: throw new Error("Bad AST"); } } var ast = parse("40 + 2", "add.js"); console.log(compile(ast).toStringWithSourceMap({ file: 'add.js' })); // { code: '40 + 2', // map: [object SourceMapGenerator] } ``` #### With SourceMapGenerator (low level API) ```js var map = new SourceMapGenerator({ file: "source-mapped.js" }); map.addMapping({ generated: { line: 10, column: 35 }, source: "foo.js", original: { line: 33, column: 2 }, name: "christopher" }); console.log(map.toString()); // '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}' ``` ## API Get a reference to the module: ```js // Node.js var sourceMap = require('source-map'); // Browser builds var sourceMap = window.sourceMap; // Inside Firefox const sourceMap = require("devtools/toolkit/sourcemap/source-map.js"); ``` ### SourceMapConsumer A SourceMapConsumer instance represents a parsed source map which we can query for information about the original file positions by giving it a file position in the generated source. #### new SourceMapConsumer(rawSourceMap) The only parameter is the raw source map (either as a string which can be `JSON.parse`'d, or an object). According to the spec, source maps have the following attributes: * `version`: Which version of the source map spec this map is following. * `sources`: An array of URLs to the original source files. * `names`: An array of identifiers which can be referenced by individual mappings. * `sourceRoot`: Optional. The URL root from which all sources are relative. * `sourcesContent`: Optional. An array of contents of the original source files. * `mappings`: A string of base64 VLQs which contain the actual mappings. * `file`: Optional. The generated filename this source map is associated with. ```js var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData); ``` #### SourceMapConsumer.prototype.computeColumnSpans() Compute the last column for each generated mapping. The last column is inclusive. ```js // Before: consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) // [ { line: 2, // column: 1 }, // { line: 2, // column: 10 }, // { line: 2, // column: 20 } ] consumer.computeColumnSpans(); // After: consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) // [ { line: 2, // column: 1, // lastColumn: 9 }, // { line: 2, // column: 10, // lastColumn: 19 }, // { line: 2, // column: 20, // lastColumn: Infinity } ] ``` #### SourceMapConsumer.prototype.originalPositionFor(generatedPosition) Returns the original source, line, and column information for the generated source's line and column positions provided. The only argument is an object with the following properties: * `line`: The line number in the generated source. Line numbers in this library are 1-based (note that the underlying source map specification uses 0-based line numbers -- this library handles the translation). * `column`: The column number in the generated source. Column numbers in this library are 0-based. * `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest element that is smaller than or greater than the one we are searching for, respectively, if the exact element cannot be found. Defaults to `SourceMapConsumer.GREATEST_LOWER_BOUND`. and an object is returned with the following properties: * `source`: The original source file, or null if this information is not available. * `line`: The line number in the original source, or null if this information is not available. The line number is 1-based. * `column`: The column number in the original source, or null if this information is not available. The column number is 0-based. * `name`: The original identifier, or null if this information is not available. ```js consumer.originalPositionFor({ line: 2, column: 10 }) // { source: 'foo.coffee', // line: 2, // column: 2, // name: null } consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 }) // { source: null, // line: null, // column: null, // name: null } ``` #### SourceMapConsumer.prototype.generatedPositionFor(originalPosition) Returns the generated line and column information for the original source, line, and column positions provided. The only argument is an object with the following properties: * `source`: The filename of the original source. * `line`: The line number in the original source. The line number is 1-based. * `column`: The column number in the original source. The column number is 0-based. and an object is returned with the following properties: * `line`: The line number in the generated source, or null. The line number is 1-based. * `column`: The column number in the generated source, or null. The column number is 0-based. ```js consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 }) // { line: 1, // column: 56 } ``` #### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition) Returns all generated line and column information for the original source, line, and column provided. If no column is provided, returns all mappings corresponding to a either the line we are searching for or the next closest line that has any mappings. Otherwise, returns all mappings corresponding to the given line and either the column we are searching for or the next closest column that has any offsets. The only argument is an object with the following properties: * `source`: The filename of the original source. * `line`: The line number in the original source. The line number is 1-based. * `column`: Optional. The column number in the original source. The column number is 0-based. and an array of objects is returned, each with the following properties: * `line`: The line number in the generated source, or null. The line number is 1-based. * `column`: The column number in the generated source, or null. The column number is 0-based. ```js consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) // [ { line: 2, // column: 1 }, // { line: 2, // column: 10 }, // { line: 2, // column: 20 } ] ``` #### SourceMapConsumer.prototype.hasContentsOfAllSources() Return true if we have the embedded source content for every source listed in the source map, false otherwise. In other words, if this method returns `true`, then `consumer.sourceContentFor(s)` will succeed for every source `s` in `consumer.sources`. ```js // ... if (consumer.hasContentsOfAllSources()) { consumerReadyCallback(consumer); } else { fetchSources(consumer, consumerReadyCallback); } // ... ``` #### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing]) Returns the original source content for the source provided. The only argument is the URL of the original source file. If the source content for the given source is not found, then an error is thrown. Optionally, pass `true` as the second param to have `null` returned instead. ```js consumer.sources // [ "my-cool-lib.clj" ] consumer.sourceContentFor("my-cool-lib.clj") // "..." consumer.sourceContentFor("this is not in the source map"); // Error: "this is not in the source map" is not in the source map consumer.sourceContentFor("this is not in the source map", true); // null ``` #### SourceMapConsumer.prototype.eachMapping(callback, context, order) Iterate over each mapping between an original source/line/column and a generated line/column in this source map. * `callback`: The function that is called with each mapping. Mappings have the form `{ source, generatedLine, generatedColumn, originalLine, originalColumn, name }` * `context`: Optional. If specified, this object will be the value of `this` every time that `callback` is called. * `order`: Either `SourceMapConsumer.GENERATED_ORDER` or `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over the mappings sorted by the generated file's line/column order or the original's source/line/column order, respectively. Defaults to `SourceMapConsumer.GENERATED_ORDER`. ```js consumer.eachMapping(function (m) { console.log(m); }) // ... // { source: 'illmatic.js', // generatedLine: 1, // generatedColumn: 0, // originalLine: 1, // originalColumn: 0, // name: null } // { source: 'illmatic.js', // generatedLine: 2, // generatedColumn: 0, // originalLine: 2, // originalColumn: 0, // name: null } // ... ``` ### SourceMapGenerator An instance of the SourceMapGenerator represents a source map which is being built incrementally. #### new SourceMapGenerator([startOfSourceMap]) You may pass an object with the following properties: * `file`: The filename of the generated source that this source map is associated with. * `sourceRoot`: A root for all relative URLs in this source map. * `skipValidation`: Optional. When `true`, disables validation of mappings as they are added. This can improve performance but should be used with discretion, as a last resort. Even then, one should avoid using this flag when running tests, if possible. ```js var generator = new sourceMap.SourceMapGenerator({ file: "my-generated-javascript-file.js", sourceRoot: "http://example.com/app/js/" }); ``` #### SourceMapGenerator.fromSourceMap(sourceMapConsumer) Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance. * `sourceMapConsumer` The SourceMap. ```js var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer); ``` #### SourceMapGenerator.prototype.addMapping(mapping) Add a single mapping from original source line and column to the generated source's line and column for this source map being created. The mapping object should have the following properties: * `generated`: An object with the generated line and column positions. * `original`: An object with the original line and column positions. * `source`: The original source file (relative to the sourceRoot). * `name`: An optional original token name for this mapping. ```js generator.addMapping({ source: "module-one.scm", original: { line: 128, column: 0 }, generated: { line: 3, column: 456 } }) ``` #### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent) Set the source content for an original source file. * `sourceFile` the URL of the original source file. * `sourceContent` the content of the source file. ```js generator.setSourceContent("module-one.scm", fs.readFileSync("path/to/module-one.scm")) ``` #### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]]) Applies a SourceMap for a source file to the SourceMap. Each mapping to the supplied source file is rewritten using the supplied SourceMap. Note: The resolution for the resulting mappings is the minimum of this map and the supplied map. * `sourceMapConsumer`: The SourceMap to be applied. * `sourceFile`: Optional. The filename of the source file. If omitted, sourceMapConsumer.file will be used, if it exists. Otherwise an error will be thrown. * `sourceMapPath`: Optional. The dirname of the path to the SourceMap to be applied. If relative, it is relative to the SourceMap. This parameter is needed when the two SourceMaps aren't in the same directory, and the SourceMap to be applied contains relative source paths. If so, those relative source paths need to be rewritten relative to the SourceMap. If omitted, it is assumed that both SourceMaps are in the same directory, thus not needing any rewriting. (Supplying `'.'` has the same effect.) #### SourceMapGenerator.prototype.toString() Renders the source map being generated to a string. ```js generator.toString() // '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}' ``` ### SourceNode SourceNodes provide a way to abstract over interpolating and/or concatenating snippets of generated JavaScript source code, while maintaining the line and column information associated between those snippets and the original source code. This is useful as the final intermediate representation a compiler might use before outputting the generated JS and source map. #### new SourceNode([line, column, source[, chunk[, name]]]) * `line`: The original line number associated with this source node, or null if it isn't associated with an original line. The line number is 1-based. * `column`: The original column number associated with this source node, or null if it isn't associated with an original column. The column number is 0-based. * `source`: The original source's filename; null if no filename is provided. * `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see below. * `name`: Optional. The original identifier. ```js var node = new SourceNode(1, 2, "a.cpp", [ new SourceNode(3, 4, "b.cpp", "extern int status;\n"), new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"), new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"), ]); ``` #### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath]) Creates a SourceNode from generated code and a SourceMapConsumer. * `code`: The generated code * `sourceMapConsumer` The SourceMap for the generated code * `relativePath` The optional path that relative sources in `sourceMapConsumer` should be relative to. ```js var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8")); var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"), consumer); ``` #### SourceNode.prototype.add(chunk) Add a chunk of generated JS to this source node. * `chunk`: A string snippet of generated JS code, another instance of `SourceNode`, or an array where each member is one of those things. ```js node.add(" + "); node.add(otherNode); node.add([leftHandOperandNode, " + ", rightHandOperandNode]); ``` #### SourceNode.prototype.prepend(chunk) Prepend a chunk of generated JS to this source node. * `chunk`: A string snippet of generated JS code, another instance of `SourceNode`, or an array where each member is one of those things. ```js node.prepend("/** Build Id: f783haef86324gf **/\n\n"); ``` #### SourceNode.prototype.setSourceContent(sourceFile, sourceContent) Set the source content for a source file. This will be added to the `SourceMap` in the `sourcesContent` field. * `sourceFile`: The filename of the source file * `sourceContent`: The content of the source file ```js node.setSourceContent("module-one.scm", fs.readFileSync("path/to/module-one.scm")) ``` #### SourceNode.prototype.walk(fn) Walk over the tree of JS snippets in this node and its children. The walking function is called once for each snippet of JS and is passed that snippet and the its original associated source's line/column location. * `fn`: The traversal function. ```js var node = new SourceNode(1, 2, "a.js", [ new SourceNode(3, 4, "b.js", "uno"), "dos", [ "tres", new SourceNode(5, 6, "c.js", "quatro") ] ]); node.walk(function (code, loc) { console.log("WALK:", code, loc); }) // WALK: uno { source: 'b.js', line: 3, column: 4, name: null } // WALK: dos { source: 'a.js', line: 1, column: 2, name: null } // WALK: tres { source: 'a.js', line: 1, column: 2, name: null } // WALK: quatro { source: 'c.js', line: 5, column: 6, name: null } ``` #### SourceNode.prototype.walkSourceContents(fn) Walk over the tree of SourceNodes. The walking function is called for each source file content and is passed the filename and source content. * `fn`: The traversal function. ```js var a = new SourceNode(1, 2, "a.js", "generated from a"); a.setSourceContent("a.js", "original a"); var b = new SourceNode(1, 2, "b.js", "generated from b"); b.setSourceContent("b.js", "original b"); var c = new SourceNode(1, 2, "c.js", "generated from c"); c.setSourceContent("c.js", "original c"); var node = new SourceNode(null, null, null, [a, b, c]); node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); }) // WALK: a.js : original a // WALK: b.js : original b // WALK: c.js : original c ``` #### SourceNode.prototype.join(sep) Like `Array.prototype.join` except for SourceNodes. Inserts the separator between each of this source node's children. * `sep`: The separator. ```js var lhs = new SourceNode(1, 2, "a.rs", "my_copy"); var operand = new SourceNode(3, 4, "a.rs", "="); var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()"); var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]); var joinedNode = node.join(" "); ``` #### SourceNode.prototype.replaceRight(pattern, replacement) Call `String.prototype.replace` on the very right-most source snippet. Useful for trimming white space from the end of a source node, etc. * `pattern`: The pattern to replace. * `replacement`: The thing to replace the pattern with. ```js // Trim trailing white space. node.replaceRight(/\s*$/, ""); ``` #### SourceNode.prototype.toString() Return the string representation of this source node. Walks over the tree and concatenates all the various snippets together to one string. ```js var node = new SourceNode(1, 2, "a.js", [ new SourceNode(3, 4, "b.js", "uno"), "dos", [ "tres", new SourceNode(5, 6, "c.js", "quatro") ] ]); node.toString() // 'unodostresquatro' ``` #### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap]) Returns the string representation of this tree of source nodes, plus a SourceMapGenerator which contains all the mappings between the generated and original sources. The arguments are the same as those to `new SourceMapGenerator`. ```js var node = new SourceNode(1, 2, "a.js", [ new SourceNode(3, 4, "b.js", "uno"), "dos", [ "tres", new SourceNode(5, 6, "c.js", "quatro") ] ]); node.toStringWithSourceMap({ file: "my-output-file.js" }) // { code: 'unodostresquatro', // map: [object SourceMapGenerator] } ```
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/source-map/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/source-map/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 24071 }
# Split2(matcher, mapper, options) ![ci](https://github.com/mcollina/split2/workflows/ci/badge.svg) Break up a stream and reassemble it so that each line is a chunk. `split2` is inspired by [@dominictarr](https://github.com/dominictarr) [`split`](https://github.com/dominictarr/split) module, and it is totally API compatible with it. However, it is based on Node.js core [`Transform`](https://nodejs.org/api/stream.html#stream_new_stream_transform_options). `matcher` may be a `String`, or a `RegExp`. Example, read every line in a file ... ``` js fs.createReadStream(file) .pipe(split2()) .on('data', function (line) { //each chunk now is a separate line! }) ``` `split` takes the same arguments as `string.split` except it defaults to '/\r?\n/', and the optional `limit` paremeter is ignored. [String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split) `split` takes an optional options object on it's third argument, which is directly passed as a [Transform](https://nodejs.org/api/stream.html#stream_new_stream_transform_options) option. Additionally, the `.maxLength` and `.skipOverflow` options are implemented, which set limits on the internal buffer size and the stream's behavior when the limit is exceeded. There is no limit unless `maxLength` is set. When the internal buffer size exceeds `maxLength`, the stream emits an error by default. You may also set `skipOverflow` to true to suppress the error and instead skip past any lines that cause the internal buffer to exceed `maxLength`. Calling `.destroy` will make the stream emit `close`. Use this to perform cleanup logic ``` js var splitFile = function(filename) { var file = fs.createReadStream(filename) return file .pipe(split2()) .on('close', function() { // destroy the file stream in case the split stream was destroyed file.destroy() }) } var stream = splitFile('my-file.txt') stream.destroy() // will destroy the input file stream ``` # NDJ - Newline Delimited Json `split2` accepts a function which transforms each line. ``` js fs.createReadStream(file) .pipe(split2(JSON.parse)) .on('data', function (obj) { //each chunk now is a js object }) .on("error", function(error) { //handling parsing errors }) ``` However, in [@dominictarr](https://github.com/dominictarr) [`split`](https://github.com/dominictarr/split) the mapper is wrapped in a try-catch, while here it is not: if your parsing logic can throw, wrap it yourself. Otherwise, you can also use the stream error handling when mapper function throw. # License Copyright (c) 2014-2021, Matteo Collina <[email protected]> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/split2/README.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/split2/README.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 3380 }
2.0.1 / 2021-01-03 ================== * Fix returning values from `Object.prototype` 2.0.0 / 2020-04-19 ================== * Drop support for Node.js 0.6 * Fix messaging casing of `418 I'm a Teapot` * Remove code 306 * Remove `status[code]` exports; use `status.message[code]` * Remove `status[msg]` exports; use `status.code[msg]` * Rename `425 Unordered Collection` to standard `425 Too Early` * Rename `STATUS_CODES` export to `message` * Return status message for `statuses(code)` when given code 1.5.0 / 2018-03-27 ================== * Add `103 Early Hints` 1.4.0 / 2017-10-20 ================== * Add `STATUS_CODES` export 1.3.1 / 2016-11-11 ================== * Fix return type in JSDoc 1.3.0 / 2016-05-17 ================== * Add `421 Misdirected Request` * perf: enable strict mode 1.2.1 / 2015-02-01 ================== * Fix message for status 451 - `451 Unavailable For Legal Reasons` 1.2.0 / 2014-09-28 ================== * Add `208 Already Repored` * Add `226 IM Used` * Add `306 (Unused)` * Add `415 Unable For Legal Reasons` * Add `508 Loop Detected` 1.1.1 / 2014-09-24 ================== * Add missing 308 to `codes.json` 1.1.0 / 2014-09-21 ================== * Add `codes.json` for universal support 1.0.4 / 2014-08-20 ================== * Package cleanup 1.0.3 / 2014-06-08 ================== * Add 308 to `.redirect` category 1.0.2 / 2014-03-13 ================== * Add `.retry` category 1.0.1 / 2014-03-12 ================== * Initial release
{ "source": "ammaarreshi/Gemini-Search", "title": "node_modules/statuses/HISTORY.md", "url": "https://github.com/ammaarreshi/Gemini-Search/blob/main/node_modules/statuses/HISTORY.md", "date": "2025-01-04T14:07:19", "stars": 1910, "description": "Perplexity style AI Search engine clone built with Gemini 2.0 Flash and Grounding", "file_size": 1545 }