Dockerfile actualizado con express js
This commit is contained in:
24
node_modules/define-data-property/.eslintrc
generated
vendored
Normal file
24
node_modules/define-data-property/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"complexity": 0,
|
||||
"id-length": 0,
|
||||
"new-cap": ["error", {
|
||||
"capIsNewExceptions": [
|
||||
"GetIntrinsic",
|
||||
],
|
||||
}],
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/**",
|
||||
"rules": {
|
||||
"max-lines-per-function": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
12
node_modules/define-data-property/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/define-data-property/.github/FUNDING.yml
generated
vendored
Normal 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/define-data-property
|
||||
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']
|
13
node_modules/define-data-property/.nycrc
generated
vendored
Normal file
13
node_modules/define-data-property/.nycrc
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"lines": 86,
|
||||
"statements": 85.93,
|
||||
"functions": 82.43,
|
||||
"branches": 76.06,
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
70
node_modules/define-data-property/CHANGELOG.md
generated
vendored
Normal file
70
node_modules/define-data-property/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
# 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.1.4](https://github.com/ljharb/define-data-property/compare/v1.1.3...v1.1.4) - 2024-02-13
|
||||
|
||||
### Commits
|
||||
|
||||
- [Refactor] use `es-define-property` [`90f2f4c`](https://github.com/ljharb/define-data-property/commit/90f2f4cc20298401e71c28e1e08888db12021453)
|
||||
- [Dev Deps] update `@types/object.getownpropertydescriptors` [`cd929d9`](https://github.com/ljharb/define-data-property/commit/cd929d9a04f5f2fdcfa9d5be140940b91a083153)
|
||||
|
||||
## [v1.1.3](https://github.com/ljharb/define-data-property/compare/v1.1.2...v1.1.3) - 2024-02-12
|
||||
|
||||
### Commits
|
||||
|
||||
- [types] hand-write d.ts instead of emitting it [`0cbc988`](https://github.com/ljharb/define-data-property/commit/0cbc988203c105f2d97948327c7167ebd33bd318)
|
||||
- [meta] simplify `exports` [`690781e`](https://github.com/ljharb/define-data-property/commit/690781eed28bbf2d6766237efda0ba6dd591609e)
|
||||
- [Dev Deps] update `hasown`; clean up DT packages [`6cdfd1c`](https://github.com/ljharb/define-data-property/commit/6cdfd1cb2d91d791bfd18cda5d5cab232fd5d8fc)
|
||||
- [actions] cleanup [`3142bc6`](https://github.com/ljharb/define-data-property/commit/3142bc6a4bc406a51f5b04f31e98562a27f35ffd)
|
||||
- [meta] add `funding` [`8474423`](https://github.com/ljharb/define-data-property/commit/847442391a79779af3e0f1bf0b5bb923552b7804)
|
||||
- [Deps] update `get-intrinsic` [`3e9be00`](https://github.com/ljharb/define-data-property/commit/3e9be00e07784ba34e7c77d8bc0fdbc832ad61de)
|
||||
|
||||
## [v1.1.2](https://github.com/ljharb/define-data-property/compare/v1.1.1...v1.1.2) - 2024-02-05
|
||||
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update @types packages, `object-inspect`, `tape`, `typescript` [`df41bf8`](https://github.com/ljharb/define-data-property/commit/df41bf84ca3456be6226055caab44e38e3a7fd2f)
|
||||
- [Dev Deps] update DT packages, `aud`, `npmignore`, `tape`, typescript` [`fab0e4e`](https://github.com/ljharb/define-data-property/commit/fab0e4ec709ee02b79f42d6db3ee5f26e0a34b8a)
|
||||
- [Dev Deps] use `hasown` instead of `has` [`aa51ef9`](https://github.com/ljharb/define-data-property/commit/aa51ef93f6403d49d9bb72a807bcdb6e418978c0)
|
||||
- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`d89be50`](https://github.com/ljharb/define-data-property/commit/d89be50571175888d391238605122679f7e65ffc)
|
||||
- [Deps] update `has-property-descriptors` [`7af887c`](https://github.com/ljharb/define-data-property/commit/7af887c9083b59b195b0079e04815cfed9fcee2b)
|
||||
- [Deps] update `get-intrinsic` [`bb8728e`](https://github.com/ljharb/define-data-property/commit/bb8728ec42cd998505a7157ae24853a560c20646)
|
||||
|
||||
## [v1.1.1](https://github.com/ljharb/define-data-property/compare/v1.1.0...v1.1.1) - 2023-10-12
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] fix tests in ES3 engines [`5c6920e`](https://github.com/ljharb/define-data-property/commit/5c6920edd1f52f675b02f417e539c28135b43f94)
|
||||
- [Dev Deps] update `@types/es-value-fixtures`, `@types/for-each`, `@types/gopd`, `@types/has-property-descriptors`, `tape`, `typescript` [`7d82dfc`](https://github.com/ljharb/define-data-property/commit/7d82dfc20f778b4465bba06335dd53f6f431aea3)
|
||||
- [Fix] IE 8 has a broken `Object.defineProperty` [`0672e1a`](https://github.com/ljharb/define-data-property/commit/0672e1af2a9fcc787e7c23b96dea60d290df5548)
|
||||
- [meta] emit types on prepack [`73acb1f`](https://github.com/ljharb/define-data-property/commit/73acb1f903c21b314ec7156bf10f73c7910530c0)
|
||||
- [Dev Deps] update `tape`, `typescript` [`9489a77`](https://github.com/ljharb/define-data-property/commit/9489a7738bf2ecf0ac71d5b78ec4ca6ad7ba0142)
|
||||
|
||||
## [v1.1.0](https://github.com/ljharb/define-data-property/compare/v1.0.1...v1.1.0) - 2023-09-13
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] add `loose` arg [`155235a`](https://github.com/ljharb/define-data-property/commit/155235a4c4d7741f6de01cd87c99599a56654b72)
|
||||
- [New] allow `null` to be passed for the non* args [`7d2fa5f`](https://github.com/ljharb/define-data-property/commit/7d2fa5f06be0392736c13b126f7cd38979f34792)
|
||||
|
||||
## [v1.0.1](https://github.com/ljharb/define-data-property/compare/v1.0.0...v1.0.1) - 2023-09-12
|
||||
|
||||
### Commits
|
||||
|
||||
- [meta] add TS types [`43d763c`](https://github.com/ljharb/define-data-property/commit/43d763c6c883f652de1c9c02ef6216ee507ffa69)
|
||||
- [Dev Deps] update `@types/tape`, `typescript` [`f444985`](https://github.com/ljharb/define-data-property/commit/f444985811c36f3e6448a03ad2f9b7898917f4c7)
|
||||
- [meta] add `safe-publish-latest`, [`172bb10`](https://github.com/ljharb/define-data-property/commit/172bb10890896ebb160e64398f6ee55760107bee)
|
||||
|
||||
## v1.0.0 - 2023-09-12
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial implementation, tests, readme [`5b43d6b`](https://github.com/ljharb/define-data-property/commit/5b43d6b44e675a904810467a7d4e0adb7efc3196)
|
||||
- Initial commit [`35e577a`](https://github.com/ljharb/define-data-property/commit/35e577a6ba59a98befa97776d70d90f3bea9009d)
|
||||
- npm init [`82a0a04`](https://github.com/ljharb/define-data-property/commit/82a0a04a321ca7de220af02d41e2745e8a9962ed)
|
||||
- Only apps should have lockfiles [`96df244`](https://github.com/ljharb/define-data-property/commit/96df244a3c6f426f9a2437be825d1c6f5dd7158e)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`a87ff18`](https://github.com/ljharb/define-data-property/commit/a87ff18cb79e14c2eb5720486c4759fd9a189375)
|
21
node_modules/define-data-property/LICENSE
generated
vendored
Normal file
21
node_modules/define-data-property/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 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.
|
67
node_modules/define-data-property/README.md
generated
vendored
Normal file
67
node_modules/define-data-property/README.md
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
# define-data-property <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]
|
||||
|
||||
Define a data property on an object. Will fall back to assignment in an engine without descriptors.
|
||||
|
||||
The three `non*` argument can also be passed `null`, which will use the existing state if available.
|
||||
|
||||
The `loose` argument will mean that if you attempt to set a non-normal data property, in an environment without descriptor support, it will fall back to normal assignment.
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var defineDataProperty = require('define-data-property');
|
||||
var assert = require('assert');
|
||||
|
||||
var obj = {};
|
||||
defineDataProperty(obj, 'key', 'value');
|
||||
defineDataProperty(
|
||||
obj,
|
||||
'key2',
|
||||
'value',
|
||||
true, // nonEnumerable, optional
|
||||
false, // nonWritable, optional
|
||||
true, // nonConfigurable, optional
|
||||
false // loose, optional
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
Object.getOwnPropertyDescriptors(obj),
|
||||
{
|
||||
key: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 'value',
|
||||
writable: true,
|
||||
},
|
||||
key2: {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
value: 'value',
|
||||
writable: true,
|
||||
},
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
[package-url]: https://npmjs.org/package/define-data-property
|
||||
[npm-version-svg]: https://versionbadg.es/ljharb/define-data-property.svg
|
||||
[deps-svg]: https://david-dm.org/ljharb/define-data-property.svg
|
||||
[deps-url]: https://david-dm.org/ljharb/define-data-property
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/define-data-property/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/define-data-property#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/define-data-property.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/define-data-property.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/define-data-property.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=define-data-property
|
||||
[codecov-image]: https://codecov.io/gh/ljharb/define-data-property/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/ljharb/define-data-property/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/define-data-property
|
||||
[actions-url]: https://github.com/ljharb/define-data-property/actions
|
12
node_modules/define-data-property/index.d.ts
generated
vendored
Normal file
12
node_modules/define-data-property/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
declare function defineDataProperty(
|
||||
obj: Record<PropertyKey, unknown>,
|
||||
property: keyof typeof obj,
|
||||
value: typeof obj[typeof property],
|
||||
nonEnumerable?: boolean | null,
|
||||
nonWritable?: boolean | null,
|
||||
nonConfigurable?: boolean | null,
|
||||
loose?: boolean
|
||||
): void;
|
||||
|
||||
export = defineDataProperty;
|
56
node_modules/define-data-property/index.js
generated
vendored
Normal file
56
node_modules/define-data-property/index.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
|
||||
var $defineProperty = require('es-define-property');
|
||||
|
||||
var $SyntaxError = require('es-errors/syntax');
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
var gopd = require('gopd');
|
||||
|
||||
/** @type {import('.')} */
|
||||
module.exports = function defineDataProperty(
|
||||
obj,
|
||||
property,
|
||||
value
|
||||
) {
|
||||
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
throw new $TypeError('`obj` must be an object or a function`');
|
||||
}
|
||||
if (typeof property !== 'string' && typeof property !== 'symbol') {
|
||||
throw new $TypeError('`property` must be a string or a symbol`');
|
||||
}
|
||||
if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
|
||||
throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');
|
||||
}
|
||||
if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
|
||||
throw new $TypeError('`nonWritable`, if provided, must be a boolean or null');
|
||||
}
|
||||
if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
|
||||
throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');
|
||||
}
|
||||
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
|
||||
throw new $TypeError('`loose`, if provided, must be a boolean');
|
||||
}
|
||||
|
||||
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
|
||||
var nonWritable = arguments.length > 4 ? arguments[4] : null;
|
||||
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
|
||||
var loose = arguments.length > 6 ? arguments[6] : false;
|
||||
|
||||
/* @type {false | TypedPropertyDescriptor<unknown>} */
|
||||
var desc = !!gopd && gopd(obj, property);
|
||||
|
||||
if ($defineProperty) {
|
||||
$defineProperty(obj, property, {
|
||||
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
||||
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
||||
value: value,
|
||||
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
||||
});
|
||||
} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
|
||||
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
|
||||
obj[property] = value; // eslint-disable-line no-param-reassign
|
||||
} else {
|
||||
throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
|
||||
}
|
||||
};
|
106
node_modules/define-data-property/package.json
generated
vendored
Normal file
106
node_modules/define-data-property/package.json
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
{
|
||||
"name": "define-data-property",
|
||||
"version": "1.1.4",
|
||||
"description": "Define a data property on an object. Will fall back to assignment in an engine without descriptors.",
|
||||
"main": "index.js",
|
||||
"types": "./index.d.ts",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"tsc": "tsc -p .",
|
||||
"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",
|
||||
"posttest": "aud --production",
|
||||
"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/define-data-property.git"
|
||||
},
|
||||
"keywords": [
|
||||
"define",
|
||||
"data",
|
||||
"property",
|
||||
"object",
|
||||
"accessor",
|
||||
"javascript",
|
||||
"ecmascript",
|
||||
"enumerable",
|
||||
"configurable",
|
||||
"writable"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/define-data-property/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/define-data-property#readme",
|
||||
"dependencies": {
|
||||
"es-define-property": "^1.0.0",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.1.0",
|
||||
"@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/get-intrinsic": "^1.2.2",
|
||||
"@types/gopd": "^1.0.3",
|
||||
"@types/has-property-descriptors": "^1.0.3",
|
||||
"@types/object-inspect": "^1.8.4",
|
||||
"@types/object.getownpropertydescriptors": "^2.1.4",
|
||||
"@types/tape": "^5.6.4",
|
||||
"aud": "^2.0.4",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"es-value-fixtures": "^1.4.2",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"for-each": "^0.3.3",
|
||||
"hasown": "^2.0.1",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.13.1",
|
||||
"object.getownpropertydescriptors": "^2.1.7",
|
||||
"reflect.ownkeys": "^1.1.4",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.7.4",
|
||||
"typescript": "next"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows",
|
||||
"types/reflect.ownkeys"
|
||||
]
|
||||
}
|
||||
}
|
392
node_modules/define-data-property/test/index.js
generated
vendored
Normal file
392
node_modules/define-data-property/test/index.js
generated
vendored
Normal file
@ -0,0 +1,392 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var v = require('es-value-fixtures');
|
||||
var forEach = require('for-each');
|
||||
var inspect = require('object-inspect');
|
||||
var hasOwn = require('hasown');
|
||||
var hasPropertyDescriptors = require('has-property-descriptors')();
|
||||
var getOwnPropertyDescriptors = require('object.getownpropertydescriptors');
|
||||
var ownKeys = require('reflect.ownkeys');
|
||||
|
||||
var defineDataProperty = require('../');
|
||||
|
||||
test('defineDataProperty', function (t) {
|
||||
t.test('argument validation', function (st) {
|
||||
forEach(v.primitives, function (nonObject) {
|
||||
st['throws'](
|
||||
// @ts-expect-error
|
||||
function () { defineDataProperty(nonObject, 'key', 'value'); },
|
||||
TypeError,
|
||||
'throws on non-object input: ' + inspect(nonObject)
|
||||
);
|
||||
});
|
||||
|
||||
forEach(v.nonPropertyKeys, function (nonPropertyKey) {
|
||||
st['throws'](
|
||||
// @ts-expect-error
|
||||
function () { defineDataProperty({}, nonPropertyKey, 'value'); },
|
||||
TypeError,
|
||||
'throws on non-PropertyKey input: ' + inspect(nonPropertyKey)
|
||||
);
|
||||
});
|
||||
|
||||
forEach(v.nonBooleans, function (nonBoolean) {
|
||||
if (nonBoolean !== null) {
|
||||
st['throws'](
|
||||
// @ts-expect-error
|
||||
function () { defineDataProperty({}, 'key', 'value', nonBoolean); },
|
||||
TypeError,
|
||||
'throws on non-boolean nonEnumerable: ' + inspect(nonBoolean)
|
||||
);
|
||||
|
||||
st['throws'](
|
||||
// @ts-expect-error
|
||||
function () { defineDataProperty({}, 'key', 'value', false, nonBoolean); },
|
||||
TypeError,
|
||||
'throws on non-boolean nonWritable: ' + inspect(nonBoolean)
|
||||
);
|
||||
|
||||
st['throws'](
|
||||
// @ts-expect-error
|
||||
function () { defineDataProperty({}, 'key', 'value', false, false, nonBoolean); },
|
||||
TypeError,
|
||||
'throws on non-boolean nonConfigurable: ' + inspect(nonBoolean)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('normal data property', function (st) {
|
||||
/** @type {Record<PropertyKey, string>} */
|
||||
var obj = { existing: 'existing property' };
|
||||
st.ok(hasOwn(obj, 'existing'), 'has initial own property');
|
||||
st.equal(obj.existing, 'existing property', 'has expected initial value');
|
||||
|
||||
var res = defineDataProperty(obj, 'added', 'added property');
|
||||
st.equal(res, void undefined, 'returns `undefined`');
|
||||
st.ok(hasOwn(obj, 'added'), 'has expected own property');
|
||||
st.equal(obj.added, 'added property', 'has expected value');
|
||||
|
||||
defineDataProperty(obj, 'existing', 'new value');
|
||||
st.ok(hasOwn(obj, 'existing'), 'still has expected own property');
|
||||
st.equal(obj.existing, 'new value', 'has new expected value');
|
||||
|
||||
defineDataProperty(obj, 'explicit1', 'new value', false);
|
||||
st.ok(hasOwn(obj, 'explicit1'), 'has expected own property (explicit enumerable)');
|
||||
st.equal(obj.explicit1, 'new value', 'has new expected value (explicit enumerable)');
|
||||
|
||||
defineDataProperty(obj, 'explicit2', 'new value', false, false);
|
||||
st.ok(hasOwn(obj, 'explicit2'), 'has expected own property (explicit writable)');
|
||||
st.equal(obj.explicit2, 'new value', 'has new expected value (explicit writable)');
|
||||
|
||||
defineDataProperty(obj, 'explicit3', 'new value', false, false, false);
|
||||
st.ok(hasOwn(obj, 'explicit3'), 'has expected own property (explicit configurable)');
|
||||
st.equal(obj.explicit3, 'new value', 'has new expected value (explicit configurable)');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('loose mode', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var obj = { existing: 'existing property' };
|
||||
|
||||
defineDataProperty(obj, 'added', 'added value 1', true, null, null, true);
|
||||
st.deepEqual(
|
||||
getOwnPropertyDescriptors(obj),
|
||||
{
|
||||
existing: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 'existing property',
|
||||
writable: true
|
||||
},
|
||||
added: {
|
||||
configurable: true,
|
||||
enumerable: !hasPropertyDescriptors,
|
||||
value: 'added value 1',
|
||||
writable: true
|
||||
}
|
||||
},
|
||||
'in loose mode, obj still adds property 1'
|
||||
);
|
||||
|
||||
defineDataProperty(obj, 'added', 'added value 2', false, true, null, true);
|
||||
st.deepEqual(
|
||||
getOwnPropertyDescriptors(obj),
|
||||
{
|
||||
existing: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 'existing property',
|
||||
writable: true
|
||||
},
|
||||
added: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 'added value 2',
|
||||
writable: !hasPropertyDescriptors
|
||||
}
|
||||
},
|
||||
'in loose mode, obj still adds property 2'
|
||||
);
|
||||
|
||||
defineDataProperty(obj, 'added', 'added value 3', false, false, true, true);
|
||||
st.deepEqual(
|
||||
getOwnPropertyDescriptors(obj),
|
||||
{
|
||||
existing: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 'existing property',
|
||||
writable: true
|
||||
},
|
||||
added: {
|
||||
configurable: !hasPropertyDescriptors,
|
||||
enumerable: true,
|
||||
value: 'added value 3',
|
||||
writable: true
|
||||
}
|
||||
},
|
||||
'in loose mode, obj still adds property 3'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('non-normal data property, ES3', { skip: hasPropertyDescriptors }, function (st) {
|
||||
/** @type {Record<PropertyKey, string>} */
|
||||
var obj = { existing: 'existing property' };
|
||||
|
||||
st['throws'](
|
||||
function () { defineDataProperty(obj, 'added', 'added value', true); },
|
||||
SyntaxError,
|
||||
'nonEnumerable throws a Syntax Error'
|
||||
);
|
||||
|
||||
st['throws'](
|
||||
function () { defineDataProperty(obj, 'added', 'added value', false, true); },
|
||||
SyntaxError,
|
||||
'nonWritable throws a Syntax Error'
|
||||
);
|
||||
|
||||
st['throws'](
|
||||
function () { defineDataProperty(obj, 'added', 'added value', false, false, true); },
|
||||
SyntaxError,
|
||||
'nonWritable throws a Syntax Error'
|
||||
);
|
||||
|
||||
st.deepEqual(
|
||||
ownKeys(obj),
|
||||
['existing'],
|
||||
'obj still has expected keys'
|
||||
);
|
||||
st.equal(obj.existing, 'existing property', 'obj still has expected values');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('new non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
/** @type {Record<PropertyKey, string>} */
|
||||
var obj = { existing: 'existing property' };
|
||||
|
||||
defineDataProperty(obj, 'nonEnum', null, true);
|
||||
defineDataProperty(obj, 'nonWrit', null, false, true);
|
||||
defineDataProperty(obj, 'nonConf', null, false, false, true);
|
||||
|
||||
st.deepEqual(
|
||||
getOwnPropertyDescriptors(obj),
|
||||
{
|
||||
existing: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 'existing property',
|
||||
writable: true
|
||||
},
|
||||
nonEnum: {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: null,
|
||||
writable: true
|
||||
},
|
||||
nonWrit: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: null,
|
||||
writable: false
|
||||
},
|
||||
nonConf: {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: null,
|
||||
writable: true
|
||||
}
|
||||
},
|
||||
'obj has expected property descriptors'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('existing non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
// test case changing an existing non-normal property
|
||||
|
||||
/** @type {Record<string, null | string>} */
|
||||
var obj = {};
|
||||
Object.defineProperty(obj, 'nonEnum', { configurable: true, enumerable: false, value: null, writable: true });
|
||||
Object.defineProperty(obj, 'nonWrit', { configurable: true, enumerable: true, value: null, writable: false });
|
||||
Object.defineProperty(obj, 'nonConf', { configurable: false, enumerable: true, value: null, writable: true });
|
||||
|
||||
st.deepEqual(
|
||||
getOwnPropertyDescriptors(obj),
|
||||
{
|
||||
nonEnum: {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: null,
|
||||
writable: true
|
||||
},
|
||||
nonWrit: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: null,
|
||||
writable: false
|
||||
},
|
||||
nonConf: {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: null,
|
||||
writable: true
|
||||
}
|
||||
},
|
||||
'obj initially has expected property descriptors'
|
||||
);
|
||||
|
||||
defineDataProperty(obj, 'nonEnum', 'new value', false);
|
||||
defineDataProperty(obj, 'nonWrit', 'new value', false, false);
|
||||
st['throws'](
|
||||
function () { defineDataProperty(obj, 'nonConf', 'new value', false, false, false); },
|
||||
TypeError,
|
||||
'can not alter a nonconfigurable property'
|
||||
);
|
||||
|
||||
st.deepEqual(
|
||||
getOwnPropertyDescriptors(obj),
|
||||
{
|
||||
nonEnum: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 'new value',
|
||||
writable: true
|
||||
},
|
||||
nonWrit: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 'new value',
|
||||
writable: true
|
||||
},
|
||||
nonConf: {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: null,
|
||||
writable: true
|
||||
}
|
||||
},
|
||||
'obj ends up with expected property descriptors'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('frozen object, ES5+', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var frozen = Object.freeze({ existing: true });
|
||||
|
||||
st['throws'](
|
||||
function () { defineDataProperty(frozen, 'existing', 'new value'); },
|
||||
TypeError,
|
||||
'frozen object can not modify an existing property'
|
||||
);
|
||||
|
||||
st['throws'](
|
||||
function () { defineDataProperty(frozen, 'new', 'new property'); },
|
||||
TypeError,
|
||||
'frozen object can not add a new property'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sealed object, ES5+', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var sealed = Object.seal({ existing: true });
|
||||
st.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(sealed, 'existing'),
|
||||
{
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: true,
|
||||
writable: true
|
||||
},
|
||||
'existing value on sealed object has expected descriptor'
|
||||
);
|
||||
|
||||
defineDataProperty(sealed, 'existing', 'new value');
|
||||
|
||||
st.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(sealed, 'existing'),
|
||||
{
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 'new value',
|
||||
writable: true
|
||||
},
|
||||
'existing value on sealed object has changed descriptor'
|
||||
);
|
||||
|
||||
st['throws'](
|
||||
function () { defineDataProperty(sealed, 'new', 'new property'); },
|
||||
TypeError,
|
||||
'sealed object can not add a new property'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('nonextensible object, ES5+', { skip: !hasPropertyDescriptors }, function (st) {
|
||||
var nonExt = Object.preventExtensions({ existing: true });
|
||||
|
||||
st.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(nonExt, 'existing'),
|
||||
{
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: true,
|
||||
writable: true
|
||||
},
|
||||
'existing value on non-extensible object has expected descriptor'
|
||||
);
|
||||
|
||||
defineDataProperty(nonExt, 'existing', 'new value', true);
|
||||
|
||||
st.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(nonExt, 'existing'),
|
||||
{
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: 'new value',
|
||||
writable: true
|
||||
},
|
||||
'existing value on non-extensible object has changed descriptor'
|
||||
);
|
||||
|
||||
st['throws'](
|
||||
function () { defineDataProperty(nonExt, 'new', 'new property'); },
|
||||
TypeError,
|
||||
'non-extensible object can not add a new property'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
59
node_modules/define-data-property/tsconfig.json
generated
vendored
Normal file
59
node_modules/define-data-property/tsconfig.json
generated
vendored
Normal 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"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user