This commit is contained in:
TiclemFR
2024-01-20 23:14:52 +01:00
parent a068f54957
commit 031f7071e6
881 changed files with 241469 additions and 247870 deletions

View File

@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.2.0](https://github.com/ljharb/set-function-length/compare/v1.1.1...v1.2.0) - 2024-01-14
### Commits
- [New] add types [`f6d9088`](https://github.com/ljharb/set-function-length/commit/f6d9088b9283a3112b21c6776e8bef6d1f30558a)
- [Fix] ensure `env` properties are always booleans [`0c42f84`](https://github.com/ljharb/set-function-length/commit/0c42f84979086389b3229e1b4272697fd352275a)
- [Dev Deps] update `aud`, `call-bind`, `npmignore`, `tape` [`2b75f75`](https://github.com/ljharb/set-function-length/commit/2b75f75468093a4bb8ce8ca989b2edd2e80d95d1)
- [Deps] update `get-intrinsic`, `has-property-descriptors` [`19bf0fc`](https://github.com/ljharb/set-function-length/commit/19bf0fc4ffaa5ad425acbfa150516be9f3b6263a)
- [meta] add `sideEffects` flag [`8bb9b78`](https://github.com/ljharb/set-function-length/commit/8bb9b78c11c621123f725c9470222f43466c01d0)
## [v1.1.1](https://github.com/ljharb/set-function-length/compare/v1.1.0...v1.1.1) - 2023-10-19
### Fixed

6
node_modules/set-function-length/env.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
export var boundFnsHaveConfigurableLengths: boolean;
export var boundFnsHaveWritableLengths: boolean;
export var functionsHaveConfigurableLengths: boolean;
export var functionsHaveWritableLengths: boolean;
export declare let __proto__: null;
//# sourceMappingURL=env.d.ts.map

1
node_modules/set-function-length/env.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["env.js"],"names":[],"mappings":"AAaA,oDAAsE;AAEtE,gDAA8D;AAN9D,qDAA2E;AAE3E,iDAAmE"}

View File

@@ -1,14 +1,19 @@
'use strict';
var gOPD = require('gopd');
var bind = require('function-bind');
var functionsHaveConfigurableLengths = gOPD && gOPD(function () {}, 'length').configurable;
var unbound = gOPD && gOPD(function () {}, 'length');
// @ts-expect-error ts(2555) TS is overly strict with .call
var bound = gOPD && gOPD(bind.call(function () {}), 'length');
var functionsHaveWritableLengths = gOPD && gOPD(function () {}, 'length').writable;
var functionsHaveConfigurableLengths = !!(unbound && unbound.configurable);
var boundFnsHaveConfigurableLengths = gOPD && gOPD(function () {}.bind(), 'length').configurable;
var functionsHaveWritableLengths = !!(unbound && unbound.writable);
var boundFnsHaveWritableLengths = gOPD && gOPD(function () {}.bind(), 'length').writable;
var boundFnsHaveConfigurableLengths = !!(bound && bound.configurable);
var boundFnsHaveWritableLengths = !!(bound && bound.writable);
module.exports = {
__proto__: null,

7
node_modules/set-function-length/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
declare namespace _exports {
export { Func };
}
declare const _exports: <T extends Func = Func>(fn: T, length: number, loose?: boolean) => T;
export = _exports;
type Func = (...args: unknown[]) => unknown;
//# sourceMappingURL=index.d.ts.map

1
node_modules/set-function-length/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;+DAYkD,MAAM,UAAU,OAAO;;sBAFjD,OAAO,EAAE,KAAK,OAAO"}

View File

@@ -8,6 +8,9 @@ var gOPD = require('gopd');
var $TypeError = GetIntrinsic('%TypeError%');
var $floor = GetIntrinsic('%Math.floor%');
/** @typedef {(...args: unknown[]) => unknown} Func */
/** @type {<T extends Func = Func>(fn: T, length: number, loose?: boolean) => T} */
module.exports = function setFunctionLength(fn, length) {
if (typeof fn !== 'function') {
throw new $TypeError('`fn` is not a function');
@@ -32,9 +35,9 @@ module.exports = function setFunctionLength(fn, length) {
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
if (hasDescriptors) {
define(fn, 'length', length, true, true);
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
} else {
define(fn, 'length', length);
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
}
}
return fn;

View File

@@ -1,6 +1,6 @@
{
"name": "set-function-length",
"version": "1.1.1",
"version": "1.2.0",
"description": "Set a function's length property",
"main": "index.js",
"exports": {
@@ -8,15 +8,21 @@
"./env": "./env.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"directories": {
"test": "test"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepack": "npmignore --auto --commentLines=autogenerated && npm run emit",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"tsc": "tsc -p .",
"preemit": "rm -f *.ts *.ts.map test/*.ts test/*.ts.map",
"emit": "npm run tsc -- --noEmit false --emitDeclarationOnly",
"postemit": "rm test/*.ts test/*.ts.map",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "npm run tsc",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
@@ -42,27 +48,38 @@
"url": "https://github.com/ljharb/set-function-length/issues"
},
"homepage": "https://github.com/ljharb/set-function-length#readme",
"dependencies": {
"define-data-property": "^1.1.1",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.2",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.1"
},
"devDependencies": {
"@ljharb/eslint-config": "^21.1.0",
"aud": "^2.0.3",
"@types/call-bind": "^1.0.5",
"@types/define-properties": "^1.1.5",
"@types/es-value-fixtures": "^1.4.4",
"@types/for-each": "^0.3.3",
"@types/function-bind": "^1.1.10",
"@types/gopd": "^1.0.3",
"@types/has-property-descriptors": "^1.0.3",
"@types/object-inspect": "^1.8.4",
"@types/tape": "^5.6.4",
"aud": "^2.0.4",
"auto-changelog": "^2.4.0",
"call-bind": "^1.0.4",
"call-bind": "^1.0.5",
"es-value-fixtures": "^1.4.2",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"for-each": "^0.3.3",
"in-publish": "^2.0.1",
"npmignore": "^0.3.0",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"object-inspect": "^1.13.1",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.1"
},
"dependencies": {
"define-data-property": "^1.1.1",
"get-intrinsic": "^1.2.1",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.0"
"tape": "^5.7.3",
"typescript": "^5.4.0-dev.20240113"
},
"engines": {
"node": ">= 0.4"
@@ -78,7 +95,9 @@
"publishConfig": {
"ignore": [
".github/workflows",
"test"
"test",
"!*.d.ts",
"!*.d.ts.map"
]
}
}

59
node_modules/set-function-length/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,59 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
/* Language and Environment */
"target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
"useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
"typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */
"resolveJsonModule": true, /* Enable importing .json files. */
/* JavaScript Support */
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
"maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
"declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"noEmit": true, /* Disable emitting files from a compilation. */
/* Interop Constraints */
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
"noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
"useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
"noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
"noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
"noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
"noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
/* Completeness */
// "skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"exclude": [
"coverage"
]
}