docs: 仓库链接指向本镜像仓库
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Skipped

This commit is contained in:
TanTan committed 2026-11-13 09:27:07 +08:00
1 parent fa9c73363d
commit 2a69b23b47
18210 files changed
+5101211 -16

No files matched your search

@@ -0,0 +1,50 @@
# TypeScript
[![CI](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml)
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://securityscorecards.dev/viewer/?uri=github.com/microsoft/TypeScript)
[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript).
Find others who are using TypeScript at [our community page](https://www.typescriptlang.org/community/).
## Installing
For the latest stable version:
```bash
npm install -D typescript
```
For our nightly builds:
```bash
npm install -D typescript@next
```
## Contribute
There are many ways to [contribute](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md) to TypeScript.
* [Submit bugs](https://github.com/microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
* Review the [source code changes](https://github.com/microsoft/TypeScript/pulls).
* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript).
* Help each other in the [TypeScript Community Discord](https://discord.gg/typescript).
* Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter.
* [Contribute bug fixes](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md).
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see
the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com)
with any additional questions or comments.
## Documentation
* [TypeScript in 5 minutes](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html)
* [Programming handbook](https://www.typescriptlang.org/docs/handbook/intro.html)
* [Homepage](https://www.typescriptlang.org/)
## Roadmap
For details on our planned features and future direction, please refer to our [roadmap](https://github.com/microsoft/TypeScript/wiki/Roadmap).
@@ -0,0 +1,9 @@
(The MIT License)
Copyright 2022 Causaly, Inc <front-end@causaly.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.
@@ -0,0 +1,22 @@
import {Value} from './index';
/**
* Sass's [function type](https://sass-lang.com/documentation/values/functions).
*
* **Heads up!** Although first-class Sass functions can be processed by custom
* functions, there's no way to invoke them outside of a Sass stylesheet.
*
* @category Custom Function
*/
export class SassFunction extends Value {
/**
* Creates a new first-class function that can be invoked using
* [`meta.call()`](https://sass-lang.com/documentation/modules/meta#call).
*
* @param signature - The function signature, like you'd write for the
* [`@function rule`](https://sass-lang.com/documentation/at-rules/function).
* @param callback - The callback that's invoked when this function is called,
* just like for a {@link CustomFunction}.
*/
constructor(signature: string, callback: (args: Value[]) => Value);
}
@@ -0,0 +1,15 @@
require("../_virtual/_rolldown/runtime.cjs");
const require_RouterServer = require("./RouterServer.cjs");
const require_renderRouterToStream = require("./renderRouterToStream.cjs");
let react_jsx_runtime = require("react/jsx-runtime");
//#region src/ssr/defaultStreamHandler.tsx
var defaultStreamHandler = (0, require("@tanstack/router-core/ssr/server").defineHandlerCallback)(({ request, router, responseHeaders }) => require_renderRouterToStream.renderRouterToStream({
request,
router,
responseHeaders,
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_RouterServer.RouterServer, { router })
}));
//#endregion
exports.defaultStreamHandler = defaultStreamHandler;
//# sourceMappingURL=defaultStreamHandler.cjs.map
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_A","2":"_Z"},B:{"1":"_J"},C:{"1":"_w","2":"_f"},D:{"1":"_DP","2":"_UC"},E:{"1":"_JB","2":"_k","132":"mB _DI"},F:{"1":"_zG","2":"_mB"},G:{"1":"_9","2":"lC","132":"_YR _FF"},H:{"516":"1D"},I:{"1":"_YD","2":"_LB","132":"_oF 6D"},J:{"1":"A","132":"D"},K:{"1":"_N"},L:{"1":"I"},M:{"132":"YC"},N:{"260":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"ME","132":"LE"}},B:1,C:"Form validation",D:true};
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Rainbow = createLucideIcon("Rainbow", [
["path", { d: "M22 17a10 10 0 0 0-20 0", key: "ozegv" }],
["path", { d: "M6 17a6 6 0 0 1 12 0", key: "5giftw" }],
["path", { d: "M10 17a2 2 0 0 1 4 0", key: "gnsikk" }]
]);
export { Rainbow as default };
//# sourceMappingURL=rainbow.js.map
@@ -0,0 +1,150 @@
# finalhandler
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-image]][node-url]
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
[![Test Coverage][coveralls-image]][coveralls-url]
[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
Node.js function to invoke as the final step to respond to HTTP request.
## 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 finalhandler
```
## API
```js
const finalhandler = require('finalhandler')
```
### finalhandler(req, res, [options])
Returns function to be invoked as the final step for the given `req` and `res`.
This function is to be invoked as `fn(err)`. If `err` is falsy, the handler will
write out a 404 response to the `res`. If it is truthy, an error response will
be written out to the `res` or `res` will be terminated if a response has already
started.
When an error is written, the following information is added to the response:
* The `res.statusCode` is set from `err.status` (or `err.statusCode`). If
this value is outside the 4xx or 5xx range, it will be set to 500.
* The `res.statusMessage` is set according to the status code.
* The body will be the HTML of the status code message if `env` is
`'production'`, otherwise will be `err.stack`.
* Any headers specified in an `err.headers` object.
The final handler will also unpipe anything from `req` when it is invoked.
#### options.env
By default, the environment is determined by `NODE_ENV` variable, but it can be
overridden by this option.
#### options.onerror
Provide a function to be called with the `err` when it exists. Can be used for
writing errors to a central location without excessive function generation. Called
as `onerror(err, req, res)`.
## Examples
### always 404
```js
const finalhandler = require('finalhandler')
const http = require('http')
const server = http.createServer((req, res) => {
const done = finalhandler(req, res)
done()
})
server.listen(3000)
```
### perform simple action
```js
const finalhandler = require('finalhandler')
const fs = require('fs')
const http = require('http')
const server = http.createServer((req, res) => {
const done = finalhandler(req, res)
fs.readFile('index.html', (err, buf) => {
if (err) return done(err)
res.setHeader('Content-Type', 'text/html')
res.end(buf)
})
})
server.listen(3000)
```
### use with middleware-style functions
```js
const finalhandler = require('finalhandler')
const http = require('http')
const serveStatic = require('serve-static')
const serve = serveStatic('public')
const server = http.createServer((req, res) => {
const done = finalhandler(req, res)
serve(req, res, done)
})
server.listen(3000)
```
### keep log of all errors
```js
const finalhandler = require('finalhandler')
const fs = require('fs')
const http = require('http')
const server = http.createServer((req, res) => {
const done = finalhandler(req, res, { onerror: logerror })
fs.readFile('index.html', (err, buf) => {
if (err) return done(err)
res.setHeader('Content-Type', 'text/html')
res.end(buf)
})
})
server.listen(3000)
function logerror (err) {
console.error(err.stack || err.toString())
}
```
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/finalhandler.svg
[npm-url]: https://npmjs.org/package/finalhandler
[node-image]: https://img.shields.io/node/v/finalhandler.svg
[node-url]: https://nodejs.org/en/download
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/finalhandler.svg
[coveralls-url]: https://coveralls.io/r/pillarjs/finalhandler?branch=master
[downloads-image]: https://img.shields.io/npm/dm/finalhandler.svg
[downloads-url]: https://npmjs.org/package/finalhandler
[github-actions-ci-image]: https://github.com/pillarjs/finalhandler/actions/workflows/ci.yml/badge.svg
[github-actions-ci-url]: https://github.com/pillarjs/finalhandler/actions/workflows/ci.yml
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/pillarjs/finalhandler/badge
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/pillarjs/finalhandler
@@ -0,0 +1,16 @@
import { a as detectCodeFormat, i as parseModule, n as generateCode, o as MagicastError, r as parseExpression, t as builders } from "./builders-mk_DIY8_.js";
import "./core.js";
import { promises } from "node:fs";
//#region src/file.ts
async function loadFile(filename, options = {}) {
const contents = await promises.readFile(filename, "utf8");
options.sourceFileName = options.sourceFileName ?? filename;
return parseModule(contents, options);
}
async function writeFile(node, filename, options) {
const { code, map } = generateCode("$ast" in node ? node.$ast : node, options);
await promises.writeFile(filename, code);
if (map) await promises.writeFile(filename + ".map", map);
}
//#endregion
export { MagicastError, builders, detectCodeFormat, generateCode, loadFile, parseExpression, parseModule, writeFile };
@@ -0,0 +1,12 @@
"use client";
import { scrapeSVGMotionValuesFromProps } from 'motion-dom';
import { makeUseVisualState } from '../../motion/utils/use-visual-state.mjs';
import { createSvgRenderState } from './utils/create-render-state.mjs';
const useSVGVisualState = /*@__PURE__*/ makeUseVisualState({
scrapeMotionValuesFromProps: scrapeSVGMotionValuesFromProps,
createRenderState: createSvgRenderState,
});
export { useSVGVisualState };
//# sourceMappingURL=use-svg-visual-state.mjs.map
@@ -0,0 +1,823 @@
flf2a$ 8 8 20 -1 6
3-D font created by Daniel Henninger <dahennin@eos.ncsu.edu>
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
**@
/**@
/**@
/**@
/**@
// @
**@
// @@
* *@
/* /*@
/ / @
@
@
@
@
@@
@
** ** @
************@
///**////**/ @
/** /** @
************@
///**////**/ @
// // @@
* @
*****@
/*/*/ @
/*****@
///*/*@
*****@
///*/ @
/ @@
@
** ** @
// ** @
** @
** @
** @
** ** @
// // @@
** @
*/ * @
/ ** @
*/ * *@
* / * @
/* /* @
/ **** *@
//// / @@
**@
//*@
/ @
@
@
@
@
@@
**@
** @
** @
/** @
/** @
//** @
//**@
// @@
** @
//** @
//**@
/**@
/**@
** @
** @
// @@
** @
** /** ** @
//** /** ** @
**************@
///**//**//**/ @
** /** //** @
// /** // @
// @@
@
* @
/* @
*********@
/////*/// @
/* @
/ @
@@
@
@
@
@
@
**@
//*@
/ @@
@
@
@
*****@
///// @
@
@
@@
@
@
@
@
@
**@
/**@
// @@
**@
** @
** @
** @
** @
** @
** @
// @@
**** @
*///**@
/* */*@
/* * /*@
/** /*@
/* /*@
/ **** @
//// @@
** @
*** @
//** @
/** @
/** @
/** @
****@
//// @@
**** @
*/// *@
/ /*@
*** @
*// @
* @
/******@
////// @@
**** @
*/// *@
/ /*@
*** @
/// *@
* /*@
/ **** @
//// @@
** @
*/* @
* /* @
******@
/////* @
/* @
/* @
/ @@
******@
/*//// @
/***** @
///// *@
/*@
* /*@
/ **** @
//// @@
**** @
*/// *@
/* / @
/***** @
/*/// *@
/* /*@
/ **** @
//// @@
******@
//////*@
/*@
* @
* @
* @
* @
/ @@
**** @
*/// *@
/* /*@
/ **** @
*/// *@
/* /*@
/ **** @
//// @@
**** @
*/// *@
/* /*@
/ **** @
///* @
* @
* @
/ @@
@
@
@
@
**@
// @
**@
// @@
@
@
@
**@
// @
**@
//*@
/ @@
**@
**/ @
**/ @
**/ @
// ** @
// ** @
// **@
// @@
@
@
******@
////// @
******@
////// @
@
@@
** @
// ** @
// ** @
// **@
**/ @
**/ @
**/ @
// @@
**** @
**//**@
/** /**@
// ** @
** @
// @
** @
// @@
**** @
*/// *@
/* **/*@
/*/* /*@
/*/ ** @
/* // @
/ *****@
///// @@
** @
**** @
**//** @
** //** @
**********@
/**//////**@
/** /**@
// // @@
****** @
/*////** @
/* /** @
/****** @
/*//// **@
/* /**@
/******* @
/////// @@
****** @
**////**@
** // @
/** @
/** @
//** **@
//****** @
////// @@
******* @
/**////** @
/** /**@
/** /**@
/** /**@
/** ** @
/******* @
/////// @@
********@
/**///// @
/** @
/******* @
/**//// @
/** @
/********@
//////// @@
********@
/**///// @
/** @
/******* @
/**//// @
/** @
/** @
// @@
******** @
**//////**@
** // @
/** @
/** *****@
//** ////**@
//******** @
//////// @@
** **@
/** /**@
/** /**@
/**********@
/**//////**@
/** /**@
/** /**@
// // @@
**@
/**@
/**@
/**@
/**@
/**@
/**@
// @@
**@
/**@
/**@
/**@
/**@
** /**@
//***** @
///// @@
** **@
/** ** @
/** ** @
/**** @
/**/** @
/**//** @
/** //**@
// // @@
** @
/** @
/** @
/** @
/** @
/** @
/********@
//////// @@
**** ****@
/**/** **/**@
/**//** ** /**@
/** //*** /**@
/** //* /**@
/** / /**@
/** /**@
// // @@
**** **@
/**/** /**@
/**//** /**@
/** //** /**@
/** //**/**@
/** //****@
/** //***@
// /// @@
******* @
**/////** @
** //**@
/** /**@
/** /**@
//** ** @
//******* @
/////// @@
******* @
/**////**@
/** /**@
/******* @
/**//// @
/** @
/** @
// @@
******* @
**/////** @
** //** @
/** /** @
/** **/** @
//** // ** @
//******* **@
/////// // @@
******* @
/**////** @
/** /** @
/******* @
/**///** @
/** //** @
/** //**@
// // @@
********@
**////// @
/** @
/*********@
////////**@
/**@
******** @
//////// @@
**********@
/////**/// @
/** @
/** @
/** @
/** @
/** @
// @@
** **@
/** /**@
/** /**@
/** /**@
/** /**@
/** /**@
//******* @
/////// @@
** **@
/** /**@
/** /**@
//** ** @
//** ** @
//**** @
//** @
// @@
** **@
/** /**@
/** * /**@
/** *** /**@
/** **/**/**@
/**** //****@
/**/ ///**@
// // @@
** **@
//** ** @
//** ** @
//*** @
**/** @
** //** @
** //**@
// // @@
** **@
//** ** @
//**** @
//** @
/** @
/** @
/** @
// @@
********@
//////** @
** @
** @
** @
** @
********@
//////// @@
*****@
/**// @
/** @
/** @
/** @
/** @
/*****@
///// @@
** @
//** @
//** @
//** @
//** @
//** @
//**@
// @@
*****@
////**@
/**@
/**@
/**@
/**@
*****@
///// @@
** @
**/ ** @
** // **@
// // @
@
@
@
@@
@
@
@
@
@
@
*****@
///// @@
**@
/* @
/ @
@
@
@
@
@@
@
@
****** @
//////** @
******* @
**////** @
//********@
//////// @@
** @
/** @
/** @
/****** @
/**///**@
/** /**@
/****** @
///// @@
@
@
***** @
**///**@
/** // @
/** **@
//***** @
///// @@
**@
/**@
/**@
******@
**///**@
/** /**@
//******@
////// @@
@
@
***** @
**///**@
/*******@
/**//// @
//******@
////// @@
****@
/**/ @
******@
///**/ @
/** @
/** @
/** @
// @@
@
***** @
**///**@
/** /**@
//******@
/////**@
***** @
///// @@
** @
/** @
/** @
/****** @
/**///**@
/** /**@
/** /**@
// // @@
**@
// @
**@
/**@
/**@
/**@
/**@
// @@
**@
// @
**@
/**@
/**@
**/**@
//*** @
/// @@
** @
/** @
/** **@
/** ** @
/**** @
/**/** @
/**//**@
// // @@
**@
/**@
/**@
/**@
/**@
/**@
***@
/// @@
@
@
********** @
//**//**//**@
/** /** /**@
/** /** /**@
*** /** /**@
/// // // @@
@
@
******* @
//**///**@
/** /**@
/** /**@
*** /**@
/// // @@
@
@
****** @
**////**@
/** /**@
/** /**@
//****** @
////// @@
@
****** @
/**///**@
/** /**@
/****** @
/**/// @
/** @
// @@
@
**** @
**//** @
/** /** @
//***** @
////** @
/***@
/// @@
@
@
******@
//**//*@
/** / @
/** @
/*** @
/// @@
@
@
******@
**//// @
//***** @
/////**@
****** @
////// @@
** @
/** @
******@
///**/ @
/** @
/** @
//** @
// @@
@
@
** **@
/** /**@
/** /**@
/** /**@
//******@
////// @@
@
@
** **@
/** /**@
//** /** @
//**** @
//** @
// @@
@
@
*** **@
//** * /**@
/** ***/**@
/****/****@
***/ ///**@
/// /// @@
@
@
** **@
//** ** @
//*** @
**/** @
** //**@
// // @@
@
** **@
//** ** @
//*** @
/** @
** @
** @
// @@
@
@
******@
////** @
** @
** @
******@
////// @@
***@
**/ @
/** @
*** @
///** @
/** @
//***@
/// @@
*@
/*@
/*@
/ @
*@
/*@
/*@
/ @@
*** @
///** @
/** @
//***@
**/ @
/** @
*** @
/// @@
** *** @
//***//**@
/// // @
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@@ -0,0 +1,61 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Doc = void 0;
class Doc {
constructor(args = [], closed = {}) {
this.content = [];
this.indent = 0;
this.args = args;
this.closed = closed;
}
// the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it
indented(fn) {
this.indent += 1;
try {
fn(this);
}
finally {
this.indent -= 1;
}
}
write(arg) {
if (typeof arg === "function") {
arg(this, { execution: "sync" });
arg(this, { execution: "async" });
return;
}
const content = arg;
const lines = content.split("\n").filter((x) => x);
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
for (const line of dedented) {
this.content.push(line);
}
}
compile() {
const F = Function;
const content = this?.content ?? [``];
const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`);
return factory(...Object.values(this.closed));
}
}
exports.Doc = Doc;
// seal-cjs-exports
(function () {
var keys = Object.getOwnPropertyNames(exports);
for (var i = 0; i < keys.length; i++) {
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
if (!desc || !desc.get || !desc.configurable) continue;
var value;
try {
value = desc.get();
} catch (e) {
continue;
}
// a circular require may not have settled this one yet, so leave it live
if (value === undefined) continue;
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
}
Object.freeze(exports);
})();
@@ -0,0 +1,3 @@
"use strict";var D=(i,t)=>()=>{try{return t||i((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}};var E=D(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.parseClass=void 0;var G={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}"],"[:alpha:]":["\\p{L}\\p{Nl}"],"[:ascii:]":["\\x00-\\x7f"],"[:blank:]":["\\p{Zs}\\t"],"[:cntrl:]":["\\p{Cc}"],"[:digit:]":["\\p{Nd}"],"[:graph:]":["\\p{Z}\\p{C}",!0],"[:lower:]":["\\p{Ll}"],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}\\p{S}"],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f"],"[:upper:]":["\\p{Lu}"],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],"[:xdigit:]":["A-Fa-f0-9"]},x=i=>i.replace(/[[\]\\-]/g,"\\$&"),A=/$./,H=(i,t,e=!1,s)=>{let h=p=>{let m=s?p.normalize(s):p;return[...m].length===1?m:p},n=t;if(i.charAt(n)!=="[")throw new Error("not in a brace expression");let o=[],a=[],r=n+1,l=!1,c=!1,u=!1,g=n,d="";t:for(;r<i.length;){let p=String.fromCodePoint(i.codePointAt(r));if((p==="!"||p==="^")&&r===n+1){u=!0,r++;continue}if(p==="]"&&l&&!c){g=r+1;break}if(l=!0,p==="\\"&&!c){c=!0,r++;continue}if(p==="["&&!c){for(let[R,[v,B]]of Object.entries(G))if(i.startsWith(R,r)){if(d)return[A,i.length-n];r+=R.length,B?a.push(v):o.push(v);continue t}}c=!1;let m=h(p);if(d){m.codePointAt(0)>d.codePointAt(0)?o.push(x(d)+"-"+x(m)):m===d&&o.push(x(m)),d="",r+=p.length;continue}if(i.startsWith("-]",r+p.length)){o.push(x(m+"-")),r+=p.length+1;continue}if(i.startsWith("-",r+p.length)){d=m,r+=p.length+1;continue}o.push(x(m)),r+=p.length}if(g<r)return[A,0];if(!o.length&&!a.length)return[A,i.length-n];let f="["+(u?"^":"")+o.join("")+"]",w="["+(u?"":"^")+a.join("")+"]",Z="^"+(o.length&&a.length?"("+f+"|"+w+")":o.length?f:w);return[new RegExp(Z,e?"iu":"u"),g-n]};S.parseClass=H});Object.defineProperty(exports,"__esModule",{value:!0});exports.Matcher=void 0;var J=E(),b={t:"match",id:0},K="!?+*@",y=i=>({t:"lit",ch:i}),Q=i=>i.replace(/[\\^$.*+?()[\]{}|/]/g,"\\$&"),L=i=>new RegExp(`^${Q(i)}$`,"iu"),C=new Map,W=i=>{let t=C.get(i);return t||(t=L(i),C.size>=1e3&&C.clear(),C.set(i,t)),t},z=(i,t)=>{if(t===i.ch)return!0;if(!i.re)return!1;let e=t.charCodeAt(0);if(e>=128)return i.re.test(t);let s=i.ascii??=new Uint8Array(128);return s[e]||=i.re.test(t)?1:2,s[e]===1},V=(i,t,e,s)=>{let h=[];for(let n=0;n<i.length;){let o=String.fromCodePoint(i.codePointAt(n));if(o==="\\"){let a=i.codePointAt(n+1),r=a===void 0?o:String.fromCodePoint(a);h.push(y(r)),n+=1+r.length;continue}if(o==="["){let[a,r]=(0,J.parseClass)(i,n,t,s);if(r){h.push({t:"class",re:a}),n+=r;continue}}if(!e&&K.includes(o)&&i[n+1]==="("){h.push({t:"open",type:o}),n+=2;continue}h.push(!e&&o==="|"?{t:"bar"}:!e&&o===")"?{t:"close"}:o==="*"?{t:"star"}:o==="?"?{t:"any"}:y(o)),n+=o.length}return h},X=i=>{let t=new Map,e=[];return i.forEach((s,h)=>{s.t==="open"?e.push(h):s.t==="close"&&e.length&&t.set(e.pop(),h)}),t},O=(i,t,e,s,h)=>{let n=[],o=[n];for(let a=e;a<s;a++){let r=i[a],l=t.get(a);if(r.t==="open"&&l!==void 0){let c=O(i,t,a+1,l,!1);n.push({t:"ext",type:r.type,alts:c}),a=l}else r.t==="bar"&&!h?o.push(n=[]):r.t==="open"?n.push(y(r.type),y("(")):r.t==="bar"?n.push(y("|")):r.t==="close"?n.push(y(")")):n.push(r)}return o},I=(i,t)=>{let e=[],s="",h=()=>{for(let n of s.normalize(t))e.push(y(n));s=""};for(let n of i){if(n.t==="lit"){s+=n.ch;continue}h(),e.push(n.t==="ext"?{...n,alts:n.alts.map(o=>I(o,t))}:n)}return h(),e},Y=(i,t)=>{let e=1,s=a=>({t:"split",id:e++,out:a}),h=(a,r)=>a.reduceRight((l,c)=>n(c,l),r),n=(a,r)=>{switch(a.t){case"lit":let g=t?W(a.ch):void 0;return{t:"lit",id:e++,ch:a.ch,re:g,next:r};case"any":case"star":return{t:a.t,id:e++,next:r};case"class":return{t:"class",id:e++,re:a.re,next:r}}let l=g=>a.alts.map(d=>h(d,g));switch(a.type){case"@":return s(l(r));case"?":return s([r,...l(r)]);case"!":return{t:"neg",id:e++,sub:s(l(b)),next:r}}let c=s([]),u=s(l(c));return c.out.push(r,u),a.type==="*"?c:u};return[h(i,b),e]},tt=i=>{let t=[],e=new Set,s=n=>n.t==="match"?"match":String(n.id),h=(n,o)=>{if(n.t==="match"||e.has(n))return;e.add(n);let a=r=>t.push(`${o}${n.id}: ${r}`);switch(n.t){case"split":a(`split -> ${n.out.map(s).join(", ")}`);for(let r of n.out)h(r,o);return;case"neg":return a(`!(${s(n.sub)}) -> ${s(n.next)}`),h(n.sub,o+" "),h(n.next,o);case"lit":a(`${JSON.stringify(n.ch)} -> ${s(n.next)}`);break;case"class":a(`${n.re} -> ${s(n.next)}`);break;default:a(`${n.t==="any"?"?":"*"} -> ${s(n.next)}`)}h(n.next,o)};return h(i,""),[`start -> ${s(i)}`,...t].join(`
`)},j=class{gen;threads=[];match=!1;runs=[];ids=[];constructor(t){this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},T=(i,t)=>i.ids.length!==t.ids.length||i.runs.length!==t.runs.length||i.ids.some((e,s)=>e!==t.ids[s])?!1:i.runs.every(e=>t.runs.some(s=>s.neg===e.neg&&T(s.state,e.state))),N=i=>({has:new Float64Array(i),seen:new Float64Array(i),gen:0}),$=class{dots;dotStart;#t;constructor(t,e,s){this.dots=t,this.dotStart=e,this.#t=s}state(){return new j(++this.#t.gen)}done(t){return t.ids=t.threads.map(e=>e.id).sort((e,s)=>e-s),t.match&&t.ids.unshift(b.id),t}#s(t,e){let{seen:s}=this.#t;return s[e.id]===t.gen?!1:(s[e.id]=t.gen,!0)}#e(t,e){let{has:s}=this.#t;return s[e.id]===t.gen?!1:(s[e.id]=t.gen,t.threads.push(e),!0)}restricted(t,e){return e&&(this.dots||this.dotStart&&t===0)}add(t,e,s,h){switch(e.t){case"split":if(!this.#s(t,e))return;for(let o of e.out)this.add(t,o,s,h);return;case"neg":if(!this.#s(t,e))return;let n=this.state();return this.add(n,e.sub,s,!1),this.done(n),this.addRun(t,{t:"run",neg:e,state:n},s,h);case"star":if(this.restricted(s,h))return;this.#e(t,e)&&this.add(t,e.next,s,h);return;case"match":t.match=!0;return;default:this.#e(t,e)}}addRun(t,e,s,h){for(let n of t.runs)if(n.neg===e.neg&&T(n.state,e.state))return;t.runs.push(e),e.state.match||this.add(t,e.neg.next,s,h)}step(t,e,s,h){let n=this.state();for(let o of t.threads)switch(o.t){case"lit":z(o,e)&&this.add(n,o.next,s+1,h);break;case"any":this.restricted(s,h)||this.add(n,o.next,s+1,h);break;case"class":!this.restricted(s,h)&&o.re.test(e)&&this.add(n,o.next,s+1,h);break;case"star":this.restricted(s,h)||this.add(n,o,s+1,h)}if(!this.restricted(s,h))for(let o of t.runs){if(o.state.dead){this.addRun(n,o,s+1,h);continue}let a=this.step(o.state,e,s,!1);this.addRun(n,{t:"run",neg:o.neg,state:a},s+1,h)}return this.done(n)}},q=i=>{let t=i.ids.join();if(!i.runs.length)return t;let e=i.runs.map(s=>`${s.neg.id}(${q(s.state)})`);return`${t}|${e.sort().join("|")}`},et=1<<18,P=class{#t;#s=new Map;#e=0;#c;#n;#i;#h;constructor(t,e){this.#t=t,this.#i=new $(!1,!1,e),this.#h=new $(!1,!0,e)}#o(t){return{state:t,match:t.match,dead:t.dead,next:new Map}}#u(t){let e=q(t),s=this.#s.get(e);if(s)return s;this.#e>et&&this.#f();let h=this.#o(t);return this.#s.set(e,h),this.#e+=e.length+1,h}#f(){this.#s.clear(),this.#e=0,this.#c=void 0,this.#n=void 0}start(t){if(t){if(this.#n)return this.#n;let s=this.#h.state();return this.#h.add(s,this.#t,0,!0),this.#n=this.#o(this.#h.done(s))}if(this.#c)return this.#c;let e=this.#i.state();return this.#i.add(e,this.#t,0,!0),this.#c=this.#u(this.#i.done(e))}next(t,e){let s=e.charCodeAt(0),h=s<128?void 0:t.next.get(e);if(h)return h;let n=t===this.#n?this.#u(this.#h.step(t.state,e,0,!0)):this.#u(this.#i.step(t.state,e,1,!0));return s<128?(t.ascii||(t.ascii=new Array(128),this.#e+=128),t.ascii[s]=n):t.next.set(e,n),this.#e++,n}},st=i=>{let t=[];for(let e=i;e.t!=="match";e=e.next){if(e.t==="split"||e.t==="neg")return;t.push(e)}return t},nt=(i,t,e,s)=>{let h=0,n=e,o=-1,a=0;for(;n<s;){let r=i[h];if(r?.t==="star"){o=h++,a=n;continue}let l=t[n];if(r&&(r.t==="any"||r.t==="lit"&&z(r,l)||r.t==="class"&&r.re.test(l))){h++,n++;continue}if(o===-1)return!1;h=o+1,n=++a}for(;i[h]?.t==="star";)h++;return h===i.length},U=i=>{let t=0,e=0;for(let s of i){let[h,n]=it(s);t+=h,e+=n}return[t,e]},it=i=>{if(i.t==="star")return[0,1/0];if(i.t!=="ext")return[1,1];if(i.type==="!")return[0,1/0];let t=i.alts.map(U),e=Math.min(...t.map(n=>n[0])),s=Math.max(...t.map(n=>n[1])),h=s===0?0:1/0;return i.type==="@"?[e,s]:i.type==="?"?[0,s]:i.type==="*"?[0,h]:[e,h]},_=(i,t,e)=>{for(let s=0;s<i.length;s++)if(!z(i[s],t[e+s]))return!1;return!0},rt=/[/\ud800-\udfff]/,ht=/[\ud800-\udfff]/,k=i=>ht.test(i)?[...i]:i,F=i=>{if(i.includes("/"))throw new Error("can only match a single path portion, got: "+i)},M=class{pattern;options;#t;#s;#e;#c;#n;#i=!1;#h;#o;#u=!1;#f=0;#m=1/0;#l=[];#a=[];#p;#g;#w=!1;#y;#r;constructor(t,e={}){if(t.includes("/"))throw new Error("can only match a single path portion, got pattern: "+t);this.pattern=t,this.options=e;let{nocase:s=!1,noext:h=!1,normalize:n}=e;this.#r=n===!0?"NFC":n||void 0;let o=/^[?*+@]\(\)$/.test(t),a=V(t,s,h||o,this.#r),[r]=O(a,X(a),0,a.length,!0);this.#r&&(r=I(r,this.#r));let[l,c]=Y(r,s);if(this.#t=l,this.#s=c,r.every(u=>u.t==="lit"))this.#n=r.map(u=>u.ch).join(""),this.#i=s;else{let u=f=>f.t!=="lit"?void 0:s?{ch:f.ch,re:W(f.ch)}:{ch:f.ch};for(let f of r){let w=u(f);if(!w)break;this.#l.push(w)}for(let f=r.length-1;f>=0;f--){let w=u(r[f]);if(!w)break;this.#a.unshift(w)}this.#w=!!(this.#l.length||this.#a.length),s||(this.#p=this.#l.map(f=>f.ch).join(""),this.#g=this.#a.map(f=>f.ch).join("")),this.#o=st(this.#t)?.slice(this.#l.length,-this.#a.length||void 0),this.#u=!!this.#o?.every(f=>f.t==="star"||f.t==="any");let[g,d]=U(r);this.#f=g,this.#m=d}}test(t){return this.#r?(F(t),this.#d(t.normalize(this.#r))):rt.test(t)?(F(t),this.#d(t,[...t])):this.#d(t,t)}testUnchecked(t){return this.#d(this.#r?t.normalize(this.Line truncated
//# sourceMappingURL=index.min.js.map
@@ -0,0 +1,8 @@
/**
* Determine if the given name is a legal variable name.
*
* This is needed when transforming TypeScript enums; if an enum key is a valid
* variable name, it might be referenced later in the enum, so we need to
* declare a variable.
*/
export default function isIdentifier(name: string): boolean;
@@ -0,0 +1,679 @@
// lib/v4/isZodErrorLike.ts
function isZodErrorLike(err) {
return err instanceof Object && "name" in err && (err.name === "ZodError" || err.name === "$ZodError") && "issues" in err && Array.isArray(err.issues);
}
// lib/v4/ValidationError.ts
var ZOD_VALIDATION_ERROR_NAME = "ZodValidationError";
var ValidationError = class extends Error {
name;
details;
constructor(message, options) {
super(message, options);
this.name = ZOD_VALIDATION_ERROR_NAME;
this.details = getIssuesFromErrorOptions(options);
}
toString() {
return this.message;
}
};
function getIssuesFromErrorOptions(options) {
if (options) {
const cause = options.cause;
if (isZodErrorLike(cause)) {
return cause.issues;
}
}
return [];
}
// lib/v4/isValidationError.ts
function isValidationError(err) {
return err instanceof ValidationError;
}
// lib/v4/isValidationErrorLike.ts
function isValidationErrorLike(err) {
return err instanceof Error && err.name === ZOD_VALIDATION_ERROR_NAME;
}
// lib/v4/errorMap/custom.ts
function parseCustomIssue(issue) {
return {
type: issue.code,
path: issue.path,
message: issue.message ?? "Invalid input"
};
}
// lib/v4/errorMap/invalidElement.ts
function parseInvalidElementIssue(issue) {
return {
type: issue.code,
path: issue.path,
message: `unexpected element in ${issue.origin}`
};
}
// lib/v4/errorMap/invalidKey.ts
function parseInvalidKeyIssue(issue) {
return {
type: issue.code,
path: issue.path,
message: `unexpected key in ${issue.origin}`
};
}
// lib/v4/errorMap/invalidStringFormat.ts
function parseInvalidStringFormatIssue(issue, options = {
displayInvalidFormatDetails: false
}) {
switch (issue.format) {
case "lowercase":
case "uppercase":
return {
type: issue.code,
path: issue.path,
message: `value must be in ${issue.format} format`
};
default: {
if (isZodIssueStringStartsWith(issue)) {
return parseStringStartsWith(issue);
}
if (isZodIssueStringEndsWith(issue)) {
return parseStringEndsWith(issue);
}
if (isZodIssueStringIncludes(issue)) {
return parseStringIncludes(issue);
}
if (isZodIssueStringInvalidRegex(issue)) {
return parseStringInvalidRegex(issue, options);
}
if (isZodIssueStringInvalidJWT(issue)) {
return parseStringInvalidJWT(issue, options);
}
return {
type: issue.code,
path: issue.path,
message: `invalid ${issue.format}`
};
}
}
}
function isZodIssueStringStartsWith(issue) {
return issue.format === "starts_with";
}
function parseStringStartsWith(issue) {
return {
type: issue.code,
path: issue.path,
message: `value must start with "${issue.prefix}"`
};
}
function isZodIssueStringEndsWith(issue) {
return issue.format === "ends_with";
}
function parseStringEndsWith(issue) {
return {
type: issue.code,
path: issue.path,
message: `value must end with "${issue.suffix}"`
};
}
function isZodIssueStringIncludes(issue) {
return issue.format === "includes";
}
function parseStringIncludes(issue) {
return {
type: issue.code,
path: issue.path,
message: `value must include "${issue.includes}"`
};
}
function isZodIssueStringInvalidRegex(issue) {
return issue.format === "regex";
}
function parseStringInvalidRegex(issue, options = {
displayInvalidFormatDetails: false
}) {
let message = "value must match pattern";
if (options.displayInvalidFormatDetails) {
message += ` "${issue.pattern}"`;
}
return {
type: issue.code,
path: issue.path,
message
};
}
function isZodIssueStringInvalidJWT(issue) {
return issue.format === "jwt";
}
function parseStringInvalidJWT(issue, options = {
displayInvalidFormatDetails: false
}) {
return {
type: issue.code,
path: issue.path,
message: options.displayInvalidFormatDetails && issue.algorithm ? `invalid jwt/${issue.algorithm}` : `invalid jwt`
};
}
// lib/v4/errorMap/invalidType.ts
function parseInvalidTypeIssue(issue) {
let message = `expected ${issue.expected}`;
if ("input" in issue) {
message += `, received ${getTypeName(issue.input)}`;
}
return {
type: issue.code,
path: issue.path,
message
};
}
function getTypeName(value) {
if (typeof value === "object") {
if (value === null) {
return "null";
}
if (value === void 0) {
return "undefined";
}
if (Array.isArray(value)) {
return "array";
}
if (value instanceof Date) {
return "date";
}
if (value instanceof RegExp) {
return "regexp";
}
if (value instanceof Map) {
return "map";
}
if (value instanceof Set) {
return "set";
}
if (value instanceof Error) {
return "error";
}
if (value instanceof Function) {
return "function";
}
return "object";
}
return typeof value;
}
// lib/v4/errorMap/invalidUnion.ts
function parseInvalidUnionIssue(issue) {
return {
type: issue.code,
path: issue.path,
message: issue.message ?? "Invalid input"
};
}
// lib/utils/stringify.ts
function stringifySymbol(symbol) {
return symbol.description ?? "";
}
function stringify(value, options = {}) {
switch (typeof value) {
case "symbol":
return stringifySymbol(value);
case "bigint":
case "number": {
switch (options.localization) {
case true:
return value.toLocaleString();
case false:
return value.toString();
default:
return value.toLocaleString(options.localization);
}
}
case "string": {
if (options.wrapStringValueInQuote) {
return `"${value}"`;
}
return value;
}
default: {
if (value instanceof Date) {
switch (options.localization) {
case true:
return value.toLocaleString();
case false:
return value.toISOString();
default:
return value.toLocaleString(options.localization);
}
}
return String(value);
}
}
}
// lib/utils/joinValues.ts
function joinValues(values, options) {
const valuesToDisplay = (options.maxValuesToDisplay ? values.slice(0, options.maxValuesToDisplay) : values).map((value) => {
return stringify(value, {
wrapStringValueInQuote: options.wrapStringValuesInQuote
});
});
if (valuesToDisplay.length < values.length) {
valuesToDisplay.push(
`${values.length - valuesToDisplay.length} more value(s)`
);
}
return valuesToDisplay.reduce((acc, value, index) => {
if (index > 0) {
if (index === valuesToDisplay.length - 1 && options.lastSeparator) {
acc += options.lastSeparator;
} else {
acc += options.separator;
}
}
acc += value;
return acc;
}, "");
}
// lib/v4/errorMap/invalidValue.ts
function parseInvalidValueIssue(issue, options) {
let message;
if (issue.values.length === 0) {
message = "invalid value";
} else if (issue.values.length === 1) {
const valueStr = stringify(issue.values[0], {
wrapStringValueInQuote: true
});
message = `expected value to be ${valueStr}`;
} else {
const valuesStr = joinValues(issue.values, {
separator: options.allowedValuesSeparator,
lastSeparator: options.allowedValuesLastSeparator,
wrapStringValuesInQuote: options.wrapAllowedValuesInQuote,
maxValuesToDisplay: options.maxAllowedValuesToDisplay
});
message = `expected value to be one of ${valuesStr}`;
}
return {
type: issue.code,
path: issue.path,
message
};
}
// lib/v4/errorMap/notMultipleOf.ts
function parseNotMultipleOfIssue(issue) {
return {
type: issue.code,
path: issue.path,
message: `expected multiple of ${issue.divisor}`
};
}
// lib/v4/errorMap/tooBig.ts
function parseTooBigIssue(issue, options) {
const maxValueStr = issue.origin === "date" ? stringify(new Date(issue.maximum), {
localization: options.dateLocalization
}) : stringify(issue.maximum, {
localization: options.numberLocalization
});
switch (issue.origin) {
case "number":
case "int":
case "bigint": {
return {
type: issue.code,
path: issue.path,
message: `number must be less than${issue.inclusive ? " or equal to" : ""} ${maxValueStr}`
};
}
case "string": {
return {
type: issue.code,
path: issue.path,
message: `string must contain at most ${maxValueStr} character(s)`
};
}
case "date": {
return {
type: issue.code,
path: issue.path,
message: `date must be ${issue.inclusive ? "prior or equal to" : "prior to"} "${maxValueStr}"`
};
}
case "array": {
return {
type: issue.code,
path: issue.path,
message: `array must contain at most ${maxValueStr} item(s)`
};
}
case "set": {
return {
type: issue.code,
path: issue.path,
message: `set must contain at most ${maxValueStr} item(s)`
};
}
case "file": {
return {
type: issue.code,
path: issue.path,
message: `file must not exceed ${maxValueStr} byte(s) in size`
};
}
default:
return {
type: issue.code,
path: issue.path,
message: `value must be less than${issue.inclusive ? " or equal to" : ""} ${maxValueStr}`
};
}
}
// lib/v4/errorMap/tooSmall.ts
function parseTooSmallIssue(issue, options) {
const minValueStr = issue.origin === "date" ? stringify(new Date(issue.minimum), {
localization: options.dateLocalization
}) : stringify(issue.minimum, {
localization: options.numberLocalization
});
switch (issue.origin) {
case "number":
case "int":
case "bigint": {
return {
type: issue.code,
path: issue.path,
message: `number must be greater than${issue.inclusive ? " or equal to" : ""} ${minValueStr}`
};
}
case "date": {
return {
type: issue.code,
path: issue.path,
message: `date must be ${issue.inclusive ? "later or equal to" : "later to"} "${minValueStr}"`
};
}
case "string": {
return {
type: issue.code,
path: issue.path,
message: `string must contain at least ${minValueStr} character(s)`
};
}
case "array": {
return {
type: issue.code,
path: issue.path,
message: `array must contain at least ${minValueStr} item(s)`
};
}
case "set": {
return {
type: issue.code,
path: issue.path,
message: `set must contain at least ${minValueStr} item(s)`
};
}
case "file": {
return {
type: issue.code,
path: issue.path,
message: `file must be at least ${minValueStr} byte(s) in size`
};
}
default:
return {
type: issue.code,
path: issue.path,
message: `value must be greater than${issue.inclusive ? " or equal to" : ""} ${minValueStr}`
};
}
}
// lib/v4/errorMap/unrecognizedKeys.ts
function parseUnrecognizedKeysIssue(issue, options) {
const keysStr = joinValues(issue.keys, {
separator: options.unrecognizedKeysSeparator,
lastSeparator: options.unrecognizedKeysLastSeparator,
wrapStringValuesInQuote: options.wrapUnrecognizedKeysInQuote,
maxValuesToDisplay: options.maxUnrecognizedKeysToDisplay
});
return {
type: issue.code,
path: issue.path,
message: `unrecognized key(s) ${keysStr} in object`
};
}
// lib/v4/errorMap/errorMap.ts
var issueParsers = {
invalid_type: parseInvalidTypeIssue,
too_big: parseTooBigIssue,
too_small: parseTooSmallIssue,
invalid_format: parseInvalidStringFormatIssue,
invalid_value: parseInvalidValueIssue,
invalid_element: parseInvalidElementIssue,
not_multiple_of: parseNotMultipleOfIssue,
unrecognized_keys: parseUnrecognizedKeysIssue,
invalid_key: parseInvalidKeyIssue,
custom: parseCustomIssue,
invalid_union: parseInvalidUnionIssue
};
var defaultErrorMapOptions = {
displayInvalidFormatDetails: false,
allowedValuesSeparator: ", ",
allowedValuesLastSeparator: " or ",
wrapAllowedValuesInQuote: true,
maxAllowedValuesToDisplay: 10,
unrecognizedKeysSeparator: ", ",
unrecognizedKeysLastSeparator: " and ",
wrapUnrecognizedKeysInQuote: true,
maxUnrecognizedKeysToDisplay: 5,
dateLocalization: true,
numberLocalization: true
};
function createErrorMap(partialOptions = {}) {
const options = {
...defaultErrorMapOptions,
...partialOptions
};
const errorMap = (issue) => {
if (issue.code === void 0) {
return "Not supported issue type";
}
const parseFunc = issueParsers[issue.code];
const ast = parseFunc(issue, options);
return ast.message;
};
return errorMap;
}
// lib/utils/NonEmptyArray.ts
function isNonEmptyArray(value) {
return value.length !== 0;
}
// lib/utils/joinPath.ts
var identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
function joinPath(path) {
if (path.length === 1) {
let propertyKey = path[0];
if (typeof propertyKey === "symbol") {
propertyKey = stringifySymbol(propertyKey);
}
return propertyKey.toString() || '""';
}
return path.reduce((acc, propertyKey) => {
if (typeof propertyKey === "number") {
return acc + "[" + propertyKey.toString() + "]";
}
if (typeof propertyKey === "symbol") {
propertyKey = stringifySymbol(propertyKey);
}
if (propertyKey.includes('"')) {
return acc + '["' + escapeQuotes(propertyKey) + '"]';
}
if (!identifierRegex.test(propertyKey)) {
return acc + '["' + propertyKey + '"]';
}
const separator = acc.length === 0 ? "" : ".";
return acc + separator + propertyKey;
}, "");
}
function escapeQuotes(str) {
return str.replace(/"/g, '\\"');
}
// lib/utils/titleCase.ts
function titleCase(value) {
if (value.length === 0) {
return value;
}
return value.charAt(0).toUpperCase() + value.slice(1);
}
// lib/v4/MessageBuilder.ts
var defaultMessageBuilderOptions = {
prefix: "Validation error",
prefixSeparator: ": ",
maxIssuesInMessage: 99,
// I've got 99 problems but the b$tch ain't one
unionSeparator: " or ",
issueSeparator: "; ",
includePath: true,
forceTitleCase: true
};
function createMessageBuilder(partialOptions = {}) {
const options = {
...defaultMessageBuilderOptions,
...partialOptions
};
return function messageBuilder(issues) {
const message = issues.slice(0, options.maxIssuesInMessage).map((issue) => mapIssue(issue, options)).join(options.issueSeparator);
return conditionallyPrefixMessage(message, options);
};
}
function mapIssue(issue, options) {
if (issue.code === "invalid_union" && isNonEmptyArray(issue.errors)) {
const individualMessages = issue.errors.map(
(issues) => issues.map(
(subIssue) => mapIssue(
{
...subIssue,
path: issue.path.concat(subIssue.path)
},
options
)
).join(options.issueSeparator)
);
return Array.from(new Set(individualMessages)).join(options.unionSeparator);
}
const buf = [];
if (options.forceTitleCase) {
buf.push(titleCase(issue.message));
} else {
buf.push(issue.message);
}
pathCondition: if (options.includePath && issue.path !== void 0 && isNonEmptyArray(issue.path)) {
if (issue.path.length === 1) {
const identifier = issue.path[0];
if (typeof identifier === "number") {
buf.push(` at index ${identifier}`);
break pathCondition;
}
}
buf.push(` at "${joinPath(issue.path)}"`);
}
return buf.join("");
}
function conditionallyPrefixMessage(message, options) {
if (options.prefix != null) {
if (message.length > 0) {
return [options.prefix, message].join(options.prefixSeparator);
}
return options.prefix;
}
if (message.length > 0) {
return message;
}
return defaultMessageBuilderOptions.prefix;
}
// lib/v4/fromZodError.ts
function fromZodError(zodError, options = {}) {
if (!isZodErrorLike(zodError)) {
throw new TypeError(
`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${fromError.name}" method instead?`
);
}
return fromZodErrorWithoutRuntimeCheck(zodError, options);
}
function fromZodErrorWithoutRuntimeCheck(zodError, options = {}) {
const zodIssues = zodError.issues;
let message;
if (isNonEmptyArray(zodIssues)) {
const messageBuilder = createMessageBuilderFromOptions(options);
message = messageBuilder(zodIssues);
} else {
message = zodError.message;
}
return new ValidationError(message, { cause: zodError });
}
function createMessageBuilderFromOptions(options) {
if ("messageBuilder" in options) {
return options.messageBuilder;
}
return createMessageBuilder(options);
}
// lib/v4/toValidationError.ts
var toValidationError = (options = {}) => (err) => {
if (isZodErrorLike(err)) {
return fromZodErrorWithoutRuntimeCheck(err, options);
}
if (err instanceof Error) {
return new ValidationError(err.message, { cause: err });
}
return new ValidationError("Unknown error");
};
// lib/v4/fromError.ts
function fromError(err, options = {}) {
return toValidationError(options)(err);
}
// lib/v4/fromZodIssue.ts
import * as zod from "zod/v4/core";
function fromZodIssue(issue, options = {}) {
const messageBuilder = createMessageBuilderFromOptions2(options);
const message = messageBuilder([issue]);
return new ValidationError(message, {
cause: new zod.$ZodRealError([issue])
});
}
function createMessageBuilderFromOptions2(options) {
if ("messageBuilder" in options) {
return options.messageBuilder;
}
return createMessageBuilder(options);
}
export {
ValidationError,
createErrorMap,
createMessageBuilder,
fromError,
fromZodError,
fromZodIssue,
isValidationError,
isValidationErrorLike,
isZodErrorLike,
toValidationError
};
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Brian Donovan
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.
@@ -0,0 +1 @@
{"version":3,"file":"utils.mjs","sources":["../../src/scoring/utils.ts"],"sourcesContent":[null],"names":["LOG10","Math","log","LOG2","nCk","n","k","count","co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vB,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IACf,OAAO,CAAqB,CAAA;AAC9B,CAAC,CAAA;AAEM,MAAM,OAAO,GAAG,CAAC,MAA6B,EAAE,EAAc,EAAE;IACrE,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAA;IACnB,MAAM,MAAM,GAA4B,EAAE,CAAA;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAGtC,EAAE,CAAC;QACJ,oEAAoE;QACpE,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;QACzB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IACf,CAAC;IACD,6CAA6C;IAC7C,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QAC3D,MAAM,CAAC,KAAK,GAAG,IAAI,CAAA;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAA;IACrB,OAAO,MAAoB,CAAA;AAC7B,CAAC,CAAA;AAjBY,QAAA,OAAO,WAiBnB","sourcesContent":["// turn tar(1) style args like `C` into the more verbose things like `cwd`\n\nimport { type GzipOptions, type ZlibOptions } from 'minizlib'\nimport { type Stats } from 'node:fs'\nimport { type ReadEntry } from './read-entry.js'\nimport { type WarnData } from './warn-method.js'\nimport type { WriteEntry } from './write-entry.js'\n\nconst argmap = new Map<keyof TarOptionsWithAliases, keyof TarOptions>([\n ['C', 'cwd'],\n ['f', 'file'],\n ['z', 'gzip'],\n ['P', 'preservePaths'],\n ['U', 'unlink'],\n ['strip-components', 'strip'],\n ['stripComponents', 'strip'],\n ['keep-newer', 'newer'],\n ['keepNewer', 'newer'],\n ['keep-newer-files', 'newer'],\n ['keepNewerFiles', 'newer'],\n ['k', 'keep'],\n ['keep-existing', 'keep'],\n ['keepExisting', 'keep'],\n ['m', 'noMtime'],\n ['no-mtime', 'noMtime'],\n ['p', 'preserveOwner'],\n ['L', 'follow'],\n ['h', 'follow'],\n ['onentry', 'onReadEntry'],\n])\n\n/**\n * The options that can be provided to tar commands.\n *\n * Note that some of these are only relevant for certain commands, since\n * they are specific to reading or writing.\n *\n * Aliases are provided in the {@link TarOptionsWithAliases} type.\n */\nexport interface TarOptions {\n //////////////////////////\n // shared options\n\n /**\n * Perform all I/O operations synchronously. If the stream is ended\n * immediately, then it will be processed entirely synchronously.\n */\n sync?: boolean\n\n /**\n * The tar file to be read and/or written. When this is set, a stream\n * is not returned. Asynchronous commands will return a promise indicating\n * when the operation is completed, and synchronous commands will return\n * immediately.\n */\n file?: string\n\n /**\n * Treat warnings as crash-worthy errors. Defaults false.\n */\n strict?: boolean\n\n /**\n * The effective current working directory for this tar command\n */\n cwd?: string\n\n /**\n * When creating a tar archive, this can be used to compress it as well.\n * Set to `true` to use the default gzip options, or customize them as\n * needed.\n *\n * When reading, if this is unset, then the compression status will be\n * inferred from the archive data. This is generally best, unless you are\n * sure of the compression settings in use to create the archive, and want to\n * fail if the archive doesn't match expectations.\n */\n gzip?: boolean | GzipOptions\n\n /**\n * When creating archives, preserve absolute and `..` paths in the archive,\n * rather than sanitizing them under the cwd.\n *\n * When extracLine truncated
@@ -0,0 +1,25 @@
{{# def.definitions }}
{{# def.errors }}
{{# def.setupKeyword }}
{{# def.$data }}
{{
var $regExpCode = it.opts.regExp ? 'regExp' : 'new RegExp';
}}
{{? $isData }}
var {{=$valid}} = true;
try {
{{=$valid}} = {{=$regExpCode}}({{=$schemaValue}}).test({{=$data}});
} catch(e) {
{{=$valid}} = false;
}
if ({{# def.$dataNotType:'string' }} !{{=$valid}}) {
{{??}}
{{
var $regexp = it.usePattern($schema);
}}
if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) {
{{?}}
{{# def.error:'pattern' }}
} {{? $breakOnError }} else { {{?}}
@@ -0,0 +1 @@
{"version":3,"file":"hand-helping.js","sources":["../../../src/icons/hand-helping.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name HandHelping\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTEgMTJoMmEyIDIgMCAxIDAgMC00aC0zYy0uNiAwLTEuMS4yLTEuNC42TDMgMTQiIC8+CiAgPHBhdGggZD0ibTcgMTggMS42LTEuNGMuMy0uNC44LS42IDEuNC0uNmg0YzEuMSAwIDIuMS0uNCAyLjgtMS4ybDQuNi00LjRhMiAyIDAgMCAwLTIuNzUtMi45MWwtNC4yIDMuOSIgLz4KICA8cGF0aCBkPSJtMiAxMyA2IDYiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/hand-helping\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst HandHelping = createLucideIcon('HandHelping', [\n ['path', { d: 'M11 12h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 14', key: '1j4xps' }],\n [\n 'path',\n {\n d: 'm7 18 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9',\n key: 'uospg8',\n },\n ],\n ['path', { d: 'm2 13 6 6', key: '16e5s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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"camel-case-attrs.mjs","sources":["../../../../../src/render/svg/utils/camel-case-attrs.ts"],"sourcesContent":["/**\n * A set of attribute names that are always read/written as camel case.\n */\nexport const camelCaseAttributes = new Set([\n \"baseFrequency\",\n \"diffuseConstant\",\n \"kernelMatrix\",\n \"kernelUnitLength\",\n \"keySplines\",\n \"keyTimes\",\n \"limitingConeAngle\",\n \"markerHeight\",\n \"markerWidth\",\n \"numOctaves\",\n \"targetX\",\n \"targetY\",\n \"surfaceScale\",\n \"specularConstant\",\n \"specularExponent\",\n \"stdDeviation\",\n \"tableValues\",\n \"viewBox\",\n \"gradientTransform\",\n \"pathLength\",\n \"startOffset\",\n \"textLength\",\n \"lengthAdjust\",\n])\n"],"names":[],"mappings":"AAAA;;AAEG;AACI,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IACvC,eAAe;IACf,iBAAiB;IACjB,cAAc;IACd,kBAAkB;IAClB,YAAY;IACZ,UAAU;IACV,mBAAmB;IACnB,cAAc;IACd,aAAa;IACb,YAAY;IACZ,SAAS;IACT,SAAS;IACT,cAAc;IACd,kBAAkB;IAClB,kBAAkB;IAClB,cAAc;IACd,aAAa;IACb,SAAS;IACT,mBAAmB;IACnB,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,cAAc;AACjB,CAAA;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../src/errors.ts","../src/EventSource.ts"],"sourcesContent":["/**\n * An extended version of the `Event` emitted by the `EventSource` object when an error occurs.\n * While the spec does not include any additional properties, we intentionally go beyond the spec\n * and provide some (minimal) additional information to aid in debugging.\n *\n * @public\n */\nexport class ErrorEvent extends Event {\n /**\n * HTTP status code, if this was triggered by an HTTP error\n * Note: this is not part of the spec, but is included for better error handling.\n *\n * @public\n */\n public code?: number | undefined\n\n /**\n * Optional message attached to the error.\n * Note: this is not part of the spec, but is included for better error handling.\n *\n * @public\n */\n public message?: string | undefined\n\n /**\n * Constructs a new `ErrorEvent` instance. This is typically not called directly,\n * but rather emitted by the `EventSource` object when an error occurs.\n *\n * @param type - The type of the event (should be \"error\")\n * @param errorEventInitDict - Optional properties to include in the error event\n */\n constructor(\n type: string,\n errorEventInitDict?: {message?: string | undefined; code?: number | undefined},\n ) {\n super(type)\n this.code = errorEventInitDict?.code ?? undefined\n this.message = errorEventInitDict?.message ?? undefined\n }\n\n /**\n * Node.js \"hides\" the `message` and `code` properties of the `ErrorEvent` instance,\n * when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,\n * we explicitly include the properties in the `inspect` method.\n *\n * This is automatically called by Node.js when you `console.log` an instance of this class.\n *\n * @param _depth - The current depth\n * @param options - The options passed to `util.inspect`\n * @param inspect - The inspect function to use (prevents having to import it from `util`)\n * @returns A string representation of the error\n */\n [Symbol.for('nodejs.util.inspect.custom')](\n _depth: number,\n options: {colors: boolean},\n inspect: (obj: unknown, inspectOptions: {colors: boolean}) => string,\n ): string {\n return inspect(inspectableError(this), options)\n }\n\n /**\n * Deno \"hides\" the `message` and `code` properties of the `ErrorEvent` instance,\n * when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,\n * we explicitly include the properties in the `inspect` method.\n *\n * This is automatically called by Deno when you `console.log` an instance of this class.\n *\n * @param inspect - The inspect function to use (prevents having to import it from `util`)\n * @param options - The options passed to `Deno.inspect`\n * @returns A string representation of the error\n */\n [Symbol.for('Deno.customInspect')](\n inspect: (obj: unknown, inspectOptions: {colors: boolean}) => string,\n options: {colors: boolean},\n ): string {\n return inspect(inspectableError(this), options)\n }\n}\n\n/**\n * For environments where DOMException may not exist, we will use a SyntaxError instead.\n * While this isn't strictly according to spec, it is very close.\n *\n * @param message - The message to include in the error\n * @returns A `DOMException` or `SyntaxError` instance\n * @internal\n */\nexport function syntaxError(message: string): SyntaxError {\n // If someone can figure out a way to make this work without depending on DOM/Node.js typings,\n // and without casting to `any`, please send a PR 🙏\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const DomException = (globalThis as any).DOMException\n if (typeof DomException === 'function') {\n return new DomException(message, 'SyntaxError')\n }\n\n return new SyntaxError(message)\n}\n\n/**\n * Flatten an error into a single error message string.\n * Unwraps nested errors and joins them with a comma.\n *\n * @param err - The error to flatten\n * @returns A string representation of the error\n * @internal\n */\nexport function flattenError(err: unknown): string {\n if (!(err instanceof Error)) {\n return `${err}`\n }\n\n if ('errors' in err && Array.isArray(err.errors)) {\n return err.errors.map(flattenError).join(', ')\n }\n\n if ('cause' in err && err.cause instanceof Error) {\n return `${err}: ${flattenError(err.cause)}`\n }\n\n return err.message\n}\n\n/**\n * Convert an `ErrorEvent` instance into a plain object for inspection.\n *\n * @param err - The `ErrorEvent` instance to inspect\n * @returns A plain object representation of the error\n * @internal\n */\nfunction inspectableError(err: ErrorEvent) {\n return {\n type: err.type,\n message: err.message,\n code: err.code,\n defaultPrevented: err.defaultPrevented,\n cancelable: err.cancelable,\n timeStamp: err.timeStamp,\n }\n}\n","import {createParser, type EveLine truncated
@@ -0,0 +1,3 @@
import type { Vocabulary } from "../types";
declare const next: Vocabulary;
export default next;
@@ -0,0 +1,10 @@
import CAC from "./CAC.ts";
import Command from "./Command.ts";
/**
* @param name The program name to display in help and version message
*/
const cac = (name = '') => new CAC(name);
export default cac;
export { cac, CAC, Command };
@@ -0,0 +1,10 @@
"use strict";
const absFloor = require("./absFloor-CImRXpov.js");
const constants = require("./constants-DR3SPJ7u.js");
const parse = require("./parse.js");
function diffInMinutes(date, input, asFloat) {
const parsed = parse(input);
const output = (+date - +parsed) / constants.MS_IN_MINUTE;
return asFloat ? output : absFloor.absFloor(output);
}
module.exports = diffInMinutes;
@@ -0,0 +1,89 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
//#region src/utils/stream.ts
/**
* @module
* Stream utility.
*/
var StreamingApi = class {
writer;
encoder;
writable;
abortSubscribers = [];
responseReadable;
/**
* Whether the stream has been aborted.
*/
aborted = false;
/**
* Whether the stream has been closed normally.
*/
closed = false;
constructor(writable, _readable) {
this.writable = writable;
this.writer = writable.getWriter();
this.encoder = new TextEncoder();
const reader = _readable.getReader();
this.abortSubscribers.push(async () => {
await reader.cancel();
});
this.responseReadable = new ReadableStream({
async pull(controller) {
const { done, value } = await reader.read();
done ? controller.close() : controller.enqueue(value);
},
cancel: () => {
if (!this.closed) this.abort();
}
});
}
async write(input) {
try {
if (typeof input === "string") input = this.encoder.encode(input);
await this.writer.write(input);
} catch {}
return this;
}
async writeln(input) {
await this.write(input + "\n");
return this;
}
sleep(ms) {
return new Promise((res) => setTimeout(res, ms));
}
async close() {
this.closed = true;
try {
await this.writer.close();
} catch {}
}
async pipe(body) {
this.writer.releaseLock();
try {
await body.pipeTo(this.writable, {
preventClose: true,
preventAbort: true
});
} finally {
this.writer = this.writable.getWriter();
}
}
onAbort(listener) {
this.abortSubscribers.push(listener);
}
/**
* Abort the stream.
* You can call this method when stream is aborted by external event.
*/
abort() {
if (!this.aborted) {
this.aborted = true;
this.abortSubscribers.forEach((subscriber) => {
try {
Promise.resolve(subscriber()).catch(() => {});
} catch {}
});
}
}
};
//#endregion
exports.StreamingApi = StreamingApi;
@@ -0,0 +1,111 @@
import { decodeBase64, encodeBase64 } from "../../utils/encode.js";
import crypto from "node:crypto";
//#region src/adapter/lambda-edge/handler.ts
globalThis.crypto ??= crypto;
/**
* Accepts events from 'Lambda@Edge' event
* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html
*/
const convertHeaders = (headers) => {
const cfHeaders = {};
headers.forEach((value, key) => {
cfHeaders[key.toLowerCase()] = [...cfHeaders[key.toLowerCase()] || [], {
key: key.toLowerCase(),
value
}];
});
return cfHeaders;
};
/**
* @deprecated `hono/lambda-edge` will be removed in v5. Install `@hono/lambda-edge` and import from there instead.
*/
const handle = (app) => {
return async (event, ...args) => {
const [context, callback] = args;
let callbackError = null;
let callbackResult;
const cf = getCloudFrontRecord(event);
const res = await app.fetch(createRequest(cf), {
event,
context,
callback: (err, result) => {
if (!callbackError && !callbackResult) {
callbackError = err;
callbackResult = result;
}
callback?.(err, result);
},
config: cf.config,
request: cf.request,
response: cf.response
});
if (callbackError) throw callbackError;
return callbackResult ?? createResult(res);
};
};
const createResult = async (res) => {
const contentEncoding = res.headers.get("content-encoding");
const isBase64Encoded = isContentTypeBinary(res.headers.get("content-type") || "") || !!contentEncoding && !/^identity$/i.test(contentEncoding);
const body = isBase64Encoded ? encodeBase64(await res.arrayBuffer()) : await res.text();
return {
status: res.status.toString(),
headers: convertHeaders(res.headers),
body,
...isBase64Encoded && { bodyEncoding: "base64" }
};
};
/**
* Reads the CloudFront record out of a Lambda@Edge event.
*
* The event is supplied by the runtime, so a malformed one means the function
* was invoked with something other than a Lambda@Edge event. Fail with a
* message naming the adapter and the missing field, rather than letting an
* unattributable property access error escape.
*/
const getCloudFrontRecord = (event) => {
const cf = event?.Records?.[0]?.cf;
if (!cf?.request) throw new TypeError("Unable to map the CloudFront event to a Request: expected `Records[0].cf.request` in the Lambda@Edge event.");
return cf;
};
const createRequest = (cf) => {
const request = cf.request;
const queryString = request.querystring;
const urlPath = `https://${request.headers?.host?.[0]?.value || cf.config?.distributionDomainName}${request.uri}`;
const url = queryString ? `${urlPath}?${queryString}` : urlPath;
const headers = new Headers();
Object.entries(request.headers ?? {}).forEach(([k, v]) => {
v.forEach((header) => headers.append(k, header.value));
});
const requestBody = request.body;
const method = request.method;
const rawBody = createBody(method, requestBody);
let body = rawBody;
if (rawBody !== void 0) {
const bytes = typeof rawBody === "string" ? new TextEncoder().encode(rawBody) : rawBody;
body = bytes;
headers.set("content-length", bytes.length.toString());
}
return new Request(url, {
headers,
method,
body
});
};
/**
* @deprecated `hono/lambda-edge` will be removed in v5. Install `@hono/lambda-edge` and import from there instead.
*/
const createBody = (method, requestBody) => {
if (!requestBody || !requestBody.data) return;
if (method === "GET" || method === "HEAD") return;
if (requestBody.encoding === "base64") return decodeBase64(requestBody.data);
return requestBody.data;
};
/**
* @deprecated `hono/lambda-edge` will be removed in v5. Install `@hono/lambda-edge` and import from there instead.
*/
const isContentTypeBinary = (contentType) => {
if (/^application\/vnd\.(?:apple\.installer|mozilla\.xul)\+xml\s*(?:;|$)/i.test(contentType)) return true;
return !/^text\/(?:plain|html|css|javascript|csv)|(?:\/|\+)(?:json|xml)\s*(?:;|$)/i.test(contentType);
};
//#endregion
export { createBody, handle, isContentTypeBinary };
@@ -0,0 +1,168 @@
import type { StrictEqualUsingBranding } from './branding';
import type { And, Extends, ExtendsExcludingAnyOrNever, IsAny, IsNever, IsUnknown, Not, OptionalKeys, UsefulKeys } from './utils';
/**
* Determines the printable type representation for a given type.
*/
export type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever<T> extends true ? 'never' : IsAny<T> extends true ? never : boolean extends T ? 'boolean' : T extends boolean ? `literal boolean: ${T}` : string extends T ? 'string' : T extends string ? `literal string: ${T}` : number extends T ? 'number' : T extends number ? `literal number: ${T}` : bigint extends T ? 'bigint' : T extends bigint ? `literal bigint: ${T}` : T extends null ? 'null' : T extends undefined ? 'undefined' : T extends (...args: any[]) => any ? 'function' : '...';
/**
* Helper for showing end-user a hint why their type assertion is failing.
* This swaps "leaf" types with a literal message about what the actual and
* expected types are. Needs to check for `Not<IsAny<Actual>>` because
* otherwise `LeafTypeOf<Actual>` returns `never`, which extends everything 🤔
*/
export type MismatchInfo<Actual, Expected> = And<[Extends<PrintType<Actual>, '...'>, Not<IsAny<Actual>>]> extends true ? And<[Extends<any[], Actual>, Extends<any[], Expected>]> extends true ? Array<MismatchInfo<Extract<Actual, any[]>[number], Extract<Expected, any[]>[number]>> : Optionalify<{
[K in UsefulKeys<Actual> | UsefulKeys<Expected>]: MismatchInfo<K extends keyof Actual ? Actual[K] : never, K extends keyof Expected ? Expected[K] : never>;
}, OptionalKeys<Expected>> : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `Expected: ${PrintType<Expected>}, Actual: ${PrintType<Exclude<Actual, Expected>>}`;
/**
* Helper for making some keys of a type optional. Only useful so far for `MismatchInfo` - it makes sure we
* don't get bogus errors about optional properties mismatching, when actually it's something else that's wrong.
*
* - Note: this helper is a no-op if there are no optional keys in the type.
*/
export type Optionalify<T, TOptionalKeys> = [TOptionalKeys] extends [never] ? T : ({
[K in Exclude<keyof T, TOptionalKeys>]: T[K];
} & {
[K in Extract<keyof T, TOptionalKeys>]?: T[K];
}) extends infer X ? {
[K in keyof X]: X[K];
} : never;
/**
* @internal
*/
declare const inverted: unique symbol;
/**
* @internal
*/
type Inverted<T> = {
[inverted]: T;
};
/**
* @internal
*/
declare const expectNull: unique symbol;
export type ExpectNull<T> = {
[expectNull]: T;
result: ExtendsExcludingAnyOrNever<T, null>;
};
/**
* @internal
*/
declare const expectUndefined: unique symbol;
export type ExpectUndefined<T> = {
[expectUndefined]: T;
result: ExtendsExcludingAnyOrNever<T, undefined>;
};
/**
* @internal
*/
declare const expectNumber: unique symbol;
export type ExpectNumber<T> = {
[expectNumber]: T;
result: ExtendsExcludingAnyOrNever<T, number>;
};
/**
* @internal
*/
declare const expectString: unique symbol;
export type ExpectString<T> = {
[expectString]: T;
result: ExtendsExcludingAnyOrNever<T, string>;
};
/**
* @internal
*/
declare const expectBoolean: unique symbol;
export type ExpectBoolean<T> = {
[expectBoolean]: T;
result: ExtendsExcludingAnyOrNever<T, boolean>;
};
/**
* @internal
*/
declare const expectVoid: unique symbol;
export type ExpectVoid<T> = {
[expectVoid]: T;
result: ExtendsExcludingAnyOrNever<T, void>;
};
/**
* @internal
*/
declare const expectFunction: unique symbol;
export type ExpectFunction<T> = {
[expectFunction]: T;
result: ExtendsExcludingAnyOrNever<T, (...args: any[]) => any>;
};
/**
* @internal
*/
declare const expectObject: unique symbol;
export type ExpectObject<T> = {
[expectObject]: T;
result: ExtendsExcludingAnyOrNever<T, object>;
};
/**
* @internal
*/
declare const expectArray: unique symbol;
export type ExpectArray<T> = {
[expectArray]: T;
result: ExtendsExcludingAnyOrNever<T, any[]>;
};
/**
* @internal
*/
declare const expectSymbol: unique symbol;
export type ExpectSymbol<T> = {
[expectSymbol]: T;
result: ExtendsExcludingAnyOrNever<T, symbol>;
};
/**
* @internal
*/
declare const expectAny: unique symbol;
export type ExpectAny<T> = {
[expectAny]: T;
result: IsAny<T>;
};
/**
* @internal
*/
declare const expectUnknown: unique symbol;
export type ExpectUnknown<T> = {
[expectUnknown]: T;
result: IsUnknown<T>;
};
/**
* @internal
*/
declare const expectNever: unique symbol;
export type ExpectNever<T> = {
[expectNever]: T;
result: IsNever<T>;
};
/**
* @internal
*/
declare const expectNullable: unique symbol;
export type ExpectNullable<T> = {
[expectNullable]: T;
result: Not<StrictEqualUsingBranding<T, NonNullable<T>>>;
};
/**
* @internal
*/
declare const expectBigInt: unique symbol;
export type ExpectBigInt<T> = {
[expectBigInt]: T;
result: ExtendsExcludingAnyOrNever<T, bigint>;
};
/**
* Checks if the result of an expecter matches the specified options, and
* resolves to a fairly readable error message if not.
*/
export type Scolder<Expecter extends {
result: boolean;
}, Options extends {
positive: boolean;
}> = Expecter['result'] extends Options['positive'] ? () => true : Options['positive'] extends true ? Expecter : Inverted<Expecter>;
export {};
@@ -0,0 +1,2 @@
'use strict';
require('../register')('native-promise-only', {Promise: require('native-promise-only')})
@@ -0,0 +1,56 @@
import type {
CodeKeywordDefinition,
ErrorObject,
KeywordErrorDefinition,
AnySchema,
} from "../../types"
import type {KeywordCxt} from "../../compile/validate"
import {_, str, not, Name} from "../../compile/codegen"
import {alwaysValidSchema, checkStrictMode, Type} from "../../compile/util"
export type AdditionalItemsError = ErrorObject<"additionalItems", {limit: number}, AnySchema>
const error: KeywordErrorDefinition = {
message: ({params: {len}}) => str`must NOT have more than ${len} items`,
params: ({params: {len}}) => _`{limit: ${len}}`,
}
const def: CodeKeywordDefinition = {
keyword: "additionalItems" as const,
type: "array",
schemaType: ["boolean", "object"],
before: "uniqueItems",
error,
code(cxt: KeywordCxt) {
const {parentSchema, it} = cxt
const {items} = parentSchema
if (!Array.isArray(items)) {
checkStrictMode(it, '"additionalItems" is ignored when "items" is not an array of schemas')
return
}
validateAdditionalItems(cxt, items)
},
}
export function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void {
const {gen, schema, data, keyword, it} = cxt
it.items = true
const len = gen.const("len", _`${data}.length`)
if (schema === false) {
cxt.setParams({len: items.length})
cxt.pass(_`${len} <= ${items.length}`)
} else if (typeof schema == "object" && !alwaysValidSchema(it, schema)) {
const valid = gen.var("valid", _`${len} <= ${items.length}`) // TODO var
gen.if(not(valid), () => validateItems(valid))
cxt.ok(valid)
}
function validateItems(valid: Name): void {
gen.forRange("i", items.length, len, (i) => {
cxt.subschema({keyword, dataProp: i, dataPropType: Type.Num}, valid)
if (!it.allErrors) gen.if(not(valid), () => gen.break())
})
}
}
export default def
@@ -0,0 +1 @@
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/compile/errors.ts"],"names":[],"mappings":";;;AAEA,uCAAgE;AAEhE,iCAAyC;AACzC,mCAAuB;AAEV,QAAA,YAAY,GAA2B;IAClD,OAAO,EAAE,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AE,SAAS,CAAC,CAAA;IACtC,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CAAA;AACjC,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAC,SAAS,EAAY,EAAE,EAAC,YAAY,EAAa;IAC3E,MAAM,QAAQ,GAAG,YAAY;QAC3B,CAAC,CAAC,IAAA,aAAG,EAAA,GAAG,SAAS,GAAG,IAAA,mBAAY,EAAC,YAAY,EAAE,WAAI,CAAC,GAAG,CAAC,EAAE;QAC1D,CAAC,CAAC,SAAS,CAAA;IACb,OAAO,CAAC,eAAC,CAAC,YAAY,EAAE,IAAA,mBAAS,EAAC,eAAC,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC9D,CAAC;AAED,SAAS,eAAe,CACtB,EAAC,OAAO,EAAE,EAAE,EAAE,EAAC,aAAa,EAAC,EAAkB,EAC/C,EAAC,UAAU,EAAE,YAAY,EAAa;IAEtC,IAAI,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAA,aAAG,EAAA,GAAG,aAAa,IAAI,OAAO,EAAE,CAAA;IAC7E,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,GAAG,IAAA,aAAG,Line truncated
@@ -0,0 +1,642 @@
import { M as ModuleDefinitionDurationsDiagnostic, U as UntrackedModuleDefinitionDiagnostic, S as SerializedTestSpecification, a as ModuleDefinitionDiagnostic, b as ModuleDefinitionLocation, c as SourceModuleDiagnostic, d as SourceModuleLocations } from './chunks/browser.d.BcoexmFG.js';
export { B as BrowserTesterOptions } from './chunks/browser.d.BcoexmFG.js';
import './chunks/global.d.DVsSRdQ5.js';
import { File, TestAnnotation, TestArtifact, TaskResultPack, TaskEventPack, Test, TaskPopulated } from '@vitest/runner';
export { CancelReason, ImportDuration, OnTestFailedHandler, OnTestFinishedHandler, RunMode, Task as RunnerTask, TaskBase as RunnerTaskBase, TaskEventPack as RunnerTaskEventPack, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteOptions, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestAnnotation, TestAnnotationArtifact, TestArtifact, TestArtifactBase, TestArtifactLocation, TestArtifactRegistry, TestAttachment, TestContext, TestFunction, TestOptions, VitestRunnerConfig as TestRunnerConfig, TestTags, VitestRunner as VitestTestRunner, afterAll, afterEach, aroundAll, aroundEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, recordArtifact, suite, test } from '@vitest/runner';
import { Awaitable } from '@vitest/utils';
export { ParsedStack, SerializedError, TestError } from '@vitest/utils';
import { b as BirpcReturn } from './chunks/worker.d.ZpHpO4yb.js';
export { C as ContextRPC, c as ContextTestEnvironment, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.ZpHpO4yb.js';
import { b as SerializedRootConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.A1h_Y6Jt.js';
export { c as RuntimeConfig, S as SerializedConfig, a as SerializedCoverageConfig } from './chunks/config.d.A1h_Y6Jt.js';
import { U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext } from './chunks/traces.d.D2T_R8rx.js';
export { a as AfterSuiteRunMeta } from './chunks/traces.d.D2T_R8rx.js';
import { ExpectStatic, MatcherState, SyncExpectationResult, AsyncExpectationResult, ExpectationResult } from '@vitest/expect';
export { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectPollOptions, ExpectStatic, JestAssertion, RawMatcherFn as Matcher, ExpectationResult as MatcherResult, MatcherState, Matchers, chai } from '@vitest/expect';
import { DomainSnapshotAdapter } from '@vitest/snapshot';
export { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotSerializer, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, UncheckedSnapshot } from '@vitest/snapshot';
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
export { Mock, MockContext, MockInstance, MockResult, MockResultIncomplete, MockResultReturn, MockResultThrow, MockSettledResult, MockSettledResultFulfilled, MockSettledResultIncomplete, MockSettledResultRejected, Mocked, MockedClass, MockedFunction, MockedObject } from '@vitest/spy';
import { Disposable } from 'vitest/optional-runtime-types.js';
import { ModuleMockFactoryWithHelper, ModuleMockOptions } from '@vitest/mocker';
export { b as bench } from './chunks/suite.d.udJtyAgw.js';
export { V as EvaluatedModules } from './chunks/evaluatedModules.d.BxJ5omdx.js';
export { NodeBenchmarkRunner as BenchmarkRunner, VitestTestRunner as TestRunner } from './runners.js';
export { a as BenchFunction, b as Benchmark, c as BenchmarkAPI, B as BenchmarkResult } from './chunks/benchmark.d.DAaHLpsq.js';
export { ExpectTypeOf, expectTypeOf } from 'expect-type';
export { a as RunnerRPC, R as RuntimeRPC } from './chunks/rpc.d.B_8sPU0w.js';
export { DiffOptions } from '@vitest/utils/diff';
export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
import '@vitest/pretty-format';
import 'vite/module-runner';
import './chunks/environment.d.CrsxCzP1.js';
import '@vitest/runner/utils';
interface SourceMap {
file: string;
mappings: string;
names: string[];
sources: string[];
sourcesContent?: string[];
version: number;
toString: () => string;
toUrl: () => string;
}
interface ExternalResult {
source?: string;
}
interface TransformResultWithSource {
code: string;
map: SourceMap | {
mappings: "";
} | null;
etag?: string;
deps?: string[];
dynamicDeps?: string[];
source?: string;
transformTime?: number;
modules?: ModuleDefinitionDurationsDiagnostic[];
untrackedModules?: UntrackedModuleDefinitionDiagnostic[];
}
interface WebSocketHandlers {
getFiles: () => File[];
getTestFiles: () => Promise<SerializedTestSpecification[]>;
getPaths: () => string[];
getConfig: () => SerializedRootConfig;
/**
* @deprecated Use `getConfig().projects` instead.
*/
getResolvedProjectLabels: () => {
name: string;
color?: LabelColor;
}[];
getModuleGraph: (projectName: string, id: string, browser?: boolean) => Promise<ModuleGraphData>;
getTransformResult: (projectName: string, id: string, testFileId: string, browser?: boolean) => Promise<TransformResultWithSource | undefined>;
getExternalResult: (id: string, testFileId: string) => Promise<ExternalResult | undefined>;
readTestFile: (id: string) => Promise<string | null>;
saveTestFile: (id: string, content: string) => Promise<void>;
rerun: (files: string[], resetTestNamePattern?: boolean) => Promise<void>;
rerunTask: (id: string) => Promise<void>;
updateSnapshot: (file?: File) => Promise<void>;
getUnhandledErrors: () => unknown[];
}
interface WebSocketEvents {
onCollected?: (files?: File[]) => Awaitable<void>;
onFinished?: (files: File[], errors: unknown[], coverage?: unknown, executionTime?: number) => Awaitable<void>;
onTestAnnotate?: (testId: string, annotation: TestAnnotation) => Awaitable<void>;
onTestArtifactRecord?: (testId: string, artifact: TestArtifact) => Awaitable<void>;
onTaskUpdate?: (packs: TaskResultPack[], events: TaskEventPack[]) => Awaitable<void>;
onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
onPathsCollected?: (paths?: string[]) => Awaitable<void>;
onSpecsCollected?: (specs?: SerializedTestSpecification[], startTime?: number) => Awaitable<void>;
onFinishedReportCoverage: () => void;
}
type WebSocketRPC = BirpcReturn<WebSocketEvents, WebSocketHandlers>;
declare function createExpect(test?: Test | TaskPopulated): ExpectStatic;
declare const globalExpect: ExpectStatic;
declare const assert: Chai.Assert;
declare const should: () => Chai.Should;
/**
* Gives access to injected context provided from the main thread.
* This usually returns a value provided by `globalSetup` or an external library.
*/
declare function inject<T extends keyof ProvidedContext & string>(key: T): ProvidedContext[T];
/**
* Composable snapshot matcher helpers for building custom snapshot matchers
* with `expect.extend`.
*
* @experimental
* @see https://vitest.dev/guide/snapshot.html#custom-snapshot-matchers
*/
declare const Snapshots: {
/**
* Composable for building custom snapshot matchers via `expect.extend`.
* Call with `this` bound to the matcher state. Returns `{ pass, message }`
* compatible with the custom matcher return contract.
*
* @example
* ```ts
* import { Snapshots } from 'vitest/runtime'
*
* expect.extend({
* toMatchTrimmedSnapshot(received: string) {
* return Snapshots.toMatchSnapshot.call(this, received.slice(0, 10))
* },
* })
* ```
*
* @experimental
* @see https://vitest.dev/guide/snapshot.html#custom-snapshot-matchers
*/
toMatchSnapshot(this: MatcherState, received: unknown, propertiesOrHint?: object | string, hint?: string): SyncExpectationResult;
/**
* Composable for building custom inline snapshot matchers via `expect.extend`.
* Call with `this` bound to the matcher state. Returns `{ pass, message }`
* compatible with the custom matcher return contract.
*
* @example
* ```ts
* import { Snapshots } from 'vitest/runtime'
*
* expect.extend({
* toMatchTrimmedInlineSnapshot(received: string, inlineSnapshot?: string) {
* return Snapshots.toMatchInlineSnapshot.call(this, received.slice(0, 10), inlineSnapshot)
* },
* })
* ```
*
* @experimental
* @see https://vitest.dev/guide/snapshot.html#custom-snapshot-matchers
*/
toMatchInlineSnapshot(this: MatcherState, received: unknown, propertiesOrInlineSnapshot?: object | string, inlineSnapshotOrHint?: string, hint?: string): SyncExpectationResult;
/**
* Composable for building custom file snapshot matchers via `expect.extend`.
* Call with `this` bound to the matcher state. Returns a `Promise<{ pass, message }>`
* compatible with the custom matcher return contract.
*
* @example
* ```ts
* import { Snapshots } from 'vitest/runtime'
*
* expect.extend({
* async toMatchTrimmedFileSnapshot(received: string, file: string) {
* return Snapshots.toMatchFileSnapshot.call(this, received.slice(0, 10), file)
* },
* })
* ```
*
* @experimental
* @see https://vitest.dev/guide/snapshot.html#custom-snapshot-matchers
*/
toMatchFileSnapshot(this: MatcherState, received: unknown, filepath: string, hint?: string): AsyncExpectationResult;
/**
* Composable for building custom domain-based snapshot matchers via `expect.extend`.
*
* Call this from a matcher and pass the domain adapter that defines capture,
* rendering, parsing, and semantic matching behavior.
*
* @experimental
*/
toMatchDomainSnapshot(this: MatcherState, domain: DomainSnapshotAdapter<any, any>, received: unknown): ExpectationResult;
/**
* Composable for building custom domain-based inline snapshot matchers via `expect.extend`.
*
* Call this from a matcher and pass the domain adapter that defines capture,
* rendering, parsing, and semantic matching behavior.
*
* @experimental
*/
toMatchDomainInlineSnapshot(this: MatcherState, domain: DomainSnapshotAdapter<any, any>, received: unknown, inlineSnapshot?: string): ExpectationResult;
};
type WaitForCallback<T> = () => T | Promise<T>;
interface WaitForOptions {
/**
* @description Time in ms between each check callback
* @default 50ms
*/
interval?: number;
/**
* @description Time in ms after which the throw a timeout error
* @default 1000ms
*/
timeout?: number;
}
declare function waitFor<T>(callback: WaitForCallback<T>, options?: number | WaitForOptions): Promise<T>;
type WaitUntilCallback<T> = () => T | Promise<T>;
interface WaitUntilOptions extends Pick<WaitForOptions, "interval" | "timeout"> {}
type Truthy<T> = T extends false | "" | 0 | null | undefined ? never : T;
declare function waitUntil<T>(callback: WaitUntilCallback<T>, options?: number | WaitUntilOptions): Promise<Truthy<T>>;
type ESModuleExports = Record<string, unknown>;
interface VitestUtils {
/**
* Checks if fake timers are enabled.
*/
isFakeTimers: () => boolean;
/**
* This method wraps all further calls to timers until [`vi.useRealTimers()`](https://vitest.dev/api/vi#vi-userealtimers) is called.
*/
useFakeTimers: (config?: FakeTimerInstallOpts) => VitestUtils;
/**
* Restores mocked timers to their original implementations. All timers that were scheduled before will be discarded.
*/
useRealTimers: () => VitestUtils;
/**
* This method will call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call.
* It will not fire any timer that was initiated during its call.
*/
runOnlyPendingTimers: () => VitestUtils;
/**
* This method will asynchronously call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call, even asynchronous ones.
* It will not fire any timer that was initiated during its call.
*/
runOnlyPendingTimersAsync: () => Promise<VitestUtils>;
/**
* This method will invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimers` will be fired.
* If you have an infinite interval, it will throw after 10,000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/faketimers#faketimers-looplimit)).
*/
runAllTimers: () => VitestUtils;
/**
* This method will asynchronously invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimersAsync` will be fired even asynchronous timers.
* If you have an infinite interval, it will throw after 10 000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/faketimers#faketimers-looplimit)).
*/
runAllTimersAsync: () => Promise<VitestUtils>;
/**
* Calls every microtask that was queued by `process.nextTick`. This will also run all microtasks scheduled by themselves.
*/
runAllTicks: () => VitestUtils;
/**
* This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first.
*/
advanceTimersByTime: (ms: number) => VitestUtils;
/**
* This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first. This will include and await asynchronously set timers.
*/
advanceTimersByTimeAsync: (ms: number) => Promise<VitestUtils>;
/**
* Will call next available timer. Useful to make assertions between each timer call. You can chain call it to manage timers by yourself.
*/
advanceTimersToNextTimer: () => VitestUtils;
/**
* Will call next available timer and wait until it's resolved if it was set asynchronously. Useful to make assertions between each timer call.
*/
advanceTimersToNextTimerAsync: () => Promise<VitestUtils>;
/**
* Similar to [`vi.advanceTimersByTime`](https://vitest.dev/api/vi#vi-advancetimersbytime), but will advance timers by the milliseconds needed to execute callbacks currently scheduled with `requestAnimationFrame`.
*/
advanceTimersToNextFrame: () => VitestUtils;
/**
* Get the number of waiting timers.
*/
getTimerCount: () => number;
/**
* If fake timers are enabled, this method simulates a user changing the system clock (will affect date related API like `hrtime`, `performance.now` or `new Date()`) - however, it will not fire any timers.
* If fake timers are not enabled, this method will only mock `Date.*` and `new Date()` calls.
*/
setSystemTime: (time: number | string | Date) => VitestUtils;
/**
* Returns mocked current date. If date is not mocked the method will return `null`.
*/
getMockedSystemTime: () => Date | null;
/**
* When using `vi.useFakeTimers`, `Date.now` calls are mocked. If you need to get real time in milliseconds, you can call this function.
*/
getRealSystemTime: () => number;
/**
* Removes all timers that are scheduled to run. These timers will never run in the future.
*/
clearAllTimers: () => VitestUtils;
/**
* Controls how fake timers are advanced.
* @param mode The mode to use for advancing timers.
* - `manual`: The default behavior. Timers will only advance when you call one of `vi.advanceTimers...()` methods.
* - `nextTimerAsync`: Timers will be advanced automatically to the next available timer after each macrotask.
* - `interval`: Timers are advanced automatically by a specified interval.
* @param interval The interval in milliseconds to use when `mode` is `'interval'`.
*/
setTimerTickMode: ((mode: "manual" | "nextTimerAsync") => VitestUtils) & ((mode: "interval", interval?: number) => VitestUtils);
/**
* Creates a spy on a method or getter/setter of an object similar to [`vi.fn()`](https://vitest.dev/api/vi#vi-fn). It returns a [mock function](https://vitest.dev/api/mock).
* @example
* ```ts
* const cart = {
* getApples: () => 42
* }
*
* const spy = vi.spyOn(cart, 'getApples').mockReturnValue(10)
*
* expect(cart.getApples()).toBe(10)
* expect(spy).toHaveBeenCalled()
* expect(spy).toHaveReturnedWith(10)
* ```
*/
spyOn: typeof spyOn;
/**
* Creates a spy on a function, though can be initiated without one. Every time a function is invoked, it stores its call arguments, returns, and instances. Also, you can manipulate its behavior with [methods](https://vitest.dev/api/mock).
*
* If no function is given, mock will return `undefined`, when invoked.
* @example
* ```ts
* const getApples = vi.fn(() => 0)
*
* getApples()
*
* expect(getApples).toHaveBeenCalled()
* expect(getApples).toHaveReturnedWith(0)
*
* getApples.mockReturnValueOnce(5)
*
* expect(getApples()).toBe(5)
* expect(getApples).toHaveNthReturnedWith(2, 5)
* ```
*/
fn: typeof fn;
/**
* Wait for the callback to execute successfully. If the callback throws an error or returns a rejected promise it will continue to wait until it succeeds or times out.
*
* This is very useful when you need to wait for some asynchronous action to complete, for example, when you start a server and need to wait for it to start.
* @example
* ```ts
* const server = createServer()
*
* await vi.waitFor(
* () => {
* if (!server.isReady)
* throw new Error('Server not started')
*
* console.log('Server started')
* }, {
* timeout: 500, // default is 1000
* interval: 20, // default is 50
* }
* )
* ```
*/
waitFor: typeof waitFor;
/**
* Wraps a function to create an assertion helper. When an assertion fails inside the helper,
* the error stack trace will point to where the helper was called, not inside the helper itself.
* Works with both synchronous and asynchronous functions, and supports `expect.soft()`.
*
* @example
* ```ts
* const myEqual = vi.defineHelper((x, y) => {
* expect(x).toEqual(y)
* })
*
* test('example', () => {
* myEqual('left', 'right') // Error points to this line
* })
* ```
* Example output:
* ```
* FAIL example.test.ts > example
* AssertionError: expected 'left' to deeply equal 'right'
*
* Expected: "right"
* Received: "left"
*
* ❯ example.test.ts:6:3
* 4| test('example', () => {
* 5| myEqual('left', 'right')
* | ^
* 6| })
* ```
* @param fn The assertion function to wrap
* @returns A wrapped function with the same signature
*/
defineHelper: <F extends (...args: any) => any>(fn: F) => F;
/**
* This is similar to [`vi.waitFor`](https://vitest.dev/api/vi#vi-waitfor), but if the callback throws any errors, execution is immediately interrupted and an error message is received.
*
* If the callback returns a falsy value, the next check will continue until a truthy value is returned. This is useful when you need to wait for something to exist before taking the next step.
* @example
* ```ts
* const element = await vi.waitUntil(
* () => document.querySelector('.element'),
* {
* timeout: 500, // default is 1000
* interval: 20, // default is 50
* }
* )
*
* // do something with the element
* expect(element.querySelector('.element-child')).toBeTruthy()
* ```
*/
waitUntil: typeof waitUntil;
/**
* Run the factory before imports are evaluated. You can return a value from the factory
* to reuse it inside your [`vi.mock`](https://vitest.dev/api/vi#vi-mock) factory and tests.
*
* If used with [`vi.mock`](https://vitest.dev/api/vi#vi-mock), both will be hoisted in the order they are defined in.
*/
hoisted: <T>(factory: () => T) => T;
/**
* Mocks every import call to the module even if it was already statically imported.
*
* The call to `vi.mock` is hoisted to the top of the file, so you don't have access to variables declared in the global file scope
* unless they are defined with [`vi.hoisted`](https://vitest.dev/api/vi#vi-hoisted) before this call.
*
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking/modules).
* @param path Path to the module. Can be aliased, if your Vitest config supports it
* @param factory Mocked module factory. The result of this function will be an exports object
*/
mock(path: string, factory?: ModuleMockFactoryWithHelper | ModuleMockOptions): void;
mock<T>(module: Promise<T>, factory?: ModuleMockFactoryWithHelper<T> | ModuleMockOptions): void;
/**
* Removes module from mocked registry. All calls to import will return the original module even if it was mocked before.
*
* This call is hoisted to the top of the file, so it will only unmock modules that were defined in `setupFiles`, for example.
* @param path Path to the module. Can be aliased, if your Vitest config supports it
*/
unmock(path: string): void;
unmock(module: Promise<unknown>): void;
/**
* Mocks every subsequent [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) call.
*
* Unlike [`vi.mock`](https://vitest.dev/api/vi#vi-mock), this method will not mock statically imported modules because it is not hoisted to the top of the file.
*
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking/modules).
* @param path Path to the module. Can be aliased, if your Vitest config supports it
* @param factory Mocked module factory. The result of this function will be an exports object
*
* @returns A disposable object that calls {@link doUnmock()} when disposed
*/
doMock(path: string, factory?: ModuleMockFactoryWithHelper | ModuleMockOptions): Disposable;
doMock<T>(module: Promise<T>, factory?: ModuleMockFactoryWithHelper<T> | ModuleMockOptions): Disposable;
/**
* Removes module from mocked registry. All subsequent calls to import will return original module.
*
* Unlike [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock), this method is not hoisted to the top of the file.
* @param path Path to the module. Can be aliased, if your Vitest config supports it
*/
doUnmock(path: string): void;
doUnmock(module: Promise<unknown>): void;
/**
* Imports module, bypassing all checks if it should be mocked.
* Can be useful if you want to mock module partially.
* @example
* ```ts
* vi.mock('./example.js', async () => {
* const axios = await vi.importActual<typeof import('./example.js')>('./example.js')
*
* return { ...axios, get: vi.fn() }
* })
* ```
* @param path Path to the module. Can be aliased, if your config supports it
*/
importActual: <T = ESModuleExports>(path: string) => Promise<T>;
/**
* Imports a module with all of its properties and nested properties mocked.
*
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking/modules).
* @example
* ```ts
* const example = await vi.importMock<typeof import('./example.js')>('./example.js')
* example.calc.mockReturnValue(10)
* expect(example.calc()).toBe(10)
* ```
* @param path Path to the module. Can be aliased, if your config supports it
* @returns Fully mocked module
*/
importMock: <T = ESModuleExports>(path: string) => Promise<MaybeMockedDeep<T>>;
/**
* Deeply mocks properties and methods of a given object
* in the same way as `vi.mock()` mocks module exports.
*
* @example
* ```ts
* const original = {
* simple: () => 'value',
* nested: {
* method: () => 'real'
* },
* prop: 'foo',
* }
*
* const mocked = vi.mockObject(original)
* expect(mocked.simple()).toBe(undefined)
* expect(mocked.nested.method()).toBe(undefined)
* expect(mocked.prop).toBe('foo')
*
* mocked.simple.mockReturnValue('mocked')
* mocked.nested.method.mockReturnValue('mocked nested')
*
* expect(mocked.simple()).toBe('mocked')
* expect(mocked.nested.method()).toBe('mocked nested')
*
* const spied = vi.mockObject(original, { spy: true })
* expect(spied.simple()).toBe('value')
* expect(spied.simple).toHaveBeenCalled()
* expect(spied.simple.mock.results[0]).toEqual({ type: 'return', value: 'value' })
* ```
*
* @param value - The object to be mocked
* @returns A deeply mocked version of the input object
*/
mockObject: <T>(value: T, options?: ModuleMockOptions) => MaybeMockedDeep<T>;
/**
* Type helper for TypeScript. Just returns the object that was passed.
*
* When `partial` is `true` it will expect a `Partial<T>` as a return value. By default, this will only make TypeScript believe that
* the first level values are mocked. You can pass down `{ partial: true, deep: true }` to make nested objects also partial recursively.
* @example
* ```ts
* import example from './example.js'
* vi.mock('./example.js')
*
* test('1 + 1 equals 10' async () => {
* vi.mocked(example.calc).mockReturnValue(10)
* expect(example.calc(1, '+', 1)).toBe(10)
* })
* ```
* @param item Anything that can be mocked
* @param deep If the object is deeply mocked
* @param options If the object is partially or deeply mocked
*/
mocked: (<T>(item: T, deep?: false) => MaybeMocked<T>) & (<T>(item: T, deep: true) => MaybeMockedDeep<T>) & (<T>(item: T, options: {
partial?: false;
deep?: false;
}) => MaybeMocked<T>) & (<T>(item: T, options: {
partial?: false;
deep: true;
}) => MaybeMockedDeep<T>) & (<T>(item: T, options: {
partial: true;
deep?: false;
}) => MaybePartiallyMocked<T>) & (<T>(item: T, options: {
partial: true;
deep: true;
}) => MaybePartiallyMockedDeep<T>) & (<T>(item: T) => MaybeMocked<T>);
/**
* Checks that a given parameter is a mock function. If you are using TypeScript, it will also narrow down its type.
*/
isMockFunction: (fn: any) => fn is MockInstance;
/**
* Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function.
*
* This will only empty `.mock` state, it will not affect mock implementations.
*
* This is useful if you need to clean up mocks between different assertions within a test.
*/
clearAllMocks: () => VitestUtils;
/**
* Calls [`.mockReset()`](https://vitest.dev/api/mock#mockreset) on every mocked function.
*
* This will empty `.mock` state, reset "once" implementations, and reset each mock's base implementation to its original.
*
* This is useful when you want to reset all mocks to their original states.
*/
resetAllMocks: () => VitestUtils;
/**
* Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function.
*
* This will empty `.mock` state, restore all original mock implementations, and restore original descriptors of spied-on objects.
*
* This is useful for inter-test cleanup and/or removing mocks created by [`vi.spyOn(...)`](https://vitest.dev/api/vi#vi-spyon).
*/
restoreAllMocks: () => VitestUtils;
/**
* Makes value available on global namespace.
* Useful, if you want to have global variables available, like `IntersectionObserver`.
* You can return it back to original value with `vi.unstubAllGlobals`, or by enabling `unstubGlobals` config option.
*/
stubGlobal: (name: string | symbol | number, value: unknown) => VitestUtils;
/**
* Changes the value of `import.meta.env` and `process.env`.
* You can return it back to original value with `vi.unstubAllEnvs`, or by enabling `unstubEnvs` config option.
*/
stubEnv: <T extends string>(name: T, value: T extends "PROD" | "DEV" | "SSR" ? boolean : string | undefined) => VitestUtils;
/**
* Reset the value to original value that was available before first `vi.stubGlobal` was called.
*/
unstubAllGlobals: () => VitestUtils;
/**
* Reset environmental variables to the ones that were available before first `vi.stubEnv` was called.
*/
unstubAllEnvs: () => VitestUtils;
/**
* Resets modules registry by clearing the cache of all modules. This allows modules to be reevaluated when reimported.
* Top-level imports cannot be re-evaluated. Might be useful to isolate modules where local state conflicts between tests.
*
* This method does not reset mocks registry. To clear mocks registry, use [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock) or [`vi.doUnmock`](https://vitest.dev/api/vi#vi-dounmock).
*/
resetModules: () => VitestUtils;
/**
* Wait for all imports to load. Useful, if you have a synchronous call that starts
* importing a module that you cannot await otherwise.
* Will also wait for new imports, started during the wait.
*/
dynamicImportSettled: () => Promise<void>;
/**
* Updates runtime config. You can only change values that are used when executing tests.
*/
setConfig: (config: RuntimeOptions) => void;
/**
* If config was changed with `vi.setConfig`, this will reset it to the original state().
*/
resetConfig: () => void;
}
declare const vitest: VitestUtils;
declare const vi: VitestUtils;
interface AssertType {
<T>(value: T): void;
}
declare const assertType: AssertType;
interface BrowserUI {
setCurrentFileId: (fileId: string) => void;
setIframeViewport: (width: number, height: number) => Promise<void>;
}
declare namespace Experimental {
export { ModuleDefinitionDiagnostic, ModuleDefinitionDurationsDiagnostic, ModuleDefinitionLocation, SourceModuleDiagnostic, SourceModuleLocations, UntrackedModuleDefinitionDiagnostic };
}
export { Experimental, LabelColor, ModuleGraphData, ProvidedContext, SerializedRootConfig, SerializedTestSpecification, Snapshots, UserConsoleLog, assert, assertType, createExpect, globalExpect as expect, inject, should, vi, vitest };
export type { AssertType, BrowserUI, ExternalResult, TransformResultWithSource, VitestUtils, WebSocketEvents, WebSocketHandlers, WebSocketRPC };
@@ -0,0 +1,891 @@
// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet.
// but the path reservations are required to avoid race conditions where
// parallelized unpack ops may mess with one another, due to dependencies
// (like a Link depending on its target) or destructive operations (like
// clobbering an fs object to create one of a different type.)
import * as fsm from '@isaacs/fs-minipass';
import assert from 'node:assert';
import { randomBytes } from 'node:crypto';
import fs from 'node:fs';
import path from 'node:path';
import { getWriteFlag } from './get-write-flag.js';
import { mkdir, mkdirSync } from './mkdir.js';
import { normalizeWindowsPath } from './normalize-windows-path.js';
import { Parser } from './parse.js';
import { stripAbsolutePath } from './strip-absolute-path.js';
import * as wc from './winchars.js';
import { PathReservations } from './path-reservations.js';
import { SymlinkError } from './symlink-error.js';
import { umask } from './process-umask.js';
const ONENTRY = Symbol('onEntry');
const CHECKFS = Symbol('checkFs');
const CHECKFS2 = Symbol('checkFs2');
const ISREUSABLE = Symbol('isReusable');
const MAKEFS = Symbol('makeFs');
const FILE = Symbol('file');
const DIRECTORY = Symbol('directory');
const LINK = Symbol('link');
const SYMLINK = Symbol('symlink');
const HARDLINK = Symbol('hardlink');
const ENSURE_NO_SYMLINK = Symbol('ensureNoSymlink');
const UNSUPPORTED = Symbol('unsupported');
const CHECKPATH = Symbol('checkPath');
const STRIPABSOLUTEPATH = Symbol('stripAbsolutePath');
const MKDIR = Symbol('mkdir');
const ONERROR = Symbol('onError');
const PENDING = Symbol('pending');
const PEND = Symbol('pend');
const UNPEND = Symbol('unpend');
const ENDED = Symbol('ended');
const MAYBECLOSE = Symbol('maybeClose');
const SKIP = Symbol('skip');
const DOCHOWN = Symbol('doChown');
const UID = Symbol('uid');
const GID = Symbol('gid');
const CHECKED_CWD = Symbol('checkedCwd');
const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
const isWindows = platform === 'win32';
const DEFAULT_MAX_DEPTH = 1024;
// Unlinks on Windows are not atomic.
//
// This means that if you have a file entry, followed by another
// file entry with an identical name, and you cannot re-use the file
// (because it's a hardlink, or because unlink:true is set, or it's
// Windows, which does not have useful nlink values), then the unlink
// will be committed to the disk AFTER the new file has been written
// over the old one, deleting the new file.
//
// To work around this, on Windows systems, we rename the file and then
// delete the renamed file. It's a sloppy kludge, but frankly, I do not
// know of a better way to do this, given windows' non-atomic unlink
// semantics.
//
// See: https://github.com/npm/node-tar/issues/183
/* c8 ignore start */
const unlinkFile = (path, cb) => {
if (!isWindows) {
return fs.unlink(path, cb);
}
const name = path + '.DELETE.' + randomBytes(16).toString('hex');
fs.rename(path, name, er => {
if (er) {
return cb(er);
}
fs.unlink(name, cb);
});
};
/* c8 ignore stop */
/* c8 ignore start */
const unlinkFileSync = (path) => {
if (!isWindows) {
return fs.unlinkSync(path);
}
const name = path + '.DELETE.' + randomBytes(16).toString('hex');
fs.renameSync(path, name);
fs.unlinkSync(name);
};
/* c8 ignore stop */
// this.gid, entry.gid, this.processUid
const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a
: b !== undefined && b === b >>> 0 ? b
: c;
export class Unpack extends Parser {
[ENDED] = false;
[CHECKED_CWD] = false;
[PENDING] = 0;
reservations = new PathReservations();
transform;
writable = true;
readable = false;
uid;
gid;
setOwner;
preserveOwner;
processGid;
processUid;
maxDepth;
forceChown;
win32;
newer;
keep;
noMtime;
preservePaths;
unlink;
cwd;
strip;
processUmask;
umask;
dmode;
fmode;
chmod;
constructor(opt = {}) {
opt.ondone = () => {
this[ENDED] = true;
this[MAYBECLOSE]();
};
super(opt);
this.transform = opt.transform;
this.chmod = !!opt.chmod;
if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {
// need both or neither
if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number') {
throw new TypeError('cannot set owner without number uid and gid');
}
if (opt.preserveOwner) {
throw new TypeError('cannot preserve owner in archive and also set owner explicitly');
}
this.uid = opt.uid;
this.gid = opt.gid;
this.setOwner = true;
}
else {
this.uid = undefined;
this.gid = undefined;
this.setOwner = false;
}
// default true for root
this.preserveOwner =
opt.preserveOwner === undefined && typeof opt.uid !== 'number' ?
!!(process.getuid?.() === 0)
: !!opt.preserveOwner;
this.processUid =
(this.preserveOwner || this.setOwner) && process.getuid ?
process.getuid()
: undefined;
this.processGid =
(this.preserveOwner || this.setOwner) && process.getgid ?
process.getgid()
: undefined;
// prevent excessively deep nesting of subfolders
// set to `Infinity` to remove this restriction
this.maxDepth =
typeof opt.maxDepth === 'number' ? opt.maxDepth : DEFAULT_MAX_DEPTH;
// mostly just for testing, but useful in some cases.
// Forcibly trigger a chown on every entry, no matter what
this.forceChown = opt.forceChown === true;
// turn ><?| in filenames into 0xf000-higher encoded forms
this.win32 = !!opt.win32 || isWindows;
// do not unpack over files that are newer than what's in the archive
this.newer = !!opt.newer;
// do not unpack over ANY files
this.keep = !!opt.keep;
// do not set mtime/atime of extracted entries
this.noMtime = !!opt.noMtime;
// allow .., absolute path entries, and unpacking through symlinks
// without this, warn and skip .., relativize absolutes, and error
// on symlinks in extraction path
this.preservePaths = !!opt.preservePaths;
// unlink files and links before writing. This breaks existing hard
// links, and removes symlink directories rather than erroring
this.unlink = !!opt.unlink;
this.cwd = normalizeWindowsPath(path.resolve(opt.cwd || process.cwd()));
this.strip = Number(opt.strip) || 0;
// if we're not chmodding, then we don't need the process umask
this.processUmask =
!this.chmod ? 0
: typeof opt.processUmask === 'number' ? opt.processUmask
: umask();
this.umask =
typeof opt.umask === 'number' ? opt.umask : this.processUmask;
// default mode for dirs created as parents
this.dmode = opt.dmode || 0o0777 & ~this.umask;
this.fmode = opt.fmode || 0o0666 & ~this.umask;
this.on('entry', entry => this[ONENTRY](entry));
}
// a bad or damaged archive is a warning for Parser, but an error
// when extracting. Mark those errors as unrecoverable, because
// the Unpack contract cannot be met.
warn(code, msg, data = {}) {
if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') {
data.recoverable = false;
}
return super.warn(code, msg, data);
}
[MAYBECLOSE]() {
if (this[ENDED] && this[PENDING] === 0) {
this.emit('prefinish');
this.emit('finish');
this.emit('end');
}
}
// return false if we need to skip this file
// return true if the field was successfully sanitized
[STRIPABSOLUTEPATH](entry, field) {
const p = entry[field];
const { type } = entry;
if (!p || this.preservePaths)
return true;
// strip off the root
const [root, stripped] = stripAbsolutePath(p);
const parts = stripped.replaceAll(/\\/g, '/').split('/');
if (parts.includes('..') ||
/* c8 ignore next */
(isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) {
// For linkpath, check if the resolved path escapes cwd rather than
// just rejecting any path with '..' - relative symlinks like
// '../sibling/file' are valid if they resolve within the cwd.
// For paths, they just simply may not ever use .. at all.
if (field === 'path' || type === 'Link') {
this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, {
entry,
[field]: p,
});
// not ok!
return false;
}
// Resolve linkpath relative to the entry's directory.
// `path.posix` is safe to use because we're operating on
// tar paths, not a filesystem.
const entryDir = path.posix.dirname(entry.path);
const resolved = path.posix.normalize(path.posix.join(entryDir, parts.join('/')));
// If the resolved path escapes (starts with ..), reject it
if (resolved.startsWith('../') || resolved === '..') {
this.warn('TAR_ENTRY_ERROR', `${field} escapes extraction directory`, {
entry,
[field]: p,
});
return false;
}
}
if (root) {
// ok, but triggers warning about stripping root
entry[field] = String(stripped);
this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute ${field}`, {
entry,
[field]: p,
});
}
return true;
}
// no IO, just string checking for absolute indicators
[CHECKPATH](entry) {
const p = normalizeWindowsPath(entry.path);
const parts = p.split('/');
if (this.strip) {
if (parts.length < this.strip) {
return false;
}
if (entry.type === 'Link') {
const linkparts = normalizeWindowsPath(String(entry.linkpath)).split('/');
if (linkparts.length >= this.strip) {
entry.linkpath = linkparts.slice(this.strip).join('/');
}
else {
return false;
}
}
parts.splice(0, this.strip);
entry.path = parts.join('/');
}
if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {
this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {
entry,
path: p,
depth: parts.length,
maxDepth: this.maxDepth,
});
return false;
}
if (!this[STRIPABSOLUTEPATH](entry, 'path') ||
!this[STRIPABSOLUTEPATH](entry, 'linkpath')) {
return false;
}
entry.absolute =
path.isAbsolute(entry.path) ?
normalizeWindowsPath(path.resolve(entry.path))
: normalizeWindowsPath(path.resolve(this.cwd, entry.path));
// if we somehow ended up with a path that escapes the cwd, and we are
// not in preservePaths mode, then something is fishy! This should have
// been prevented above, so ignore this for coverage.
/* c8 ignore start - defense in depth */
if (!this.preservePaths &&
typeof entry.absolute === 'string' &&
entry.absolute.indexOf(this.cwd + '/') !== 0 &&
entry.absolute !== this.cwd) {
this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {
entry,
path: normalizeWindowsPath(entry.path),
resolvedPath: entry.absolute,
cwd: this.cwd,
});
return false;
}
/* c8 ignore stop */
// an archive can set properties on the extraction directory, but it
// may not replace the cwd with a different kind of thing entirely.
if (entry.absolute === this.cwd &&
entry.type !== 'Directory' &&
entry.type !== 'GNUDumpDir') {
return false;
}
// only encode : chars that aren't drive letter indicators
if (this.win32) {
const { root: aRoot } = path.win32.parse(String(entry.absolute));
entry.absolute =
aRoot + wc.encode(String(entry.absolute).slice(aRoot.length));
const { root: pRoot } = path.win32.parse(entry.path);
entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length));
}
return true;
}
[ONENTRY](entry) {
if (!this[CHECKPATH](entry)) {
return entry.resume();
}
assert.equal(typeof entry.absolute, 'string');
switch (entry.type) {
case 'Directory':
case 'GNUDumpDir':
if (entry.mode) {
entry.mode = entry.mode | 0o700;
}
// eslint-disable-next-line no-fallthrough
case 'File':
case 'OldFile':
case 'ContiguousFile':
case 'Link':
case 'SymbolicLink':
return this[CHECKFS](entry);
case 'CharacterDevice':
case 'BlockDevice':
case 'FIFO':
default:
return this[UNSUPPORTED](entry);
}
}
[ONERROR](er, entry) {
// Cwd has to exist, or else nothing works. That's serious.
// Other errors are warnings, which raise the error in strict
// mode, but otherwise continue on.
if (er.name === 'CwdError') {
this.emit('error', er);
}
else {
this.warn('TAR_ENTRY_ERROR', er, { entry });
this[UNPEND]();
entry.resume();
}
}
[MKDIR](dir, mode, cb) {
void mkdir(normalizeWindowsPath(dir), {
uid: this.uid,
gid: this.gid,
processUid: this.processUid,
processGid: this.processGid,
umask: this.processUmask,
preserve: this.preservePaths,
unlink: this.unlink,
cwd: this.cwd,
mode: mode,
}, cb);
}
[DOCHOWN](entry) {
// in preserve owner mode, chown if the entry doesn't match process
// in set owner mode, chown if setting doesn't match process
return (this.forceChown ||
(this.preserveOwner &&
((typeof entry.uid === 'number' &&
entry.uid !== this.processUid) ||
(typeof entry.gid === 'number' &&
entry.gid !== this.processGid))) ||
(typeof this.uid === 'number' && this.uid !== this.processUid) ||
(typeof this.gid === 'number' && this.gid !== this.processGid));
}
[UID](entry) {
return uint32(this.uid, entry.uid, this.processUid);
}
[GID](entry) {
return uint32(this.gid, entry.gid, this.processGid);
}
[FILE](entry, fullyDone) {
const mode = typeof entry.mode === 'number' ? entry.mode & 0o7777 : this.fmode;
const stream = new fsm.WriteStream(String(entry.absolute), {
// slight lie, but it can be numeric flags
flags: getWriteFlag(entry.size),
mode: mode,
autoClose: false,
});
stream.on('error', (er) => {
if (stream.fd) {
fs.close(stream.fd, () => { });
}
// flush all the data out so that we aren't left hanging
// if the error wasn't actually fatal. otherwise the parse
// is blocked, and we never proceed.
stream.write = () => true;
this[ONERROR](er, entry);
fullyDone();
});
let actions = 1;
const done = (er) => {
if (er) {
/* c8 ignore start - we should always have a fd by now */
if (stream.fd) {
fs.close(stream.fd, () => { });
}
/* c8 ignore stop */
this[ONERROR](er, entry);
fullyDone();
return;
}
if (--actions === 0) {
if (stream.fd !== undefined) {
fs.close(stream.fd, er => {
if (er) {
this[ONERROR](er, entry);
}
else {
this[UNPEND]();
}
fullyDone();
});
}
}
};
stream.on('finish', () => {
// if futimes fails, try utimes
// if utimes fails, fail with the original error
// same for fchown/chown
const abs = String(entry.absolute);
const fd = stream.fd;
if (typeof fd === 'number' && entry.mtime && !this.noMtime) {
actions++;
const atime = entry.atime || new Date();
const mtime = entry.mtime;
fs.futimes(fd, atime, mtime, er => er ?
fs.utimes(abs, atime, mtime, er2 => done(er2 && er))
: done());
}
if (typeof fd === 'number' && this[DOCHOWN](entry)) {
actions++;
const uid = this[UID](entry);
const gid = this[GID](entry);
if (typeof uid === 'number' && typeof gid === 'number') {
fs.fchown(fd, uid, gid, er => er ? fs.chown(abs, uid, gid, er2 => done(er2 && er)) : done());
}
}
done();
});
const tx = this.transform ? this.transform(entry) || entry : entry;
if (tx !== entry) {
tx.on('error', er => {
this[ONERROR](er, entry);
fullyDone();
});
entry.pipe(tx);
}
tx.pipe(stream);
}
[DIRECTORY](entry, fullyDone) {
const mode = typeof entry.mode === 'number' ? entry.mode & 0o7777 : this.dmode;
this[MKDIR](String(entry.absolute), mode, er => {
if (er) {
this[ONERROR](er, entry);
fullyDone();
return;
}
let actions = 1;
const done = () => {
if (--actions === 0) {
fullyDone();
this[UNPEND]();
entry.resume();
}
};
if (entry.mtime && !this.noMtime) {
actions++;
fs.utimes(String(entry.absolute), entry.atime || new Date(), entry.mtime, done);
}
if (this[DOCHOWN](entry)) {
actions++;
fs.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done);
}
done();
});
}
[UNSUPPORTED](entry) {
entry.unsupported = true;
this.warn('TAR_ENTRY_UNSUPPORTED', `unsupported entry type: ${entry.type}`, { entry });
entry.resume();
}
[SYMLINK](entry, done) {
const parts = normalizeWindowsPath(path.relative(this.cwd, path.resolve(path.dirname(String(entry.absolute)), String(entry.linkpath)))).split('/');
this[ENSURE_NO_SYMLINK](entry, this.cwd, parts, () => this[LINK](entry, String(entry.linkpath), 'symlink', done), er => {
this[ONERROR](er, entry);
done();
});
}
[HARDLINK](entry, done) {
const linkpath = normalizeWindowsPath(path.resolve(this.cwd, String(entry.linkpath)));
const parts = normalizeWindowsPath(String(entry.linkpath)).split('/');
this[ENSURE_NO_SYMLINK](entry, this.cwd, parts, () => this[LINK](entry, linkpath, 'link', done), er => {
this[ONERROR](er, entry);
done();
});
}
[ENSURE_NO_SYMLINK](entry, cwd, parts, done, onError) {
const p = parts.shift();
if (this.preservePaths || p === undefined)
return done();
const t = path.resolve(cwd, p);
fs.lstat(t, (er, st) => {
if (er)
return done();
if (st?.isSymbolicLink()) {
return onError(new SymlinkError(t, path.resolve(t, parts.join('/'))));
}
this[ENSURE_NO_SYMLINK](entry, t, parts, done, onError);
});
}
[PEND]() {
this[PENDING]++;
}
[UNPEND]() {
this[PENDING]--;
this[MAYBECLOSE]();
}
[SKIP](entry) {
this[UNPEND]();
entry.resume();
}
// Check if we can reuse an existing filesystem entry safely and
// overwrite it, rather than unlinking and recreating
// Windows doesn't report a useful nlink, so we just never reuse entries
[ISREUSABLE](entry, st) {
return (entry.type === 'File' &&
!this.unlink &&
st.isFile() &&
st.nlink <= 1 &&
!isWindows);
}
// check if a thing is there, and if so, try to clobber it
[CHECKFS](entry) {
this[PEND]();
const paths = [entry.path];
if (entry.linkpath) {
paths.push(entry.linkpath);
}
this.reservations.reserve(paths, done => this[CHECKFS2](entry, done));
}
[CHECKFS2](entry, fullyDone) {
const done = (er) => {
fullyDone(er);
};
const checkCwd = () => {
this[MKDIR](this.cwd, this.dmode, er => {
if (er) {
this[ONERROR](er, entry);
done();
return;
}
this[CHECKED_CWD] = true;
start();
});
};
const start = () => {
if (entry.absolute !== this.cwd) {
const parent = normalizeWindowsPath(path.dirname(String(entry.absolute)));
if (parent !== this.cwd) {
return this[MKDIR](parent, this.dmode, er => {
if (er) {
this[ONERROR](er, entry);
done();
return;
}
afterMakeParent();
});
}
}
afterMakeParent();
};
const afterMakeParent = () => {
fs.lstat(String(entry.absolute), (lstatEr, st) => {
if (st &&
(this.keep ||
/* c8 ignore next */
(this.newer && st.mtime > (entry.mtime ?? st.mtime)))) {
this[SKIP](entry);
done();
return;
}
if (lstatEr || this[ISREUSABLE](entry, st)) {
return this[MAKEFS](null, entry, done);
}
if (st.isDirectory()) {
if (entry.type === 'Directory') {
const needChmod = this.chmod && entry.mode && (st.mode & 0o7777) !== entry.mode;
const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done);
if (!needChmod) {
return afterChmod();
}
return fs.chmod(String(entry.absolute), Number(entry.mode), afterChmod);
}
// Not a dir entry, have to remove it.
// NB: the only way to end up with an entry that is the cwd
// itself, in such a way that == does not detect, is a
// tricky windows absolute path with UNC or 8.3 parts (and
// preservePaths:true, or else it will have been stripped).
// In that case, the user has opted out of path protections
// explicitly, so if they blow away the cwd, c'est la vie.
if (entry.absolute !== this.cwd) {
return fs.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done));
}
}
// not a dir, and not reusable
// don't remove if the cwd, we want that error
if (entry.absolute === this.cwd) {
return this[MAKEFS](null, entry, done);
}
unlinkFile(String(entry.absolute), er => this[MAKEFS](er ?? null, entry, done));
});
};
if (this[CHECKED_CWD]) {
start();
}
else {
checkCwd();
}
}
[MAKEFS](er, entry, done) {
if (er) {
this[ONERROR](er, entry);
done();
return;
}
switch (entry.type) {
case 'File':
case 'OldFile':
case 'ContiguousFile':
return this[FILE](entry, done);
case 'Link':
return this[HARDLINK](entry, done);
case 'SymbolicLink':
return this[SYMLINK](entry, done);
case 'Directory':
case 'GNUDumpDir':
return this[DIRECTORY](entry, done);
}
}
[LINK](entry, linkpath, link, done) {
fs[link](linkpath, String(entry.absolute), er => {
if (er) {
this[ONERROR](er, entry);
}
else {
this[UNPEND]();
entry.resume();
}
done();
});
}
}
const callSync = (fn) => {
try {
return [null, fn()];
}
catch (er) {
return [er, null];
}
};
export class UnpackSync extends Unpack {
sync = true;
[MAKEFS](er, entry) {
return super[MAKEFS](er, entry, () => { });
}
[CHECKFS](entry) {
if (!this[CHECKED_CWD]) {
const er = this[MKDIR](this.cwd, this.dmode);
if (er) {
return this[ONERROR](er, entry);
}
this[CHECKED_CWD] = true;
}
// don't bother to make the parent if the current entry is the cwd,
// we've already checked it.
if (entry.absolute !== this.cwd) {
const parent = normalizeWindowsPath(path.dirname(String(entry.absolute)));
if (parent !== this.cwd) {
const mkParent = this[MKDIR](parent, this.dmode);
if (mkParent) {
return this[ONERROR](mkParent, entry);
}
}
}
const [lstatEr, st] = callSync(() => fs.lstatSync(String(entry.absolute)));
if (st &&
(this.keep ||
/* c8 ignore next */
(this.newer && st.mtime > (entry.mtime ?? st.mtime)))) {
return this[SKIP](entry);
}
if (lstatEr || this[ISREUSABLE](entry, st)) {
return this[MAKEFS](null, entry);
}
if (st.isDirectory()) {
if (entry.type === 'Directory') {
const needChmod = this.chmod && entry.mode && (st.mode & 0o7777) !== entry.mode;
const [er] = needChmod ?
callSync(() => {
fs.chmodSync(String(entry.absolute), Number(entry.mode));
})
: [];
return this[MAKEFS](er, entry);
}
// not a dir entry, have to remove it
const [er] = callSync(() => fs.rmdirSync(String(entry.absolute)));
this[MAKEFS](er, entry);
}
// not a dir, and not reusable.
// don't remove if it's the cwd, since we want that error.
const [er] = entry.absolute === this.cwd ?
[]
: callSync(() => unlinkFileSync(String(entry.absolute)));
this[MAKEFS](er, entry);
}
[FILE](entry, done) {
const mode = typeof entry.mode === 'number' ? entry.mode & 0o7777 : this.fmode;
const oner = (er) => {
let closeError;
try {
fs.closeSync(fd);
}
catch (e) {
closeError = e;
}
if (er || closeError) {
this[ONERROR](er || closeError, entry);
}
done();
};
let fd;
try {
fd = fs.openSync(String(entry.absolute), getWriteFlag(entry.size), mode);
/* c8 ignore start - This is only a problem if the file was successfully
* statted, BUT failed to open. Testing this is annoying, and we
* already have ample testint for other uses of oner() methods.
*/
}
catch (er) {
return oner(er);
}
/* c8 ignore stop */
const tx = this.transform ? this.transform(entry) || entry : entry;
if (tx !== entry) {
tx.on('error', er => this[ONERROR](er, entry));
entry.pipe(tx);
}
tx.on('data', (chunk) => {
try {
fs.writeSync(fd, chunk, 0, chunk.length);
}
catch (er) {
oner(er);
}
});
tx.on('end', () => {
let er = null;
// try both, falling futimes back to utimes
// if either fails, handle the first error
if (entry.mtime && !this.noMtime) {
const atime = entry.atime || new Date();
const mtime = entry.mtime;
try {
fs.futimesSync(fd, atime, mtime);
}
catch (futimeser) {
try {
fs.utimesSync(String(entry.absolute), atime, mtime);
}
catch {
er = futimeser;
}
}
}
if (this[DOCHOWN](entry)) {
const uid = this[UID](entry);
const gid = this[GID](entry);
try {
fs.fchownSync(fd, Number(uid), Number(gid));
}
catch (fchowner) {
try {
fs.chownSync(String(entry.absolute), Number(uid), Number(gid));
}
catch {
er = er || fchowner;
}
}
}
oner(er);
});
}
[DIRECTORY](entry, done) {
const mode = typeof entry.mode === 'number' ? entry.mode & 0o7777 : this.dmode;
const er = this[MKDIR](String(entry.absolute), mode);
if (er) {
this[ONERROR](er, entry);
done();
return;
}
if (entry.mtime && !this.noMtime) {
try {
fs.utimesSync(String(entry.absolute), entry.atime || new Date(), entry.mtime);
/* c8 ignore next */
}
catch { }
}
if (this[DOCHOWN](entry)) {
try {
fs.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)));
}
catch { }
}
done();
entry.resume();
}
[MKDIR](dir, mode) {
try {
return mkdirSync(normalizeWindowsPath(dir), {
uid: this.uid,
gid: this.gid,
processUid: this.processUid,
processGid: this.processGid,
umask: this.processUmask,
preserve: this.preservePaths,
unlink: this.unlink,
cwd: this.cwd,
mode: mode,
});
}
catch (er) {
return er;
}
}
[ENSURE_NO_SYMLINK](_entry, cwd, parts, done, onError) {
if (this.preservePaths || parts.length === 0)
return done();
let t = cwd;
for (const p of parts) {
t = path.resolve(t, p);
const [er, st] = callSync(() => fs.lstatSync(t));
if (er)
return done();
if (st.isSymbolicLink()) {
return onError(new SymlinkError(t, path.resolve(cwd, parts.join('/'))));
}
}
done();
}
[LINK](entry, linkpath, link, done) {
const linkSync = `${link}Sync`;
try {
fs[linkSync](linkpath, String(entry.absolute));
done();
entry.resume();
}
catch (er) {
return this[ONERROR](er, entry);
}
}
}
//# sourceMappingURL=unpack.js.map
@@ -0,0 +1,2 @@
import { viteReactRefreshWrapperPlugin as reactRefreshWrapperPlugin } from "rolldown/experimental";
export { reactRefreshWrapperPlugin };
@@ -0,0 +1,4 @@
const floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
export { floatRegex };
//# sourceMappingURL=float-regex.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"shield-minus.js","sources":["../../../src/icons/shield-minus.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ShieldMinus\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjAgMTNjMCA1LTMuNSA3LjUtNy42NiA4Ljk1YTEgMSAwIDAgMS0uNjctLjAxQzcuNSAyMC41IDQgMTggNCAxM1Y2YTEgMSAwIDAgMSAxLTFjMiAwIDQuNS0xLjIgNi4yNC0yLjcyYTEuMTcgMS4xNyAwIDAgMSAxLjUyIDBDMTQuNTEgMy44MSAxNyA1IDE5IDVhMSAxIDAgMCAxIDEgMXoiIC8+CiAgPHBhdGggZD0iTTkgMTJoNiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/shield-minus\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ShieldMinus = createLucideIcon('ShieldMinus', [\n [\n 'path',\n {\n d: 'M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z',\n key: 'oel41y',\n },\n ],\n ['path', { d: 'M9 12h6', key: '1c52cq' }],\n]);\n\nexport default ShieldMinus;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAClD,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAA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GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,252 @@
// jscs:disable requireUseStrict
var test = require('tape');
var functionBind = require('../implementation');
var getCurrentContext = function () { return this; };
test('functionBind is a function', function (t) {
t.equal(typeof functionBind, 'function');
t.end();
});
test('non-functions', function (t) {
var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g];
t.plan(nonFunctions.length);
for (var i = 0; i < nonFunctions.length; ++i) {
try { functionBind.call(nonFunctions[i]); } catch (ex) {
t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i]));
}
}
t.end();
});
test('without a context', function (t) {
t.test('binds properly', function (st) {
var args, context;
var namespace = {
func: functionBind.call(function () {
args = Array.prototype.slice.call(arguments);
context = this;
})
};
namespace.func(1, 2, 3);
st.deepEqual(args, [1, 2, 3]);
st.equal(context, getCurrentContext.call());
st.end();
});
t.test('binds properly, and still supplies bound arguments', function (st) {
var args, context;
var namespace = {
func: functionBind.call(function () {
args = Array.prototype.slice.call(arguments);
context = this;
}, undefined, 1, 2, 3)
};
namespace.func(4, 5, 6);
st.deepEqual(args, [1, 2, 3, 4, 5, 6]);
st.equal(context, getCurrentContext.call());
st.end();
});
t.test('returns properly', function (st) {
var args;
var namespace = {
func: functionBind.call(function () {
args = Array.prototype.slice.call(arguments);
return this;
}, null)
};
var context = namespace.func(1, 2, 3);
st.equal(context, getCurrentContext.call(), 'returned context is namespaced context');
st.deepEqual(args, [1, 2, 3], 'passed arguments are correct');
st.end();
});
t.test('returns properly with bound arguments', function (st) {
var args;
var namespace = {
func: functionBind.call(function () {
args = Array.prototype.slice.call(arguments);
return this;
}, null, 1, 2, 3)
};
var context = namespace.func(4, 5, 6);
st.equal(context, getCurrentContext.call(), 'returned context is namespaced context');
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct');
st.end();
});
t.test('called as a constructor', function (st) {
var thunkify = function (value) {
return function () { return value; };
};
st.test('returns object value', function (sst) {
var expectedReturnValue = [1, 2, 3];
var Constructor = functionBind.call(thunkify(expectedReturnValue), null);
var result = new Constructor();
sst.equal(result, expectedReturnValue);
sst.end();
});
st.test('does not return primitive value', function (sst) {
var Constructor = functionBind.call(thunkify(42), null);
var result = new Constructor();
sst.notEqual(result, 42);
sst.end();
});
st.test('object from bound constructor is instance of original and bound constructor', function (sst) {
var A = function (x) {
this.name = x || 'A';
};
var B = functionBind.call(A, null, 'B');
var result = new B();
sst.ok(result instanceof B, 'result is instance of bound constructor');
sst.ok(result instanceof A, 'result is instance of original constructor');
sst.end();
});
st.end();
});
t.end();
});
test('with a context', function (t) {
t.test('with no bound arguments', function (st) {
var args, context;
var boundContext = {};
var namespace = {
func: functionBind.call(function () {
args = Array.prototype.slice.call(arguments);
context = this;
}, boundContext)
};
namespace.func(1, 2, 3);
st.equal(context, boundContext, 'binds a context properly');
st.deepEqual(args, [1, 2, 3], 'supplies passed arguments');
st.end();
});
t.test('with bound arguments', function (st) {
var args, context;
var boundContext = {};
var namespace = {
func: functionBind.call(function () {
args = Array.prototype.slice.call(arguments);
context = this;
}, boundContext, 1, 2, 3)
};
namespace.func(4, 5, 6);
st.equal(context, boundContext, 'binds a context properly');
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments');
st.end();
});
t.test('returns properly', function (st) {
var boundContext = {};
var args;
var namespace = {
func: functionBind.call(function () {
args = Array.prototype.slice.call(arguments);
return this;
}, boundContext)
};
var context = namespace.func(1, 2, 3);
st.equal(context, boundContext, 'returned context is bound context');
st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context');
st.deepEqual(args, [1, 2, 3], 'passed arguments are correct');
st.end();
});
t.test('returns properly with bound arguments', function (st) {
var boundContext = {};
var args;
var namespace = {
func: functionBind.call(function () {
args = Array.prototype.slice.call(arguments);
return this;
}, boundContext, 1, 2, 3)
};
var context = namespace.func(4, 5, 6);
st.equal(context, boundContext, 'returned context is bound context');
st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context');
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct');
st.end();
});
t.test('passes the correct arguments when called as a constructor', function (st) {
var expected = { name: 'Correct' };
var namespace = {
Func: functionBind.call(function (arg) {
return arg;
}, { name: 'Incorrect' })
};
var returned = new namespace.Func(expected);
st.equal(returned, expected, 'returns the right arg when called as a constructor');
st.end();
});
t.test('has the new instance\'s context when called as a constructor', function (st) {
var actualContext;
var expectedContext = { foo: 'bar' };
var namespace = {
Func: functionBind.call(function () {
actualContext = this;
}, expectedContext)
};
var result = new namespace.Func();
st.equal(result instanceof namespace.Func, true);
st.notEqual(actualContext, expectedContext);
st.end();
});
t.end();
});
test('bound function length', function (t) {
t.test('sets a correct length without thisArg', function (st) {
var subject = functionBind.call(function (a, b, c) { return a + b + c; });
st.equal(subject.length, 3);
st.equal(subject(1, 2, 3), 6);
st.end();
});
t.test('sets a correct length with thisArg', function (st) {
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {});
st.equal(subject.length, 3);
st.equal(subject(1, 2, 3), 6);
st.end();
});
t.test('sets a correct length without thisArg and first argument', function (st) {
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1);
st.equal(subject.length, 2);
st.equal(subject(2, 3), 6);
st.end();
});
t.test('sets a correct length with thisArg and first argument', function (st) {
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1);
st.equal(subject.length, 2);
st.equal(subject(2, 3), 6);
st.end();
});
t.test('sets a correct length without thisArg and too many arguments', function (st) {
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4);
st.equal(subject.length, 0);
st.equal(subject(), 6);
st.end();
});
t.test('sets a correct length with thisArg and too many arguments', function (st) {
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4);
st.equal(subject.length, 0);
st.equal(subject(), 6);
st.end();
});
});
@@ -0,0 +1,3 @@
#!/usr/bin/env node
import { crossEnv } from "../index.js";
crossEnv(process.argv.slice(2));
@@ -0,0 +1,250 @@
"use strict";
/**
* Experimental server task features for MCP SDK.
* WARNING: These APIs are experimental and may change without notice.
*
* @experimental
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExperimentalServerTasks = void 0;
const types_js_1 = require("../../types.js");
/**
* Experimental task features for low-level MCP servers.
*
* Access via `server.experimental.tasks`:
* ```typescript
* const stream = server.experimental.tasks.requestStream(request, schema, options);
* ```
*
* For high-level server usage with task-based tools, use `McpServer.experimental.tasks` instead.
*
* @experimental
*/
class ExperimentalServerTasks {
constructor(_server) {
this._server = _server;
}
/**
* Sends a request and returns an AsyncGenerator that yields response messages.
* The generator is guaranteed to end with either a 'result' or 'error' message.
*
* This method provides streaming access to request processing, allowing you to
* observe intermediate task status updates for task-augmented requests.
*
* @param request - The request to send
* @param resultSchema - Zod schema for validating the result
* @param options - Optional request options (timeout, signal, task creation params, etc.)
* @returns AsyncGenerator that yields ResponseMessage objects
*
* @experimental
*/
requestStream(request, resultSchema, options) {
return this._server.requestStream(request, resultSchema, options);
}
/**
* Sends a sampling request and returns an AsyncGenerator that yields response messages.
* The generator is guaranteed to end with either a 'result' or 'error' message.
*
* For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
* before the final result.
*
* @example
* ```typescript
* const stream = server.experimental.tasks.createMessageStream({
* messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
* maxTokens: 100
* }, {
* onprogress: (progress) => {
* // Handle streaming tokens via progress notifications
* console.log('Progress:', progress.message);
* }
* });
*
* for await (const message of stream) {
* switch (message.type) {
* case 'taskCreated':
* console.log('Task created:', message.task.taskId);
* break;
* case 'taskStatus':
* console.log('Task status:', message.task.status);
* break;
* case 'result':
* console.log('Final result:', message.result);
* break;
* case 'error':
* console.error('Error:', message.error);
* break;
* }
* }
* ```
*
* @param params - The sampling request parameters
* @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
* @returns AsyncGenerator that yields ResponseMessage objects
*
* @experimental
*/
createMessageStream(params, options) {
// Access client capabilities via the server
const clientCapabilities = this._server.getClientCapabilities();
// Capability check - only required when tools/toolChoice are provided
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
throw new Error('Client does not support sampling tools capability.');
}
// Message structure validation - always validate tool_use/tool_result pairs.
// These may appear even without tools/toolChoice in the current request when
// a previous sampling request returned tool_use and this is a follow-up with results.
if (params.messages.length > 0) {
const lastMessage = params.messages[params.messages.length - 1];
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
const hasToolResults = lastContent.some(c => c.type === 'tool_result');
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
const previousContent = previousMessage
? Array.isArray(previousMessage.content)
? previousMessage.content
: [previousMessage.content]
: [];
const hasPreviousToolUse = previousContent.some(c => c.type === 'tool_use');
if (hasToolResults) {
if (lastContent.some(c => c.type !== 'tool_result')) {
throw new Error('The last message must contain only tool_result content if any is present');
}
if (!hasPreviousToolUse) {
throw new Error('tool_result blocks are not matching any tool_use from the previous message');
}
}
if (hasPreviousToolUse) {
// Extract tool_use IDs from previous message and tool_result IDs from current message
const toolUseIds = new Set(previousContent.filter(c => c.type === 'tool_use').map(c => c.id));
const toolResultIds = new Set(lastContent.filter(c => c.type === 'tool_result').map(c => c.toolUseId));
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every(id => toolResultIds.has(id))) {
throw new Error('ids of tool_result blocks and tool_use blocks from previous message do not match');
}
}
}
return this.requestStream({
method: 'sampling/createMessage',
params
}, types_js_1.CreateMessageResultSchema, options);
}
/**
* Sends an elicitation request and returns an AsyncGenerator that yields response messages.
* The generator is guaranteed to end with either a 'result' or 'error' message.
*
* For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
* and 'taskStatus' messages before the final result.
*
* @example
* ```typescript
* const stream = server.experimental.tasks.elicitInputStream({
* mode: 'url',
* message: 'Please authenticate',
* elicitationId: 'auth-123',
* url: 'https://example.com/auth'
* }, {
* task: { ttl: 300000 } // Task-augmented for long-running auth flow
* });
*
* for await (const message of stream) {
* switch (message.type) {
* case 'taskCreated':
* console.log('Task created:', message.task.taskId);
* break;
* case 'taskStatus':
* console.log('Task status:', message.task.status);
* break;
* case 'result':
* console.log('User action:', message.result.action);
* break;
* case 'error':
* console.error('Error:', message.error);
* break;
* }
* }
* ```
*
* @param params - The elicitation request parameters
* @param options - Optional request options (timeout, signal, task creation params, etc.)
* @returns AsyncGenerator that yields ResponseMessage objects
*
* @experimental
*/
elicitInputStream(params, options) {
// Access client capabilities via the server
const clientCapabilities = this._server.getClientCapabilities();
const mode = params.mode ?? 'form';
// Capability check based on mode
switch (mode) {
case 'url': {
if (!clientCapabilities?.elicitation?.url) {
throw new Error('Client does not support url elicitation.');
}
break;
}
case 'form': {
if (!clientCapabilities?.elicitation?.form) {
throw new Error('Client does not support form elicitation.');
}
break;
}
}
// Normalize params to ensure mode is set for form mode (defaults to 'form' per spec)
const normalizedParams = mode === 'form' && params.mode === undefined ? { ...params, mode: 'form' } : params;
// Cast to ServerRequest needed because TypeScript can't narrow the union type
// based on the discriminated 'method' field when constructing the object literal
return this.requestStream({
method: 'elicitation/create',
params: normalizedParams
}, types_js_1.ElicitResultSchema, options);
}
/**
* Gets the current status of a task.
*
* @param taskId - The task identifier
* @param options - Optional request options
* @returns The task status
*
* @experimental
*/
async getTask(taskId, options) {
return this._server.getTask({ taskId }, options);
}
/**
* Retrieves the result of a completed task.
*
* @param taskId - The task identifier
* @param resultSchema - Zod schema for validating the result
* @param options - Optional request options
* @returns The task result
*
* @experimental
*/
async getTaskResult(taskId, resultSchema, options) {
return this._server.getTaskResult({ taskId }, resultSchema, options);
}
/**
* Lists tasks with optional pagination.
*
* @param cursor - Optional pagination cursor
* @param options - Optional request options
* @returns List of tasks with optional next cursor
*
* @experimental
*/
async listTasks(cursor, options) {
return this._server.listTasks(cursor ? { cursor } : undefined, options);
}
/**
* Cancels a running task.
*
* @param taskId - The task identifier
* @param options - Optional request options
*
* @experimental
*/
async cancelTask(taskId, options) {
return this._server.cancelTask({ taskId }, options);
}
}
exports.ExperimentalServerTasks = ExperimentalServerTasks;
//# sourceMappingURL=server.js.map
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTypeImport = isTypeImport;
const scope_manager_1 = require("@typescript-eslint/scope-manager");
const utils_1 = require("@typescript-eslint/utils");
/**
* Determine whether a variable definition is a type import. e.g.:
*
* ```ts
* import type { Foo } from 'foo';
* import { type Bar } from 'bar';
* ```
*
* @param definition - The variable definition to check.
*/
function isTypeImport(definition) {
return (definition?.type === scope_manager_1.DefinitionType.ImportBinding &&
(definition.parent.importKind === 'type' ||
(definition.node.type === utils_1.AST_NODE_TYPES.ImportSpecifier &&
definition.node.importKind === 'type')));
}
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = rewriteThis;
var _core = require("@babel/core");
var _traverse = require("@babel/traverse");
let rewriteThisVisitor;
function rewriteThis(programPath) {
if (!rewriteThisVisitor) {
rewriteThisVisitor = _traverse.visitors.environmentVisitor({
ThisExpression(path) {
path.replaceWith(_core.types.unaryExpression("void", _core.types.numericLiteral(0), true));
}
});
rewriteThisVisitor.noScope = true;
}
(0, _traverse.default)(programPath.node, rewriteThisVisitor);
}
//# sourceMappingURL=rewrite-this.js.map
@@ -0,0 +1,458 @@
/**
* SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
* SHA256 is the fastest hash implementable in JS, even faster than Blake3.
* Check out {@link https://www.rfc-editor.org/rfc/rfc4634 | RFC 4634} and
* {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf | FIPS 180-4}.
* @module
*/
import { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from "./_md.js";
import * as u64 from "./_u64.js";
import { clean, createHasher, oidNist, rotr } from "./utils.js";
/**
* SHA-224 / SHA-256 round constants from RFC 6234 §5.1: the first 32 bits
* of the cube roots of the first 64 primes (2..311).
*/
// prettier-ignore
const SHA256_K = /* @__PURE__ */ Uint32Array.from([
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
]);
/** Reusable SHA-224 / SHA-256 message schedule buffer `W_t` from RFC 6234 §6.2 step 1. */
const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
/** Internal SHA-224 / SHA-256 compression engine from RFC 6234 §6.2. */
class SHA2_32B extends HashMD {
constructor(outputLen) {
super(64, outputLen, 8, false);
}
get() {
const { A, B, C, D, E, F, G, H } = this;
return [A, B, C, D, E, F, G, H];
}
// prettier-ignore
set(A, B, C, D, E, F, G, H) {
this.A = A | 0;
this.B = B | 0;
this.C = C | 0;
this.D = D | 0;
this.E = E | 0;
this.F = F | 0;
this.G = G | 0;
this.H = H | 0;
}
process(view, offset) {
// Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
for (let i = 0; i < 16; i++, offset += 4)
SHA256_W[i] = view.getUint32(offset, false);
for (let i = 16; i < 64; i++) {
const W15 = SHA256_W[i - 15];
const W2 = SHA256_W[i - 2];
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);
SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
}
// Compression function main loop, 64 rounds
let { A, B, C, D, E, F, G, H } = this;
for (let i = 0; i < 64; i++) {
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
const T2 = (sigma0 + Maj(A, B, C)) | 0;
H = G;
G = F;
F = E;
E = (D + T1) | 0;
D = C;
C = B;
B = A;
A = (T1 + T2) | 0;
}
// Add the compressed chunk to the current hash value
A = (A + this.A) | 0;
B = (B + this.B) | 0;
C = (C + this.C) | 0;
D = (D + this.D) | 0;
E = (E + this.E) | 0;
F = (F + this.F) | 0;
G = (G + this.G) | 0;
H = (H + this.H) | 0;
this.set(A, B, C, D, E, F, G, H);
}
roundClean() {
clean(SHA256_W);
}
destroy() {
// HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves
// update()/digest() callable on reused instances.
this.destroyed = true;
this.set(0, 0, 0, 0, 0, 0, 0, 0);
clean(this.buffer);
}
}
/** Internal SHA-256 hash class grounded in RFC 6234 §6.2. */
export class _SHA256 extends SHA2_32B {
// We cannot use array here since array allows indexing by variable
// which means optimizer/compiler cannot use registers.
A = SHA256_IV[0] | 0;
B = SHA256_IV[1] | 0;
C = SHA256_IV[2] | 0;
D = SHA256_IV[3] | 0;
E = SHA256_IV[4] | 0;
F = SHA256_IV[5] | 0;
G = SHA256_IV[6] | 0;
H = SHA256_IV[7] | 0;
constructor() {
super(32);
}
}
/** Internal SHA-224 hash class grounded in RFC 6234 §6.2 and §8.5. */
export class _SHA224 extends SHA2_32B {
A = SHA224_IV[0] | 0;
B = SHA224_IV[1] | 0;
C = SHA224_IV[2] | 0;
D = SHA224_IV[3] | 0;
E = SHA224_IV[4] | 0;
F = SHA224_IV[5] | 0;
G = SHA224_IV[6] | 0;
H = SHA224_IV[7] | 0;
constructor() {
super(28);
}
}
// SHA2-512 is slower than sha256 in js because u64 operations are slow.
// SHA-384 / SHA-512 round constants from RFC 6234 §5.2:
// 80 full 64-bit words split into high/low halves.
// prettier-ignore
const K512 = /* @__PURE__ */ (() => u64.split([
'0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',
'0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',
'0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',
'0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',
'0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',
'0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',
'0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',
'0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',
'0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',
'0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',
'0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',
'0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',
'0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',
'0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',
'0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',
'0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',
'0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',
'0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',
'0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',
'0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'
].map(n => BigInt(n))))();
const SHA512_Kh = /* @__PURE__ */ (() => K512[0])();
const SHA512_Kl = /* @__PURE__ */ (() => K512[1])();
// Reusable high-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words.
const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
// Reusable low-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words.
const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
/** Internal SHA-384 / SHA-512 compression engine from RFC 6234 §6.4. */
class SHA2_64B extends HashMD {
constructor(outputLen) {
super(128, outputLen, 16, false);
}
// prettier-ignore
get() {
const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
}
// prettier-ignore
set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
this.Ah = Ah | 0;
this.Al = Al | 0;
this.Bh = Bh | 0;
this.Bl = Bl | 0;
this.Ch = Ch | 0;
this.Cl = Cl | 0;
this.Dh = Dh | 0;
this.Dl = Dl | 0;
this.Eh = Eh | 0;
this.El = El | 0;
this.Fh = Fh | 0;
this.Fl = Fl | 0;
this.Gh = Gh | 0;
this.Gl = Gl | 0;
this.Hh = Hh | 0;
this.Hl = Hl | 0;
}
process(view, offset) {
// Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array
for (let i = 0; i < 16; i++, offset += 4) {
SHA512_W_H[i] = view.getUint32(offset);
SHA512_W_L[i] = view.getUint32((offset += 4));
}
for (let i = 16; i < 80; i++) {
// s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)
const W15h = SHA512_W_H[i - 15] | 0;
const W15l = SHA512_W_L[i - 15] | 0;
const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);
const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);
// s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)
const W2h = SHA512_W_H[i - 2] | 0;
const W2l = SHA512_W_L[i - 2] | 0;
const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);
const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);
// SHA512_W[i] = s0 + s1 + SHA512_W[i - 7] + SHA512_W[i - 16];
const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
SHA512_W_H[i] = SUMh | 0;
SHA512_W_L[i] = SUMl | 0;
}
let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
// Compression function main loop, 80 rounds
for (let i = 0; i < 80; i++) {
// S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)
const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);
const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);
//const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
const CHIh = (Eh & Fh) ^ (~Eh & Gh);
const CHIl = (El & Fl) ^ (~El & Gl);
// T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]
// prettier-ignore
const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
const T1l = T1ll | 0;
// S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)
const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);
const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);
const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);
const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);
Hh = Gh | 0;
Hl = Gl | 0;
Gh = Fh | 0;
Gl = Fl | 0;
Fh = Eh | 0;
Fl = El | 0;
({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
Dh = Ch | 0;
Dl = Cl | 0;
Ch = Bh | 0;
Cl = Bl | 0;
Bh = Ah | 0;
Bl = Al | 0;
const All = u64.add3L(T1l, sigma0l, MAJl);
Ah = u64.add3H(All, T1h, sigma0h, MAJh);
Al = All | 0;
}
// Add the compressed chunk to the current hash value
({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
}
roundClean() {
clean(SHA512_W_H, SHA512_W_L);
}
destroy() {
// HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves
// update()/digest() callable on reused instances.
this.destroyed = true;
clean(this.buffer);
this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
}
/** Internal SHA-512 hash class grounded in RFC 6234 §6.3 and §6.4. */
export class _SHA512 extends SHA2_64B {
Ah = SHA512_IV[0] | 0;
Al = SHA512_IV[1] | 0;
Bh = SHA512_IV[2] | 0;
Bl = SHA512_IV[3] | 0;
Ch = SHA512_IV[4] | 0;
Cl = SHA512_IV[5] | 0;
Dh = SHA512_IV[6] | 0;
Dl = SHA512_IV[7] | 0;
Eh = SHA512_IV[8] | 0;
El = SHA512_IV[9] | 0;
Fh = SHA512_IV[10] | 0;
Fl = SHA512_IV[11] | 0;
Gh = SHA512_IV[12] | 0;
Gl = SHA512_IV[13] | 0;
Hh = SHA512_IV[14] | 0;
Hl = SHA512_IV[15] | 0;
constructor() {
super(64);
}
}
/** Internal SHA-384 hash class grounded in RFC 6234 §6.3 and §6.4. */
export class _SHA384 extends SHA2_64B {
Ah = SHA384_IV[0] | 0;
Al = SHA384_IV[1] | 0;
Bh = SHA384_IV[2] | 0;
Bl = SHA384_IV[3] | 0;
Ch = SHA384_IV[4] | 0;
Cl = SHA384_IV[5] | 0;
Dh = SHA384_IV[6] | 0;
Dl = SHA384_IV[7] | 0;
Eh = SHA384_IV[8] | 0;
El = SHA384_IV[9] | 0;
Fh = SHA384_IV[10] | 0;
Fl = SHA384_IV[11] | 0;
Gh = SHA384_IV[12] | 0;
Gl = SHA384_IV[13] | 0;
Hh = SHA384_IV[14] | 0;
Hl = SHA384_IV[15] | 0;
constructor() {
super(48);
}
}
/**
* Truncated SHA512/256 and SHA512/224.
* SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as "intermediary" IV of SHA512/t.
* Then t hashes string to produce result IV.
* See the repo-side derivation recipe in `test/misc/sha2-gen-iv.js`.
* These IV literals are checked against that script rather than a dedicated
* local RFC section.
*/
/** SHA-512/224 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and
* stored as sixteen big-endian 32-bit halves. */
const T224_IV = /* @__PURE__ */ Uint32Array.from([
0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,
0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,
]);
/** SHA-512/256 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and
* stored as sixteen big-endian 32-bit halves. */
const T256_IV = /* @__PURE__ */ Uint32Array.from([
0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,
0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,
]);
/** Internal SHA-512/224 hash class using the derived `T224_IV` and the shared
* RFC 6234 §6.4 compression engine. */
export class _SHA512_224 extends SHA2_64B {
Ah = T224_IV[0] | 0;
Al = T224_IV[1] | 0;
Bh = T224_IV[2] | 0;
Bl = T224_IV[3] | 0;
Ch = T224_IV[4] | 0;
Cl = T224_IV[5] | 0;
Dh = T224_IV[6] | 0;
Dl = T224_IV[7] | 0;
Eh = T224_IV[8] | 0;
El = T224_IV[9] | 0;
Fh = T224_IV[10] | 0;
Fl = T224_IV[11] | 0;
Gh = T224_IV[12] | 0;
Gl = T224_IV[13] | 0;
Hh = T224_IV[14] | 0;
Hl = T224_IV[15] | 0;
constructor() {
super(28);
}
}
/** Internal SHA-512/256 hash class using the derived `T256_IV` and the shared
* RFC 6234 §6.4 compression engine. */
export class _SHA512_256 extends SHA2_64B {
Ah = T256_IV[0] | 0;
Al = T256_IV[1] | 0;
Bh = T256_IV[2] | 0;
Bl = T256_IV[3] | 0;
Ch = T256_IV[4] | 0;
Cl = T256_IV[5] | 0;
Dh = T256_IV[6] | 0;
Dl = T256_IV[7] | 0;
Eh = T256_IV[8] | 0;
El = T256_IV[9] | 0;
Fh = T256_IV[10] | 0;
Fl = T256_IV[11] | 0;
Gh = T256_IV[12] | 0;
Gl = T256_IV[13] | 0;
Hh = T256_IV[14] | 0;
Hl = T256_IV[15] | 0;
constructor() {
super(32);
}
}
/**
* SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:
*
* - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.
* - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
* - Each sha256 hash is executing 2^18 bit operations.
* - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA2-256.
* ```ts
* sha256(new Uint8Array([97, 98, 99]));
* ```
*/
export const sha256 = /* @__PURE__ */ createHasher(() => new _SHA256(),
/* @__PURE__ */ oidNist(0x01));
/**
* SHA2-224 hash function from RFC 4634.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA2-224.
* ```ts
* sha224(new Uint8Array([97, 98, 99]));
* ```
*/
export const sha224 = /* @__PURE__ */ createHasher(() => new _SHA224(),
/* @__PURE__ */ oidNist(0x04));
/**
* SHA2-512 hash function from RFC 4634.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA2-512.
* ```ts
* sha512(new Uint8Array([97, 98, 99]));
* ```
*/
export const sha512 = /* @__PURE__ */ createHasher(() => new _SHA512(),
/* @__PURE__ */ oidNist(0x03));
/**
* SHA2-384 hash function from RFC 4634.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA2-384.
* ```ts
* sha384(new Uint8Array([97, 98, 99]));
* ```
*/
export const sha384 = /* @__PURE__ */ createHasher(() => new _SHA384(),
/* @__PURE__ */ oidNist(0x02));
/**
* SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks.
* See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA2-512/256.
* ```ts
* sha512_256(new Uint8Array([97, 98, 99]));
* ```
*/
export const sha512_256 = /* @__PURE__ */ createHasher(() => new _SHA512_256(),
/* @__PURE__ */ oidNist(0x06));
/**
* SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks.
* See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA2-512/224.
* ```ts
* sha512_224(new Uint8Array([97, 98, 99]));
* ```
*/
export const sha512_224 = /* @__PURE__ */ createHasher(() => new _SHA512_224(),
/* @__PURE__ */ oidNist(0x05));
//# sourceMappingURL=sha2.js.map
@@ -0,0 +1,24 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const AirVent = createLucideIcon("AirVent", [
[
"path",
{
d: "M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",
key: "larmp2"
}
],
["path", { d: "M6 8h12", key: "6g4wlu" }],
["path", { d: "M18.3 17.7a2.5 2.5 0 0 1-3.16 3.83 2.53 2.53 0 0 1-1.14-2V12", key: "1bo8pg" }],
["path", { d: "M6.6 15.6A2 2 0 1 0 10 17v-5", key: "t9h90c" }]
]);
export { AirVent as default };
//# sourceMappingURL=air-vent.js.map
@@ -0,0 +1,148 @@
import module$1, { isBuiltin } from 'node:module';
import { fileURLToPath } from 'node:url';
import { MessageChannel } from 'node:worker_threads';
import { initSyntaxLexers, hoistMocks } from '@vitest/mocker/transforms';
import { cleanUrl } from '@vitest/utils/helpers';
import { p as parse } from './acorn.B2iPLyUM.js';
import MagicString from 'magic-string';
import { resolve } from 'pathe';
import c from 'tinyrainbow';
import { distDir } from '../path.js';
import { t as toBuiltin } from './modules.BJuCwlRJ.js';
import 'node:path';
const NOW_LENGTH = Date.now().toString().length;
const REGEXP_VITEST = new RegExp(`%3Fvitest=\\d{${NOW_LENGTH}}`);
const REGEXP_MOCK_ACTUAL = /\?mock=actual/;
async function setupNodeLoaderHooks(worker) {
if (module$1.setSourceMapsSupport) module$1.setSourceMapsSupport(true);
else if (process.setSourceMapsEnabled) process.setSourceMapsEnabled(true);
if (worker.config.experimental.nodeLoader !== false) await initSyntaxLexers();
if (typeof module$1.registerHooks === "function") module$1.registerHooks({
resolve(specifier, context, nextResolve) {
if (specifier.includes("mock=actual")) {
// url is already resolved by `importActual`
const moduleId = specifier.replace(REGEXP_MOCK_ACTUAL, "");
const builtin = isBuiltin(moduleId);
return {
url: builtin ? toBuiltin(moduleId) : moduleId,
format: builtin ? "builtin" : void 0,
shortCircuit: true
};
}
const isVitest = specifier.includes("%3Fvitest=");
const result = nextResolve(isVitest ? specifier.replace(REGEXP_VITEST, "") : specifier, context);
// avoid tracking /node_modules/ module graph for performance reasons
if (context.parentURL && result.url && !result.url.includes("/node_modules/")) worker.rpc.ensureModuleGraphEntry(result.url, context.parentURL).catch(() => {
// ignore errors
});
// this is require for in-source tests to be invalidated if
// one of the files already imported it in --maxWorkers=1 --no-isolate
if (isVitest) result.url = `${result.url}?vitest=${Date.now()}`;
if (worker.config.experimental.nodeLoader === false || !context.parentURL || result.url.includes(distDir) || context.parentURL?.toString().includes(distDir)) return result;
const mockedResult = getNativeMocker()?.resolveMockedModule(result.url, context.parentURL);
if (mockedResult != null) return mockedResult;
return result;
},
load: worker.config.experimental.nodeLoader === false ? void 0 : createLoadHook()
});
else if (module$1.register) {
if (worker.config.experimental.nodeLoader !== false) console.warn(`${c.bgYellow(" WARNING ")} "module.registerHooks" is not supported in Node.js ${process.version}. This means that some features like module mocking or in-source testing are not supported. Upgrade your Node.js version to at least 22.15 or disable "experimental.nodeLoader" flag manually.\n`);
const { port1, port2 } = new MessageChannel();
port1.unref();
port2.unref();
port1.on("message", (data) => {
if (!data || typeof data !== "object") return;
switch (data.event) {
case "register-module-graph-entry": {
const { url, parentURL } = data;
worker.rpc.ensureModuleGraphEntry(url, parentURL);
return;
}
default: console.error("Unknown message event:", data.event);
}
});
/** Registers {@link file://./../nodejsWorkerLoader.ts} */
module$1.register("#nodejs-worker-loader", {
parentURL: import.meta.url,
data: { port: port2 },
transferList: [port2]
});
} else if (!process.versions.deno && !process.versions.bun) console.warn("\"module.registerHooks\" and \"module.register\" are not supported. Some Vitest features may not work. Please, use Node.js 18.19.0 or higher.");
}
function replaceInSourceMarker(url, source, ms) {
const re = /import\.meta\.vitest/g;
let match;
let overridden = false;
// eslint-disable-next-line no-cond-assign
while (match = re.exec(source)) {
const { index, "0": code } = match;
overridden = true;
// should it support process.vitest for CJS modules?
ms().overwrite(index, index + code.length, "IMPORT_META_TEST()");
}
if (overridden) {
const filename = resolve(fileURLToPath(url));
// appending instead of prepending because functions are hoisted and we don't change the offset
ms().append(`;\nfunction IMPORT_META_TEST() { return typeof __vitest_worker__ !== 'undefined' && __vitest_worker__.filepath === "${filename.replace(/"/g, "\\\"")}" ? __vitest_index__ : undefined; }`);
}
}
const ignoreFormats = new Set([
"addon",
"builtin",
"wasm"
]);
function createLoadHook(_worker) {
return (url, context, nextLoad) => {
const result = url.includes("mock=") && isBuiltin(cleanUrl(url)) ? { format: "commonjs" } : nextLoad(url, context);
if (result.format && ignoreFormats.has(result.format) || url.includes(distDir)) return result;
const mocker = getNativeMocker();
mocker?.checkCircularManualMock(url);
if (url.includes("mock=automock") || url.includes("mock=autospy")) {
const automockedResult = mocker?.loadAutomock(url, result);
if (automockedResult != null) return automockedResult;
return result;
}
if (url.includes("mock=manual")) {
const mockedResult = mocker?.loadManualMock(url, result);
if (mockedResult != null) return mockedResult;
return result;
}
// ignore non-vitest modules for performance reasons,
// vi.hoisted and vi.mock won't work outside of test files or setup files
if (!result.source || !url.includes("vitest=")) return result;
const filename = url.startsWith("file://") ? fileURLToPath(url) : url;
const source = result.source.toString();
const transformedCode = result.format?.includes("typescript") ? module$1.stripTypeScriptTypes(source) : source;
let _ms;
const ms = () => _ms || (_ms = new MagicString(source));
if (source.includes("import.meta.vitest")) replaceInSourceMarker(url, source, ms);
hoistMocks(transformedCode, filename, (code) => parse(code, {
ecmaVersion: "latest",
sourceType: result.format === "module" || result.format === "module-typescript" || result.format === "typescript" ? "module" : "script"
}), {
magicString: ms,
globalThisAccessor: "\"__vitest_mocker__\""
});
let code;
if (_ms) code = `${_ms.toString()}\n//# sourceMappingURL=${genSourceMapUrl(_ms.generateMap({
hires: "boundary",
source: filename
}))}`;
else code = source;
return {
format: result.format,
shortCircuit: true,
source: code
};
};
}
function genSourceMapUrl(map) {
if (typeof map !== "string") map = JSON.stringify(map);
return `data:application/json;base64,${Buffer.from(map).toString("base64")}`;
}
function getNativeMocker() {
return typeof __vitest_mocker__ !== "undefined" ? __vitest_mocker__ : void 0;
}
export { setupNodeLoaderHooks };
@@ -0,0 +1,40 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABILITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference lib="es2020.intl" />
interface Date {
/**
* Converts a date and time to a string by using the current or specified locale.
* @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleDateString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
}
@@ -0,0 +1,16 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.es2019_array = void 0;
const base_config_1 = require("./base-config");
exports.es2019_array = {
libs: [],
variables: [
['FlatArray', base_config_1.TYPE],
['ReadonlyArray', base_config_1.TYPE],
['Array', base_config_1.TYPE],
],
};
@@ -0,0 +1 @@
{"version":3,"file":"dd-resizable.js","sourceRoot":"","sources":["../src/dd-resizable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAwB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA+BzC,MAAa,WAAY,SAAQ,eAAe;IA0B9C,8DAA8D;IAC9D,YAAmB,EAAuB,EAAS,SAAyB,EAAE;QAC5E,KAAK,EAAE,CAAC;QADS,OAAE,GAAF,EAAE,CAAqB;QAAS,WAAM,GAAN,MAAM,CAAqB;QAtB9E,gBAAgB;QACN,cAAS,GAAwB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAwT1D,gBAAgB;QACN,QAAG,GAAG,GAAa,EAAE;YAC7B,MAAM,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC;YAC5C,MAAM,eAAe,GAAG,aAAa,CAAC,qBAAqB,EAAE,CA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AAE,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,kCAAkC;QAC/G,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC;QACpD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QLine truncated
@@ -0,0 +1,11 @@
import { HeadContentProps } from './HeadContent.js';
/**
* Render route-managed head tags (title, meta, links, styles, head scripts).
* Place inside the document head of your app shell.
*
* Development version: filters out dev styles link after hydration and
* includes a fallback cleanup effect for hydration mismatch cases.
*
* @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management
*/
export declare function HeadContent(props: HeadContentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
{"version":3,"file":"square-user-round.js","sources":["../../../src/icons/square-user-round.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name SquareUserRound\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTggMjFhNiA2IDAgMCAwLTEyIDAiIC8+CiAgPGNpcmNsZSBjeD0iMTIiIGN5PSIxMSIgcj0iNCIgLz4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjMiIHJ4PSIyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/square-user-round\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst SquareUserRound = createLucideIcon('SquareUserRound', [\n ['path', { d: 'M18 21a6 6 0 0 0-12 0', key: 'kaz2du' }],\n ['circle', { cx: '12', cy: '11', r: '4', key: '1gt34v' }],\n ['rect', { width: '18', height: '18', x: '3', y: '3', rx: '2', key: 'afitv7' }],\n]);\n\nexport default SquareUserRound;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,iBAAiB,iBAAmB,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAyB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACtD,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,MAAM,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,27 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCanonicalFileName = exports.typescriptVersionIsAtLeast = void 0;
// required by website
__exportStar(require("./ast-converter"), exports);
__exportStar(require("./create-program/getScriptKind"), exports);
// required by packages/utils/src/ts-estree.ts
__exportStar(require("./getModifiers"), exports);
var version_check_1 = require("./version-check");
Object.defineProperty(exports, "typescriptVersionIsAtLeast", { enumerable: true, get: function () { return version_check_1.typescriptVersionIsAtLeast; } });
// required by packages/type-utils
var shared_1 = require("./create-program/shared");
Object.defineProperty(exports, "getCanonicalFileName", { enumerable: true, get: function () { return shared_1.getCanonicalFileName; } });
@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _unsupportedIterableToArray;
var _arrayLikeToArray = require("./arrayLikeToArray.js");
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return (0, _arrayLikeToArray.default)(o, minLen);
var name = Object.prototype.toString.call(o).slice(8, -1);
if (name === "Object" && o.constructor) name = o.constructor.name;
if (name === "Map" || name === "Set") return Array.from(o);
if (name === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(name)) {
return (0, _arrayLikeToArray.default)(o, minLen);
}
}
//# sourceMappingURL=unsupportedIterableToArray.js.map
@@ -0,0 +1,39 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
//#region src/utils/color.ts
/**
* @module
* Color utility.
*/
/**
* Get whether color change on terminal is enabled or disabled.
* If `NO_COLOR` environment variable is set, this function returns `false`.
* Unlike getColorEnabledAsync(), this cannot check Cloudflare environment variables.
* @see {@link https://no-color.org/}
*
* @returns {boolean}
*/
function getColorEnabled() {
const { process, Deno } = globalThis;
return !(typeof Deno?.noColor === "boolean" ? Deno.noColor : process !== void 0 ? "NO_COLOR" in process?.env : false);
}
/**
* Get whether color change on terminal is enabled or disabled.
* If `NO_COLOR` environment variable is set, this function returns `false`.
* @see {@link https://no-color.org/}
*
* @returns {boolean}
*/
async function getColorEnabledAsync() {
const { navigator } = globalThis;
const cfWorkers = "cloudflare:workers";
return !(navigator !== void 0 && navigator.userAgent === "Cloudflare-Workers" ? await (async () => {
try {
return "NO_COLOR" in ((await import(cfWorkers)).env ?? {});
} catch {
return false;
}
})() : !getColorEnabled());
}
//#endregion
exports.getColorEnabled = getColorEnabled;
exports.getColorEnabledAsync = getColorEnabledAsync;
@@ -0,0 +1 @@
{"version":3,"file":"grid-2x2.js","sources":["../../../src/icons/grid-2x2.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Grid2x2\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgM3YxOCIgLz4KICA8cGF0aCBkPSJNMyAxMmgxOCIgLz4KICA8cmVjdCB4PSIzIiB5PSIzIiB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHJ4PSIyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/grid-2x2\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Grid2x2 = createLucideIcon('Grid2x2', [\n ['path', { d: 'M12 3v18', key: '108xh3' }],\n ['path', { d: 'M3 12h18', key: '1i2n21' }],\n ['rect', { x: '3', y: '3', width: '18', height: '18', rx: '2', key: 'h1oib' }],\n]);\n\nexport default Grid2x2;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAG,KAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,QAAQ,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,SAAS,CAAA;AAC/E,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,43 @@
import {IdentifierRole} from "../parser/tokenizer";
import {TokenType, TokenType as tt} from "../parser/tokenizer/types";
import {startsWithLowerCase} from "../transformers/JSXTransformer";
import getJSXPragmaInfo from "./getJSXPragmaInfo";
export function getNonTypeIdentifiers(tokens, options) {
const jsxPragmaInfo = getJSXPragmaInfo(options);
const nonTypeIdentifiers = new Set();
for (let i = 0; i < tokens.tokens.length; i++) {
const token = tokens.tokens[i];
if (
token.type === tt.name &&
!token.isType &&
(token.identifierRole === IdentifierRole.Access ||
token.identifierRole === IdentifierRole.ObjectShorthand ||
token.identifierRole === IdentifierRole.ExportAccess) &&
!token.shadowsGlobal
) {
nonTypeIdentifiers.add(tokens.identifierNameForToken(token));
}
if (token.type === tt.jsxTagStart) {
nonTypeIdentifiers.add(jsxPragmaInfo.base);
}
if (
token.type === tt.jsxTagStart &&
i + 1 < tokens.tokens.length &&
tokens.tokens[i + 1].type === tt.jsxTagEnd
) {
nonTypeIdentifiers.add(jsxPragmaInfo.base);
nonTypeIdentifiers.add(jsxPragmaInfo.fragmentBase);
}
if (token.type === tt.jsxName && token.identifierRole === IdentifierRole.Access) {
const identifierName = tokens.identifierNameForToken(token);
// Lower-case single-component tag names like "div" don't count.
if (!startsWithLowerCase(identifierName) || tokens.tokens[i + 1].type === TokenType.dot) {
nonTypeIdentifiers.add(tokens.identifierNameForToken(token));
}
}
}
return nonTypeIdentifiers;
}
@@ -0,0 +1 @@
{"version":3,"file":"utils.mjs","sources":["../../../../src/components/AnimatePresence/utils.ts"],"sourcesContent":["import { isValidElement, Children, ReactElement, ReactNode } from \"react\"\n\nexport type ComponentKey = string | number\n\nexport const getChildKey = (child: ReactElement<any>): ComponentKey =>\n child.key || \"\"\n\nexport function onlyElements(children: ReactNode): ReactElement<any>[] {\n const filtered: ReactElement<any>[] = []\n\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child)) filtered.push(child)\n })\n\n return filtered\n}\n"],"names":[],"mappings":";;AAIO,MAAM,WAAW,GAAG,CAAC,KAAwB,KAChD,KAAK,CAAC,GAAG,IAAI;AAEX,SAAU,YAAY,CAAC,QAAmB,EAAA;IAC5C,MAAM,QAAQ,GAAwB,EAAE;;IAGxC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,KAAI;QACjC,IAAI,cAAc,CAAC,KAAK,CAAC;AAAE,YAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;AACnD,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,QAAQ;AACnB;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/pattern.ts"],"names":[],"mappings":";;AAEA,kCAAkC;AAClC,6CAA0C;AAC1C,mDAA4C;AAI5C,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,uBAAuB,UAAU,GAAG;IAClE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,aAAa,UAAU,GAAG;CACtD,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AAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}
@@ -0,0 +1,7 @@
import { HonoBase as Hono$1, HonoOptions } from "../hono-base.js";
import { BlankEnv, BlankSchema, Env, Schema } from "../types.js";
//#region src/preset/quick.d.ts
export declare class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = '/'> extends Hono$1<E, S, BasePath> {
constructor(options?: HonoOptions<E>);
}
//#endregion
@@ -0,0 +1,7 @@
"use strict";
const constants = require("./constants-DR3SPJ7u.js");
const addMilliseconds = require("./addMilliseconds.js");
function addSeconds(date, seconds) {
return addMilliseconds(date, seconds * constants.MS_IN_SECOND);
}
module.exports = addSeconds;
@@ -0,0 +1 @@
{"version":3,"file":"features-max.mjs","sources":["../../../../src/render/dom/features-max.ts"],"sourcesContent":["\"use client\"\n\nimport { drag } from \"../../motion/features/drag\"\nimport { layout } from \"../../motion/features/layout\"\nimport { FeatureBundle } from \"../../motion/features/types\"\nimport { domAnimation } from \"./features-animation\"\n\n/**\n * @public\n */\nexport const domMax: FeatureBundle = {\n ...domAnimation,\n ...drag,\n ...layout,\n}\n"],"names":[],"mappings":";;;;;AAOA;;AAEG;AACI;AACH;AACA;AACA;;;"}
@@ -0,0 +1,612 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.analyzeChain = analyzeChain;
const utils_1 = require("@typescript-eslint/utils");
const ts_api_utils_1 = require("ts-api-utils");
const ts = __importStar(require("typescript"));
const util_1 = require("../../util");
const checkNullishAndReport_1 = require("./checkNullishAndReport");
const compareNodes_1 = require("./compareNodes");
const gatherLogicalOperands_1 = require("./gatherLogicalOperands");
function includesType(parserServices, node, typeFlagIn) {
const typeFlag = typeFlagIn | ts.TypeFlags.Any | ts.TypeFlags.Unknown;
const types = (0, ts_api_utils_1.unionConstituents)(parserServices.getTypeAtLocation(node));
for (const type of types) {
if ((0, util_1.isTypeFlagSet)(type, typeFlag)) {
return true;
}
}
return false;
}
function isValidAndLastChainOperand(ComparisonValueType, comparisonType, parserServices) {
const type = parserServices.getTypeAtLocation(ComparisonValueType);
const ANY_UNKNOWN_FLAGS = ts.TypeFlags.Any | ts.TypeFlags.Unknown;
const types = (0, ts_api_utils_1.unionConstituents)(type);
switch (comparisonType) {
case gatherLogicalOperands_1.ComparisonType.Equal: {
const isNullish = types.some(t => (0, util_1.isTypeFlagSet)(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Null | ts.TypeFlags.Undefined));
return !isNullish;
}
case gatherLogicalOperands_1.ComparisonType.StrictEqual: {
const isUndefined = types.some(t => (0, util_1.isTypeFlagSet)(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Undefined));
return !isUndefined;
}
case gatherLogicalOperands_1.ComparisonType.NotStrictEqual: {
return types.every(t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Undefined));
}
case gatherLogicalOperands_1.ComparisonType.NotEqual: {
return types.every(t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Undefined | ts.TypeFlags.Null));
}
}
}
function isValidOrLastChainOperand(ComparisonValueType, comparisonType, parserServices) {
const type = parserServices.getTypeAtLocation(ComparisonValueType);
const ANY_UNKNOWN_FLAGS = ts.TypeFlags.Any | ts.TypeFlags.Unknown;
const types = (0, ts_api_utils_1.unionConstituents)(type);
switch (comparisonType) {
case gatherLogicalOperands_1.ComparisonType.NotEqual: {
const isNullish = types.some(t => (0, util_1.isTypeFlagSet)(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Null | ts.TypeFlags.Undefined));
return !isNullish;
}
case gatherLogicalOperands_1.ComparisonType.NotStrictEqual: {
const isUndefined = types.some(t => (0, util_1.isTypeFlagSet)(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Undefined));
return !isUndefined;
}
case gatherLogicalOperands_1.ComparisonType.Equal:
return types.every(t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Undefined | ts.TypeFlags.Null));
case gatherLogicalOperands_1.ComparisonType.StrictEqual:
return types.every(t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Undefined));
}
}
const analyzeAndChainOperand = (parserServices, operand, index, chain) => {
switch (operand.comparisonType) {
case gatherLogicalOperands_1.NullishComparisonType.Boolean:
case gatherLogicalOperands_1.NullishComparisonType.NotEqualNullOrUndefined:
return [operand];
case gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualNull: {
// handle `x !== null && x !== undefined`
const nextOperand = chain.at(index + 1);
if (nextOperand?.comparisonType ===
gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualUndefined &&
(0, compareNodes_1.compareNodes)(operand.comparedName, nextOperand.comparedName) ===
compareNodes_1.NodeComparisonResult.Equal) {
return [operand, nextOperand];
}
if (nextOperand &&
!includesType(parserServices, operand.comparedName, ts.TypeFlags.Undefined)) {
// we know the next operand is not an `undefined` check and that this
// operand includes `undefined` - which means that making this an
// optional chain would change the runtime behavior of the expression
return [operand];
}
return null;
}
case gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualUndefined: {
// handle `x !== undefined && x !== null`
const nextOperand = chain.at(index + 1);
if (nextOperand?.comparisonType ===
gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualNull &&
(0, compareNodes_1.compareNodes)(operand.comparedName, nextOperand.comparedName) ===
compareNodes_1.NodeComparisonResult.Equal) {
return [operand, nextOperand];
}
if (includesType(parserServices, operand.comparedName, ts.TypeFlags.Null)) {
// we know the next operand is not a `null` check and that this
// operand includes `null` - which means that making this an
// optional chain would change the runtime behavior of the expression
return null;
}
return [operand];
}
default:
return null;
}
};
const analyzeOrChainOperand = (parserServices, operand, index, chain) => {
switch (operand.comparisonType) {
case gatherLogicalOperands_1.NullishComparisonType.NotBoolean:
case gatherLogicalOperands_1.NullishComparisonType.EqualNullOrUndefined:
return [operand];
case gatherLogicalOperands_1.NullishComparisonType.StrictEqualNull: {
// handle `x === null || x === undefined`
const nextOperand = chain.at(index + 1);
if (nextOperand?.comparisonType ===
gatherLogicalOperands_1.NullishComparisonType.StrictEqualUndefined &&
(0, compareNodes_1.compareNodes)(operand.comparedName, nextOperand.comparedName) ===
compareNodes_1.NodeComparisonResult.Equal) {
return [operand, nextOperand];
}
if (includesType(parserServices, operand.comparedName, ts.TypeFlags.Undefined)) {
// we know the next operand is not an `undefined` check and that this
// operand includes `undefined` - which means that making this an
// optional chain would change the runtime behavior of the expression
return null;
}
return [operand];
}
case gatherLogicalOperands_1.NullishComparisonType.StrictEqualUndefined: {
// handle `x === undefined || x === null`
const nextOperand = chain.at(index + 1);
if (nextOperand?.comparisonType === gatherLogicalOperands_1.NullishComparisonType.StrictEqualNull &&
(0, compareNodes_1.compareNodes)(operand.comparedName, nextOperand.comparedName) ===
compareNodes_1.NodeComparisonResult.Equal) {
return [operand, nextOperand];
}
if (includesType(parserServices, operand.comparedName, ts.TypeFlags.Null)) {
// we know the next operand is not a `null` check and that this
// operand includes `null` - which means that making this an
// optional chain would change the runtime behavior of the expression
return null;
}
return [operand];
}
default:
return null;
}
};
const resolveOperandSubset = (previousOperand, lastChainOperand) => {
const isNameSubset = (0, compareNodes_1.compareNodes)(previousOperand.comparedName, lastChainOperand.comparedName) === compareNodes_1.NodeComparisonResult.Subset;
if (lastChainOperand.yoda !== gatherLogicalOperands_1.Yoda.Unknown) {
return {
comparedName: lastChainOperand.comparedName,
comparisonValue: lastChainOperand.comparisonValue,
isSubset: isNameSubset,
isYoda: lastChainOperand.yoda === gatherLogicalOperands_1.Yoda.Yes,
};
}
const isValueSubset = (0, compareNodes_1.compareNodes)(previousOperand.comparedName, lastChainOperand.comparisonValue) === compareNodes_1.NodeComparisonResult.Subset;
if (isNameSubset && !isValueSubset) {
return {
comparedName: lastChainOperand.comparedName,
comparisonValue: lastChainOperand.comparisonValue,
isSubset: true,
isYoda: false,
};
}
if (!isNameSubset && isValueSubset) {
return {
comparedName: lastChainOperand.comparisonValue,
comparisonValue: lastChainOperand.comparedName,
isSubset: true,
isYoda: true,
};
}
return {
comparedName: lastChainOperand.comparisonValue,
comparisonValue: lastChainOperand.comparisonValue,
isSubset: false,
isYoda: true,
};
};
/**
* Returns the range that needs to be reported from the chain.
* @param chain The chain of logical expressions.
* @param boundary The boundary range that the range to report cannot fall outside.
* @param sourceCode The source code to get tokens.
* @returns The range to report.
*/
function getReportRange(chain, boundary, sourceCode) {
const leftNode = chain[0].node;
const rightNode = chain[chain.length - 1].node;
let leftMost = (0, util_1.nullThrows)(sourceCode.getFirstToken(leftNode), util_1.NullThrowsReasons.MissingToken('any token', leftNode.type));
let rightMost = (0, util_1.nullThrows)(sourceCode.getLastToken(rightNode), util_1.NullThrowsReasons.MissingToken('any token', rightNode.type));
while (leftMost.range[0] > boundary[0]) {
const token = sourceCode.getTokenBefore(leftMost);
if (!token || !(0, util_1.isOpeningParenToken)(token) || token.range[0] < boundary[0]) {
break;
}
leftMost = token;
}
while (rightMost.range[1] < boundary[1]) {
const token = sourceCode.getTokenAfter(rightMost);
if (!token || !(0, util_1.isClosingParenToken)(token) || token.range[1] > boundary[1]) {
break;
}
rightMost = token;
}
return [leftMost.range[0], rightMost.range[1]];
}
function getReportDescriptor(sourceCode, parserServices, node, operator, options, subChain, lastChain) {
const chain = lastChain ? [...subChain, lastChain] : subChain;
const lastOperand = chain[chain.length - 1];
let useSuggestionFixer;
if (options.allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing ===
true) {
// user has opted-in to the unsafe behavior
useSuggestionFixer = false;
}
// optional chain specifically will union `undefined` into the final type
// so we need to make sure that there is at least one operand that includes
// `undefined`, or else we're going to change the final type - which is
// unsafe and might cause downstream type errors.
else if (lastChain ||
lastOperand.comparisonType === gatherLogicalOperands_1.NullishComparisonType.EqualNullOrUndefined ||
lastOperand.comparisonType ===
gatherLogicalOperands_1.NullishComparisonType.NotEqualNullOrUndefined ||
lastOperand.comparisonType === gatherLogicalOperands_1.NullishComparisonType.StrictEqualUndefined ||
lastOperand.comparisonType ===
gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualUndefined ||
(operator === '||' &&
lastOperand.comparisonType === gatherLogicalOperands_1.NullishComparisonType.NotBoolean)) {
// we know the last operand is an equality check - so the change in types
// DOES NOT matter and will not change the runtime result or cause a type
// check error
useSuggestionFixer = false;
}
else {
useSuggestionFixer = true;
for (const operand of chain) {
if (includesType(parserServices, operand.node, ts.TypeFlags.Undefined)) {
useSuggestionFixer = false;
break;
}
}
// TODO - we could further reduce the false-positive rate of this check by
// checking for cases where the change in types don't matter like
// the test location of an if/while/etc statement.
// but it's quite complex to do this without false-negatives, so
// for now we'll just be over-eager with our matching.
//
// it's MUCH better to false-positive here and only provide a
// suggestion fixer, rather than false-negative and autofix to
// broken code.
}
// In its most naive form we could just slap `?.` for every single part of the
// chain. However this would be undesirable because it'd create unnecessary
// conditions in the user's code where there were none before - and it would
// cause errors with rules like our `no-unnecessary-condition`.
//
// Instead we want to include the minimum number of `?.` required to correctly
// unify the code into a single chain. Naively you might think that we can
// just take the final operand add `?.` after the locations from the previous
// operands - however this won't be correct either because earlier operands
// can include a necessary `?.` that's not needed or included in a later
// operand.
//
// So instead what we need to do is to start at the first operand and
// iteratively diff it against the next operand, and add the difference to the
// first operand.
//
// eg
// `foo && foo.bar && foo.bar.baz?.bam && foo.bar.baz.bam()`
// 1) `foo`
// 2) diff(`foo`, `foo.bar`) = `.bar`
// 3) result = `foo?.bar`
// 4) diff(`foo.bar`, `foo.bar.baz?.bam`) = `.baz?.bam`
// 5) result = `foo?.bar?.baz?.bam`
// 6) diff(`foo.bar.baz?.bam`, `foo.bar.baz.bam()`) = `()`
// 7) result = `foo?.bar?.baz?.bam?.()`
const parts = [];
for (const current of chain) {
const nextOperand = flattenChainExpression(sourceCode, current.comparedName);
const diff = nextOperand.slice(parts.length);
if (diff.length > 0) {
if (parts.length > 0) {
// we need to make the first operand of the diff optional so it matches the
// logic before merging
// foo.bar && foo.bar.baz
// diff = .baz
// result = foo.bar?.baz
diff[0].optional = true;
}
parts.push(...diff);
}
}
let newCode = parts
.map(part => {
let str = '';
if (part.optional) {
str += '?.';
}
else {
if (part.nonNull) {
str += '!';
}
if (part.requiresDot) {
str += '.';
}
}
if (part.precedence !== util_1.OperatorPrecedence.Invalid &&
part.precedence < util_1.OperatorPrecedence.Member) {
str += `(${part.text})`;
}
else {
str += part.text;
}
return str;
})
.join('');
if (lastOperand.node.type === utils_1.AST_NODE_TYPES.BinaryExpression) {
// retain the ending comparison for cases like
// x && x.a != null
// x && typeof x.a !== 'undefined'
const operator = lastOperand.node.operator;
const { left, right } = (() => {
if (lastOperand.isYoda) {
const unaryOperator = lastOperand.node.right.type === utils_1.AST_NODE_TYPES.UnaryExpression
? `${lastOperand.node.right.operator} `
: '';
return {
left: sourceCode.getText(lastOperand.node.left),
right: unaryOperator + newCode,
};
}
const unaryOperator = lastOperand.node.left.type === utils_1.AST_NODE_TYPES.UnaryExpression
? `${lastOperand.node.left.operator} `
: '';
return {
left: unaryOperator + newCode,
right: sourceCode.getText(lastOperand.node.right),
};
})();
newCode = `${left} ${operator} ${right}`;
}
else if (lastOperand.comparisonType === gatherLogicalOperands_1.NullishComparisonType.NotBoolean) {
newCode = `!${newCode}`;
}
const reportRange = getReportRange(chain, node.range, sourceCode);
const fix = fixer => {
let unclosedParens = 0;
const tokensInRange = sourceCode.getTokens(node, {
filter: token => token.range[0] >= reportRange[0] && token.range[1] <= reportRange[1],
});
for (const token of tokensInRange) {
if ((0, util_1.isOpeningParenToken)(token)) {
unclosedParens++;
}
else if ((0, util_1.isClosingParenToken)(token)) {
unclosedParens--;
}
}
if (unclosedParens > 0 && reportRange[1] < node.range[1]) {
const openParensOutsideRange = [];
const unmatchedCloseParens = [];
const tokensOutRange = sourceCode.getTokens(node, {
filter: token => token.range[1] > reportRange[1],
});
for (const token of tokensOutRange) {
if ((0, util_1.isOpeningParenToken)(token)) {
openParensOutsideRange.push(token.range[0]);
}
if ((0, util_1.isClosingParenToken)(token)) {
if (openParensOutsideRange.length > 0) {
openParensOutsideRange.pop();
}
else {
unmatchedCloseParens.push(token.range[0]);
}
}
}
let leftCode = sourceCode.getText(node);
unmatchedCloseParens.reverse();
for (const unmatchedParenIndex of unmatchedCloseParens) {
leftCode =
leftCode.slice(0, unmatchedParenIndex) +
leftCode.slice(unmatchedParenIndex + 1);
}
leftCode = leftCode.slice(reportRange[1]);
return fixer.replaceTextRange(node.range, newCode + leftCode);
}
return fixer.replaceTextRange(reportRange, newCode);
};
return {
loc: {
end: sourceCode.getLocFromIndex(reportRange[1]),
start: sourceCode.getLocFromIndex(reportRange[0]),
},
messageId: 'preferOptionalChain',
...(0, util_1.getFixOrSuggest)({
fixOrSuggest: useSuggestionFixer ? 'suggest' : 'fix',
suggestion: {
fix,
messageId: 'optionalChainSuggest',
},
}),
};
function flattenChainExpression(sourceCode, node) {
switch (node.type) {
case utils_1.AST_NODE_TYPES.ChainExpression:
return flattenChainExpression(sourceCode, node.expression);
case utils_1.AST_NODE_TYPES.CallExpression: {
const argumentsText = (() => {
const closingParenToken = (0, util_1.nullThrows)(sourceCode.getLastToken(node), util_1.NullThrowsReasons.MissingToken('closing parenthesis', node.type));
const openingParenToken = (0, util_1.nullThrows)(sourceCode.getFirstTokenBetween(node.typeArguments ?? node.callee, closingParenToken, util_1.isOpeningParenToken), util_1.NullThrowsReasons.MissingToken('opening parenthesis', node.type));
return sourceCode.text.substring(openingParenToken.range[0], closingParenToken.range[1]);
})();
const typeArgumentsText = (() => {
if (node.typeArguments == null) {
return '';
}
return sourceCode.getText(node.typeArguments);
})();
return [
...flattenChainExpression(sourceCode, node.callee),
{
nonNull: false,
optional: node.optional,
// no precedence for this
precedence: util_1.OperatorPrecedence.Invalid,
requiresDot: false,
text: typeArgumentsText + argumentsText,
},
];
}
case utils_1.AST_NODE_TYPES.MemberExpression: {
const propertyText = sourceCode.getText(node.property);
return [
...flattenChainExpression(sourceCode, node.object),
{
nonNull: node.object.type === utils_1.AST_NODE_TYPES.TSNonNullExpression,
optional: node.optional,
precedence: node.computed
? // computed is already wrapped in [] so no need to wrap in () as well
util_1.OperatorPrecedence.Invalid
: (0, util_1.getOperatorPrecedenceForNode)(node.property),
requiresDot: !node.computed,
text: node.computed ? `[${propertyText}]` : propertyText,
},
];
}
case utils_1.AST_NODE_TYPES.TSNonNullExpression:
return flattenChainExpression(sourceCode, node.expression);
default:
return [
{
nonNull: false,
optional: false,
precedence: (0, util_1.getOperatorPrecedenceForNode)(node),
requiresDot: false,
text: sourceCode.getText(node),
},
];
}
}
}
function analyzeChain(context, parserServices, options, node, operator, chain, lastChainOperand) {
// need at least 2 operands in a chain for it to be a chain
if (chain.length + (lastChainOperand ? 1 : 0) <= 1 ||
/* istanbul ignore next -- previous checks make this unreachable, but keep it for exhaustiveness check */
operator === '??') {
return;
}
const analyzeOperand = (() => {
switch (operator) {
case '&&':
return analyzeAndChainOperand;
case '||':
return analyzeOrChainOperand;
}
})();
// Things like x !== null && x !== undefined have two nodes, but they are
// one logical unit here, so we'll allow them to be grouped.
let subChain = [];
let lastChain = undefined;
const maybeReportThenReset = (newChainSeed) => {
if (subChain.length + (lastChain ? 1 : 0) > 1) {
const subChainFlat = subChain.flat();
const maybeNullishNodes = lastChain
? subChainFlat.map(({ node }) => node)
: subChainFlat.slice(0, -1).map(({ node }) => node);
(0, checkNullishAndReport_1.checkNullishAndReport)(context, parserServices, options, maybeNullishNodes, getReportDescriptor(context.sourceCode, parserServices, node, operator, options, subChainFlat, lastChain));
}
// we've reached the end of a chain of logical expressions
// i.e. the current operand doesn't belong to the previous chain.
//
// we don't want to throw away the current operand otherwise we will skip it
// and that can cause us to miss chains. So instead we seed the new chain
// with the current operand
//
// eg this means we can catch cases like:
// unrelated != null && foo != null && foo.bar != null;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ first "chain"
// ^^^^^^^^^^^ newChainSeed
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ second chain
subChain = newChainSeed ? [newChainSeed] : [];
lastChain = undefined;
};
for (let i = 0; i < chain.length; i += 1) {
const lastOperand = subChain.flat().at(-1);
const operand = chain[i];
const validatedOperands = analyzeOperand(parserServices, operand, i, chain);
if (!validatedOperands) {
// TODO - #7170
// check if the name is a superset/equal - if it is, then it likely
// intended to be part of the chain and something we should include in the
// report, eg
// foo == null || foo.bar;
// ^^^^^^^^^^^ valid OR chain
// ^^^^^^^ invalid OR chain logical, but still part of
// the chain for combination purposes
if (lastOperand) {
const comparisonResult = (0, compareNodes_1.compareNodes)(lastOperand.comparedName, operand.comparedName);
switch (operand.comparisonType) {
case gatherLogicalOperands_1.NullishComparisonType.StrictEqualUndefined:
case gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualUndefined: {
if (comparisonResult === compareNodes_1.NodeComparisonResult.Subset) {
lastChain = operand;
}
break;
}
}
}
maybeReportThenReset();
continue;
}
// in case multiple operands were consumed - make sure to correctly increment the index
i += validatedOperands.length - 1;
const currentOperand = validatedOperands[0];
if (lastOperand) {
const comparisonResult = (0, compareNodes_1.compareNodes)(lastOperand.comparedName,
// purposely inspect and push the last operand because the prior operands don't matter
// this also means we won't false-positive in cases like
// foo !== null && foo !== undefined
validatedOperands[validatedOperands.length - 1].comparedName);
if (comparisonResult === compareNodes_1.NodeComparisonResult.Subset) {
// the operands are comparable, so we can continue searching
subChain.push(currentOperand);
}
else if (comparisonResult === compareNodes_1.NodeComparisonResult.Invalid) {
maybeReportThenReset(validatedOperands);
}
else {
// purposely don't push this case because the node is a no-op and if
// we consider it then we might report on things like
// foo && foo
}
}
else {
subChain.push(currentOperand);
}
}
const lastOperand = subChain.flat().at(-1);
if (lastOperand && lastChainOperand) {
const isValidLastChainOperand = operator === '&&'
? isValidAndLastChainOperand
: isValidOrLastChainOperand;
const { comparedName, comparisonValue, isSubset, isYoda } = resolveOperandSubset(lastOperand, lastChainOperand);
if (isSubset &&
isValidLastChainOperand(comparisonValue, lastChainOperand.comparisonType, parserServices)) {
lastChain = {
...lastChainOperand,
comparedName,
comparisonValue,
isYoda,
};
}
}
// check the leftovers
maybeReportThenReset();
}
@@ -0,0 +1 @@
{"version":3,"names":["_cloneNode","require","cloneWithoutLoc","node","cloneNode"],"sources":["../../src/clone/cloneWithoutLoc.ts"],"sourcesContent":["import cloneNode from \"./cloneNode.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Create a shallow clone of a `node` excluding `_private` and location properties.\n */\nexport default function cloneWithoutLoc<T extends t.Node>(node: T): T {\n return cloneNode(node, /* deep */ false, /* withoutLoc */ true);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAMe,SAASC,eAAeA,CAAmBC,IAAO,EAAK;EACpE,OAAO,IAAAC,kBAAS,EAACD,IAAI,EAAa,KAAK,EAAmB,IAAI,CAAC;AACjE","ignoreList":[]}
@@ -0,0 +1 @@
{"version":3,"file":"jtd.js","sourceRoot":"","sources":["../lib/jtd.ts"],"names":[],"mappings":";;;AAEA,iCAA8C;AAC9C,4CAA8C;AAC9C,kDAA6C;AAC7C,uD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W,IAAI,EAAE,CAAC,CAAA;QACpF,wBAAwB;QACxB,IAAI,CAAC,GAAG,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC/D,OAAO,GAAG,CAAC,SAAS,CAAA;IACtB,CAAC;IAEO,cAAc,CAAC,GAAc;QACnC,eAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,GAAG,CAAC,MAA0B,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;QAChF,wBAAwB;QACxB,IAAI,CAAC,GAAG,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC3D,OAAO,GAAG,CAAC,KAAK,CAAA;IAClB,CAAC;CACF;AAvDD,kBAuDC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAA;AACxB,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAElB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA;AAInD,+DAAqE;AAA7D,mHAAA,OAAO,OAAmB;AAClC,iDAA8D;AAAtD,4GAAA,OAAO,OAAmB"}
@@ -0,0 +1,48 @@
export * from "@tanstack/store";
import { useStore } from "./useStore.js";
function shallow(objA, objB) {
if (Object.is(objA, objB)) {
return true;
}
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
return false;
}
if (objA instanceof Map && objB instanceof Map) {
if (objA.size !== objB.size) return false;
for (const [k, v] of objA) {
if (!objB.has(k) || !Object.is(v, objB.get(k))) return false;
}
return true;
}
if (objA instanceof Set && objB instanceof Set) {
if (objA.size !== objB.size) return false;
for (const v of objA) {
if (!objB.has(v)) return false;
}
return true;
}
if (objA instanceof Date && objB instanceof Date) {
if (objA.getTime() !== objB.getTime()) return false;
return true;
}
const keysA = getOwnKeys(objA);
if (keysA.length !== getOwnKeys(objB).length) {
return false;
}
for (let i = 0; i < keysA.length; i++) {
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return true;
}
function getOwnKeys(obj) {
return Object.keys(obj).concat(
Object.getOwnPropertySymbols(obj)
);
}
export {
shallow,
useStore
};
//# sourceMappingURL=index.js.map
@@ -0,0 +1,629 @@
flf2a$ 6 5 17 -1 16
"Sub-Zero" font by Sub-Zero
==============================
-> Conversion to FigLet font by MEPH. (Part of ASCII Editor Service Pack I)
(http://studenten.freepage.de/meph/ascii/ascii/editor/_index.htm)
-> Defined: ASCII code alphabet
-> Uppercase characters only.
ScarecrowsASCIIArtArchive1.0.txt
From: "Sub-Zero" <bodom@papaya.ucs.indiana.edu>
"Here's a font I've been working on lately. Can someone make the V, Q, and X
look better? Also, the B, P, and R could use an improvement too.
Oh, here it is."
$$$@
$$$@
$$$@
$$$@
$$$@
$$$@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
______ @
/\ __ \ @
\ \ __ \ @
\ \_\ \_\ @
\/_/\/_/ @
@@
______ @
/\ == \ @
\ \ __< @
\ \_____\ @
\/_____/ @
@@
______ @
/\ ___\ @
\ \ \____ @
\ \_____\ @
\/_____/ @
@@
_____ @
/\ __-. @
\ \ \/\ \ @
\ \____- @
\/____/ @
@@
______ @
/\ ___\ @
\ \ __\ @
\ \_____\ @
\/_____/ @
@@
______ @
/\ ___\ @
\ \ __\ @
\ \_\ @
\/_/ @
@@
______ @
/\ ___\ @
\ \ \__ \ @
\ \_____\ @
\/_____/ @
@@
__ __ @
/\ \_\ \ @
\ \ __ \ @
\ \_\ \_\ @
\/_/\/_/ @
@@
__ @
/\ \ @
\ \ \ @
\ \_\ @
\/_/ @
@@
__ @
/\ \ @
_\_\ \ @
/\_____\ @
\/_____/ @
@@
__ __ @
/\ \/ / @
\ \ _"-. @
\ \_\ \_\ @
\/_/\/_/ @
@@
__ @
/\ \ @
\ \ \____ @
\ \_____\ @
\/_____/ @
@@
__ __ @
/\ "-./ \ @
\ \ \-./\ \ @
\ \_\ \ \_\ @
\/_/ \/_/ @
@@
__ __ @
/\ "-.\ \ @
\ \ \-. \ @
\ \_\\"\_\ @
\/_/ \/_/ @
@@
______ @
/\ __ \ @
\ \ \/\ \ @
\ \_____\ @
\/_____/ @
@@
______ @
/\ == \ @
\ \ _-/ @
\ \_\ @
\/_/ @
@@
______ @
/\ __ \ @
\ \ \/\_\ @
\ \___\_\ @
\/___/_/ @
@@
______ @
/\ == \ @
\ \ __< @
\ \_\ \_\ @
\/_/ /_/ @
@@
______ @
/\ ___\ @
\ \___ \ @
\/\_____\ @
\/_____/ @
@@
______ @
/\__ _\ @
\/_/\ \/ @
\ \_\ @
\/_/ @
@@
__ __ @
/\ \/\ \ @
\ \ \_\ \ @
\ \_____\ @
\/_____/ @
@@
__ __ @
/\ \ / / @
\ \ \'/ @
\ \__| @
\/_/ @
@@
__ __ @
/\ \ _ \ \ @
\ \ \/ ".\ \ @
\ \__/".~\_\ @
\/_/ \/_/ @
@@
__ __ @
/\_\_\_\ @
\/_/\_\/_ @
/\_\/\_\ @
\/_/\/_/ @
@@
__ __ @
/\ \_\ \ @
\ \____ \ @
\/\_____\ @
\/_____/ @
@@
______ @
/\___ \ @
\/_/ /__ @
/\_____\ @
\/_____/ @
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
______ @
/\ __ \ @
\ \ __ \ @
\ \_\ \_\ @
\/_/\/_/ @
@@
______ @
/\ == \ @
\ \ __< @
\ \_____\ @
\/_____/ @
@@
______ @
/\ ___\ @
\ \ \____ @
\ \_____\ @
\/_____/ @
@@
_____ @
/\ __-. @
\ \ \/\ \ @
\ \____- @
\/____/ @
@@
______ @
/\ ___\ @
\ \ __\ @
\ \_____\ @
\/_____/ @
@@
______ @
/\ ___\ @
\ \ __\ @
\ \_\ @
\/_/ @
@@
______ @
/\ ___\ @
\ \ \__ \ @
\ \_____\ @
\/_____/ @
@@
__ __ @
/\ \_\ \ @
\ \ __ \ @
\ \_\ \_\ @
\/_/\/_/ @
@@
__ @
/\ \ @
\ \ \ @
\ \_\ @
\/_/ @
@@
__ @
/\ \ @
_\_\ \ @
/\_____\ @
\/_____/ @
@@
__ __ @
/\ \/ / @
\ \ _"-. @
\ \_\ \_\ @
\/_/\/_/ @
@@
__ @
/\ \ @
\ \ \____ @
\ \_____\ @
\/_____/ @
@@
__ __ @
/\ "-./ \ @
\ \ \-./\ \ @
\ \_\ \ \_\ @
\/_/ \/_/ @
@@
__ __ @
/\ "-.\ \ @
\ \ \-. \ @
\ \_\\"\_\ @
\/_/ \/_/ @
@@
______ @
/\ __ \ @
\ \ \/\ \ @
\ \_____\ @
\/_____/ @
@@
______ @
/\ == \ @
\ \ _-/ @
\ \_\ @
\/_/ @
@@
______ @
/\ __ \ @
\ \ \/\_\ @
\ \___\_\ @
\/___/_/ @
@@
______ @
/\ == \ @
\ \ __< @
\ \_\ \_\ @
\/_/ /_/ @
@@
______ @
/\ ___\ @
\ \___ \ @
\/\_____\ @
\/_____/ @
@@
______ @
/\__ _\ @
\/_/\ \/ @
\ \_\ @
\/_/ @
@@
__ __ @
/\ \/\ \ @
\ \ \_\ \ @
\ \_____\ @
\/_____/ @
@@
__ __ @
/\ \ / / @
\ \ \'/ @
\ \__| @
\/_/ @
@@
__ __ @
/\ \ _ \ \ @
\ \ \/ ".\ \ @
\ \__/".~\_\ @
\/_/ \/_/ @
@@
__ __ @
/\_\_\_\ @
\/_/\_\/_ @
/\_\/\_\ @
\/_/\/_/ @
@@
__ __ @
/\ \_\ \ @
\ \____ \ @
\/\_____\ @
\/_____/ @
@@
______ @
/\___ \ @
\/_/ /__ @
/\_____\ @
\/_____/ @
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
@
@
@@
@@ -0,0 +1,525 @@
flf2a$ 5 4 15 0 14
Thick by Randall Ransom 2/94
Figlet release 2.0 -- August 5, 1993
Date: 5 Mar 1994
Explanation of first line:
flf2 - "magic number" for file identification
a - should always be `a', for now
$ - the "hardblank" -- prints as a blank, but can't be smushed
5 - height of a character
4 - height of a character, not including descenders
15 - max line length (excluding comment lines) + a fudge factor
0 - default smushmode for this font (like "-m 0" on command line)
14 - number of comment lines
$$$@
$$$@
$$$@
$$$@
$$$@@
8$@
8$@
"$@
w$@
$$@@
w w$@
" "$@
$ $$@
$ $$@
$ $$@@
8 8 $@
w8ww8w$@
w8ww8w$@
8 8 $@
$@@
.w8w.$@
"w8 "$@
8w $@
"w8w"$@
" $@@
o dP$@
dP $@
dP $@
dP o$@
$@@
dP8P$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8$@
8 8 8$@
$@@
$@
8d8b.$@
8P Y8$@
8 8$@
$@@
$@
.d8b.$@
8' .8$@
`Y8P'$@
$@@
$@
88b.$@
8 8$@
88P'$@
8 $@@
$@
.d88 $@
8 8 $@
`Y88 $@
8P$@@
$@
8d8b$@
8P $@
8 $@
$@@
$@
d88b$@
`Yb.$@
Y88P$@
$@@
w $@
w8ww$@
8 $@
Y8P$@
$@@
$@
8 8$@
8b d8$@
`Y8P8$@
$@@
$@
Yb dP$@
YbdP $@
YP $@
$@@
$@
Yb db dP$@
YbdPYbdP $@
YP YP $@
$@@
$@
Yb dP$@
`8. $@
dP Yb$@
$@@
$@
Yb dP$@
YbdP $@
dP $@
dP $@@
$@
888P$@
dP $@
d888$@
$@@
.dP$@
8P $@
w' $@
8b $@
'Yb$@@
8$@
8$@
8$@
8$@
8$@@
Yb. $@
Y8 $@
`w$@
d8 $@
dP' $@@
dPYb dP$@
dP YbdP $@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
@@ -0,0 +1,95 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const codegen_1 = require("../../compile/codegen");
const util_1 = require("../../compile/util");
const error = {
message: ({ params: { min, max } }) => max === undefined
? (0, codegen_1.str) `must contain at least ${min} valid item(s)`
: (0, codegen_1.str) `must contain at least ${min} and no more than ${max} valid item(s)`,
params: ({ params: { min, max } }) => max === undefined ? (0, codegen_1._) `{minContains: ${min}}` : (0, codegen_1._) `{minContains: ${min}, maxContains: ${max}}`,
};
const def = {
keyword: "contains",
type: "array",
schemaType: ["object", "boolean"],
before: "uniqueItems",
trackErrors: true,
error,
code(cxt) {
const { gen, schema, parentSchema, data, it } = cxt;
let min;
let max;
const { minContains, maxContains } = parentSchema;
if (it.opts.next) {
min = minContains === undefined ? 1 : minContains;
max = maxContains;
}
else {
min = 1;
}
const len = gen.const("len", (0, codegen_1._) `${data}.length`);
cxt.setParams({ min, max });
if (max === undefined && min === 0) {
(0, util_1.checkStrictMode)(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`);
return;
}
if (max !== undefined && min > max) {
(0, util_1.checkStrictMode)(it, `"minContains" > "maxContains" is always invalid`);
cxt.fail();
return;
}
if ((0, util_1.alwaysValidSchema)(it, schema)) {
let cond = (0, codegen_1._) `${len} >= ${min}`;
if (max !== undefined)
cond = (0, codegen_1._) `${cond} && ${len} <= ${max}`;
cxt.pass(cond);
return;
}
it.items = true;
const valid = gen.name("valid");
if (max === undefined && min === 1) {
validateItems(valid, () => gen.if(valid, () => gen.break()));
}
else if (min === 0) {
gen.let(valid, true);
if (max !== undefined)
gen.if((0, codegen_1._) `${data}.length > 0`, validateItemsWithCount);
}
else {
gen.let(valid, false);
validateItemsWithCount();
}
cxt.result(valid, () => cxt.reset());
function validateItemsWithCount() {
const schValid = gen.name("_valid");
const count = gen.let("count", 0);
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
}
function validateItems(_valid, block) {
gen.forRange("i", 0, len, (i) => {
cxt.subschema({
keyword: "contains",
dataProp: i,
dataPropType: util_1.Type.Num,
compositeRule: true,
}, _valid);
block();
});
}
function checkLimits(count) {
gen.code((0, codegen_1._) `${count}++`);
if (max === undefined) {
gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true).break());
}
else {
gen.if((0, codegen_1._) `${count} > ${max}`, () => gen.assign(valid, false).break());
if (min === 1)
gen.assign(valid, true);
else
gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true));
}
}
},
};
exports.default = def;
//# sourceMappingURL=contains.js.map
@@ -0,0 +1,68 @@
{
"name": "baseline-browser-mapping",
"main": "./dist/index.cjs",
"version": "2.11.0",
"description": "A library for obtaining browser versions with their maximum supported Baseline feature set and Widely Available status.",
"exports": {
".": {
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./legacy": {
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}
},
"jsdelivr": "./dist/index.js",
"files": [
"dist/*",
"!dist/scripts/*",
"LICENSE.txt",
"README.md"
],
"types": "./dist/index.d.ts",
"type": "module",
"bin": {
"baseline-browser-mapping": "dist/cli.cjs"
},
"engines": {
"node": ">=6.0.0"
},
"scripts": {
"fix-cli-permissions": "output=$(npx baseline-browser-mapping 2>&1); path=$(printf '%s\n' \"$output\" | sed -n 's/^.*: \\(.*\\): Permission denied$/\\1/p; t; s/^\\(.*\\): Permission denied$/\\1/p'); if [ -n \"$path\" ]; then echo \"Permission denied for: $path\"; echo \"Removing $path ...\"; rm -rf \"$path\"; else echo \"$output\"; fi",
"test:format": "npx prettier --check .",
"test:lint": "npx eslint .",
"test:legacy-test": "node spec/legacy-tests/legacy-test.cjs; node dist/cli.cjs",
"test:jasmine": "npx jasmine",
"test:jasmine-browser": "npx jasmine-browser-runner runSpecs --config ./spec/support/jasmine-browser.js",
"test": "npm run build && npm run fix-cli-permissions && npm run test:format && npm run test:lint && npm run test:jasmine && npm run test:jasmine-browser",
"build": "rm -rf dist; npx prettier . --write; rollup -c; rm -rf ./dist/scripts/expose-data.d.ts ./dist/cli.d.ts",
"refresh-downstream": "npx tsx scripts/refresh-downstream.ts",
"refresh-static": "npx tsx scripts/refresh-static.ts",
"update-timeline": "npx tsx scripts/create-timeline.ts; npx prettier ./src/data/timeline.js --write",
"update-data-dependencies": "npm i @mdn/browser-compat-data@latest web-features@latest -D",
"check-timeline-changes": "git diff --name-only | grep -q '^src/data/timeline.js$' && echo 'changes-available=TRUE' || echo 'changes-available=FALSE'"
},
"license": "Apache-2.0",
"devDependencies": {
"@mdn/browser-compat-data": "^8.0.7",
"@rollup/plugin-terser": "^1.0.0",
"@rollup/plugin-typescript": "^12.1.3",
"@types/node": "^22.19.21",
"eslint-plugin-new-with-error": "^5.0.0",
"jasmine": "^5.8.0",
"jasmine-browser-runner": "^3.0.0",
"jasmine-spec-reporter": "^7.0.0",
"prettier": "^3.5.3",
"rollup": "^4.44.0",
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.35.0",
"web-features": "^3.34.1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/web-platform-dx/baseline-browser-mapping.git"
}
}
@@ -0,0 +1,333 @@
/**
* @fileoverview Traverser for SourceCode objects.
* @author Nicholas C. Zakas
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const { parse, matches } = require("./esquery");
const vk = require("eslint-visitor-keys");
//-----------------------------------------------------------------------------
// Typedefs
//-----------------------------------------------------------------------------
/**
* @import { Language, SourceCode } from "@eslint/core";
* @import { ESQueryOptions } from "esquery";
* @import { ESQueryParsedSelector } from "./esquery.js";
* @import { SourceCodeVisitor } from "./source-code-visitor.js";
*/
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
const STEP_KIND_VISIT = 1;
const STEP_KIND_CALL = 2;
/**
* Compares two ESQuery selectors by specificity.
* @param {ESQueryParsedSelector} a The first selector to compare.
* @param {ESQueryParsedSelector} b The second selector to compare.
* @returns {number} A negative number if `a` is less specific than `b` or they are equally specific and `a` <= `b` alphabetically, a positive number if `a` is more specific than `b`.
*/
function compareSpecificity(a, b) {
return a.compare(b);
}
/**
* Helper to wrap ESQuery operations.
*/
class ESQueryHelper {
/**
* Creates a new instance.
* @param {SourceCodeVisitor} visitor The visitor containing the functions to call.
* @param {ESQueryOptions} esqueryOptions `esquery` options for traversing custom nodes.
*/
constructor(visitor, esqueryOptions) {
/**
* The visitor to use during traversal.
* @type {SourceCodeVisitor}
*/
this.visitor = visitor;
/**
* The options for `esquery` to use during matching.
* @type {ESQueryOptions}
*/
this.esqueryOptions = esqueryOptions;
/**
* A map of node type to selectors targeting that node type on the
* enter phase of traversal.
* @type {Map<string, ESQueryParsedSelector[]>}
*/
this.enterSelectorsByNodeType = new Map();
/**
* A map of node type to selectors targeting that node type on the
* exit phase of traversal.
* @type {Map<string, ESQueryParsedSelector[]>}
*/
this.exitSelectorsByNodeType = new Map();
/**
* An array of selectors that match any node type on the
* enter phase of traversal.
* @type {ESQueryParsedSelector[]}
*/
this.anyTypeEnterSelectors = [];
/**
* An array of selectors that match any node type on the
* exit phase of traversal.
* @type {ESQueryParsedSelector[]}
*/
this.anyTypeExitSelectors = [];
visitor.forEachName(rawSelector => {
const selector = parse(rawSelector);
/*
* If this selector has identified specific node types,
* add it to the map for these node types for faster lookup.
*/
if (selector.nodeTypes) {
const typeMap = selector.isExit
? this.exitSelectorsByNodeType
: this.enterSelectorsByNodeType;
selector.nodeTypes.forEach(nodeType => {
if (!typeMap.has(nodeType)) {
typeMap.set(nodeType, []);
}
typeMap.get(nodeType).push(selector);
});
return;
}
/*
* Remaining selectors are added to the "any type" selectors
* list for the appropriate phase of traversal. This ensures
* that all selectors will still be applied even if no
* specific node type is matched.
*/
const selectors = selector.isExit
? this.anyTypeExitSelectors
: this.anyTypeEnterSelectors;
selectors.push(selector);
});
// sort all selectors by specificity for prioritizing call order
this.anyTypeEnterSelectors.sort(compareSpecificity);
this.anyTypeExitSelectors.sort(compareSpecificity);
this.enterSelectorsByNodeType.forEach(selectorList =>
selectorList.sort(compareSpecificity),
);
this.exitSelectorsByNodeType.forEach(selectorList =>
selectorList.sort(compareSpecificity),
);
}
/**
* Checks if a node matches a given selector.
* @param {ASTNode} node The node to check
* @param {ASTNode[]} ancestry The ancestry of the node being checked.
* @param {ESQueryParsedSelector} selector An AST selector descriptor
* @returns {boolean} `true` if the selector matches the node, `false` otherwise
*/
matches(node, ancestry, selector) {
return matches(node, selector.root, ancestry, this.esqueryOptions);
}
/**
* Calculates all appropriate selectors to a node, in specificity order
* @param {ASTNode} node The node to check
* @param {ASTNode[]} ancestry The ancestry of the node being checked.
* @param {boolean} isExit `false` if the node is currently being entered, `true` if it's currently being exited
* @returns {string[]} An array of selectors that match the node.
*/
calculateSelectors(node, ancestry, isExit) {
const nodeTypeKey = this.esqueryOptions?.nodeTypeKey || "type";
const selectors = [];
/*
* Get the selectors that may match this node. First, check
* to see if the node type has specific selectors,
* then gather the "any type" selectors.
*/
const selectorsByNodeType =
(isExit
? this.exitSelectorsByNodeType
: this.enterSelectorsByNodeType
).get(node[nodeTypeKey]) || [];
const anyTypeSelectors = isExit
? this.anyTypeExitSelectors
: this.anyTypeEnterSelectors;
/*
* selectorsByNodeType and anyTypeSelectors were already sorted by specificity in the constructor.
* Iterate through each of them, applying selectors in the right order.
*/
let selectorsByNodeTypeIndex = 0;
let anyTypeSelectorsIndex = 0;
while (
selectorsByNodeTypeIndex < selectorsByNodeType.length ||
anyTypeSelectorsIndex < anyTypeSelectors.length
) {
/*
* If we've already exhausted the selectors for this node type,
* or if the next any type selector is more specific than the
* next selector for this node type, apply the any type selector.
*/
const hasMoreNodeTypeSelectors =
selectorsByNodeTypeIndex < selectorsByNodeType.length;
const hasMoreAnyTypeSelectors =
anyTypeSelectorsIndex < anyTypeSelectors.length;
const anyTypeSelector = anyTypeSelectors[anyTypeSelectorsIndex];
const nodeTypeSelector =
selectorsByNodeType[selectorsByNodeTypeIndex];
// Only compare specificity if both selectors exist
const isAnyTypeSelectorLessSpecific =
hasMoreAnyTypeSelectors &&
hasMoreNodeTypeSelectors &&
anyTypeSelector.compare(nodeTypeSelector) < 0;
if (!hasMoreNodeTypeSelectors || isAnyTypeSelectorLessSpecific) {
anyTypeSelectorsIndex++;
if (this.matches(node, ancestry, anyTypeSelector)) {
selectors.push(anyTypeSelector.source);
}
} else {
selectorsByNodeTypeIndex++;
if (this.matches(node, ancestry, nodeTypeSelector)) {
selectors.push(nodeTypeSelector.source);
}
}
}
return selectors;
}
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
/**
* Traverses source code and ensures that visitor methods are called when
* entering and leaving each node.
*/
class SourceCodeTraverser {
/**
* The language of the source code being traversed.
* @type {Language}
*/
#language;
/**
* Map of languages to instances of this class.
* @type {WeakMap<Language, SourceCodeTraverser>}
*/
static instances = new WeakMap();
/**
* Creates a new instance.
* @param {Language} language The language of the source code being traversed.
*/
constructor(language) {
this.#language = language;
}
static getInstance(language) {
if (!this.instances.has(language)) {
this.instances.set(language, new this(language));
}
return this.instances.get(language);
}
/**
* Traverses the given source code synchronously.
* @param {SourceCode} sourceCode The source code to traverse.
* @param {SourceCodeVisitor} visitor The emitter to use for events.
* @param {Object} options Options for traversal.
* @param {ReturnType<SourceCode["traverse"]>} options.steps The steps to take during traversal.
* @returns {void}
* @throws {Error} If an error occurs during traversal.
*/
traverseSync(sourceCode, visitor, { steps } = {}) {
const esquery = new ESQueryHelper(visitor, {
visitorKeys: sourceCode.visitorKeys ?? this.#language.visitorKeys,
fallback: vk.getKeys,
matchClass: this.#language.matchesSelectorClass ?? (() => false),
nodeTypeKey: this.#language.nodeTypeKey,
});
const currentAncestry = [];
for (const step of steps ?? sourceCode.traverse()) {
switch (step.kind) {
case STEP_KIND_VISIT: {
try {
if (step.phase === 1) {
esquery
.calculateSelectors(
step.target,
currentAncestry,
false,
)
.forEach(selector => {
visitor.callSync(
selector,
...(step.args ?? [step.target]),
);
});
currentAncestry.unshift(step.target);
} else {
currentAncestry.shift();
esquery
.calculateSelectors(
step.target,
currentAncestry,
true,
)
.forEach(selector => {
visitor.callSync(
selector,
...(step.args ?? [step.target]),
);
});
}
} catch (err) {
err.currentNode = step.target;
throw err;
}
break;
}
case STEP_KIND_CALL: {
visitor.callSync(step.target, ...step.args);
break;
}
default:
throw new Error(
`Invalid traversal step found: "${step.kind}".`,
);
}
}
}
}
module.exports = { SourceCodeTraverser };
@@ -0,0 +1 @@
{"version":3,"file":"hand-metal.js","sources":["../../../src/icons/hand-metal.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name HandMetal\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTggMTIuNVYxMGEyIDIgMCAwIDAtMi0yYTIgMiAwIDAgMC0yIDJ2MS40IiAvPgogIDxwYXRoIGQ9Ik0xNCAxMVY5YTIgMiAwIDEgMC00IDB2MiIgLz4KICA8cGF0aCBkPSJNMTAgMTAuNVY1YTIgMiAwIDEgMC00IDB2OSIgLz4KICA8cGF0aCBkPSJtNyAxNS0xLjc2LTEuNzZhMiAyIDAgMCAwLTIuODMgMi44MmwzLjYgMy42QzcuNSAyMS4xNCA5LjIgMjIgMTIgMjJoMmE4IDggMCAwIDAgOC04VjdhMiAyIDAgMSAwLTQgMHY1IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/hand-metal\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst HandMetal = createLucideIcon('HandMetal', [\n ['path', { d: 'M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4', key: 'wc6myp' }],\n ['path', { d: 'M14 11V9a2 2 0 1 0-4 0v2', key: '94qvcw' }],\n ['path', { d: 'M10 10.5V5a2 2 0 1 0-4 0v9', key: 'm1ah89' }],\n [\n 'path',\n {\n d: 'm7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5',\n key: 't1skq1',\n },\n ],\n]);\n\nexport default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CAAA;AAAA,CAC3D,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,140 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const util = __importStar(require("../core/util.cjs"));
const error = () => {
const Sizable = {
string: { unit: "teikn", verb: "å ha" },
file: { unit: "bytes", verb: "å ha" },
array: { unit: "element", verb: "å innehalde" },
set: { unit: "element", verb: "å innehalde" },
map: { unit: "element", verb: "å innehalde" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "e-postadresse",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO dato- og klokkeslett",
date: "ISO-dato",
time: "ISO-klokkeslett",
duration: "ISO-varigheit",
ipv4: "IPv4-adresse",
ipv6: "IPv6-adresse",
mac: "MAC-adresse",
cidrv4: "IPv4-spekter",
cidrv6: "IPv6-spekter",
base64: "base64-enkoda streng",
base64url: "base64url-enkoda streng",
json_string: "JSON-streng",
e164: "E.164-nummer",
credit_card: "kredittkortnummer",
currency_code: "valutakode",
iban: "IBAN",
jwt: "JWT",
template_literal: "input",
};
const TypeDictionary = {
nan: "NaN",
number: "tal",
array: "liste",
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue.expected)) {
return `Ugyldig input: forventa instanceof ${issue.expected}, fekk ${received}`;
}
return `Ugyldig input: forventa ${expected}, fekk ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Ugyldig verdi: forventa ${util.stringifyPrimitive(issue.values[0])}`;
return `Ugyldig val: forventa eitt av ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `For stor(t): forventa ${issue.origin ?? "value"} til å ha ${adj}${issue.maximum.toString()} ${sizing.unit ?? "element"}`;
return `For stor(t): forventa ${issue.origin ?? "value"} til å ha ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `For lite(n): forventa ${issue.origin} til å ha ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `For lite(n): forventa ${issue.origin} til å ha ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `Ugyldig streng: må starte med "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Ugyldig streng: må slutte med "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Ugyldig streng: må innehalde "${_issue.includes}"`;
if (_issue.format === "regex")
return `Ugyldig streng: må matche mønsteret ${_issue.pattern}`;
return `Ugyldig ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Ugyldig tal: må vere eit multiplum av ${issue.divisor}`;
case "unrecognized_keys":
return `${issue.keys.length > 1 ? "Ukjende nøklar" : "Ukjend nøkkel"}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Ugyldig nøkkel i ${issue.origin}`;
case "invalid_union":
return "Ugyldig input";
case "invalid_element":
return `Ugyldig verdi i ${issue.origin}`;
default:
return `Ugyldig input`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
module.exports = exports.default;
@@ -0,0 +1,3 @@
import type { Vocabulary } from "../types";
declare const draft2020Vocabularies: Vocabulary[];
export default draft2020Vocabularies;
@@ -0,0 +1,21 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Omega = createLucideIcon("Omega", [
[
"path",
{
d: "M3 20h4.5a.5.5 0 0 0 .5-.5v-.282a.52.52 0 0 0-.247-.437 8 8 0 1 1 8.494-.001.52.52 0 0 0-.247.438v.282a.5.5 0 0 0 .5.5H21",
key: "1x94xo"
}
]
]);
export { Omega as default };
//# sourceMappingURL=omega.js.map
@@ -0,0 +1,248 @@
/**
* @fileoverview Disallow reassigning function parameters.
* @author Nat Burns
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
const stopNodePattern =
/(?:Statement|Declaration|Function(?:Expression)?|Program)$/u;
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow reassigning function parameters",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-param-reassign",
},
schema: [
{
oneOf: [
{
type: "object",
properties: {
props: {
enum: [false],
},
},
additionalProperties: false,
},
{
type: "object",
properties: {
props: {
enum: [true],
},
ignorePropertyModificationsFor: {
type: "array",
items: {
type: "string",
},
uniqueItems: true,
},
ignorePropertyModificationsForRegex: {
type: "array",
items: {
type: "string",
},
uniqueItems: true,
},
},
additionalProperties: false,
},
],
},
],
messages: {
assignmentToFunctionParam:
"Assignment to function parameter '{{name}}'.",
assignmentToFunctionParamProp:
"Assignment to property of function parameter '{{name}}'.",
},
},
create(context) {
const props = context.options[0] && context.options[0].props;
const ignoredPropertyAssignmentsFor =
(context.options[0] &&
context.options[0].ignorePropertyModificationsFor) ||
[];
const ignoredPropertyAssignmentsForRegex =
(context.options[0] &&
context.options[0].ignorePropertyModificationsForRegex) ||
[];
const sourceCode = context.sourceCode;
/**
* Checks whether or not the reference modifies properties of its variable.
* @param {Reference} reference A reference to check.
* @returns {boolean} Whether or not the reference modifies properties of its variable.
*/
function isModifyingProp(reference) {
let node = reference.identifier;
let parent = node.parent;
while (
parent &&
(!stopNodePattern.test(parent.type) ||
parent.type === "ForInStatement" ||
parent.type === "ForOfStatement")
) {
switch (parent.type) {
// e.g. foo.a = 0;
case "AssignmentExpression":
return parent.left === node;
// e.g. ++foo.a;
case "UpdateExpression":
return true;
// e.g. delete foo.a;
case "UnaryExpression":
if (parent.operator === "delete") {
return true;
}
break;
// e.g. for (foo.a in b) {}
case "ForInStatement":
case "ForOfStatement":
if (parent.left === node) {
return true;
}
// this is a stop node for parent.right and parent.body
return false;
// EXCLUDES: e.g. cache.get(foo.a).b = 0;
case "CallExpression":
if (parent.callee !== node) {
return false;
}
break;
// EXCLUDES: e.g. cache[foo.a] = 0;
case "MemberExpression":
if (parent.property === node) {
return false;
}
break;
// EXCLUDES: e.g. ({ [foo]: a }) = bar;
case "Property":
if (parent.key === node) {
return false;
}
break;
// EXCLUDES: e.g. (foo ? a : b).c = bar;
case "ConditionalExpression":
if (parent.test === node) {
return false;
}
break;
// no default
}
node = parent;
parent = node.parent;
}
return false;
}
/**
* Tests that an identifier name matches any of the ignored property assignments.
* First we test strings in ignoredPropertyAssignmentsFor.
* Then we instantiate and test RegExp objects from ignoredPropertyAssignmentsForRegex strings.
* @param {string} identifierName A string that describes the name of an identifier to
* ignore property assignments for.
* @returns {boolean} Whether the string matches an ignored property assignment regular expression or not.
*/
function isIgnoredPropertyAssignment(identifierName) {
return (
ignoredPropertyAssignmentsFor.includes(identifierName) ||
ignoredPropertyAssignmentsForRegex.some(ignored =>
new RegExp(ignored, "u").test(identifierName),
)
);
}
/**
* Reports a reference if is non initializer and writable.
* @param {Reference} reference A reference to check.
* @param {number} index The index of the reference in the references.
* @param {Reference[]} references The array that the reference belongs to.
* @returns {void}
*/
function checkReference(reference, index, references) {
const identifier = reference.identifier;
if (
identifier &&
!reference.init &&
/*
* Destructuring assignments can have multiple default value,
* so possibly there are multiple writeable references for the same identifier.
*/
(index === 0 || references[index - 1].identifier !== identifier)
) {
if (reference.isWrite()) {
context.report({
node: identifier,
messageId: "assignmentToFunctionParam",
data: { name: identifier.name },
});
} else if (
props &&
isModifyingProp(reference) &&
!isIgnoredPropertyAssignment(identifier.name)
) {
context.report({
node: identifier,
messageId: "assignmentToFunctionParamProp",
data: { name: identifier.name },
});
}
}
}
/**
* Finds and reports references that are non initializer and writable.
* @param {Variable} variable A variable to check.
* @returns {void}
*/
function checkVariable(variable) {
if (variable.defs[0].type === "Parameter") {
variable.references.forEach(checkReference);
}
}
/**
* Checks parameters of a given function node.
* @param {ASTNode} node A function node to check.
* @returns {void}
*/
function checkForFunction(node) {
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
}
return {
// `:exit` is needed for the `node.parent` property of identifier nodes.
"FunctionDeclaration:exit": checkForFunction,
"FunctionExpression:exit": checkForFunction,
"ArrowFunctionExpression:exit": checkForFunction,
};
},
};
@@ -0,0 +1,278 @@
# flat-cache - Changelog
## v3.0.4
- **Refactoring**
- add files by name to the list of exported files - [89a2698](https://github.com/royriojas/flat-cache/commit/89a2698), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 02:35:39
## v3.0.3
- **Bug Fixes**
- Fix wrong eslint command - [f268e42](https://github.com/royriojas/flat-cache/commit/f268e42), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 02:15:04
## v3.0.2
- **Refactoring**
- Update the files paths - [6983a80](https://github.com/royriojas/flat-cache/commit/6983a80), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:58:39
- Move code to src/ - [18ed6e8](https://github.com/royriojas/flat-cache/commit/18ed6e8), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:57:17
- Change eslint-cache location - [beed74c](https://github.com/royriojas/flat-cache/commit/beed74c), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:48:32
## v3.0.1
- **Refactoring**
- Remove unused deps - [8c6d9dc](https://github.com/royriojas/flat-cache/commit/8c6d9dc), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:43:29
## v3.0.0
- **Refactoring**
- Fix engines - [52b824c](https://github.com/royriojas/flat-cache/commit/52b824c), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:01:52
- **Other changes**
- Replace write with combination of mkdir and writeFile ([#49](https://github.com/royriojas/flat-cache/issues/49)) - [ef48276](https://github.com/royriojas/flat-cache/commit/ef48276), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 08/11/2020 00:17:15
Node v10 introduced a great "recursive" option for mkdir which allows to
get rid from mkdirp package and easily rewrite "write" package usage
with two function calls.
https://nodejs.org/api/fs.html#fs_fs_mkdir_path_options_callback
- Added a testcase for clearAll ([#48](https://github.com/royriojas/flat-cache/issues/48)) - [45b51ca](https://github.com/royriojas/flat-cache/commit/45b51ca), [Aaron Chen](https://github.com/Aaron Chen), 21/05/2020 08:40:03
- requet node>=10 - [a5c482c](https://github.com/royriojas/flat-cache/commit/a5c482c), [yumetodo](https://github.com/yumetodo), 10/04/2020 23:14:53
thanks @SuperITMan
- Update README.md - [29fe40b](https://github.com/royriojas/flat-cache/commit/29fe40b), [Roy Riojas](https://github.com/Roy Riojas), 10/04/2020 20:08:05
- reduce vulnerability to 1 - [e9db1b2](https://github.com/royriojas/flat-cache/commit/e9db1b2), [yumetodo](https://github.com/yumetodo), 30/03/2020 11:10:43
- reduce vulnerabilities dependencies to 8 - [b58d196](https://github.com/royriojas/flat-cache/commit/b58d196), [yumetodo](https://github.com/yumetodo), 30/03/2020 10:54:56
- use prettier instead of esbeautifier - [03b1db7](https://github.com/royriojas/flat-cache/commit/03b1db7), [yumetodo](https://github.com/yumetodo), 30/03/2020 10:27:14
- update proxyquire - [c2f048d](https://github.com/royriojas/flat-cache/commit/c2f048d), [yumetodo](https://github.com/yumetodo), 30/03/2020 10:16:16
- update flatted and mocha - [a0e56da](https://github.com/royriojas/flat-cache/commit/a0e56da), [yumetodo](https://github.com/yumetodo), 30/03/2020 09:46:45
mocha > mkdirp is updated
istanble >>> optimist > minimist is not updated
- drop support node.js < 10 in develop - [beba691](https://github.com/royriojas/flat-cache/commit/beba691), [yumetodo](https://github.com/yumetodo), 18/03/2020 01:31:09
see mkdirp
- npm aufit fix(still remains) - [ce166cb](https://github.com/royriojas/flat-cache/commit/ce166cb), [yumetodo](https://github.com/yumetodo), 18/03/2020 01:18:08
37 vulnerabilities required manual review and could not be updated
- updtate sinon - [9f2d1b6](https://github.com/royriojas/flat-cache/commit/9f2d1b6), [yumetodo](https://github.com/yumetodo), 18/03/2020 01:17:51
- apply eslint-plugin-mocha - [07343b5](https://github.com/royriojas/flat-cache/commit/07343b5), [yumetodo](https://github.com/yumetodo), 13/03/2020 22:17:21
- Less strint version check ([#44](https://github.com/royriojas/flat-cache/issues/44)) - [92aca1c](https://github.com/royriojas/flat-cache/commit/92aca1c), [Wojciech Maj](https://github.com/Wojciech Maj), 13/11/2019 16:18:25
- Use ^ version matching for production dependencies
- Run npm audit fix
- **Bug Fixes**
- update dependencies and use eslint directly - [73fbed2](https://github.com/royriojas/flat-cache/commit/73fbed2), [yumetodo](https://github.com/yumetodo), 18/03/2020 01:17:27
## v2.0.1
- **Refactoring**
- upgrade node modules to latest versions - [6402ed3](https://github.com/royriojas/flat-cache/commit/6402ed3), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 18:47:05
## v2.0.0
- **Bug Fixes**
- upgrade package.json lock file - [8d21c7b](https://github.com/royriojas/flat-cache/commit/8d21c7b), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 17:03:13
- Use the same versions of node_js that eslint use - [8d23379](https://github.com/royriojas/flat-cache/commit/8d23379), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 16:25:11
- **Other changes**
- Replace circular-json with flatted ([#36](https://github.com/royriojas/flat-cache/issues/36)) - [b93aced](https://github.com/royriojas/flat-cache/commit/b93aced), [C. K. Tang](https://github.com/C. K. Tang), 08/01/2019 17:03:01
- Change JSON parser from circular-json to flatted & 1 more changes ([#37](https://github.com/royriojas/flat-cache/issues/37)) - [745e65a](https://github.com/royriojas/flat-cache/commit/745e65a), [Andy Chen](https://github.com/Andy Chen), 08/01/2019 16:17:20
- Change JSON parser from circular-json to flatted & 1 more changes
- Change JSON parser from circular-json
- Audited 2 vulnerabilities
- Update package.json
- Update Engine require
- There's a bunch of dependencies in this pkg requires node >=4, so I changed it to 4
- Remove and add node versions
- I have seen this pkg is not available with node 0.12 so I removed it
- I have added a popular used LTS version of node - 10
## v1.3.4
- **Refactoring**
- Add del.js and utils.js to the list of files to be beautified - [9d0ca9b](https://github.com/royriojas/flat-cache/commit/9d0ca9b), [Roy Riojas](https://github.com/Roy Riojas), 14/11/2018 12:19:02
## v1.3.3
- **Refactoring**
- Make sure package-lock.json is up to date - [a7d2598](https://github.com/royriojas/flat-cache/commit/a7d2598), [Roy Riojas](https://github.com/Roy Riojas), 14/11/2018 11:36:08
- **Other changes**
- Removed the need for del ([#33](https://github.com/royriojas/flat-cache/issues/33)) - [c429012](https://github.com/royriojas/flat-cache/commit/c429012), [S. Gilroy](https://github.com/S. Gilroy), 13/11/2018 13:56:37
- Removed the need for del
Removed the need for del as newer versions have broken backwards
compatibility. del mainly uses rimraf for deleting folders
and files, replaceing it with rimraf only is a minimal change.
- Disable glob on rimraf calls
- Added glob disable to wrong call
- Wrapped rimraf to simplify solution
## v1.3.2
- **Refactoring**
- remove yarn.lock file - [704c6c4](https://github.com/royriojas/flat-cache/commit/704c6c4), [Roy Riojas](https://github.com/Roy Riojas), 07/11/2018 15:41:08
- **Other changes**
- replace circular-json with flatted ([#23](https://github.com/royriojas/flat-cache/issues/23))" - [db12d74](https://github.com/royriojas/flat-cache/commit/db12d74), [Roy Riojas](https://github.com/Roy Riojas), 07/11/2018 15:40:39
This reverts commit 00f689277a75e85fef28e6a048fad227afc525e6.
## v1.3.1
- **Refactoring**
- upgrade deps to remove some security warnings - [f405719](https://github.com/royriojas/flat-cache/commit/f405719), [Roy Riojas](https://github.com/Roy Riojas), 06/11/2018 12:07:31
- **Bug Fixes**
- replace circular-json with flatted ([#23](https://github.com/royriojas/flat-cache/issues/23)) - [00f6892](https://github.com/royriojas/flat-cache/commit/00f6892), [Terry](https://github.com/Terry), 05/11/2018 18:44:16
- **Other changes**
- update del to v3.0.0 ([#26](https://github.com/royriojas/flat-cache/issues/26)) - [d42883f](https://github.com/royriojas/flat-cache/commit/d42883f), [Patrick Silva](https://github.com/Patrick Silva), 03/11/2018 01:00:44
Closes <a target="_blank" class="info-link" href="https://github.com/royriojas/flat-cache/issues/25"><span>#25</span></a>
## v1.3.0
- **Other changes**
- Added #all method ([#16](https://github.com/royriojas/flat-cache/issues/16)) - [12293be](https://github.com/royriojas/flat-cache/commit/12293be), [Ozair Patel](https://github.com/Ozair Patel), 25/09/2017 14:46:38
- Added #all method
- Added #all method test
- Updated readme
- Added yarn.lock
- Added more keys for #all test
- Beautified file
- fix changelog title style ([#14](https://github.com/royriojas/flat-cache/issues/14)) - [af8338a](https://github.com/royriojas/flat-cache/commit/af8338a), [前端小武](https://github.com/前端小武), 19/12/2016 20:34:48
## v1.2.2
- **Bug Fixes**
- Do not crash if cache file is invalid JSON. ([#13](https://github.com/royriojas/flat-cache/issues/13)) - [87beaa6](https://github.com/royriojas/flat-cache/commit/87beaa6), [Roy Riojas](https://github.com/Roy Riojas), 19/12/2016 18:03:35
Fixes <a target="_blank" class="info-link" href="https://github.com/royriojas/flat-cache/issues/12"><span>#12</span></a>
Not sure under which situations a cache file might exist that does
not contain a valid JSON structure, but just in case to cover
the possibility of this happening a try catch block has been added
If the cache is somehow not valid the cache will be discarded an a
a new cache will be stored instead
- **Other changes**
- Added travis ci support for modern node versions ([#11](https://github.com/royriojas/flat-cache/issues/11)) - [1c2b1f7](https://github.com/royriojas/flat-cache/commit/1c2b1f7), [Amila Welihinda](https://github.com/Amila Welihinda), 10/11/2016 23:47:52
- Bumping `circular-son` version ([#10](https://github.com/royriojas/flat-cache/issues/10)) - [4d5e861](https://github.com/royriojas/flat-cache/commit/4d5e861), [Andrea Giammarchi](https://github.com/Andrea Giammarchi), 02/08/2016 07:13:52
As mentioned in https://github.com/WebReflection/circular-json/issues/25 `circular-json` wan't rightly implementing the license field.
Latest version bump changed only that bit so that ESLint should now be happy.
## v1.2.1
- **Bug Fixes**
- Add missing utils.js file to the package. closes [#8](https://github.com/royriojas/flat-cache/issues/8) - [ec10cf2](https://github.com/royriojas/flat-cache/commit/ec10cf2), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 02:18:57
## v1.2.0
- **Documentation**
- Add documentation about noPrune option - [23e11f9](https://github.com/royriojas/flat-cache/commit/23e11f9), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 02:06:49
## v1.0.11
- **Features**
- Add noPrune option to cache.save() method. closes [#7](https://github.com/royriojas/flat-cache/issues/7) - [2c8016a](https://github.com/royriojas/flat-cache/commit/2c8016a), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 02:00:29
- Add json read and write utility based on circular-json - [c31081e](https://github.com/royriojas/flat-cache/commit/c31081e), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:58:17
- **Bug Fixes**
- Remove UTF16 BOM stripping - [4a41e22](https://github.com/royriojas/flat-cache/commit/4a41e22), [Jean Ponchon](https://github.com/Jean Ponchon), 29/07/2016 02:18:06
Since we control both writing and reading of JSON stream, there no needs
to handle unicode BOM.
- Use circular-json to handle circular references (fix [#5](https://github.com/royriojas/flat-cache/issues/5)) - [cd7aeed](https://github.com/royriojas/flat-cache/commit/cd7aeed), [Jean Ponchon](https://github.com/Jean Ponchon), 25/07/2016 11:11:59
- **Tests Related fixes**
- Add missing file from eslint test - [d6fa3c3](https://github.com/royriojas/flat-cache/commit/d6fa3c3), [Jean Ponchon](https://github.com/Jean Ponchon), 29/07/2016 02:15:51
- Add test for circular json serialization / deserialization - [07d2ddd](https://github.com/royriojas/flat-cache/commit/07d2ddd), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:59:36
- **Refactoring**
- Remove unused read-json-sync - [2be1c24](https://github.com/royriojas/flat-cache/commit/2be1c24), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:59:18
- **Build Scripts Changes**
- travis tests on 0.12 and 4x - [3a613fd](https://github.com/royriojas/flat-cache/commit/3a613fd), [royriojas](https://github.com/royriojas), 15/11/2015 14:34:40
## v1.0.10
- **Build Scripts Changes**
- add eslint-fix task - [fd29e52](https://github.com/royriojas/flat-cache/commit/fd29e52), [royriojas](https://github.com/royriojas), 01/11/2015 15:04:08
- make sure the test script also verify beautification and linting of files before running tests - [e94e176](https://github.com/royriojas/flat-cache/commit/e94e176), [royriojas](https://github.com/royriojas), 01/11/2015 11:54:48
- **Other changes**
- add clearAll for cacheDir - [97383d9](https://github.com/royriojas/flat-cache/commit/97383d9), [xieyaowu](https://github.com/xieyaowu), 31/10/2015 21:02:18
## v1.0.9
- **Bug Fixes**
- wrong default values for changelogx user repo name - [7bb52d1](https://github.com/royriojas/flat-cache/commit/7bb52d1), [royriojas](https://github.com/royriojas), 11/09/2015 15:59:30
## v1.0.8
- **Build Scripts Changes**
- test against node 4 - [c395b66](https://github.com/royriojas/flat-cache/commit/c395b66), [royriojas](https://github.com/royriojas), 11/09/2015 15:51:39
## v1.0.7
- **Other changes**
- Move dependencies into devDep - [7e47099](https://github.com/royriojas/flat-cache/commit/7e47099), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 15:10:57
- **Documentation**
- Add missing changelog link - [f51197a](https://github.com/royriojas/flat-cache/commit/f51197a), [royriojas](https://github.com/royriojas), 11/09/2015 14:48:05
## v1.0.6
- **Build Scripts Changes**
- Add helpers/code check scripts - [bdb82f3](https://github.com/royriojas/flat-cache/commit/bdb82f3), [royriojas](https://github.com/royriojas), 11/09/2015 14:44:31
## v1.0.5
- **Documentation**
- better description for the module - [436817f](https://github.com/royriojas/flat-cache/commit/436817f), [royriojas](https://github.com/royriojas), 11/09/2015 14:35:33
- **Other changes**
- Update dependencies - [be88aa3](https://github.com/royriojas/flat-cache/commit/be88aa3), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 13:47:41
## v1.0.4
- **Refactoring**
- load a cache file using the full filepath - [b8f68c2](https://github.com/royriojas/flat-cache/commit/b8f68c2), [Roy Riojas](https://github.com/Roy Riojas), 30/08/2015 04:19:14
- **Documentation**
- Add documentation about `clearAll` and `clearCacheById` - [13947c1](https://github.com/royriojas/flat-cache/commit/13947c1), [Roy Riojas](https://github.com/Roy Riojas), 01/03/2015 23:44:05
- **Features**
- Add methods to remove the cache documents created - [af40443](https://github.com/royriojas/flat-cache/commit/af40443), [Roy Riojas](https://github.com/Roy Riojas), 01/03/2015 23:39:27
## v1.0.1
- **Other changes**
- Update README.md - [c2b6805](https://github.com/royriojas/flat-cache/commit/c2b6805), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 04:28:07
## v1.0.0
- **Refactoring**
- flat-cache v.1.0.0 - [c984274](https://github.com/royriojas/flat-cache/commit/c984274), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 04:11:50
- **Other changes**
- Initial commit - [d43cccf](https://github.com/royriojas/flat-cache/commit/d43cccf), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 01:12:16
@@ -0,0 +1 @@
{"version":3,"file":"book.js","sources":["../../../src/icons/book.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Book\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNCAxOS41di0xNUEyLjUgMi41IDAgMCAxIDYuNSAySDE5YTEgMSAwIDAgMSAxIDF2MThhMSAxIDAgMCAxLTEgMUg2LjVhMSAxIDAgMCAxIDAtNUgyMCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/book\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Book = createLucideIcon('Book', [\n [\n 'path',\n {\n d: 'M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20',\n key: 'k3hazp',\n },\n ],\n]);\n\nexport default Book;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,iBAAiB,MAAQ,CAAA,CAAA,CAAA;AAAA,CACpC,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,15 @@
var test = require('tape');
var equal = require('../');
test('0 values', function (t) {
t.ok(equal( 0, 0), ' 0 === 0');
t.ok(equal( 0, +0), ' 0 === +0');
t.ok(equal(+0, +0), '+0 === +0');
t.ok(equal(-0, -0), '-0 === -0');
t.notOk(equal(-0, 0), '-0 !== 0');
t.notOk(equal(-0, +0), '-0 !== +0');
t.end();
});