Initial Save

This commit is contained in:
jackbeeby
2025-03-28 12:30:19 +11:00
parent e381994f19
commit d8773925e8
9910 changed files with 982718 additions and 0 deletions

10
node_modules/set-proto/.eslintrc generated vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"id-length": "off",
"sort-keys": "off",
},
}

12
node_modules/set-proto/.github/FUNDING.yml generated vendored Normal file
View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/set-proto
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

9
node_modules/set-proto/.nycrc generated vendored Normal file
View File

@@ -0,0 +1,9 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}

15
node_modules/set-proto/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,15 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v1.0.0 - 2024-12-30
### Commits
- Initial implementation, tests, readme, types [`7036fc9`](https://github.com/ljharb/set-proto/commit/7036fc9128568b1ff0b75d1955f7f364a4394079)
- Initial commit [`dd9bedd`](https://github.com/ljharb/set-proto/commit/dd9bedd41db6ff3efa00c84fcac8ae34558bf6ee)
- npm init [`63915de`](https://github.com/ljharb/set-proto/commit/63915dee39422698275fabe9876eb141e04390dd)
- Only apps should have lockfiles [`deffdae`](https://github.com/ljharb/set-proto/commit/deffdae5b989a9305247a4db314222ecc0a99280)

21
node_modules/set-proto/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Jordan Harband
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.

8
node_modules/set-proto/Object.setPrototypeOf.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
declare function setProto<O extends object, P extends object | null>(
object: O,
proto: P,
): O;
declare const x: typeof setProto | null;
export = x;

6
node_modules/set-proto/Object.setPrototypeOf.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
'use strict';
var $Object = require('es-object-atoms');
/** @type {import('./Object.setPrototypeOf')} */
module.exports = $Object.setPrototypeOf || null;

52
node_modules/set-proto/README.md generated vendored Normal file
View File

@@ -0,0 +1,52 @@
# set-proto <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
Robustly set the [[Prototype]] of an object. Uses the best available method.
## Getting started
```sh
npm install --save set-proto
```
## Usage/Examples
```js
const assert = require('assert');
const setProto = require('set-proto');
const a = { a: 1, b: 2, [Symbol.toStringTag]: 'foo' };
const b = { c: 3 };
assert.ok(!('c' in a));
setProto(a, b);
assert.ok('c' in a);
```
## Tests
Clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/set-proto
[npm-version-svg]: https://versionbadg.es/ljharb/set-proto.svg
[deps-svg]: https://david-dm.org/ljharb/set-proto.svg
[deps-url]: https://david-dm.org/ljharb/set-proto
[dev-deps-svg]: https://david-dm.org/ljharb/set-proto/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/set-proto#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/set-proto.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/set-proto.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/set-proto.svg
[downloads-url]: https://npm-stat.com/charts.html?package=set-proto
[codecov-image]: https://codecov.io/gh/ljharb/set-proto/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/set-proto/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/set-proto
[actions-url]: https://github.com/ljharb/set-proto/actions

3
node_modules/set-proto/Reflect.setPrototypeOf.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
declare const x: typeof Reflect.setPrototypeOf | null;
export = x;

4
node_modules/set-proto/Reflect.setPrototypeOf.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./Reflect.setPrototypeOf')} */
module.exports = (typeof Reflect !== 'undefined' && Reflect.setPrototypeOf) || null;

8
node_modules/set-proto/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
declare function setProto<O extends object, P extends object | null>(
object: O,
proto: P,
): O;
declare const x: typeof setProto | null;
export = x;

25
node_modules/set-proto/index.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
'use strict';
var reflectSetProto = require('./Reflect.setPrototypeOf');
var originalSetProto = require('./Object.setPrototypeOf');
var setDunderProto = require('dunder-proto/set');
var $TypeError = require('es-errors/type');
/** @type {import('.')} */
module.exports = reflectSetProto
? function setProto(O, proto) {
// @ts-expect-error TS can't narrow inside a closure, for some reason
if (reflectSetProto(O, proto)) {
return O;
}
throw new $TypeError('Reflect.setPrototypeOf: failed to set [[Prototype]]');
}
: originalSetProto || (
setDunderProto ? function setProto(O, proto) {
// @ts-expect-error TS can't narrow inside a closure, for some reason
setDunderProto(O, proto);
return O;
} : null
);

82
node_modules/set-proto/package.json generated vendored Normal file
View File

@@ -0,0 +1,82 @@
{
"name": "set-proto",
"version": "1.0.0",
"description": "Robustly set the [[Prototype]] of an object",
"main": "index.js",
"exports": {
".": "./index.js",
"./Reflect.setPrototypeOf": "./Reflect.setPrototypeOf.js",
"./Object.setPrototypeOf": "./Object.setPrototypeOf.js",
"./package.json": "./package.json"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"pretest": "npm run --silent lint",
"test": "npm run tests-only",
"posttest": "npx npm@\">=10.2\" audit --production",
"tests-only": "nyc tape 'test/**/*.js'",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "tsc && attw -P",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/set-proto.git"
},
"keywords": [
"set",
"proto",
"prototype",
"setPrototypeOf",
"[[Prototype]]"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ljharb/set-proto/issues"
},
"homepage": "https://github.com/ljharb/set-proto#readme",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.0.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.2",
"@ljharb/eslint-config": "^21.1.1",
"@ljharb/tsconfig": "^0.2.3",
"@types/tape": "^5.8.0",
"auto-changelog": "^2.5.0",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0",
"typescript": "next"
},
"engines": {
"node": ">= 0.4"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"testling": {
"files": "test/index.js"
}
}

40
node_modules/set-proto/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
'use strict';
var test = require('tape');
var setProto = require('../');
var isPrototypeOf = Object.prototype.isPrototypeOf;
test('setProto', function (t) {
t.equal(typeof setProto, 'function', 'is a function');
t.test('can set', { skip: !setProto }, function (st) {
var obj = { a: 1 };
var proto = { b: 2 };
st.ok(isPrototypeOf.call(Object.prototype, obj), 'Object.prototype is isPrototypeOf obj');
st.notOk(isPrototypeOf.call(proto, obj), 'proto is not isPrototypeOf obj');
st.ok('a' in obj, 'a is in obj');
st.notOk('b' in obj, 'b is not in obj');
// eslint-disable-next-line no-extra-parens
st.equal(/** @type {NonNullable<typeof setProto>} */ (setProto)(obj, proto), obj, 'returns the object');
st.ok(isPrototypeOf.call(Object.prototype, obj), 'Object.prototype is isPrototypeOf obj');
st.ok(isPrototypeOf.call(proto, obj), 'proto is isPrototypeOf obj');
st.ok('a' in obj, 'a is in obj');
st.ok('b' in obj, 'b is in obj');
st.equal(Object.getPrototypeOf(obj), proto, 'sets the prototype');
st.end();
});
t.test('can not set', { skip: !!setProto }, function (st) {
st.equal(setProto, null);
st.end();
});
t.end();
});

9
node_modules/set-proto/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,9 @@
{
"extends": "@ljharb/tsconfig",
"compilerOptions": {
//"target": "es2021",
},
"exclude": [
"coverage",
],
}