🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
13
node_modules/unherit/index.d.ts
generated
vendored
Normal file
13
node_modules/unherit/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Create a subclass that can be modified without affecting the super class.
|
||||
*
|
||||
* @template {{prototype: object, new (...args: any[]): any}} Class
|
||||
* @param {Class} Super
|
||||
* @return {Class}
|
||||
*/
|
||||
export function unherit<
|
||||
Class extends {
|
||||
new (...args: any[]): any
|
||||
prototype: object
|
||||
}
|
||||
>(Super: Class): Class
|
||||
29
node_modules/unherit/index.js
generated
vendored
Normal file
29
node_modules/unherit/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* Create a subclass that can be modified without affecting the super class.
|
||||
*
|
||||
* @template {{prototype: object, new (...args: any[]): any}} Class
|
||||
* @param {Class} Super
|
||||
* @return {Class}
|
||||
*/
|
||||
export function unherit(Super) {
|
||||
const Of = class extends Super {}
|
||||
|
||||
// Clone values.
|
||||
const proto = Of.prototype
|
||||
/** @type {string} */
|
||||
let key
|
||||
|
||||
// We specifically want to get *all* fields, not just own fields.
|
||||
// eslint-disable-next-line guard-for-in
|
||||
for (key in proto) {
|
||||
/** @type {unknown} */
|
||||
const value = proto[key]
|
||||
|
||||
if (value && typeof value === 'object') {
|
||||
// @ts-expect-error: shallow clone arrays or other values.
|
||||
proto[key] = 'concat' in value ? value.concat() : Object.assign({}, value)
|
||||
}
|
||||
}
|
||||
|
||||
return Of
|
||||
}
|
||||
21
node_modules/unherit/license
generated
vendored
Normal file
21
node_modules/unherit/license
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 Titus Wormer <tituswormer@gmail.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.
|
||||
74
node_modules/unherit/package.json
generated
vendored
Normal file
74
node_modules/unherit/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"name": "unherit",
|
||||
"version": "3.0.1",
|
||||
"description": "Create a subclass that can be modified without affecting the super class",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"super",
|
||||
"class",
|
||||
"constructor"
|
||||
],
|
||||
"repository": "wooorm/unherit",
|
||||
"bugs": "https://github.com/wooorm/unherit/issues",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
},
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^11.0.0",
|
||||
"remark-preset-wooorm": "^9.0.0",
|
||||
"type-coverage": "^2.0.0",
|
||||
"typescript": "^4.0.0",
|
||||
"xo": "^0.52.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npm run build && npm run format",
|
||||
"build": "tsc --build --clean && tsc --build && type-coverage",
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"test-api": "node --conditions development test.js",
|
||||
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
|
||||
"test": "npm run build && npm run format && npm run test-coverage"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"typeCoverage": {
|
||||
"atLeast": 100,
|
||||
"detail": true,
|
||||
"strict": true,
|
||||
"ignoreCatch": true,
|
||||
"#": "we need a couple `any`s in parameters",
|
||||
"ignoreFiles": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
138
node_modules/unherit/readme.md
generated
vendored
Normal file
138
node_modules/unherit/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
# unherit
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
|
||||
Create a subclass that can be modified without affecting the super class.
|
||||
|
||||
## Contents
|
||||
|
||||
* [What is this?](#what-is-this)
|
||||
* [When should I use this?](#when-should-i-use-this)
|
||||
* [Install](#install)
|
||||
* [Use](#use)
|
||||
* [API](#api)
|
||||
* [`unherit(Super)`](#unheritsuper)
|
||||
* [Types](#types)
|
||||
* [Compatibility](#compatibility)
|
||||
* [Contribute](#contribute)
|
||||
* [Security](#security)
|
||||
* [License](#license)
|
||||
|
||||
## What is this?
|
||||
|
||||
This is a tiny package lets you create a subclass, that can be modified,
|
||||
without affecting the super class.
|
||||
|
||||
## When should I use this?
|
||||
|
||||
Not often!
|
||||
You might have some weird cases though.
|
||||
|
||||
## Install
|
||||
|
||||
This package is [ESM only][esm].
|
||||
In Node.js (version 14.14+, 16.0+), install with [npm][]:
|
||||
|
||||
```sh
|
||||
npm install unherit
|
||||
```
|
||||
|
||||
In Deno with [`esm.sh`][esmsh]:
|
||||
|
||||
```js
|
||||
import {unherit} from 'https://esm.sh/unherit@3'
|
||||
```
|
||||
|
||||
In browsers with [`esm.sh`][esmsh]:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import {unherit} from 'https://esm.sh/unherit@3?bundle'
|
||||
</script>
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
import {EventEmitter} from 'node:events'
|
||||
import {unherit} from 'unherit'
|
||||
|
||||
// Create a private class which acts just like `EventEmitter`.
|
||||
const Emitter = unherit(EventEmitter)
|
||||
|
||||
Emitter.prototype.defaultMaxListeners = 0
|
||||
// Now, all instances of `Emitter` have `0` maximum listeners, without affecting
|
||||
// other `EventEmitter`s.
|
||||
|
||||
new Emitter().defaultMaxListeners === 0 // => true
|
||||
new EventEmitter().defaultMaxListeners === undefined // => true
|
||||
new Emitter() instanceof EventEmitter // => true
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package exports the identifier `unherit`.
|
||||
There is no default export.
|
||||
|
||||
### `unherit(Super)`
|
||||
|
||||
Subclass `Super`.
|
||||
|
||||
## Types
|
||||
|
||||
This package is fully typed with [TypeScript][].
|
||||
It exports no additional types.
|
||||
|
||||
## Compatibility
|
||||
|
||||
This package is at least compatible with all maintained versions of Node.js.
|
||||
As of now, that is Node.js 14.14+ and 16.0+.
|
||||
It also works in Deno and modern browsers.
|
||||
|
||||
## Contribute
|
||||
|
||||
Yes please!
|
||||
See [How to Contribute to Open Source][contribute].
|
||||
|
||||
## Security
|
||||
|
||||
This package is safe.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://github.com/wooorm/unherit/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/wooorm/unherit/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/unherit.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/wooorm/unherit
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/unherit.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/unherit
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/unherit.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=unherit
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
||||
|
||||
[esmsh]: https://esm.sh
|
||||
|
||||
[typescript]: https://www.typescriptlang.org
|
||||
|
||||
[contribute]: https://opensource.guide/how-to-contribute/
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
Loading…
Add table
Add a link
Reference in a new issue