Spaces:
Paused
Paused
Include updated package-lock.json (part 17)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/deep-is/test/cmp.js +23 -0
- node_modules/deep-is/test/neg-vs-pos-0.js +15 -0
- node_modules/deepmerge/.editorconfig +7 -0
- node_modules/deepmerge/changelog.md +167 -0
- node_modules/deepmerge/index.d.ts +20 -0
- node_modules/deepmerge/index.js +106 -0
- node_modules/deepmerge/license.txt +21 -0
- node_modules/deepmerge/package.json +42 -0
- node_modules/deepmerge/readme.md +264 -0
- node_modules/deepmerge/rollup.config.js +22 -0
- node_modules/define-data-property/.eslintrc +24 -0
- node_modules/define-data-property/.github/FUNDING.yml +12 -0
- node_modules/define-data-property/.nycrc +13 -0
- node_modules/define-data-property/CHANGELOG.md +70 -0
- node_modules/define-data-property/LICENSE +21 -0
- node_modules/define-data-property/README.md +67 -0
- node_modules/define-data-property/index.d.ts +12 -0
- node_modules/define-data-property/index.js +56 -0
- node_modules/define-data-property/package.json +106 -0
- node_modules/define-data-property/test/index.js +392 -0
- node_modules/define-data-property/tsconfig.json +59 -0
- node_modules/define-properties/.editorconfig +13 -0
- node_modules/define-properties/.eslintrc +19 -0
- node_modules/define-properties/.github/FUNDING.yml +12 -0
- node_modules/define-properties/.nycrc +9 -0
- node_modules/define-properties/CHANGELOG.md +91 -0
- node_modules/define-properties/LICENSE +21 -0
- node_modules/define-properties/README.md +84 -0
- node_modules/define-properties/index.js +47 -0
- node_modules/define-properties/package.json +88 -0
- node_modules/defu/LICENSE +21 -0
- node_modules/defu/README.md +171 -0
- node_modules/defu/lib/defu.cjs +10 -0
- node_modules/defu/lib/defu.d.cts +24 -0
- node_modules/defu/package.json +48 -0
- node_modules/delayed-stream/.npmignore +1 -0
- node_modules/delayed-stream/License +19 -0
- node_modules/delayed-stream/Makefile +7 -0
- node_modules/delayed-stream/Readme.md +141 -0
- node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- node_modules/delayed-stream/package.json +27 -0
- node_modules/depd/History.md +103 -0
- node_modules/depd/LICENSE +22 -0
- node_modules/depd/Readme.md +280 -0
- node_modules/depd/index.js +538 -0
- node_modules/depd/lib/browser/index.js +77 -0
- node_modules/depd/package.json +45 -0
- node_modules/dequal/index.d.ts +1 -0
- node_modules/dequal/license +21 -0
- node_modules/dequal/lite/index.d.ts +1 -0
node_modules/deep-is/test/cmp.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var test = require('tape');
|
| 2 |
+
var equal = require('../');
|
| 3 |
+
|
| 4 |
+
test('equal', function (t) {
|
| 5 |
+
t.ok(equal(
|
| 6 |
+
{ a : [ 2, 3 ], b : [ 4 ] },
|
| 7 |
+
{ a : [ 2, 3 ], b : [ 4 ] }
|
| 8 |
+
));
|
| 9 |
+
t.end();
|
| 10 |
+
});
|
| 11 |
+
|
| 12 |
+
test('not equal', function (t) {
|
| 13 |
+
t.notOk(equal(
|
| 14 |
+
{ x : 5, y : [6] },
|
| 15 |
+
{ x : 5, y : 6 }
|
| 16 |
+
));
|
| 17 |
+
t.end();
|
| 18 |
+
});
|
| 19 |
+
|
| 20 |
+
test('nested nulls', function (t) {
|
| 21 |
+
t.ok(equal([ null, null, null ], [ null, null, null ]));
|
| 22 |
+
t.end();
|
| 23 |
+
});
|
node_modules/deep-is/test/neg-vs-pos-0.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var test = require('tape');
|
| 2 |
+
var equal = require('../');
|
| 3 |
+
|
| 4 |
+
test('0 values', function (t) {
|
| 5 |
+
t.ok(equal( 0, 0), ' 0 === 0');
|
| 6 |
+
t.ok(equal( 0, +0), ' 0 === +0');
|
| 7 |
+
t.ok(equal(+0, +0), '+0 === +0');
|
| 8 |
+
t.ok(equal(-0, -0), '-0 === -0');
|
| 9 |
+
|
| 10 |
+
t.notOk(equal(-0, 0), '-0 !== 0');
|
| 11 |
+
t.notOk(equal(-0, +0), '-0 !== +0');
|
| 12 |
+
|
| 13 |
+
t.end();
|
| 14 |
+
});
|
| 15 |
+
|
node_modules/deepmerge/.editorconfig
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
root = true
|
| 2 |
+
|
| 3 |
+
[*]
|
| 4 |
+
indent_style = tab
|
| 5 |
+
end_of_line = lf
|
| 6 |
+
trim_trailing_whitespace = true
|
| 7 |
+
insert_final_newline = true
|
node_modules/deepmerge/changelog.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# [4.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.1)
|
| 2 |
+
|
| 3 |
+
- Fix type definition for arrayMerge options. [#239](https://github.com/TehShrike/deepmerge/pull/239)
|
| 4 |
+
|
| 5 |
+
# [4.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.0)
|
| 6 |
+
|
| 7 |
+
- Avoid thrown errors if the target doesn't have `propertyIsEnumerable`. [#252](https://github.com/TehShrike/deepmerge/pull/252)
|
| 8 |
+
|
| 9 |
+
# [4.2.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.2)
|
| 10 |
+
|
| 11 |
+
- `isMergeableObject` is now only called if there are two values that could be merged. [a34dd4d2](https://github.com/TehShrike/deepmerge/commit/a34dd4d25bf5e250653540a2022bc832c7b00a19)
|
| 12 |
+
|
| 13 |
+
# [4.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.1)
|
| 14 |
+
|
| 15 |
+
- Fix: falsey values can now be merged. [#170](https://github.com/TehShrike/deepmerge/issues/170)
|
| 16 |
+
|
| 17 |
+
# [4.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.0)
|
| 18 |
+
|
| 19 |
+
- Properties are now only overwritten if they exist on the target object and are enumerable. [#164](https://github.com/TehShrike/deepmerge/pull/164)
|
| 20 |
+
|
| 21 |
+
Technically this could probably be a patch release since "which properties get overwritten" wasn't documented and accidentally overwriting a built-in function or some function up the property chain would almost certainly be undesirable, but it feels like a gray area, so here we are with a feature version bump.
|
| 22 |
+
|
| 23 |
+
# [4.1.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.2)
|
| 24 |
+
|
| 25 |
+
- Rolled back #167 since `Object.assign` breaks ES5 support. [55067352](https://github.com/TehShrike/deepmerge/commit/55067352a92c65a6c44a5165f3387720aae1e192)
|
| 26 |
+
|
| 27 |
+
# [4.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.1)
|
| 28 |
+
|
| 29 |
+
- The `options` argument is no longer mutated [#167](https://github.com/TehShrike/deepmerge/pull/167)
|
| 30 |
+
|
| 31 |
+
# [4.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.0)
|
| 32 |
+
|
| 33 |
+
- `cloneUnlessOtherwiseSpecified` is now exposed to the `arrayMerge` function [#165](https://github.com/TehShrike/deepmerge/pull/165)
|
| 34 |
+
|
| 35 |
+
# [4.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.0.0)
|
| 36 |
+
|
| 37 |
+
- The `main` entry point in `package.json` is now a CommonJS module instead of a UMD module [#155](https://github.com/TehShrike/deepmerge/pull/155)
|
| 38 |
+
|
| 39 |
+
# [3.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.3.0)
|
| 40 |
+
|
| 41 |
+
- Enumerable Symbol properties are now copied [#151](https://github.com/TehShrike/deepmerge/pull/151)
|
| 42 |
+
|
| 43 |
+
# [3.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.1)
|
| 44 |
+
|
| 45 |
+
- bumping dev dependency versions to try to shut up bogus security warnings from Github/npm [#149](https://github.com/TehShrike/deepmerge/pull/149)
|
| 46 |
+
|
| 47 |
+
# [3.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.0)
|
| 48 |
+
|
| 49 |
+
- feature: added the [`customMerge`](https://github.com/TehShrike/deepmerge#custommerge) option [#133](https://github.com/TehShrike/deepmerge/pull/133)
|
| 50 |
+
|
| 51 |
+
# [3.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.1.0)
|
| 52 |
+
|
| 53 |
+
- typescript typing: make the `all` function generic [#129](https://github.com/TehShrike/deepmerge/pull/129)
|
| 54 |
+
|
| 55 |
+
# [3.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.0.0)
|
| 56 |
+
|
| 57 |
+
- drop ES module build [#123](https://github.com/TehShrike/deepmerge/issues/123)
|
| 58 |
+
|
| 59 |
+
# [2.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.1)
|
| 60 |
+
|
| 61 |
+
- bug: typescript export type was wrong [#121](https://github.com/TehShrike/deepmerge/pull/121)
|
| 62 |
+
|
| 63 |
+
# [2.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.0)
|
| 64 |
+
|
| 65 |
+
- feature: added TypeScript typings [#119](https://github.com/TehShrike/deepmerge/pull/119)
|
| 66 |
+
|
| 67 |
+
# [2.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.1)
|
| 68 |
+
|
| 69 |
+
- documentation: Rename "methods" to "api", note ESM syntax [#103](https://github.com/TehShrike/deepmerge/pull/103)
|
| 70 |
+
- documentation: Fix grammar [#107](https://github.com/TehShrike/deepmerge/pull/107)
|
| 71 |
+
- documentation: Restructure headers for clarity + some wording tweaks [108](https://github.com/TehShrike/deepmerge/pull/108) + [109](https://github.com/TehShrike/deepmerge/pull/109)
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
# [2.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.0)
|
| 75 |
+
|
| 76 |
+
- feature: Support a custom `isMergeableObject` function [#96](https://github.com/TehShrike/deepmerge/pull/96)
|
| 77 |
+
- documentation: note a Webpack bug that some users might need to work around [#100](https://github.com/TehShrike/deepmerge/pull/100)
|
| 78 |
+
|
| 79 |
+
# [2.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.1)
|
| 80 |
+
|
| 81 |
+
- documentation: fix the old array merge algorithm in the readme. [#84](https://github.com/TehShrike/deepmerge/pull/84)
|
| 82 |
+
|
| 83 |
+
# [2.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.0)
|
| 84 |
+
|
| 85 |
+
- breaking: the array merge algorithm has changed from a complicated thing to `target.concat(source).map(element => cloneUnlessOtherwiseSpecified(element, optionsArgument))`
|
| 86 |
+
- breaking: The `clone` option now defaults to `true`
|
| 87 |
+
- feature: `merge.all` now accepts an array of any size, even 0 or 1 elements
|
| 88 |
+
|
| 89 |
+
See [pull request 77](https://github.com/TehShrike/deepmerge/pull/77).
|
| 90 |
+
|
| 91 |
+
# [1.5.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.2)
|
| 92 |
+
|
| 93 |
+
- fix: no longer attempts to merge React elements [#76](https://github.com/TehShrike/deepmerge/issues/76)
|
| 94 |
+
|
| 95 |
+
# [1.5.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.1)
|
| 96 |
+
|
| 97 |
+
- bower support: officially dropping bower support. If you use bower, please depend on the [unpkg distribution](https://unpkg.com/deepmerge/dist/umd.js). See [#63](https://github.com/TehShrike/deepmerge/issues/63)
|
| 98 |
+
|
| 99 |
+
# [1.5.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.0)
|
| 100 |
+
|
| 101 |
+
- bug fix: merging objects into arrays was allowed, and doesn't make any sense. [#65](https://github.com/TehShrike/deepmerge/issues/65) published as a feature release instead of a patch because it is a decent behavior change.
|
| 102 |
+
|
| 103 |
+
# [1.4.4](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.4)
|
| 104 |
+
|
| 105 |
+
- bower support: updated `main` in bower.json
|
| 106 |
+
|
| 107 |
+
# [1.4.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.3)
|
| 108 |
+
|
| 109 |
+
- bower support: inline is-mergeable-object in a new CommonJS build, so that people using both bower and CommonJS can bundle the library [0b34e6](https://github.com/TehShrike/deepmerge/commit/0b34e6e95f989f2fc8091d25f0d291c08f3d2d24)
|
| 110 |
+
|
| 111 |
+
# [1.4.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.2)
|
| 112 |
+
|
| 113 |
+
- performance: bump is-mergeable-object dependency version for a slight performance improvement [5906c7](https://github.com/TehShrike/deepmerge/commit/5906c765d691d48e83d76efbb0d4b9ca150dc12c)
|
| 114 |
+
|
| 115 |
+
# [1.4.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.1)
|
| 116 |
+
|
| 117 |
+
- documentation: fix unpkg link [acc45b](https://github.com/TehShrike/deepmerge/commit/acc45be85519c1df906a72ecb24764b622d18d47)
|
| 118 |
+
|
| 119 |
+
# [1.4.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.0)
|
| 120 |
+
|
| 121 |
+
- api: instead of only exporting a UMD module, expose a UMD module with `pkg.main`, a CJS module with `pkg.browser`, and an ES module with `pkg.module` [#62](https://github.com/TehShrike/deepmerge/pull/62)
|
| 122 |
+
|
| 123 |
+
# [1.3.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.2)
|
| 124 |
+
|
| 125 |
+
- documentation: note the minified/gzipped file sizes [56](https://github.com/TehShrike/deepmerge/pull/56)
|
| 126 |
+
- documentation: make data structures more readable in merge example: pull request [57](https://github.com/TehShrike/deepmerge/pull/57)
|
| 127 |
+
|
| 128 |
+
# [1.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.1)
|
| 129 |
+
|
| 130 |
+
- documentation: clarify and test some array merging documentation: pull request [51](https://github.com/TehShrike/deepmerge/pull/51)
|
| 131 |
+
|
| 132 |
+
# [1.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.0)
|
| 133 |
+
|
| 134 |
+
- feature: `merge.all`, a merge function that merges any number of objects: pull request [50](https://github.com/TehShrike/deepmerge/pull/50)
|
| 135 |
+
|
| 136 |
+
# [1.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.2.0)
|
| 137 |
+
|
| 138 |
+
- fix: an error that would be thrown when an array would be merged onto a truthy non-array value: pull request [46](https://github.com/TehShrike/deepmerge/pull/46)
|
| 139 |
+
- feature: the ability to clone: Issue [28](https://github.com/TehShrike/deepmerge/issues/28), pull requests [44](https://github.com/TehShrike/deepmerge/pull/44) and [48](https://github.com/TehShrike/deepmerge/pull/48)
|
| 140 |
+
- maintenance: added tests + travis to `.npmignore`: pull request [47](https://github.com/TehShrike/deepmerge/pull/47)
|
| 141 |
+
|
| 142 |
+
# [1.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.1)
|
| 143 |
+
|
| 144 |
+
- fix an issue where an error was thrown when merging an array onto a non-array: [Pull request 46](https://github.com/TehShrike/deepmerge/pull/46)
|
| 145 |
+
|
| 146 |
+
# [1.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.0)
|
| 147 |
+
|
| 148 |
+
- allow consumers to specify their own array merging algorithm: [Pull request 37](https://github.com/TehShrike/deepmerge/pull/37)
|
| 149 |
+
|
| 150 |
+
# [1.0.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.3)
|
| 151 |
+
|
| 152 |
+
- adding bower.json back: [Issue 38](https://github.com/TehShrike/deepmerge/pull/38)
|
| 153 |
+
- updating keywords and Github links in package.json [bc3898e](https://github.com/TehShrike/deepmerge/commit/bc3898e587a56f74591328f40f656b0152c1d5eb)
|
| 154 |
+
|
| 155 |
+
# [1.0.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.2)
|
| 156 |
+
|
| 157 |
+
- Updating the readme: dropping bower, testing that the example works: [7102fc](https://github.com/TehShrike/deepmerge/commit/7102fcc4ddec11e2d33205866f9f18df14e5aeb5)
|
| 158 |
+
|
| 159 |
+
# [1.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.1)
|
| 160 |
+
|
| 161 |
+
- `null`, dates, and regular expressions are now properly merged in arrays: [Issue 18](https://github.com/TehShrike/deepmerge/pull/18), plus commit: [ef1c6b](https://github.com/TehShrike/deepmerge/commit/ef1c6bac8350ba12a24966f0bc7da02560827586)
|
| 162 |
+
|
| 163 |
+
# 1.0.0
|
| 164 |
+
|
| 165 |
+
- Should only be a patch change, because this module is READY. [Issue 15](https://github.com/TehShrike/deepmerge/issues/15)
|
| 166 |
+
- Regular expressions are now treated like primitive values when merging: [Issue 30](https://github.com/TehShrike/deepmerge/pull/30)
|
| 167 |
+
- Dates are now treated like primitives when merging: [Issue 31](https://github.com/TehShrike/deepmerge/issues/31)
|
node_modules/deepmerge/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare function deepmerge<T>(x: Partial<T>, y: Partial<T>, options?: deepmerge.Options): T;
|
| 2 |
+
declare function deepmerge<T1, T2>(x: Partial<T1>, y: Partial<T2>, options?: deepmerge.Options): T1 & T2;
|
| 3 |
+
|
| 4 |
+
declare namespace deepmerge {
|
| 5 |
+
export interface Options {
|
| 6 |
+
arrayMerge?(target: any[], source: any[], options?: ArrayMergeOptions): any[];
|
| 7 |
+
clone?: boolean;
|
| 8 |
+
customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined;
|
| 9 |
+
isMergeableObject?(value: object): boolean;
|
| 10 |
+
}
|
| 11 |
+
export interface ArrayMergeOptions {
|
| 12 |
+
isMergeableObject(value: object): boolean;
|
| 13 |
+
cloneUnlessOtherwiseSpecified(value: object, options?: Options): object;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
export function all (objects: object[], options?: Options): object;
|
| 17 |
+
export function all<T> (objects: Partial<T>[], options?: Options): T;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
export = deepmerge;
|
node_modules/deepmerge/index.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var defaultIsMergeableObject = require('is-mergeable-object')
|
| 2 |
+
|
| 3 |
+
function emptyTarget(val) {
|
| 4 |
+
return Array.isArray(val) ? [] : {}
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
| 8 |
+
return (options.clone !== false && options.isMergeableObject(value))
|
| 9 |
+
? deepmerge(emptyTarget(value), value, options)
|
| 10 |
+
: value
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
function defaultArrayMerge(target, source, options) {
|
| 14 |
+
return target.concat(source).map(function(element) {
|
| 15 |
+
return cloneUnlessOtherwiseSpecified(element, options)
|
| 16 |
+
})
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
function getMergeFunction(key, options) {
|
| 20 |
+
if (!options.customMerge) {
|
| 21 |
+
return deepmerge
|
| 22 |
+
}
|
| 23 |
+
var customMerge = options.customMerge(key)
|
| 24 |
+
return typeof customMerge === 'function' ? customMerge : deepmerge
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
function getEnumerableOwnPropertySymbols(target) {
|
| 28 |
+
return Object.getOwnPropertySymbols
|
| 29 |
+
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
| 30 |
+
return Object.propertyIsEnumerable.call(target, symbol)
|
| 31 |
+
})
|
| 32 |
+
: []
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
function getKeys(target) {
|
| 36 |
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
function propertyIsOnObject(object, property) {
|
| 40 |
+
try {
|
| 41 |
+
return property in object
|
| 42 |
+
} catch(_) {
|
| 43 |
+
return false
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
| 48 |
+
function propertyIsUnsafe(target, key) {
|
| 49 |
+
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
| 50 |
+
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
| 51 |
+
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
function mergeObject(target, source, options) {
|
| 55 |
+
var destination = {}
|
| 56 |
+
if (options.isMergeableObject(target)) {
|
| 57 |
+
getKeys(target).forEach(function(key) {
|
| 58 |
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options)
|
| 59 |
+
})
|
| 60 |
+
}
|
| 61 |
+
getKeys(source).forEach(function(key) {
|
| 62 |
+
if (propertyIsUnsafe(target, key)) {
|
| 63 |
+
return
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
| 67 |
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options)
|
| 68 |
+
} else {
|
| 69 |
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options)
|
| 70 |
+
}
|
| 71 |
+
})
|
| 72 |
+
return destination
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
function deepmerge(target, source, options) {
|
| 76 |
+
options = options || {}
|
| 77 |
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge
|
| 78 |
+
options.isMergeableObject = options.isMergeableObject || defaultIsMergeableObject
|
| 79 |
+
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
| 80 |
+
// implementations can use it. The caller may not replace it.
|
| 81 |
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified
|
| 82 |
+
|
| 83 |
+
var sourceIsArray = Array.isArray(source)
|
| 84 |
+
var targetIsArray = Array.isArray(target)
|
| 85 |
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray
|
| 86 |
+
|
| 87 |
+
if (!sourceAndTargetTypesMatch) {
|
| 88 |
+
return cloneUnlessOtherwiseSpecified(source, options)
|
| 89 |
+
} else if (sourceIsArray) {
|
| 90 |
+
return options.arrayMerge(target, source, options)
|
| 91 |
+
} else {
|
| 92 |
+
return mergeObject(target, source, options)
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
deepmerge.all = function deepmergeAll(array, options) {
|
| 97 |
+
if (!Array.isArray(array)) {
|
| 98 |
+
throw new Error('first argument should be an array')
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
return array.reduce(function(prev, next) {
|
| 102 |
+
return deepmerge(prev, next, options)
|
| 103 |
+
}, {})
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
module.exports = deepmerge
|
node_modules/deepmerge/license.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2012 James Halliday, Josh Duff, and other contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in
|
| 13 |
+
all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 21 |
+
THE SOFTWARE.
|
node_modules/deepmerge/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "deepmerge",
|
| 3 |
+
"description": "A library for deep (recursive) merging of Javascript objects",
|
| 4 |
+
"keywords": [
|
| 5 |
+
"merge",
|
| 6 |
+
"deep",
|
| 7 |
+
"extend",
|
| 8 |
+
"copy",
|
| 9 |
+
"clone",
|
| 10 |
+
"recursive"
|
| 11 |
+
],
|
| 12 |
+
"version": "4.3.1",
|
| 13 |
+
"homepage": "https://github.com/TehShrike/deepmerge",
|
| 14 |
+
"repository": {
|
| 15 |
+
"type": "git",
|
| 16 |
+
"url": "git://github.com/TehShrike/deepmerge.git"
|
| 17 |
+
},
|
| 18 |
+
"main": "dist/cjs.js",
|
| 19 |
+
"engines": {
|
| 20 |
+
"node": ">=0.10.0"
|
| 21 |
+
},
|
| 22 |
+
"scripts": {
|
| 23 |
+
"build": "rollup -c",
|
| 24 |
+
"test": "npm run build && tape test/*.js && jsmd readme.md && npm run test:typescript",
|
| 25 |
+
"test:typescript": "tsc --noEmit test/typescript.ts && ts-node test/typescript.ts",
|
| 26 |
+
"size": "npm run build && uglifyjs --compress --mangle -- ./dist/umd.js | gzip -c | wc -c"
|
| 27 |
+
},
|
| 28 |
+
"devDependencies": {
|
| 29 |
+
"@types/node": "^8.10.54",
|
| 30 |
+
"is-mergeable-object": "1.1.0",
|
| 31 |
+
"is-plain-object": "^5.0.0",
|
| 32 |
+
"jsmd": "^1.0.2",
|
| 33 |
+
"rollup": "^1.23.1",
|
| 34 |
+
"rollup-plugin-commonjs": "^10.1.0",
|
| 35 |
+
"rollup-plugin-node-resolve": "^5.2.0",
|
| 36 |
+
"tape": "^4.11.0",
|
| 37 |
+
"ts-node": "7.0.1",
|
| 38 |
+
"typescript": "=2.2.2",
|
| 39 |
+
"uglify-js": "^3.6.1"
|
| 40 |
+
},
|
| 41 |
+
"license": "MIT"
|
| 42 |
+
}
|
node_modules/deepmerge/readme.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# deepmerge
|
| 2 |
+
|
| 3 |
+
Merges the enumerable properties of two or more objects deeply.
|
| 4 |
+
|
| 5 |
+
> UMD bundle is 723B minified+gzipped
|
| 6 |
+
|
| 7 |
+
## Getting Started
|
| 8 |
+
|
| 9 |
+
### Example Usage
|
| 10 |
+
<!--js
|
| 11 |
+
const merge = require('./')
|
| 12 |
+
-->
|
| 13 |
+
|
| 14 |
+
```js
|
| 15 |
+
const x = {
|
| 16 |
+
foo: { bar: 3 },
|
| 17 |
+
array: [{
|
| 18 |
+
does: 'work',
|
| 19 |
+
too: [ 1, 2, 3 ]
|
| 20 |
+
}]
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
const y = {
|
| 24 |
+
foo: { baz: 4 },
|
| 25 |
+
quux: 5,
|
| 26 |
+
array: [{
|
| 27 |
+
does: 'work',
|
| 28 |
+
too: [ 4, 5, 6 ]
|
| 29 |
+
}, {
|
| 30 |
+
really: 'yes'
|
| 31 |
+
}]
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
const output = {
|
| 35 |
+
foo: {
|
| 36 |
+
bar: 3,
|
| 37 |
+
baz: 4
|
| 38 |
+
},
|
| 39 |
+
array: [{
|
| 40 |
+
does: 'work',
|
| 41 |
+
too: [ 1, 2, 3 ]
|
| 42 |
+
}, {
|
| 43 |
+
does: 'work',
|
| 44 |
+
too: [ 4, 5, 6 ]
|
| 45 |
+
}, {
|
| 46 |
+
really: 'yes'
|
| 47 |
+
}],
|
| 48 |
+
quux: 5
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
merge(x, y) // => output
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
### Installation
|
| 56 |
+
|
| 57 |
+
With [npm](http://npmjs.org) do:
|
| 58 |
+
|
| 59 |
+
```sh
|
| 60 |
+
npm install deepmerge
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
deepmerge can be used directly in the browser without the use of package managers/bundlers as well: [UMD version from unpkg.com](https://unpkg.com/deepmerge/dist/umd.js).
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
### Include
|
| 67 |
+
|
| 68 |
+
deepmerge exposes a CommonJS entry point:
|
| 69 |
+
|
| 70 |
+
```
|
| 71 |
+
const merge = require('deepmerge')
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
The ESM entry point was dropped due to a [Webpack bug](https://github.com/webpack/webpack/issues/6584).
|
| 75 |
+
|
| 76 |
+
# API
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
## `merge(x, y, [options])`
|
| 80 |
+
|
| 81 |
+
Merge two objects `x` and `y` deeply, returning a new merged object with the
|
| 82 |
+
elements from both `x` and `y`.
|
| 83 |
+
|
| 84 |
+
If an element at the same key is present for both `x` and `y`, the value from
|
| 85 |
+
`y` will appear in the result.
|
| 86 |
+
|
| 87 |
+
Merging creates a new object, so that neither `x` or `y` is modified.
|
| 88 |
+
|
| 89 |
+
**Note:** By default, arrays are merged by concatenating them.
|
| 90 |
+
|
| 91 |
+
## `merge.all(arrayOfObjects, [options])`
|
| 92 |
+
|
| 93 |
+
Merges any number of objects into a single result object.
|
| 94 |
+
|
| 95 |
+
```js
|
| 96 |
+
const foobar = { foo: { bar: 3 } }
|
| 97 |
+
const foobaz = { foo: { baz: 4 } }
|
| 98 |
+
const bar = { bar: 'yay!' }
|
| 99 |
+
|
| 100 |
+
merge.all([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' }
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
## Options
|
| 105 |
+
|
| 106 |
+
### `arrayMerge`
|
| 107 |
+
|
| 108 |
+
There are multiple ways to merge two arrays, below are a few examples but you can also create your own custom function.
|
| 109 |
+
|
| 110 |
+
Your `arrayMerge` function will be called with three arguments: a `target` array, the `source` array, and an `options` object with these properties:
|
| 111 |
+
|
| 112 |
+
- `isMergeableObject(value)`
|
| 113 |
+
- `cloneUnlessOtherwiseSpecified(value, options)`
|
| 114 |
+
|
| 115 |
+
#### `arrayMerge` example: overwrite target array
|
| 116 |
+
|
| 117 |
+
Overwrites the existing array values completely rather than concatenating them:
|
| 118 |
+
|
| 119 |
+
```js
|
| 120 |
+
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray
|
| 121 |
+
|
| 122 |
+
merge(
|
| 123 |
+
[1, 2, 3],
|
| 124 |
+
[3, 2, 1],
|
| 125 |
+
{ arrayMerge: overwriteMerge }
|
| 126 |
+
) // => [3, 2, 1]
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
#### `arrayMerge` example: combine arrays
|
| 130 |
+
|
| 131 |
+
Combines objects at the same index in the two arrays.
|
| 132 |
+
|
| 133 |
+
This was the default array merging algorithm pre-version-2.0.0.
|
| 134 |
+
|
| 135 |
+
```js
|
| 136 |
+
const combineMerge = (target, source, options) => {
|
| 137 |
+
const destination = target.slice()
|
| 138 |
+
|
| 139 |
+
source.forEach((item, index) => {
|
| 140 |
+
if (typeof destination[index] === 'undefined') {
|
| 141 |
+
destination[index] = options.cloneUnlessOtherwiseSpecified(item, options)
|
| 142 |
+
} else if (options.isMergeableObject(item)) {
|
| 143 |
+
destination[index] = merge(target[index], item, options)
|
| 144 |
+
} else if (target.indexOf(item) === -1) {
|
| 145 |
+
destination.push(item)
|
| 146 |
+
}
|
| 147 |
+
})
|
| 148 |
+
return destination
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
merge(
|
| 152 |
+
[{ a: true }],
|
| 153 |
+
[{ b: true }, 'ah yup'],
|
| 154 |
+
{ arrayMerge: combineMerge }
|
| 155 |
+
) // => [{ a: true, b: true }, 'ah yup']
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
### `isMergeableObject`
|
| 159 |
+
|
| 160 |
+
By default, deepmerge clones every property from almost every kind of object.
|
| 161 |
+
|
| 162 |
+
You may not want this, if your objects are of special types, and you want to copy the whole object instead of just copying its properties.
|
| 163 |
+
|
| 164 |
+
You can accomplish this by passing in a function for the `isMergeableObject` option.
|
| 165 |
+
|
| 166 |
+
If you only want to clone properties of plain objects, and ignore all "special" kinds of instantiated objects, you probably want to drop in [`is-plain-object`](https://github.com/jonschlinkert/is-plain-object).
|
| 167 |
+
|
| 168 |
+
```js
|
| 169 |
+
const { isPlainObject } = require('is-plain-object')
|
| 170 |
+
|
| 171 |
+
function SuperSpecial() {
|
| 172 |
+
this.special = 'oh yeah man totally'
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
const instantiatedSpecialObject = new SuperSpecial()
|
| 176 |
+
|
| 177 |
+
const target = {
|
| 178 |
+
someProperty: {
|
| 179 |
+
cool: 'oh for sure'
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
const source = {
|
| 184 |
+
someProperty: instantiatedSpecialObject
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
const defaultOutput = merge(target, source)
|
| 188 |
+
|
| 189 |
+
defaultOutput.someProperty.cool // => 'oh for sure'
|
| 190 |
+
defaultOutput.someProperty.special // => 'oh yeah man totally'
|
| 191 |
+
defaultOutput.someProperty instanceof SuperSpecial // => false
|
| 192 |
+
|
| 193 |
+
const customMergeOutput = merge(target, source, {
|
| 194 |
+
isMergeableObject: isPlainObject
|
| 195 |
+
})
|
| 196 |
+
|
| 197 |
+
customMergeOutput.someProperty.cool // => undefined
|
| 198 |
+
customMergeOutput.someProperty.special // => 'oh yeah man totally'
|
| 199 |
+
customMergeOutput.someProperty instanceof SuperSpecial // => true
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
### `customMerge`
|
| 203 |
+
|
| 204 |
+
Specifies a function which can be used to override the default merge behavior for a property, based on the property name.
|
| 205 |
+
|
| 206 |
+
The `customMerge` function will be passed the key for each property, and should return the function which should be used to merge the values for that property.
|
| 207 |
+
|
| 208 |
+
It may also return undefined, in which case the default merge behaviour will be used.
|
| 209 |
+
|
| 210 |
+
```js
|
| 211 |
+
const alex = {
|
| 212 |
+
name: {
|
| 213 |
+
first: 'Alex',
|
| 214 |
+
last: 'Alexson'
|
| 215 |
+
},
|
| 216 |
+
pets: ['Cat', 'Parrot']
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
const tony = {
|
| 220 |
+
name: {
|
| 221 |
+
first: 'Tony',
|
| 222 |
+
last: 'Tonison'
|
| 223 |
+
},
|
| 224 |
+
pets: ['Dog']
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
const mergeNames = (nameA, nameB) => `${nameA.first} and ${nameB.first}`
|
| 228 |
+
|
| 229 |
+
const options = {
|
| 230 |
+
customMerge: (key) => {
|
| 231 |
+
if (key === 'name') {
|
| 232 |
+
return mergeNames
|
| 233 |
+
}
|
| 234 |
+
}
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
const result = merge(alex, tony, options)
|
| 238 |
+
|
| 239 |
+
result.name // => 'Alex and Tony'
|
| 240 |
+
result.pets // => ['Cat', 'Parrot', 'Dog']
|
| 241 |
+
```
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
### `clone`
|
| 245 |
+
|
| 246 |
+
*Deprecated.*
|
| 247 |
+
|
| 248 |
+
Defaults to `true`.
|
| 249 |
+
|
| 250 |
+
If `clone` is `false` then child objects will be copied directly instead of being cloned. This was the default behavior before version 2.x.
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
# Testing
|
| 254 |
+
|
| 255 |
+
With [npm](http://npmjs.org) do:
|
| 256 |
+
|
| 257 |
+
```sh
|
| 258 |
+
npm test
|
| 259 |
+
```
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
# License
|
| 263 |
+
|
| 264 |
+
MIT
|
node_modules/deepmerge/rollup.config.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import resolve from 'rollup-plugin-node-resolve'
|
| 2 |
+
import commonjs from 'rollup-plugin-commonjs'
|
| 3 |
+
import pkg from './package.json'
|
| 4 |
+
|
| 5 |
+
export default {
|
| 6 |
+
input: `index.js`,
|
| 7 |
+
plugins: [
|
| 8 |
+
commonjs(),
|
| 9 |
+
resolve(),
|
| 10 |
+
],
|
| 11 |
+
output: [
|
| 12 |
+
{
|
| 13 |
+
file: pkg.main,
|
| 14 |
+
format: `cjs`
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
name: 'deepmerge',
|
| 18 |
+
file: 'dist/umd.js',
|
| 19 |
+
format: `umd`
|
| 20 |
+
},
|
| 21 |
+
],
|
| 22 |
+
}
|
node_modules/define-data-property/.eslintrc
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"root": true,
|
| 3 |
+
|
| 4 |
+
"extends": "@ljharb",
|
| 5 |
+
|
| 6 |
+
"rules": {
|
| 7 |
+
"complexity": 0,
|
| 8 |
+
"id-length": 0,
|
| 9 |
+
"new-cap": ["error", {
|
| 10 |
+
"capIsNewExceptions": [
|
| 11 |
+
"GetIntrinsic",
|
| 12 |
+
],
|
| 13 |
+
}],
|
| 14 |
+
},
|
| 15 |
+
|
| 16 |
+
"overrides": [
|
| 17 |
+
{
|
| 18 |
+
"files": "test/**",
|
| 19 |
+
"rules": {
|
| 20 |
+
"max-lines-per-function": "off",
|
| 21 |
+
},
|
| 22 |
+
},
|
| 23 |
+
],
|
| 24 |
+
}
|
node_modules/define-data-property/.github/FUNDING.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# These are supported funding model platforms
|
| 2 |
+
|
| 3 |
+
github: [ljharb]
|
| 4 |
+
patreon: # Replace with a single Patreon username
|
| 5 |
+
open_collective: # Replace with a single Open Collective username
|
| 6 |
+
ko_fi: # Replace with a single Ko-fi username
|
| 7 |
+
tidelift: npm/define-data-property
|
| 8 |
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
| 9 |
+
liberapay: # Replace with a single Liberapay username
|
| 10 |
+
issuehunt: # Replace with a single IssueHunt username
|
| 11 |
+
otechie: # Replace with a single Otechie username
|
| 12 |
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
node_modules/define-data-property/.nycrc
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"all": true,
|
| 3 |
+
"check-coverage": false,
|
| 4 |
+
"reporter": ["text-summary", "text", "html", "json"],
|
| 5 |
+
"lines": 86,
|
| 6 |
+
"statements": 85.93,
|
| 7 |
+
"functions": 82.43,
|
| 8 |
+
"branches": 76.06,
|
| 9 |
+
"exclude": [
|
| 10 |
+
"coverage",
|
| 11 |
+
"test"
|
| 12 |
+
]
|
| 13 |
+
}
|
node_modules/define-data-property/CHANGELOG.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
All notable changes to this project will be documented in this file.
|
| 4 |
+
|
| 5 |
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
| 6 |
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
| 7 |
+
|
| 8 |
+
## [v1.1.4](https://github.com/ljharb/define-data-property/compare/v1.1.3...v1.1.4) - 2024-02-13
|
| 9 |
+
|
| 10 |
+
### Commits
|
| 11 |
+
|
| 12 |
+
- [Refactor] use `es-define-property` [`90f2f4c`](https://github.com/ljharb/define-data-property/commit/90f2f4cc20298401e71c28e1e08888db12021453)
|
| 13 |
+
- [Dev Deps] update `@types/object.getownpropertydescriptors` [`cd929d9`](https://github.com/ljharb/define-data-property/commit/cd929d9a04f5f2fdcfa9d5be140940b91a083153)
|
| 14 |
+
|
| 15 |
+
## [v1.1.3](https://github.com/ljharb/define-data-property/compare/v1.1.2...v1.1.3) - 2024-02-12
|
| 16 |
+
|
| 17 |
+
### Commits
|
| 18 |
+
|
| 19 |
+
- [types] hand-write d.ts instead of emitting it [`0cbc988`](https://github.com/ljharb/define-data-property/commit/0cbc988203c105f2d97948327c7167ebd33bd318)
|
| 20 |
+
- [meta] simplify `exports` [`690781e`](https://github.com/ljharb/define-data-property/commit/690781eed28bbf2d6766237efda0ba6dd591609e)
|
| 21 |
+
- [Dev Deps] update `hasown`; clean up DT packages [`6cdfd1c`](https://github.com/ljharb/define-data-property/commit/6cdfd1cb2d91d791bfd18cda5d5cab232fd5d8fc)
|
| 22 |
+
- [actions] cleanup [`3142bc6`](https://github.com/ljharb/define-data-property/commit/3142bc6a4bc406a51f5b04f31e98562a27f35ffd)
|
| 23 |
+
- [meta] add `funding` [`8474423`](https://github.com/ljharb/define-data-property/commit/847442391a79779af3e0f1bf0b5bb923552b7804)
|
| 24 |
+
- [Deps] update `get-intrinsic` [`3e9be00`](https://github.com/ljharb/define-data-property/commit/3e9be00e07784ba34e7c77d8bc0fdbc832ad61de)
|
| 25 |
+
|
| 26 |
+
## [v1.1.2](https://github.com/ljharb/define-data-property/compare/v1.1.1...v1.1.2) - 2024-02-05
|
| 27 |
+
|
| 28 |
+
### Commits
|
| 29 |
+
|
| 30 |
+
- [Dev Deps] update @types packages, `object-inspect`, `tape`, `typescript` [`df41bf8`](https://github.com/ljharb/define-data-property/commit/df41bf84ca3456be6226055caab44e38e3a7fd2f)
|
| 31 |
+
- [Dev Deps] update DT packages, `aud`, `npmignore`, `tape`, typescript` [`fab0e4e`](https://github.com/ljharb/define-data-property/commit/fab0e4ec709ee02b79f42d6db3ee5f26e0a34b8a)
|
| 32 |
+
- [Dev Deps] use `hasown` instead of `has` [`aa51ef9`](https://github.com/ljharb/define-data-property/commit/aa51ef93f6403d49d9bb72a807bcdb6e418978c0)
|
| 33 |
+
- [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)
|
| 34 |
+
- [Deps] update `has-property-descriptors` [`7af887c`](https://github.com/ljharb/define-data-property/commit/7af887c9083b59b195b0079e04815cfed9fcee2b)
|
| 35 |
+
- [Deps] update `get-intrinsic` [`bb8728e`](https://github.com/ljharb/define-data-property/commit/bb8728ec42cd998505a7157ae24853a560c20646)
|
| 36 |
+
|
| 37 |
+
## [v1.1.1](https://github.com/ljharb/define-data-property/compare/v1.1.0...v1.1.1) - 2023-10-12
|
| 38 |
+
|
| 39 |
+
### Commits
|
| 40 |
+
|
| 41 |
+
- [Tests] fix tests in ES3 engines [`5c6920e`](https://github.com/ljharb/define-data-property/commit/5c6920edd1f52f675b02f417e539c28135b43f94)
|
| 42 |
+
- [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)
|
| 43 |
+
- [Fix] IE 8 has a broken `Object.defineProperty` [`0672e1a`](https://github.com/ljharb/define-data-property/commit/0672e1af2a9fcc787e7c23b96dea60d290df5548)
|
| 44 |
+
- [meta] emit types on prepack [`73acb1f`](https://github.com/ljharb/define-data-property/commit/73acb1f903c21b314ec7156bf10f73c7910530c0)
|
| 45 |
+
- [Dev Deps] update `tape`, `typescript` [`9489a77`](https://github.com/ljharb/define-data-property/commit/9489a7738bf2ecf0ac71d5b78ec4ca6ad7ba0142)
|
| 46 |
+
|
| 47 |
+
## [v1.1.0](https://github.com/ljharb/define-data-property/compare/v1.0.1...v1.1.0) - 2023-09-13
|
| 48 |
+
|
| 49 |
+
### Commits
|
| 50 |
+
|
| 51 |
+
- [New] add `loose` arg [`155235a`](https://github.com/ljharb/define-data-property/commit/155235a4c4d7741f6de01cd87c99599a56654b72)
|
| 52 |
+
- [New] allow `null` to be passed for the non* args [`7d2fa5f`](https://github.com/ljharb/define-data-property/commit/7d2fa5f06be0392736c13b126f7cd38979f34792)
|
| 53 |
+
|
| 54 |
+
## [v1.0.1](https://github.com/ljharb/define-data-property/compare/v1.0.0...v1.0.1) - 2023-09-12
|
| 55 |
+
|
| 56 |
+
### Commits
|
| 57 |
+
|
| 58 |
+
- [meta] add TS types [`43d763c`](https://github.com/ljharb/define-data-property/commit/43d763c6c883f652de1c9c02ef6216ee507ffa69)
|
| 59 |
+
- [Dev Deps] update `@types/tape`, `typescript` [`f444985`](https://github.com/ljharb/define-data-property/commit/f444985811c36f3e6448a03ad2f9b7898917f4c7)
|
| 60 |
+
- [meta] add `safe-publish-latest`, [`172bb10`](https://github.com/ljharb/define-data-property/commit/172bb10890896ebb160e64398f6ee55760107bee)
|
| 61 |
+
|
| 62 |
+
## v1.0.0 - 2023-09-12
|
| 63 |
+
|
| 64 |
+
### Commits
|
| 65 |
+
|
| 66 |
+
- Initial implementation, tests, readme [`5b43d6b`](https://github.com/ljharb/define-data-property/commit/5b43d6b44e675a904810467a7d4e0adb7efc3196)
|
| 67 |
+
- Initial commit [`35e577a`](https://github.com/ljharb/define-data-property/commit/35e577a6ba59a98befa97776d70d90f3bea9009d)
|
| 68 |
+
- npm init [`82a0a04`](https://github.com/ljharb/define-data-property/commit/82a0a04a321ca7de220af02d41e2745e8a9962ed)
|
| 69 |
+
- Only apps should have lockfiles [`96df244`](https://github.com/ljharb/define-data-property/commit/96df244a3c6f426f9a2437be825d1c6f5dd7158e)
|
| 70 |
+
- [meta] use `npmignore` to autogenerate an npmignore file [`a87ff18`](https://github.com/ljharb/define-data-property/commit/a87ff18cb79e14c2eb5720486c4759fd9a189375)
|
node_modules/define-data-property/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2023 Jordan Harband
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
node_modules/define-data-property/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# define-data-property <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
| 2 |
+
|
| 3 |
+
[![github actions][actions-image]][actions-url]
|
| 4 |
+
[![coverage][codecov-image]][codecov-url]
|
| 5 |
+
[![License][license-image]][license-url]
|
| 6 |
+
[![Downloads][downloads-image]][downloads-url]
|
| 7 |
+
|
| 8 |
+
[![npm badge][npm-badge-png]][package-url]
|
| 9 |
+
|
| 10 |
+
Define a data property on an object. Will fall back to assignment in an engine without descriptors.
|
| 11 |
+
|
| 12 |
+
The three `non*` argument can also be passed `null`, which will use the existing state if available.
|
| 13 |
+
|
| 14 |
+
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.
|
| 15 |
+
|
| 16 |
+
## Usage
|
| 17 |
+
|
| 18 |
+
```javascript
|
| 19 |
+
var defineDataProperty = require('define-data-property');
|
| 20 |
+
var assert = require('assert');
|
| 21 |
+
|
| 22 |
+
var obj = {};
|
| 23 |
+
defineDataProperty(obj, 'key', 'value');
|
| 24 |
+
defineDataProperty(
|
| 25 |
+
obj,
|
| 26 |
+
'key2',
|
| 27 |
+
'value',
|
| 28 |
+
true, // nonEnumerable, optional
|
| 29 |
+
false, // nonWritable, optional
|
| 30 |
+
true, // nonConfigurable, optional
|
| 31 |
+
false // loose, optional
|
| 32 |
+
);
|
| 33 |
+
|
| 34 |
+
assert.deepEqual(
|
| 35 |
+
Object.getOwnPropertyDescriptors(obj),
|
| 36 |
+
{
|
| 37 |
+
key: {
|
| 38 |
+
configurable: true,
|
| 39 |
+
enumerable: true,
|
| 40 |
+
value: 'value',
|
| 41 |
+
writable: true,
|
| 42 |
+
},
|
| 43 |
+
key2: {
|
| 44 |
+
configurable: false,
|
| 45 |
+
enumerable: false,
|
| 46 |
+
value: 'value',
|
| 47 |
+
writable: true,
|
| 48 |
+
},
|
| 49 |
+
}
|
| 50 |
+
);
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
[package-url]: https://npmjs.org/package/define-data-property
|
| 54 |
+
[npm-version-svg]: https://versionbadg.es/ljharb/define-data-property.svg
|
| 55 |
+
[deps-svg]: https://david-dm.org/ljharb/define-data-property.svg
|
| 56 |
+
[deps-url]: https://david-dm.org/ljharb/define-data-property
|
| 57 |
+
[dev-deps-svg]: https://david-dm.org/ljharb/define-data-property/dev-status.svg
|
| 58 |
+
[dev-deps-url]: https://david-dm.org/ljharb/define-data-property#info=devDependencies
|
| 59 |
+
[npm-badge-png]: https://nodei.co/npm/define-data-property.png?downloads=true&stars=true
|
| 60 |
+
[license-image]: https://img.shields.io/npm/l/define-data-property.svg
|
| 61 |
+
[license-url]: LICENSE
|
| 62 |
+
[downloads-image]: https://img.shields.io/npm/dm/define-data-property.svg
|
| 63 |
+
[downloads-url]: https://npm-stat.com/charts.html?package=define-data-property
|
| 64 |
+
[codecov-image]: https://codecov.io/gh/ljharb/define-data-property/branch/main/graphs/badge.svg
|
| 65 |
+
[codecov-url]: https://app.codecov.io/gh/ljharb/define-data-property/
|
| 66 |
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/define-data-property
|
| 67 |
+
[actions-url]: https://github.com/ljharb/define-data-property/actions
|
node_modules/define-data-property/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
declare function defineDataProperty(
|
| 3 |
+
obj: Record<PropertyKey, unknown>,
|
| 4 |
+
property: keyof typeof obj,
|
| 5 |
+
value: typeof obj[typeof property],
|
| 6 |
+
nonEnumerable?: boolean | null,
|
| 7 |
+
nonWritable?: boolean | null,
|
| 8 |
+
nonConfigurable?: boolean | null,
|
| 9 |
+
loose?: boolean
|
| 10 |
+
): void;
|
| 11 |
+
|
| 12 |
+
export = defineDataProperty;
|
node_modules/define-data-property/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var $defineProperty = require('es-define-property');
|
| 4 |
+
|
| 5 |
+
var $SyntaxError = require('es-errors/syntax');
|
| 6 |
+
var $TypeError = require('es-errors/type');
|
| 7 |
+
|
| 8 |
+
var gopd = require('gopd');
|
| 9 |
+
|
| 10 |
+
/** @type {import('.')} */
|
| 11 |
+
module.exports = function defineDataProperty(
|
| 12 |
+
obj,
|
| 13 |
+
property,
|
| 14 |
+
value
|
| 15 |
+
) {
|
| 16 |
+
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
| 17 |
+
throw new $TypeError('`obj` must be an object or a function`');
|
| 18 |
+
}
|
| 19 |
+
if (typeof property !== 'string' && typeof property !== 'symbol') {
|
| 20 |
+
throw new $TypeError('`property` must be a string or a symbol`');
|
| 21 |
+
}
|
| 22 |
+
if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
|
| 23 |
+
throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');
|
| 24 |
+
}
|
| 25 |
+
if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
|
| 26 |
+
throw new $TypeError('`nonWritable`, if provided, must be a boolean or null');
|
| 27 |
+
}
|
| 28 |
+
if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
|
| 29 |
+
throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');
|
| 30 |
+
}
|
| 31 |
+
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
|
| 32 |
+
throw new $TypeError('`loose`, if provided, must be a boolean');
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
|
| 36 |
+
var nonWritable = arguments.length > 4 ? arguments[4] : null;
|
| 37 |
+
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
|
| 38 |
+
var loose = arguments.length > 6 ? arguments[6] : false;
|
| 39 |
+
|
| 40 |
+
/* @type {false | TypedPropertyDescriptor<unknown>} */
|
| 41 |
+
var desc = !!gopd && gopd(obj, property);
|
| 42 |
+
|
| 43 |
+
if ($defineProperty) {
|
| 44 |
+
$defineProperty(obj, property, {
|
| 45 |
+
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
| 46 |
+
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
| 47 |
+
value: value,
|
| 48 |
+
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
| 49 |
+
});
|
| 50 |
+
} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
|
| 51 |
+
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
|
| 52 |
+
obj[property] = value; // eslint-disable-line no-param-reassign
|
| 53 |
+
} else {
|
| 54 |
+
throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
|
| 55 |
+
}
|
| 56 |
+
};
|
node_modules/define-data-property/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "define-data-property",
|
| 3 |
+
"version": "1.1.4",
|
| 4 |
+
"description": "Define a data property on an object. Will fall back to assignment in an engine without descriptors.",
|
| 5 |
+
"main": "index.js",
|
| 6 |
+
"types": "./index.d.ts",
|
| 7 |
+
"exports": {
|
| 8 |
+
".": "./index.js",
|
| 9 |
+
"./package.json": "./package.json"
|
| 10 |
+
},
|
| 11 |
+
"sideEffects": false,
|
| 12 |
+
"scripts": {
|
| 13 |
+
"prepack": "npmignore --auto --commentLines=autogenerated",
|
| 14 |
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
| 15 |
+
"prepublishOnly": "safe-publish-latest",
|
| 16 |
+
"tsc": "tsc -p .",
|
| 17 |
+
"prelint": "evalmd README.md",
|
| 18 |
+
"lint": "eslint --ext=js,mjs .",
|
| 19 |
+
"postlint": "npm run tsc",
|
| 20 |
+
"pretest": "npm run lint",
|
| 21 |
+
"tests-only": "nyc tape 'test/**/*.js'",
|
| 22 |
+
"test": "npm run tests-only",
|
| 23 |
+
"posttest": "aud --production",
|
| 24 |
+
"version": "auto-changelog && git add CHANGELOG.md",
|
| 25 |
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
| 26 |
+
},
|
| 27 |
+
"repository": {
|
| 28 |
+
"type": "git",
|
| 29 |
+
"url": "git+https://github.com/ljharb/define-data-property.git"
|
| 30 |
+
},
|
| 31 |
+
"keywords": [
|
| 32 |
+
"define",
|
| 33 |
+
"data",
|
| 34 |
+
"property",
|
| 35 |
+
"object",
|
| 36 |
+
"accessor",
|
| 37 |
+
"javascript",
|
| 38 |
+
"ecmascript",
|
| 39 |
+
"enumerable",
|
| 40 |
+
"configurable",
|
| 41 |
+
"writable"
|
| 42 |
+
],
|
| 43 |
+
"author": "Jordan Harband <ljharb@gmail.com>",
|
| 44 |
+
"funding": {
|
| 45 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 46 |
+
},
|
| 47 |
+
"license": "MIT",
|
| 48 |
+
"bugs": {
|
| 49 |
+
"url": "https://github.com/ljharb/define-data-property/issues"
|
| 50 |
+
},
|
| 51 |
+
"homepage": "https://github.com/ljharb/define-data-property#readme",
|
| 52 |
+
"dependencies": {
|
| 53 |
+
"es-define-property": "^1.0.0",
|
| 54 |
+
"es-errors": "^1.3.0",
|
| 55 |
+
"gopd": "^1.0.1"
|
| 56 |
+
},
|
| 57 |
+
"devDependencies": {
|
| 58 |
+
"@ljharb/eslint-config": "^21.1.0",
|
| 59 |
+
"@types/call-bind": "^1.0.5",
|
| 60 |
+
"@types/define-properties": "^1.1.5",
|
| 61 |
+
"@types/es-value-fixtures": "^1.4.4",
|
| 62 |
+
"@types/for-each": "^0.3.3",
|
| 63 |
+
"@types/get-intrinsic": "^1.2.2",
|
| 64 |
+
"@types/gopd": "^1.0.3",
|
| 65 |
+
"@types/has-property-descriptors": "^1.0.3",
|
| 66 |
+
"@types/object-inspect": "^1.8.4",
|
| 67 |
+
"@types/object.getownpropertydescriptors": "^2.1.4",
|
| 68 |
+
"@types/tape": "^5.6.4",
|
| 69 |
+
"aud": "^2.0.4",
|
| 70 |
+
"auto-changelog": "^2.4.0",
|
| 71 |
+
"es-value-fixtures": "^1.4.2",
|
| 72 |
+
"eslint": "=8.8.0",
|
| 73 |
+
"evalmd": "^0.0.19",
|
| 74 |
+
"for-each": "^0.3.3",
|
| 75 |
+
"hasown": "^2.0.1",
|
| 76 |
+
"in-publish": "^2.0.1",
|
| 77 |
+
"npmignore": "^0.3.1",
|
| 78 |
+
"nyc": "^10.3.2",
|
| 79 |
+
"object-inspect": "^1.13.1",
|
| 80 |
+
"object.getownpropertydescriptors": "^2.1.7",
|
| 81 |
+
"reflect.ownkeys": "^1.1.4",
|
| 82 |
+
"safe-publish-latest": "^2.0.0",
|
| 83 |
+
"tape": "^5.7.4",
|
| 84 |
+
"typescript": "next"
|
| 85 |
+
},
|
| 86 |
+
"engines": {
|
| 87 |
+
"node": ">= 0.4"
|
| 88 |
+
},
|
| 89 |
+
"testling": {
|
| 90 |
+
"files": "test/index.js"
|
| 91 |
+
},
|
| 92 |
+
"auto-changelog": {
|
| 93 |
+
"output": "CHANGELOG.md",
|
| 94 |
+
"template": "keepachangelog",
|
| 95 |
+
"unreleased": false,
|
| 96 |
+
"commitLimit": false,
|
| 97 |
+
"backfillLimit": false,
|
| 98 |
+
"hideCredit": true
|
| 99 |
+
},
|
| 100 |
+
"publishConfig": {
|
| 101 |
+
"ignore": [
|
| 102 |
+
".github/workflows",
|
| 103 |
+
"types/reflect.ownkeys"
|
| 104 |
+
]
|
| 105 |
+
}
|
| 106 |
+
}
|
node_modules/define-data-property/test/index.js
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var test = require('tape');
|
| 4 |
+
var v = require('es-value-fixtures');
|
| 5 |
+
var forEach = require('for-each');
|
| 6 |
+
var inspect = require('object-inspect');
|
| 7 |
+
var hasOwn = require('hasown');
|
| 8 |
+
var hasPropertyDescriptors = require('has-property-descriptors')();
|
| 9 |
+
var getOwnPropertyDescriptors = require('object.getownpropertydescriptors');
|
| 10 |
+
var ownKeys = require('reflect.ownkeys');
|
| 11 |
+
|
| 12 |
+
var defineDataProperty = require('../');
|
| 13 |
+
|
| 14 |
+
test('defineDataProperty', function (t) {
|
| 15 |
+
t.test('argument validation', function (st) {
|
| 16 |
+
forEach(v.primitives, function (nonObject) {
|
| 17 |
+
st['throws'](
|
| 18 |
+
// @ts-expect-error
|
| 19 |
+
function () { defineDataProperty(nonObject, 'key', 'value'); },
|
| 20 |
+
TypeError,
|
| 21 |
+
'throws on non-object input: ' + inspect(nonObject)
|
| 22 |
+
);
|
| 23 |
+
});
|
| 24 |
+
|
| 25 |
+
forEach(v.nonPropertyKeys, function (nonPropertyKey) {
|
| 26 |
+
st['throws'](
|
| 27 |
+
// @ts-expect-error
|
| 28 |
+
function () { defineDataProperty({}, nonPropertyKey, 'value'); },
|
| 29 |
+
TypeError,
|
| 30 |
+
'throws on non-PropertyKey input: ' + inspect(nonPropertyKey)
|
| 31 |
+
);
|
| 32 |
+
});
|
| 33 |
+
|
| 34 |
+
forEach(v.nonBooleans, function (nonBoolean) {
|
| 35 |
+
if (nonBoolean !== null) {
|
| 36 |
+
st['throws'](
|
| 37 |
+
// @ts-expect-error
|
| 38 |
+
function () { defineDataProperty({}, 'key', 'value', nonBoolean); },
|
| 39 |
+
TypeError,
|
| 40 |
+
'throws on non-boolean nonEnumerable: ' + inspect(nonBoolean)
|
| 41 |
+
);
|
| 42 |
+
|
| 43 |
+
st['throws'](
|
| 44 |
+
// @ts-expect-error
|
| 45 |
+
function () { defineDataProperty({}, 'key', 'value', false, nonBoolean); },
|
| 46 |
+
TypeError,
|
| 47 |
+
'throws on non-boolean nonWritable: ' + inspect(nonBoolean)
|
| 48 |
+
);
|
| 49 |
+
|
| 50 |
+
st['throws'](
|
| 51 |
+
// @ts-expect-error
|
| 52 |
+
function () { defineDataProperty({}, 'key', 'value', false, false, nonBoolean); },
|
| 53 |
+
TypeError,
|
| 54 |
+
'throws on non-boolean nonConfigurable: ' + inspect(nonBoolean)
|
| 55 |
+
);
|
| 56 |
+
}
|
| 57 |
+
});
|
| 58 |
+
|
| 59 |
+
st.end();
|
| 60 |
+
});
|
| 61 |
+
|
| 62 |
+
t.test('normal data property', function (st) {
|
| 63 |
+
/** @type {Record<PropertyKey, string>} */
|
| 64 |
+
var obj = { existing: 'existing property' };
|
| 65 |
+
st.ok(hasOwn(obj, 'existing'), 'has initial own property');
|
| 66 |
+
st.equal(obj.existing, 'existing property', 'has expected initial value');
|
| 67 |
+
|
| 68 |
+
var res = defineDataProperty(obj, 'added', 'added property');
|
| 69 |
+
st.equal(res, void undefined, 'returns `undefined`');
|
| 70 |
+
st.ok(hasOwn(obj, 'added'), 'has expected own property');
|
| 71 |
+
st.equal(obj.added, 'added property', 'has expected value');
|
| 72 |
+
|
| 73 |
+
defineDataProperty(obj, 'existing', 'new value');
|
| 74 |
+
st.ok(hasOwn(obj, 'existing'), 'still has expected own property');
|
| 75 |
+
st.equal(obj.existing, 'new value', 'has new expected value');
|
| 76 |
+
|
| 77 |
+
defineDataProperty(obj, 'explicit1', 'new value', false);
|
| 78 |
+
st.ok(hasOwn(obj, 'explicit1'), 'has expected own property (explicit enumerable)');
|
| 79 |
+
st.equal(obj.explicit1, 'new value', 'has new expected value (explicit enumerable)');
|
| 80 |
+
|
| 81 |
+
defineDataProperty(obj, 'explicit2', 'new value', false, false);
|
| 82 |
+
st.ok(hasOwn(obj, 'explicit2'), 'has expected own property (explicit writable)');
|
| 83 |
+
st.equal(obj.explicit2, 'new value', 'has new expected value (explicit writable)');
|
| 84 |
+
|
| 85 |
+
defineDataProperty(obj, 'explicit3', 'new value', false, false, false);
|
| 86 |
+
st.ok(hasOwn(obj, 'explicit3'), 'has expected own property (explicit configurable)');
|
| 87 |
+
st.equal(obj.explicit3, 'new value', 'has new expected value (explicit configurable)');
|
| 88 |
+
|
| 89 |
+
st.end();
|
| 90 |
+
});
|
| 91 |
+
|
| 92 |
+
t.test('loose mode', { skip: !hasPropertyDescriptors }, function (st) {
|
| 93 |
+
var obj = { existing: 'existing property' };
|
| 94 |
+
|
| 95 |
+
defineDataProperty(obj, 'added', 'added value 1', true, null, null, true);
|
| 96 |
+
st.deepEqual(
|
| 97 |
+
getOwnPropertyDescriptors(obj),
|
| 98 |
+
{
|
| 99 |
+
existing: {
|
| 100 |
+
configurable: true,
|
| 101 |
+
enumerable: true,
|
| 102 |
+
value: 'existing property',
|
| 103 |
+
writable: true
|
| 104 |
+
},
|
| 105 |
+
added: {
|
| 106 |
+
configurable: true,
|
| 107 |
+
enumerable: !hasPropertyDescriptors,
|
| 108 |
+
value: 'added value 1',
|
| 109 |
+
writable: true
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
'in loose mode, obj still adds property 1'
|
| 113 |
+
);
|
| 114 |
+
|
| 115 |
+
defineDataProperty(obj, 'added', 'added value 2', false, true, null, true);
|
| 116 |
+
st.deepEqual(
|
| 117 |
+
getOwnPropertyDescriptors(obj),
|
| 118 |
+
{
|
| 119 |
+
existing: {
|
| 120 |
+
configurable: true,
|
| 121 |
+
enumerable: true,
|
| 122 |
+
value: 'existing property',
|
| 123 |
+
writable: true
|
| 124 |
+
},
|
| 125 |
+
added: {
|
| 126 |
+
configurable: true,
|
| 127 |
+
enumerable: true,
|
| 128 |
+
value: 'added value 2',
|
| 129 |
+
writable: !hasPropertyDescriptors
|
| 130 |
+
}
|
| 131 |
+
},
|
| 132 |
+
'in loose mode, obj still adds property 2'
|
| 133 |
+
);
|
| 134 |
+
|
| 135 |
+
defineDataProperty(obj, 'added', 'added value 3', false, false, true, true);
|
| 136 |
+
st.deepEqual(
|
| 137 |
+
getOwnPropertyDescriptors(obj),
|
| 138 |
+
{
|
| 139 |
+
existing: {
|
| 140 |
+
configurable: true,
|
| 141 |
+
enumerable: true,
|
| 142 |
+
value: 'existing property',
|
| 143 |
+
writable: true
|
| 144 |
+
},
|
| 145 |
+
added: {
|
| 146 |
+
configurable: !hasPropertyDescriptors,
|
| 147 |
+
enumerable: true,
|
| 148 |
+
value: 'added value 3',
|
| 149 |
+
writable: true
|
| 150 |
+
}
|
| 151 |
+
},
|
| 152 |
+
'in loose mode, obj still adds property 3'
|
| 153 |
+
);
|
| 154 |
+
|
| 155 |
+
st.end();
|
| 156 |
+
});
|
| 157 |
+
|
| 158 |
+
t.test('non-normal data property, ES3', { skip: hasPropertyDescriptors }, function (st) {
|
| 159 |
+
/** @type {Record<PropertyKey, string>} */
|
| 160 |
+
var obj = { existing: 'existing property' };
|
| 161 |
+
|
| 162 |
+
st['throws'](
|
| 163 |
+
function () { defineDataProperty(obj, 'added', 'added value', true); },
|
| 164 |
+
SyntaxError,
|
| 165 |
+
'nonEnumerable throws a Syntax Error'
|
| 166 |
+
);
|
| 167 |
+
|
| 168 |
+
st['throws'](
|
| 169 |
+
function () { defineDataProperty(obj, 'added', 'added value', false, true); },
|
| 170 |
+
SyntaxError,
|
| 171 |
+
'nonWritable throws a Syntax Error'
|
| 172 |
+
);
|
| 173 |
+
|
| 174 |
+
st['throws'](
|
| 175 |
+
function () { defineDataProperty(obj, 'added', 'added value', false, false, true); },
|
| 176 |
+
SyntaxError,
|
| 177 |
+
'nonWritable throws a Syntax Error'
|
| 178 |
+
);
|
| 179 |
+
|
| 180 |
+
st.deepEqual(
|
| 181 |
+
ownKeys(obj),
|
| 182 |
+
['existing'],
|
| 183 |
+
'obj still has expected keys'
|
| 184 |
+
);
|
| 185 |
+
st.equal(obj.existing, 'existing property', 'obj still has expected values');
|
| 186 |
+
|
| 187 |
+
st.end();
|
| 188 |
+
});
|
| 189 |
+
|
| 190 |
+
t.test('new non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) {
|
| 191 |
+
/** @type {Record<PropertyKey, string>} */
|
| 192 |
+
var obj = { existing: 'existing property' };
|
| 193 |
+
|
| 194 |
+
defineDataProperty(obj, 'nonEnum', null, true);
|
| 195 |
+
defineDataProperty(obj, 'nonWrit', null, false, true);
|
| 196 |
+
defineDataProperty(obj, 'nonConf', null, false, false, true);
|
| 197 |
+
|
| 198 |
+
st.deepEqual(
|
| 199 |
+
getOwnPropertyDescriptors(obj),
|
| 200 |
+
{
|
| 201 |
+
existing: {
|
| 202 |
+
configurable: true,
|
| 203 |
+
enumerable: true,
|
| 204 |
+
value: 'existing property',
|
| 205 |
+
writable: true
|
| 206 |
+
},
|
| 207 |
+
nonEnum: {
|
| 208 |
+
configurable: true,
|
| 209 |
+
enumerable: false,
|
| 210 |
+
value: null,
|
| 211 |
+
writable: true
|
| 212 |
+
},
|
| 213 |
+
nonWrit: {
|
| 214 |
+
configurable: true,
|
| 215 |
+
enumerable: true,
|
| 216 |
+
value: null,
|
| 217 |
+
writable: false
|
| 218 |
+
},
|
| 219 |
+
nonConf: {
|
| 220 |
+
configurable: false,
|
| 221 |
+
enumerable: true,
|
| 222 |
+
value: null,
|
| 223 |
+
writable: true
|
| 224 |
+
}
|
| 225 |
+
},
|
| 226 |
+
'obj has expected property descriptors'
|
| 227 |
+
);
|
| 228 |
+
|
| 229 |
+
st.end();
|
| 230 |
+
});
|
| 231 |
+
|
| 232 |
+
t.test('existing non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) {
|
| 233 |
+
// test case changing an existing non-normal property
|
| 234 |
+
|
| 235 |
+
/** @type {Record<string, null | string>} */
|
| 236 |
+
var obj = {};
|
| 237 |
+
Object.defineProperty(obj, 'nonEnum', { configurable: true, enumerable: false, value: null, writable: true });
|
| 238 |
+
Object.defineProperty(obj, 'nonWrit', { configurable: true, enumerable: true, value: null, writable: false });
|
| 239 |
+
Object.defineProperty(obj, 'nonConf', { configurable: false, enumerable: true, value: null, writable: true });
|
| 240 |
+
|
| 241 |
+
st.deepEqual(
|
| 242 |
+
getOwnPropertyDescriptors(obj),
|
| 243 |
+
{
|
| 244 |
+
nonEnum: {
|
| 245 |
+
configurable: true,
|
| 246 |
+
enumerable: false,
|
| 247 |
+
value: null,
|
| 248 |
+
writable: true
|
| 249 |
+
},
|
| 250 |
+
nonWrit: {
|
| 251 |
+
configurable: true,
|
| 252 |
+
enumerable: true,
|
| 253 |
+
value: null,
|
| 254 |
+
writable: false
|
| 255 |
+
},
|
| 256 |
+
nonConf: {
|
| 257 |
+
configurable: false,
|
| 258 |
+
enumerable: true,
|
| 259 |
+
value: null,
|
| 260 |
+
writable: true
|
| 261 |
+
}
|
| 262 |
+
},
|
| 263 |
+
'obj initially has expected property descriptors'
|
| 264 |
+
);
|
| 265 |
+
|
| 266 |
+
defineDataProperty(obj, 'nonEnum', 'new value', false);
|
| 267 |
+
defineDataProperty(obj, 'nonWrit', 'new value', false, false);
|
| 268 |
+
st['throws'](
|
| 269 |
+
function () { defineDataProperty(obj, 'nonConf', 'new value', false, false, false); },
|
| 270 |
+
TypeError,
|
| 271 |
+
'can not alter a nonconfigurable property'
|
| 272 |
+
);
|
| 273 |
+
|
| 274 |
+
st.deepEqual(
|
| 275 |
+
getOwnPropertyDescriptors(obj),
|
| 276 |
+
{
|
| 277 |
+
nonEnum: {
|
| 278 |
+
configurable: true,
|
| 279 |
+
enumerable: true,
|
| 280 |
+
value: 'new value',
|
| 281 |
+
writable: true
|
| 282 |
+
},
|
| 283 |
+
nonWrit: {
|
| 284 |
+
configurable: true,
|
| 285 |
+
enumerable: true,
|
| 286 |
+
value: 'new value',
|
| 287 |
+
writable: true
|
| 288 |
+
},
|
| 289 |
+
nonConf: {
|
| 290 |
+
configurable: false,
|
| 291 |
+
enumerable: true,
|
| 292 |
+
value: null,
|
| 293 |
+
writable: true
|
| 294 |
+
}
|
| 295 |
+
},
|
| 296 |
+
'obj ends up with expected property descriptors'
|
| 297 |
+
);
|
| 298 |
+
|
| 299 |
+
st.end();
|
| 300 |
+
});
|
| 301 |
+
|
| 302 |
+
t.test('frozen object, ES5+', { skip: !hasPropertyDescriptors }, function (st) {
|
| 303 |
+
var frozen = Object.freeze({ existing: true });
|
| 304 |
+
|
| 305 |
+
st['throws'](
|
| 306 |
+
function () { defineDataProperty(frozen, 'existing', 'new value'); },
|
| 307 |
+
TypeError,
|
| 308 |
+
'frozen object can not modify an existing property'
|
| 309 |
+
);
|
| 310 |
+
|
| 311 |
+
st['throws'](
|
| 312 |
+
function () { defineDataProperty(frozen, 'new', 'new property'); },
|
| 313 |
+
TypeError,
|
| 314 |
+
'frozen object can not add a new property'
|
| 315 |
+
);
|
| 316 |
+
|
| 317 |
+
st.end();
|
| 318 |
+
});
|
| 319 |
+
|
| 320 |
+
t.test('sealed object, ES5+', { skip: !hasPropertyDescriptors }, function (st) {
|
| 321 |
+
var sealed = Object.seal({ existing: true });
|
| 322 |
+
st.deepEqual(
|
| 323 |
+
Object.getOwnPropertyDescriptor(sealed, 'existing'),
|
| 324 |
+
{
|
| 325 |
+
configurable: false,
|
| 326 |
+
enumerable: true,
|
| 327 |
+
value: true,
|
| 328 |
+
writable: true
|
| 329 |
+
},
|
| 330 |
+
'existing value on sealed object has expected descriptor'
|
| 331 |
+
);
|
| 332 |
+
|
| 333 |
+
defineDataProperty(sealed, 'existing', 'new value');
|
| 334 |
+
|
| 335 |
+
st.deepEqual(
|
| 336 |
+
Object.getOwnPropertyDescriptor(sealed, 'existing'),
|
| 337 |
+
{
|
| 338 |
+
configurable: false,
|
| 339 |
+
enumerable: true,
|
| 340 |
+
value: 'new value',
|
| 341 |
+
writable: true
|
| 342 |
+
},
|
| 343 |
+
'existing value on sealed object has changed descriptor'
|
| 344 |
+
);
|
| 345 |
+
|
| 346 |
+
st['throws'](
|
| 347 |
+
function () { defineDataProperty(sealed, 'new', 'new property'); },
|
| 348 |
+
TypeError,
|
| 349 |
+
'sealed object can not add a new property'
|
| 350 |
+
);
|
| 351 |
+
|
| 352 |
+
st.end();
|
| 353 |
+
});
|
| 354 |
+
|
| 355 |
+
t.test('nonextensible object, ES5+', { skip: !hasPropertyDescriptors }, function (st) {
|
| 356 |
+
var nonExt = Object.preventExtensions({ existing: true });
|
| 357 |
+
|
| 358 |
+
st.deepEqual(
|
| 359 |
+
Object.getOwnPropertyDescriptor(nonExt, 'existing'),
|
| 360 |
+
{
|
| 361 |
+
configurable: true,
|
| 362 |
+
enumerable: true,
|
| 363 |
+
value: true,
|
| 364 |
+
writable: true
|
| 365 |
+
},
|
| 366 |
+
'existing value on non-extensible object has expected descriptor'
|
| 367 |
+
);
|
| 368 |
+
|
| 369 |
+
defineDataProperty(nonExt, 'existing', 'new value', true);
|
| 370 |
+
|
| 371 |
+
st.deepEqual(
|
| 372 |
+
Object.getOwnPropertyDescriptor(nonExt, 'existing'),
|
| 373 |
+
{
|
| 374 |
+
configurable: true,
|
| 375 |
+
enumerable: false,
|
| 376 |
+
value: 'new value',
|
| 377 |
+
writable: true
|
| 378 |
+
},
|
| 379 |
+
'existing value on non-extensible object has changed descriptor'
|
| 380 |
+
);
|
| 381 |
+
|
| 382 |
+
st['throws'](
|
| 383 |
+
function () { defineDataProperty(nonExt, 'new', 'new property'); },
|
| 384 |
+
TypeError,
|
| 385 |
+
'non-extensible object can not add a new property'
|
| 386 |
+
);
|
| 387 |
+
|
| 388 |
+
st.end();
|
| 389 |
+
});
|
| 390 |
+
|
| 391 |
+
t.end();
|
| 392 |
+
});
|
node_modules/define-data-property/tsconfig.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compilerOptions": {
|
| 3 |
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
| 4 |
+
|
| 5 |
+
/* Projects */
|
| 6 |
+
|
| 7 |
+
/* Language and Environment */
|
| 8 |
+
"target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
| 9 |
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
| 10 |
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
| 11 |
+
"useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
| 12 |
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
| 13 |
+
|
| 14 |
+
/* Modules */
|
| 15 |
+
"module": "commonjs", /* Specify what module code is generated. */
|
| 16 |
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
| 17 |
+
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
| 18 |
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
| 19 |
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
| 20 |
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
| 21 |
+
"typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */
|
| 22 |
+
"resolveJsonModule": true, /* Enable importing .json files. */
|
| 23 |
+
|
| 24 |
+
/* JavaScript Support */
|
| 25 |
+
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
| 26 |
+
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
| 27 |
+
"maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
| 28 |
+
|
| 29 |
+
/* Emit */
|
| 30 |
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
| 31 |
+
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
| 32 |
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
| 33 |
+
"noEmit": true, /* Disable emitting files from a compilation. */
|
| 34 |
+
|
| 35 |
+
/* Interop Constraints */
|
| 36 |
+
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
| 37 |
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
| 38 |
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
| 39 |
+
|
| 40 |
+
/* Type Checking */
|
| 41 |
+
"strict": true, /* Enable all strict type-checking options. */
|
| 42 |
+
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
| 43 |
+
"noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
| 44 |
+
"useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
| 45 |
+
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
| 46 |
+
"noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
| 47 |
+
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
| 48 |
+
"noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
| 49 |
+
"noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
| 50 |
+
"noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
| 51 |
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
| 52 |
+
|
| 53 |
+
/* Completeness */
|
| 54 |
+
// "skipLibCheck": true /* Skip type checking all .d.ts files. */
|
| 55 |
+
},
|
| 56 |
+
"exclude": [
|
| 57 |
+
"coverage"
|
| 58 |
+
]
|
| 59 |
+
}
|
node_modules/define-properties/.editorconfig
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
root = true
|
| 2 |
+
|
| 3 |
+
[*]
|
| 4 |
+
indent_style = tab;
|
| 5 |
+
insert_final_newline = true;
|
| 6 |
+
quote_type = auto;
|
| 7 |
+
space_after_anonymous_functions = true;
|
| 8 |
+
space_after_control_statements = true;
|
| 9 |
+
spaces_around_operators = true;
|
| 10 |
+
trim_trailing_whitespace = true;
|
| 11 |
+
spaces_in_brackets = false;
|
| 12 |
+
end_of_line = lf;
|
| 13 |
+
|
node_modules/define-properties/.eslintrc
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"root": true,
|
| 3 |
+
|
| 4 |
+
"extends": "@ljharb",
|
| 5 |
+
|
| 6 |
+
"rules": {
|
| 7 |
+
"id-length": [2, { "min": 1, "max": 35 }],
|
| 8 |
+
"max-params": [2, 4],
|
| 9 |
+
},
|
| 10 |
+
|
| 11 |
+
"overrides": [
|
| 12 |
+
{
|
| 13 |
+
"files": "test/**",
|
| 14 |
+
"rules": {
|
| 15 |
+
"max-lines-per-function": 0,
|
| 16 |
+
},
|
| 17 |
+
},
|
| 18 |
+
],
|
| 19 |
+
}
|
node_modules/define-properties/.github/FUNDING.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# These are supported funding model platforms
|
| 2 |
+
|
| 3 |
+
github: [ljharb]
|
| 4 |
+
patreon: # Replace with a single Patreon username
|
| 5 |
+
open_collective: # Replace with a single Open Collective username
|
| 6 |
+
ko_fi: # Replace with a single Ko-fi username
|
| 7 |
+
tidelift: npm/define-properties
|
| 8 |
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
| 9 |
+
liberapay: # Replace with a single Liberapay username
|
| 10 |
+
issuehunt: # Replace with a single IssueHunt username
|
| 11 |
+
otechie: # Replace with a single Otechie username
|
| 12 |
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
node_modules/define-properties/.nycrc
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"all": true,
|
| 3 |
+
"check-coverage": false,
|
| 4 |
+
"reporter": ["text-summary", "text", "html", "json"],
|
| 5 |
+
"exclude": [
|
| 6 |
+
"coverage",
|
| 7 |
+
"test"
|
| 8 |
+
]
|
| 9 |
+
}
|
node_modules/define-properties/CHANGELOG.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
All notable changes to this project will be documented in this file.
|
| 4 |
+
|
| 5 |
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
| 6 |
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
| 7 |
+
|
| 8 |
+
## [v1.2.1](https://github.com/ljharb/define-properties/compare/v1.2.0...v1.2.1) - 2023-09-12
|
| 9 |
+
|
| 10 |
+
### Commits
|
| 11 |
+
|
| 12 |
+
- [Refactor] use `define-data-property` [`e7782a7`](https://github.com/ljharb/define-properties/commit/e7782a7480a62f8b6e141b49371e6de4df176c97)
|
| 13 |
+
- [actions] use reusable rebase action [`cd249c3`](https://github.com/ljharb/define-properties/commit/cd249c3920607bc8eeb7c0cd5b672b810983cac5)
|
| 14 |
+
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`8205f97`](https://github.com/ljharb/define-properties/commit/8205f9734a4da8ee5b3b29798788567a09b330e8)
|
| 15 |
+
|
| 16 |
+
## [v1.2.0](https://github.com/ljharb/define-properties/compare/v1.1.4...v1.2.0) - 2023-02-10
|
| 17 |
+
|
| 18 |
+
### Commits
|
| 19 |
+
|
| 20 |
+
- [New] if the predicate is boolean `true`, it compares the existing value with `===` as the predicate [`d8dd6fc`](https://github.com/ljharb/define-properties/commit/d8dd6fca40d7c5878a4b643b91e66ae5a513a194)
|
| 21 |
+
- [meta] add `auto-changelog` [`7ebe2b0`](https://github.com/ljharb/define-properties/commit/7ebe2b0a0f90e62b842942cd45e86864fe75d9f6)
|
| 22 |
+
- [meta] use `npmignore` to autogenerate an npmignore file [`647478a`](https://github.com/ljharb/define-properties/commit/647478a8401fbf053fb633c0a3a7c982da6bad74)
|
| 23 |
+
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`e620d70`](https://github.com/ljharb/define-properties/commit/e620d707d2e1118a38796f22a862200eb0a53fff)
|
| 24 |
+
- [Dev Deps] update `aud`, `tape` [`f1e5072`](https://github.com/ljharb/define-properties/commit/f1e507225c2551a99ed4fe40d3fe71b0f44acf88)
|
| 25 |
+
- [actions] update checkout action [`628b3af`](https://github.com/ljharb/define-properties/commit/628b3af5c74b8f0963296d811a8f6fa657baf964)
|
| 26 |
+
|
| 27 |
+
<!-- auto-changelog-above -->
|
| 28 |
+
|
| 29 |
+
1.1.4 / 2022-04-14
|
| 30 |
+
=================
|
| 31 |
+
* [Refactor] use `has-property-descriptors`
|
| 32 |
+
* [readme] add github actions/codecov badges
|
| 33 |
+
* [Docs] fix header parsing; remove testling
|
| 34 |
+
* [Deps] update `object-keys`
|
| 35 |
+
* [meta] use `prepublishOnly` script for npm 7+
|
| 36 |
+
* [meta] add `funding` field; create FUNDING.yml
|
| 37 |
+
* [actions] add "Allow Edits" workflow; automatic rebasing / merge commit blocking
|
| 38 |
+
* [actions] reuse common workflows
|
| 39 |
+
* [actions] update codecov uploader
|
| 40 |
+
* [actions] use `node/install` instead of `node/run`; use `codecov` action
|
| 41 |
+
* [Tests] migrate tests to Github Actions
|
| 42 |
+
* [Tests] run `nyc` on all tests; use `tape` runner
|
| 43 |
+
* [Tests] use shared travis-ci config
|
| 44 |
+
* [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops
|
| 45 |
+
* [Tests] remove `jscs`
|
| 46 |
+
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape`; add `aud`, `safe-publish-latest`
|
| 47 |
+
|
| 48 |
+
1.1.3 / 2018-08-14
|
| 49 |
+
=================
|
| 50 |
+
* [Refactor] use a for loop instead of `foreach` to make for smaller bundle sizes
|
| 51 |
+
* [Robustness] cache `Array.prototype.concat` and `Object.defineProperty`
|
| 52 |
+
* [Deps] update `object-keys`
|
| 53 |
+
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `tape`, `jscs`; remove unused eccheck script + dep
|
| 54 |
+
* [Tests] use pretest/posttest for linting/security
|
| 55 |
+
* [Tests] fix npm upgrades on older nodes
|
| 56 |
+
|
| 57 |
+
1.1.2 / 2015-10-14
|
| 58 |
+
=================
|
| 59 |
+
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
|
| 60 |
+
* [Deps] Update `object-keys`
|
| 61 |
+
* [Dev Deps] update `jscs`, `tape`, `eslint`, `@ljharb/eslint-config`, `nsp`
|
| 62 |
+
* [Tests] up to `io.js` `v3.3`, `node` `v4.2`
|
| 63 |
+
|
| 64 |
+
1.1.1 / 2015-07-21
|
| 65 |
+
=================
|
| 66 |
+
* [Deps] Update `object-keys`
|
| 67 |
+
* [Dev Deps] Update `tape`, `eslint`
|
| 68 |
+
* [Tests] Test on `io.js` `v2.4`
|
| 69 |
+
|
| 70 |
+
1.1.0 / 2015-07-01
|
| 71 |
+
=================
|
| 72 |
+
* [New] Add support for symbol-valued properties.
|
| 73 |
+
* [Dev Deps] Update `nsp`, `eslint`
|
| 74 |
+
* [Tests] Test up to `io.js` `v2.3`
|
| 75 |
+
|
| 76 |
+
1.0.3 / 2015-05-30
|
| 77 |
+
=================
|
| 78 |
+
* Using a more reliable check for supported property descriptors.
|
| 79 |
+
|
| 80 |
+
1.0.2 / 2015-05-23
|
| 81 |
+
=================
|
| 82 |
+
* Test up to `io.js` `v2.0`
|
| 83 |
+
* Update `tape`, `jscs`, `nsp`, `eslint`, `object-keys`, `editorconfig-tools`, `covert`
|
| 84 |
+
|
| 85 |
+
1.0.1 / 2015-01-06
|
| 86 |
+
=================
|
| 87 |
+
* Update `object-keys` to fix ES3 support
|
| 88 |
+
|
| 89 |
+
1.0.0 / 2015-01-04
|
| 90 |
+
=================
|
| 91 |
+
* v1.0.0
|
node_modules/define-properties/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (C) 2015 Jordan Harband
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in
|
| 13 |
+
all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 21 |
+
THE SOFTWARE.
|
node_modules/define-properties/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# define-properties <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
| 2 |
+
|
| 3 |
+
[![github actions][actions-image]][actions-url]
|
| 4 |
+
[![coverage][codecov-image]][codecov-url]
|
| 5 |
+
[![dependency status][deps-svg]][deps-url]
|
| 6 |
+
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
| 7 |
+
[![License][license-image]][license-url]
|
| 8 |
+
[![Downloads][downloads-image]][downloads-url]
|
| 9 |
+
|
| 10 |
+
[![npm badge][npm-badge-png]][package-url]
|
| 11 |
+
|
| 12 |
+
Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines.
|
| 13 |
+
Existing properties are not overridden. Accepts a map of property names to a predicate that, when true, force-overrides.
|
| 14 |
+
|
| 15 |
+
## Example
|
| 16 |
+
|
| 17 |
+
```js
|
| 18 |
+
var define = require('define-properties');
|
| 19 |
+
var assert = require('assert');
|
| 20 |
+
|
| 21 |
+
var obj = define({ a: 1, b: 2 }, {
|
| 22 |
+
a: 10,
|
| 23 |
+
b: 20,
|
| 24 |
+
c: 30
|
| 25 |
+
});
|
| 26 |
+
assert(obj.a === 1);
|
| 27 |
+
assert(obj.b === 2);
|
| 28 |
+
assert(obj.c === 30);
|
| 29 |
+
if (define.supportsDescriptors) {
|
| 30 |
+
assert.deepEqual(Object.keys(obj), ['a', 'b']);
|
| 31 |
+
assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'c'), {
|
| 32 |
+
configurable: true,
|
| 33 |
+
enumerable: false,
|
| 34 |
+
value: 30,
|
| 35 |
+
writable: false
|
| 36 |
+
});
|
| 37 |
+
}
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
Then, with predicates:
|
| 41 |
+
```js
|
| 42 |
+
var define = require('define-properties');
|
| 43 |
+
var assert = require('assert');
|
| 44 |
+
|
| 45 |
+
var obj = define({ a: 1, b: 2, c: 3 }, {
|
| 46 |
+
a: 10,
|
| 47 |
+
b: 20,
|
| 48 |
+
c: 30
|
| 49 |
+
}, {
|
| 50 |
+
a: function () { return false; },
|
| 51 |
+
b: function () { return true; }
|
| 52 |
+
});
|
| 53 |
+
assert(obj.a === 1);
|
| 54 |
+
assert(obj.b === 20);
|
| 55 |
+
assert(obj.c === 3);
|
| 56 |
+
if (define.supportsDescriptors) {
|
| 57 |
+
assert.deepEqual(Object.keys(obj), ['a', 'c']);
|
| 58 |
+
assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'b'), {
|
| 59 |
+
configurable: true,
|
| 60 |
+
enumerable: false,
|
| 61 |
+
value: 20,
|
| 62 |
+
writable: false
|
| 63 |
+
});
|
| 64 |
+
}
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Tests
|
| 68 |
+
Simply clone the repo, `npm install`, and run `npm test`
|
| 69 |
+
|
| 70 |
+
[package-url]: https://npmjs.org/package/define-properties
|
| 71 |
+
[npm-version-svg]: https://versionbadg.es/ljharb/define-properties.svg
|
| 72 |
+
[deps-svg]: https://david-dm.org/ljharb/define-properties.svg
|
| 73 |
+
[deps-url]: https://david-dm.org/ljharb/define-properties
|
| 74 |
+
[dev-deps-svg]: https://david-dm.org/ljharb/define-properties/dev-status.svg
|
| 75 |
+
[dev-deps-url]: https://david-dm.org/ljharb/define-properties#info=devDependencies
|
| 76 |
+
[npm-badge-png]: https://nodei.co/npm/define-properties.png?downloads=true&stars=true
|
| 77 |
+
[license-image]: https://img.shields.io/npm/l/define-properties.svg
|
| 78 |
+
[license-url]: LICENSE
|
| 79 |
+
[downloads-image]: https://img.shields.io/npm/dm/define-properties.svg
|
| 80 |
+
[downloads-url]: https://npm-stat.com/charts.html?package=define-properties
|
| 81 |
+
[codecov-image]: https://codecov.io/gh/ljharb/define-properties/branch/main/graphs/badge.svg
|
| 82 |
+
[codecov-url]: https://app.codecov.io/gh/ljharb/define-properties/
|
| 83 |
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/define-properties
|
| 84 |
+
[actions-url]: https://github.com/ljharb/define-properties/actions
|
node_modules/define-properties/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var keys = require('object-keys');
|
| 4 |
+
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
|
| 5 |
+
|
| 6 |
+
var toStr = Object.prototype.toString;
|
| 7 |
+
var concat = Array.prototype.concat;
|
| 8 |
+
var defineDataProperty = require('define-data-property');
|
| 9 |
+
|
| 10 |
+
var isFunction = function (fn) {
|
| 11 |
+
return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
|
| 12 |
+
};
|
| 13 |
+
|
| 14 |
+
var supportsDescriptors = require('has-property-descriptors')();
|
| 15 |
+
|
| 16 |
+
var defineProperty = function (object, name, value, predicate) {
|
| 17 |
+
if (name in object) {
|
| 18 |
+
if (predicate === true) {
|
| 19 |
+
if (object[name] === value) {
|
| 20 |
+
return;
|
| 21 |
+
}
|
| 22 |
+
} else if (!isFunction(predicate) || !predicate()) {
|
| 23 |
+
return;
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
if (supportsDescriptors) {
|
| 28 |
+
defineDataProperty(object, name, value, true);
|
| 29 |
+
} else {
|
| 30 |
+
defineDataProperty(object, name, value);
|
| 31 |
+
}
|
| 32 |
+
};
|
| 33 |
+
|
| 34 |
+
var defineProperties = function (object, map) {
|
| 35 |
+
var predicates = arguments.length > 2 ? arguments[2] : {};
|
| 36 |
+
var props = keys(map);
|
| 37 |
+
if (hasSymbols) {
|
| 38 |
+
props = concat.call(props, Object.getOwnPropertySymbols(map));
|
| 39 |
+
}
|
| 40 |
+
for (var i = 0; i < props.length; i += 1) {
|
| 41 |
+
defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
|
| 42 |
+
}
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
defineProperties.supportsDescriptors = !!supportsDescriptors;
|
| 46 |
+
|
| 47 |
+
module.exports = defineProperties;
|
node_modules/define-properties/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "define-properties",
|
| 3 |
+
"version": "1.2.1",
|
| 4 |
+
"author": "Jordan Harband <ljharb@gmail.com>",
|
| 5 |
+
"funding": {
|
| 6 |
+
"url": "https://github.com/sponsors/ljharb"
|
| 7 |
+
},
|
| 8 |
+
"description": "Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines.",
|
| 9 |
+
"license": "MIT",
|
| 10 |
+
"main": "index.js",
|
| 11 |
+
"scripts": {
|
| 12 |
+
"prepack": "npmignore --auto --commentLines=autogenerated",
|
| 13 |
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
| 14 |
+
"prepublishOnly": "safe-publish-latest",
|
| 15 |
+
"pretest": "npm run lint",
|
| 16 |
+
"test": "npm run tests-only",
|
| 17 |
+
"posttest": "aud --production",
|
| 18 |
+
"tests-only": "nyc tape 'test/**/*.js'",
|
| 19 |
+
"lint": "eslint --ext=js,mjs .",
|
| 20 |
+
"version": "auto-changelog && git add CHANGELOG.md",
|
| 21 |
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
| 22 |
+
},
|
| 23 |
+
"repository": {
|
| 24 |
+
"type": "git",
|
| 25 |
+
"url": "git://github.com/ljharb/define-properties.git"
|
| 26 |
+
},
|
| 27 |
+
"keywords": [
|
| 28 |
+
"Object.defineProperty",
|
| 29 |
+
"Object.defineProperties",
|
| 30 |
+
"object",
|
| 31 |
+
"property descriptor",
|
| 32 |
+
"descriptor",
|
| 33 |
+
"define",
|
| 34 |
+
"ES5"
|
| 35 |
+
],
|
| 36 |
+
"dependencies": {
|
| 37 |
+
"define-data-property": "^1.0.1",
|
| 38 |
+
"has-property-descriptors": "^1.0.0",
|
| 39 |
+
"object-keys": "^1.1.1"
|
| 40 |
+
},
|
| 41 |
+
"devDependencies": {
|
| 42 |
+
"@ljharb/eslint-config": "^21.1.0",
|
| 43 |
+
"aud": "^2.0.3",
|
| 44 |
+
"auto-changelog": "^2.4.0",
|
| 45 |
+
"eslint": "=8.8.0",
|
| 46 |
+
"in-publish": "^2.0.1",
|
| 47 |
+
"npmignore": "^0.3.0",
|
| 48 |
+
"nyc": "^10.3.2",
|
| 49 |
+
"safe-publish-latest": "^2.0.0",
|
| 50 |
+
"tape": "^5.6.6"
|
| 51 |
+
},
|
| 52 |
+
"testling": {
|
| 53 |
+
"files": "test/index.js",
|
| 54 |
+
"browsers": [
|
| 55 |
+
"iexplore/6.0..latest",
|
| 56 |
+
"firefox/3.0..6.0",
|
| 57 |
+
"firefox/15.0..latest",
|
| 58 |
+
"firefox/nightly",
|
| 59 |
+
"chrome/4.0..10.0",
|
| 60 |
+
"chrome/20.0..latest",
|
| 61 |
+
"chrome/canary",
|
| 62 |
+
"opera/10.0..latest",
|
| 63 |
+
"opera/next",
|
| 64 |
+
"safari/4.0..latest",
|
| 65 |
+
"ipad/6.0..latest",
|
| 66 |
+
"iphone/6.0..latest",
|
| 67 |
+
"android-browser/4.2"
|
| 68 |
+
]
|
| 69 |
+
},
|
| 70 |
+
"engines": {
|
| 71 |
+
"node": ">= 0.4"
|
| 72 |
+
},
|
| 73 |
+
"auto-changelog": {
|
| 74 |
+
"output": "CHANGELOG.md",
|
| 75 |
+
"template": "keepachangelog",
|
| 76 |
+
"unreleased": false,
|
| 77 |
+
"commitLimit": false,
|
| 78 |
+
"backfillLimit": false,
|
| 79 |
+
"hideCredit": true,
|
| 80 |
+
"startingVersion": "1.1.5"
|
| 81 |
+
},
|
| 82 |
+
"publishConfig": {
|
| 83 |
+
"ignore": [
|
| 84 |
+
".github/workflows",
|
| 85 |
+
"test/"
|
| 86 |
+
]
|
| 87 |
+
}
|
| 88 |
+
}
|
node_modules/defu/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
node_modules/defu/README.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🌊 defu
|
| 2 |
+
|
| 3 |
+
Assign default properties, recursively. Lightweight and Fast.
|
| 4 |
+
|
| 5 |
+
[![npm version][npm-version-src]][npm-version-href]
|
| 6 |
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
| 7 |
+
[![bundle][bundle-src]][bundle-href]
|
| 8 |
+
[![Codecov][codecov-src]][codecov-href]
|
| 9 |
+
[![License][license-src]][license-href]
|
| 10 |
+
|
| 11 |
+
## Install
|
| 12 |
+
|
| 13 |
+
Install package:
|
| 14 |
+
|
| 15 |
+
```bash
|
| 16 |
+
# yarn
|
| 17 |
+
yarn add defu
|
| 18 |
+
# npm
|
| 19 |
+
npm install defu
|
| 20 |
+
# pnpm
|
| 21 |
+
pnpm install defu
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
## Usage
|
| 25 |
+
|
| 26 |
+
```js
|
| 27 |
+
import { defu } from "defu";
|
| 28 |
+
|
| 29 |
+
const options = defu(object, ...defaults);
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
Leftmost arguments have more priority when assigning defaults.
|
| 33 |
+
|
| 34 |
+
### Arguments
|
| 35 |
+
|
| 36 |
+
- **object (Object):** The destination object.
|
| 37 |
+
- **source (Object):** The source object.
|
| 38 |
+
|
| 39 |
+
```js
|
| 40 |
+
import { defu } from "defu";
|
| 41 |
+
|
| 42 |
+
console.log(defu({ a: { b: 2 } }, { a: { b: 1, c: 3 } }));
|
| 43 |
+
// => { a: { b: 2, c: 3 } }
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
### Using with CommonJS
|
| 47 |
+
|
| 48 |
+
```js
|
| 49 |
+
const { defu } = require("defu");
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Custom Merger
|
| 53 |
+
|
| 54 |
+
Sometimes default merging strategy is not desirable. Using `createDefu` we can create a custom instance with different merging strategy.
|
| 55 |
+
|
| 56 |
+
This function accepts `obj` (source object), `key` and `value` (current value) and should return `true` if applied custom merging.
|
| 57 |
+
|
| 58 |
+
**Example:** Sum numbers instead of overriding
|
| 59 |
+
|
| 60 |
+
```js
|
| 61 |
+
import { createDefu } from "defu";
|
| 62 |
+
|
| 63 |
+
const ext = createDefu((obj, key, value) => {
|
| 64 |
+
if (typeof obj[key] === "number" && typeof value === "number") {
|
| 65 |
+
obj[key] += value;
|
| 66 |
+
return true;
|
| 67 |
+
}
|
| 68 |
+
});
|
| 69 |
+
|
| 70 |
+
ext({ cost: 15 }, { cost: 10 }); // { cost: 25 }
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
## Function Merger
|
| 74 |
+
|
| 75 |
+
Using `defuFn`, if user provided a function, it will be called with default value instead of merging.
|
| 76 |
+
|
| 77 |
+
It can be useful for default values manipulation.
|
| 78 |
+
|
| 79 |
+
**Example:** Filter some items from defaults (array) and add 20 to the count default value.
|
| 80 |
+
|
| 81 |
+
```js
|
| 82 |
+
import { defuFn } from "defu";
|
| 83 |
+
|
| 84 |
+
defuFn(
|
| 85 |
+
{
|
| 86 |
+
ignore: (val) => val.filter((item) => item !== "dist"),
|
| 87 |
+
count: (count) => count + 20,
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
ignore: ["node_modules", "dist"],
|
| 91 |
+
count: 10,
|
| 92 |
+
},
|
| 93 |
+
);
|
| 94 |
+
/*
|
| 95 |
+
{
|
| 96 |
+
ignore: ['node_modules'],
|
| 97 |
+
count: 30
|
| 98 |
+
}
|
| 99 |
+
*/
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
**Note:** if the default value is not defined, the function defined won't be called and kept as value.
|
| 103 |
+
|
| 104 |
+
## Array Function Merger
|
| 105 |
+
|
| 106 |
+
`defuArrayFn` is similar to `defuFn` but **only applies to array values defined in defaults**.
|
| 107 |
+
|
| 108 |
+
**Example:** Filter some items from defaults (array) and add 20 to the count default value.
|
| 109 |
+
|
| 110 |
+
```js
|
| 111 |
+
import { defuArrayFn } from "defu";
|
| 112 |
+
|
| 113 |
+
defuArrayFn(
|
| 114 |
+
{
|
| 115 |
+
ignore: (val) => val.filter((i) => i !== "dist"),
|
| 116 |
+
count: () => 20,
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
ignore: ["node_modules", "dist"],
|
| 120 |
+
count: 10,
|
| 121 |
+
},
|
| 122 |
+
);
|
| 123 |
+
/*
|
| 124 |
+
{
|
| 125 |
+
ignore: ['node_modules'],
|
| 126 |
+
count: () => 20
|
| 127 |
+
}
|
| 128 |
+
*/
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
**Note:** the function is called only if the value defined in defaults is an aray.
|
| 132 |
+
|
| 133 |
+
### Remarks
|
| 134 |
+
|
| 135 |
+
- `object` and `defaults` are not modified
|
| 136 |
+
- Nullish values ([`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null) and [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)) are skipped. Please use [defaults-deep](https://www.npmjs.com/package/defaults-deep) or [omit-deep](http://npmjs.com/package/omit-deep) or [lodash.defaultsdeep](https://www.npmjs.com/package/lodash.defaultsdeep) if you need to preserve or different behavior.
|
| 137 |
+
- Assignment of `__proto__` and `constructor` keys will be skipped to prevent security issues with object pollution.
|
| 138 |
+
- Will concat `array` values (if default property is defined)
|
| 139 |
+
|
| 140 |
+
```js
|
| 141 |
+
console.log(defu({ array: ["b", "c"] }, { array: ["a"] }));
|
| 142 |
+
// => { array: ['b', 'c', 'a'] }
|
| 143 |
+
```
|
| 144 |
+
|
| 145 |
+
## Type
|
| 146 |
+
|
| 147 |
+
We expose `Defu` as a type utility to return a merged type that follows the rules that defu follows.
|
| 148 |
+
|
| 149 |
+
```js
|
| 150 |
+
import type { Defu } from 'defu'
|
| 151 |
+
|
| 152 |
+
type Options = Defu<{ foo: 'bar' }, [{}, { bar: 'baz' }, { something: 42 }]>
|
| 153 |
+
// returns { foo: 'bar', bar: 'baz', 'something': 42 }
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
## License
|
| 157 |
+
|
| 158 |
+
MIT. Made with 💖
|
| 159 |
+
|
| 160 |
+
<!-- Refs -->
|
| 161 |
+
|
| 162 |
+
[npm-version-src]: https://img.shields.io/npm/v/defu?style=flat&colorA=18181B&colorB=F0DB4F
|
| 163 |
+
[npm-version-href]: https://npmjs.com/package/defu
|
| 164 |
+
[npm-downloads-src]: https://img.shields.io/npm/dm/defu?style=flat&colorA=18181B&colorB=F0DB4F
|
| 165 |
+
[npm-downloads-href]: https://npmjs.com/package/defu
|
| 166 |
+
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/defu/main?style=flat&colorA=18181B&colorB=F0DB4F
|
| 167 |
+
[codecov-href]: https://codecov.io/gh/unjs/defu
|
| 168 |
+
[bundle-src]: https://img.shields.io/bundlephobia/minzip/defu?style=flat&colorA=18181B&colorB=F0DB4F
|
| 169 |
+
[bundle-href]: https://bundlephobia.com/result?p=defu
|
| 170 |
+
[license-src]: https://img.shields.io/github/license/unjs/defu.svg?style=flat&colorA=18181B&colorB=F0DB4F
|
| 171 |
+
[license-href]: https://github.com/unjs/defu/blob/main/LICENSE
|
node_modules/defu/lib/defu.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const { defu, createDefu, defuFn, defuArrayFn } = require("../dist/defu.cjs");
|
| 2 |
+
|
| 3 |
+
module.exports = defu;
|
| 4 |
+
|
| 5 |
+
module.exports.defu = defu;
|
| 6 |
+
module.exports.default = defu;
|
| 7 |
+
|
| 8 |
+
module.exports.createDefu = createDefu;
|
| 9 |
+
module.exports.defuFn = defuFn;
|
| 10 |
+
module.exports.defuArrayFn = defuArrayFn;
|
node_modules/defu/lib/defu.d.cts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Defu, DefuInstance, DefuFn } from "../dist/defu.mts";
|
| 2 |
+
|
| 3 |
+
type _Input = Record<string | number | symbol, any>;
|
| 4 |
+
type _IgnoredInput = boolean | number | null | any[] | Record<never, any> | undefined;
|
| 5 |
+
|
| 6 |
+
declare function defuProxy<Source extends _Input, Defaults extends Array<_Input | _IgnoredInput>>(
|
| 7 |
+
source: Source | _IgnoredInput,
|
| 8 |
+
...defaults: Defaults
|
| 9 |
+
): Defu<Source, Defaults>;
|
| 10 |
+
|
| 11 |
+
declare namespace defuProxy {
|
| 12 |
+
export type { Defu, DefuFn, DefuInstance };
|
| 13 |
+
export var fn: DefuFn;
|
| 14 |
+
export var arrayFn: DefuFn;
|
| 15 |
+
export function extend(merger?: (...args: any[]) => any): DefuFn;
|
| 16 |
+
var _default: DefuInstance;
|
| 17 |
+
export { _default as default };
|
| 18 |
+
export var defu: DefuInstance;
|
| 19 |
+
export var createDefu: typeof import("../dist/defu.mts").createDefu;
|
| 20 |
+
export var defuFn: DefuFn;
|
| 21 |
+
export var defuArrayFn: DefuFn;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
export = defuProxy;
|
node_modules/defu/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "defu",
|
| 3 |
+
"version": "6.1.7",
|
| 4 |
+
"description": "Recursively assign default properties. Lightweight and Fast!",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"repository": "unjs/defu",
|
| 7 |
+
"files": [
|
| 8 |
+
"dist",
|
| 9 |
+
"lib"
|
| 10 |
+
],
|
| 11 |
+
"main": "./lib/defu.cjs",
|
| 12 |
+
"module": "./dist/defu.mjs",
|
| 13 |
+
"types": "./dist/defu.d.ts",
|
| 14 |
+
"exports": {
|
| 15 |
+
".": {
|
| 16 |
+
"import": {
|
| 17 |
+
"types": "./dist/defu.d.mts",
|
| 18 |
+
"default": "./dist/defu.mjs"
|
| 19 |
+
},
|
| 20 |
+
"require": {
|
| 21 |
+
"types": "./lib/defu.d.cts",
|
| 22 |
+
"default": "./lib/defu.cjs"
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
},
|
| 26 |
+
"devDependencies": {
|
| 27 |
+
"@types/node": "^25.5.0",
|
| 28 |
+
"@typescript/native-preview": "7.0.0-dev.20260401.1",
|
| 29 |
+
"@vitest/coverage-v8": "^4.1.2",
|
| 30 |
+
"changelogen": "^0.6.2",
|
| 31 |
+
"eslint-config-unjs": "^0.6.2",
|
| 32 |
+
"expect-type": "^1.3.0",
|
| 33 |
+
"oxfmt": "^0.43.0",
|
| 34 |
+
"oxlint": "^1.58.0",
|
| 35 |
+
"typescript": "^6.0.2",
|
| 36 |
+
"unbuild": "^3.6.1",
|
| 37 |
+
"vitest": "^4.1.2"
|
| 38 |
+
},
|
| 39 |
+
"scripts": {
|
| 40 |
+
"build": "unbuild",
|
| 41 |
+
"dev": "vitest",
|
| 42 |
+
"lint": "oxlint src && oxfmt --check src test",
|
| 43 |
+
"lint:fix": "oxlint src --fix && oxfmt src test",
|
| 44 |
+
"release": "pnpm test && pnpm build && changelogen --release && git push --follow-tags && pnpm publish",
|
| 45 |
+
"test": "pnpm lint && pnpm test:types && pnpm vitest run",
|
| 46 |
+
"test:types": "tsgo --noEmit"
|
| 47 |
+
}
|
| 48 |
+
}
|
node_modules/delayed-stream/.npmignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
test
|
node_modules/delayed-stream/License
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 4 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 5 |
+
in the Software without restriction, including without limitation the rights
|
| 6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 7 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 8 |
+
furnished to do so, subject to the following conditions:
|
| 9 |
+
|
| 10 |
+
The above copyright notice and this permission notice shall be included in
|
| 11 |
+
all copies or substantial portions of the Software.
|
| 12 |
+
|
| 13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 19 |
+
THE SOFTWARE.
|
node_modules/delayed-stream/Makefile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SHELL := /bin/bash
|
| 2 |
+
|
| 3 |
+
test:
|
| 4 |
+
@./test/run.js
|
| 5 |
+
|
| 6 |
+
.PHONY: test
|
| 7 |
+
|
node_modules/delayed-stream/Readme.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# delayed-stream
|
| 2 |
+
|
| 3 |
+
Buffers events from a stream until you are ready to handle them.
|
| 4 |
+
|
| 5 |
+
## Installation
|
| 6 |
+
|
| 7 |
+
``` bash
|
| 8 |
+
npm install delayed-stream
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
## Usage
|
| 12 |
+
|
| 13 |
+
The following example shows how to write a http echo server that delays its
|
| 14 |
+
response by 1000 ms.
|
| 15 |
+
|
| 16 |
+
``` javascript
|
| 17 |
+
var DelayedStream = require('delayed-stream');
|
| 18 |
+
var http = require('http');
|
| 19 |
+
|
| 20 |
+
http.createServer(function(req, res) {
|
| 21 |
+
var delayed = DelayedStream.create(req);
|
| 22 |
+
|
| 23 |
+
setTimeout(function() {
|
| 24 |
+
res.writeHead(200);
|
| 25 |
+
delayed.pipe(res);
|
| 26 |
+
}, 1000);
|
| 27 |
+
});
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
If you are not using `Stream#pipe`, you can also manually release the buffered
|
| 31 |
+
events by calling `delayedStream.resume()`:
|
| 32 |
+
|
| 33 |
+
``` javascript
|
| 34 |
+
var delayed = DelayedStream.create(req);
|
| 35 |
+
|
| 36 |
+
setTimeout(function() {
|
| 37 |
+
// Emit all buffered events and resume underlaying source
|
| 38 |
+
delayed.resume();
|
| 39 |
+
}, 1000);
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## Implementation
|
| 43 |
+
|
| 44 |
+
In order to use this meta stream properly, here are a few things you should
|
| 45 |
+
know about the implementation.
|
| 46 |
+
|
| 47 |
+
### Event Buffering / Proxying
|
| 48 |
+
|
| 49 |
+
All events of the `source` stream are hijacked by overwriting the `source.emit`
|
| 50 |
+
method. Until node implements a catch-all event listener, this is the only way.
|
| 51 |
+
|
| 52 |
+
However, delayed-stream still continues to emit all events it captures on the
|
| 53 |
+
`source`, regardless of whether you have released the delayed stream yet or
|
| 54 |
+
not.
|
| 55 |
+
|
| 56 |
+
Upon creation, delayed-stream captures all `source` events and stores them in
|
| 57 |
+
an internal event buffer. Once `delayedStream.release()` is called, all
|
| 58 |
+
buffered events are emitted on the `delayedStream`, and the event buffer is
|
| 59 |
+
cleared. After that, delayed-stream merely acts as a proxy for the underlaying
|
| 60 |
+
source.
|
| 61 |
+
|
| 62 |
+
### Error handling
|
| 63 |
+
|
| 64 |
+
Error events on `source` are buffered / proxied just like any other events.
|
| 65 |
+
However, `delayedStream.create` attaches a no-op `'error'` listener to the
|
| 66 |
+
`source`. This way you only have to handle errors on the `delayedStream`
|
| 67 |
+
object, rather than in two places.
|
| 68 |
+
|
| 69 |
+
### Buffer limits
|
| 70 |
+
|
| 71 |
+
delayed-stream provides a `maxDataSize` property that can be used to limit
|
| 72 |
+
the amount of data being buffered. In order to protect you from bad `source`
|
| 73 |
+
streams that don't react to `source.pause()`, this feature is enabled by
|
| 74 |
+
default.
|
| 75 |
+
|
| 76 |
+
## API
|
| 77 |
+
|
| 78 |
+
### DelayedStream.create(source, [options])
|
| 79 |
+
|
| 80 |
+
Returns a new `delayedStream`. Available options are:
|
| 81 |
+
|
| 82 |
+
* `pauseStream`
|
| 83 |
+
* `maxDataSize`
|
| 84 |
+
|
| 85 |
+
The description for those properties can be found below.
|
| 86 |
+
|
| 87 |
+
### delayedStream.source
|
| 88 |
+
|
| 89 |
+
The `source` stream managed by this object. This is useful if you are
|
| 90 |
+
passing your `delayedStream` around, and you still want to access properties
|
| 91 |
+
on the `source` object.
|
| 92 |
+
|
| 93 |
+
### delayedStream.pauseStream = true
|
| 94 |
+
|
| 95 |
+
Whether to pause the underlaying `source` when calling
|
| 96 |
+
`DelayedStream.create()`. Modifying this property afterwards has no effect.
|
| 97 |
+
|
| 98 |
+
### delayedStream.maxDataSize = 1024 * 1024
|
| 99 |
+
|
| 100 |
+
The amount of data to buffer before emitting an `error`.
|
| 101 |
+
|
| 102 |
+
If the underlaying source is emitting `Buffer` objects, the `maxDataSize`
|
| 103 |
+
refers to bytes.
|
| 104 |
+
|
| 105 |
+
If the underlaying source is emitting JavaScript strings, the size refers to
|
| 106 |
+
characters.
|
| 107 |
+
|
| 108 |
+
If you know what you are doing, you can set this property to `Infinity` to
|
| 109 |
+
disable this feature. You can also modify this property during runtime.
|
| 110 |
+
|
| 111 |
+
### delayedStream.dataSize = 0
|
| 112 |
+
|
| 113 |
+
The amount of data buffered so far.
|
| 114 |
+
|
| 115 |
+
### delayedStream.readable
|
| 116 |
+
|
| 117 |
+
An ECMA5 getter that returns the value of `source.readable`.
|
| 118 |
+
|
| 119 |
+
### delayedStream.resume()
|
| 120 |
+
|
| 121 |
+
If the `delayedStream` has not been released so far, `delayedStream.release()`
|
| 122 |
+
is called.
|
| 123 |
+
|
| 124 |
+
In either case, `source.resume()` is called.
|
| 125 |
+
|
| 126 |
+
### delayedStream.pause()
|
| 127 |
+
|
| 128 |
+
Calls `source.pause()`.
|
| 129 |
+
|
| 130 |
+
### delayedStream.pipe(dest)
|
| 131 |
+
|
| 132 |
+
Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`.
|
| 133 |
+
|
| 134 |
+
### delayedStream.release()
|
| 135 |
+
|
| 136 |
+
Emits and clears all events that have been buffered up so far. This does not
|
| 137 |
+
resume the underlaying source, use `delayedStream.resume()` instead.
|
| 138 |
+
|
| 139 |
+
## License
|
| 140 |
+
|
| 141 |
+
delayed-stream is licensed under the MIT license.
|
node_modules/delayed-stream/lib/delayed_stream.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var Stream = require('stream').Stream;
|
| 2 |
+
var util = require('util');
|
| 3 |
+
|
| 4 |
+
module.exports = DelayedStream;
|
| 5 |
+
function DelayedStream() {
|
| 6 |
+
this.source = null;
|
| 7 |
+
this.dataSize = 0;
|
| 8 |
+
this.maxDataSize = 1024 * 1024;
|
| 9 |
+
this.pauseStream = true;
|
| 10 |
+
|
| 11 |
+
this._maxDataSizeExceeded = false;
|
| 12 |
+
this._released = false;
|
| 13 |
+
this._bufferedEvents = [];
|
| 14 |
+
}
|
| 15 |
+
util.inherits(DelayedStream, Stream);
|
| 16 |
+
|
| 17 |
+
DelayedStream.create = function(source, options) {
|
| 18 |
+
var delayedStream = new this();
|
| 19 |
+
|
| 20 |
+
options = options || {};
|
| 21 |
+
for (var option in options) {
|
| 22 |
+
delayedStream[option] = options[option];
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
delayedStream.source = source;
|
| 26 |
+
|
| 27 |
+
var realEmit = source.emit;
|
| 28 |
+
source.emit = function() {
|
| 29 |
+
delayedStream._handleEmit(arguments);
|
| 30 |
+
return realEmit.apply(source, arguments);
|
| 31 |
+
};
|
| 32 |
+
|
| 33 |
+
source.on('error', function() {});
|
| 34 |
+
if (delayedStream.pauseStream) {
|
| 35 |
+
source.pause();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
return delayedStream;
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
Object.defineProperty(DelayedStream.prototype, 'readable', {
|
| 42 |
+
configurable: true,
|
| 43 |
+
enumerable: true,
|
| 44 |
+
get: function() {
|
| 45 |
+
return this.source.readable;
|
| 46 |
+
}
|
| 47 |
+
});
|
| 48 |
+
|
| 49 |
+
DelayedStream.prototype.setEncoding = function() {
|
| 50 |
+
return this.source.setEncoding.apply(this.source, arguments);
|
| 51 |
+
};
|
| 52 |
+
|
| 53 |
+
DelayedStream.prototype.resume = function() {
|
| 54 |
+
if (!this._released) {
|
| 55 |
+
this.release();
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
this.source.resume();
|
| 59 |
+
};
|
| 60 |
+
|
| 61 |
+
DelayedStream.prototype.pause = function() {
|
| 62 |
+
this.source.pause();
|
| 63 |
+
};
|
| 64 |
+
|
| 65 |
+
DelayedStream.prototype.release = function() {
|
| 66 |
+
this._released = true;
|
| 67 |
+
|
| 68 |
+
this._bufferedEvents.forEach(function(args) {
|
| 69 |
+
this.emit.apply(this, args);
|
| 70 |
+
}.bind(this));
|
| 71 |
+
this._bufferedEvents = [];
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
DelayedStream.prototype.pipe = function() {
|
| 75 |
+
var r = Stream.prototype.pipe.apply(this, arguments);
|
| 76 |
+
this.resume();
|
| 77 |
+
return r;
|
| 78 |
+
};
|
| 79 |
+
|
| 80 |
+
DelayedStream.prototype._handleEmit = function(args) {
|
| 81 |
+
if (this._released) {
|
| 82 |
+
this.emit.apply(this, args);
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
if (args[0] === 'data') {
|
| 87 |
+
this.dataSize += args[1].length;
|
| 88 |
+
this._checkIfMaxDataSizeExceeded();
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
this._bufferedEvents.push(args);
|
| 92 |
+
};
|
| 93 |
+
|
| 94 |
+
DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
|
| 95 |
+
if (this._maxDataSizeExceeded) {
|
| 96 |
+
return;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
if (this.dataSize <= this.maxDataSize) {
|
| 100 |
+
return;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
this._maxDataSizeExceeded = true;
|
| 104 |
+
var message =
|
| 105 |
+
'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'
|
| 106 |
+
this.emit('error', new Error(message));
|
| 107 |
+
};
|
node_modules/delayed-stream/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
|
| 3 |
+
"contributors": [
|
| 4 |
+
"Mike Atkins <apeherder@gmail.com>"
|
| 5 |
+
],
|
| 6 |
+
"name": "delayed-stream",
|
| 7 |
+
"description": "Buffers events from a stream until you are ready to handle them.",
|
| 8 |
+
"license": "MIT",
|
| 9 |
+
"version": "1.0.0",
|
| 10 |
+
"homepage": "https://github.com/felixge/node-delayed-stream",
|
| 11 |
+
"repository": {
|
| 12 |
+
"type": "git",
|
| 13 |
+
"url": "git://github.com/felixge/node-delayed-stream.git"
|
| 14 |
+
},
|
| 15 |
+
"main": "./lib/delayed_stream",
|
| 16 |
+
"engines": {
|
| 17 |
+
"node": ">=0.4.0"
|
| 18 |
+
},
|
| 19 |
+
"scripts": {
|
| 20 |
+
"test": "make test"
|
| 21 |
+
},
|
| 22 |
+
"dependencies": {},
|
| 23 |
+
"devDependencies": {
|
| 24 |
+
"fake": "0.2.0",
|
| 25 |
+
"far": "0.0.1"
|
| 26 |
+
}
|
| 27 |
+
}
|
node_modules/depd/History.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2.0.0 / 2018-10-26
|
| 2 |
+
==================
|
| 3 |
+
|
| 4 |
+
* Drop support for Node.js 0.6
|
| 5 |
+
* Replace internal `eval` usage with `Function` constructor
|
| 6 |
+
* Use instance methods on `process` to check for listeners
|
| 7 |
+
|
| 8 |
+
1.1.2 / 2018-01-11
|
| 9 |
+
==================
|
| 10 |
+
|
| 11 |
+
* perf: remove argument reassignment
|
| 12 |
+
* Support Node.js 0.6 to 9.x
|
| 13 |
+
|
| 14 |
+
1.1.1 / 2017-07-27
|
| 15 |
+
==================
|
| 16 |
+
|
| 17 |
+
* Remove unnecessary `Buffer` loading
|
| 18 |
+
* Support Node.js 0.6 to 8.x
|
| 19 |
+
|
| 20 |
+
1.1.0 / 2015-09-14
|
| 21 |
+
==================
|
| 22 |
+
|
| 23 |
+
* Enable strict mode in more places
|
| 24 |
+
* Support io.js 3.x
|
| 25 |
+
* Support io.js 2.x
|
| 26 |
+
* Support web browser loading
|
| 27 |
+
- Requires bundler like Browserify or webpack
|
| 28 |
+
|
| 29 |
+
1.0.1 / 2015-04-07
|
| 30 |
+
==================
|
| 31 |
+
|
| 32 |
+
* Fix `TypeError`s when under `'use strict'` code
|
| 33 |
+
* Fix useless type name on auto-generated messages
|
| 34 |
+
* Support io.js 1.x
|
| 35 |
+
* Support Node.js 0.12
|
| 36 |
+
|
| 37 |
+
1.0.0 / 2014-09-17
|
| 38 |
+
==================
|
| 39 |
+
|
| 40 |
+
* No changes
|
| 41 |
+
|
| 42 |
+
0.4.5 / 2014-09-09
|
| 43 |
+
==================
|
| 44 |
+
|
| 45 |
+
* Improve call speed to functions using the function wrapper
|
| 46 |
+
* Support Node.js 0.6
|
| 47 |
+
|
| 48 |
+
0.4.4 / 2014-07-27
|
| 49 |
+
==================
|
| 50 |
+
|
| 51 |
+
* Work-around v8 generating empty stack traces
|
| 52 |
+
|
| 53 |
+
0.4.3 / 2014-07-26
|
| 54 |
+
==================
|
| 55 |
+
|
| 56 |
+
* Fix exception when global `Error.stackTraceLimit` is too low
|
| 57 |
+
|
| 58 |
+
0.4.2 / 2014-07-19
|
| 59 |
+
==================
|
| 60 |
+
|
| 61 |
+
* Correct call site for wrapped functions and properties
|
| 62 |
+
|
| 63 |
+
0.4.1 / 2014-07-19
|
| 64 |
+
==================
|
| 65 |
+
|
| 66 |
+
* Improve automatic message generation for function properties
|
| 67 |
+
|
| 68 |
+
0.4.0 / 2014-07-19
|
| 69 |
+
==================
|
| 70 |
+
|
| 71 |
+
* Add `TRACE_DEPRECATION` environment variable
|
| 72 |
+
* Remove non-standard grey color from color output
|
| 73 |
+
* Support `--no-deprecation` argument
|
| 74 |
+
* Support `--trace-deprecation` argument
|
| 75 |
+
* Support `deprecate.property(fn, prop, message)`
|
| 76 |
+
|
| 77 |
+
0.3.0 / 2014-06-16
|
| 78 |
+
==================
|
| 79 |
+
|
| 80 |
+
* Add `NO_DEPRECATION` environment variable
|
| 81 |
+
|
| 82 |
+
0.2.0 / 2014-06-15
|
| 83 |
+
==================
|
| 84 |
+
|
| 85 |
+
* Add `deprecate.property(obj, prop, message)`
|
| 86 |
+
* Remove `supports-color` dependency for node.js 0.8
|
| 87 |
+
|
| 88 |
+
0.1.0 / 2014-06-15
|
| 89 |
+
==================
|
| 90 |
+
|
| 91 |
+
* Add `deprecate.function(fn, message)`
|
| 92 |
+
* Add `process.on('deprecation', fn)` emitter
|
| 93 |
+
* Automatically generate message when omitted from `deprecate()`
|
| 94 |
+
|
| 95 |
+
0.0.1 / 2014-06-15
|
| 96 |
+
==================
|
| 97 |
+
|
| 98 |
+
* Fix warning for dynamic calls at singe call site
|
| 99 |
+
|
| 100 |
+
0.0.0 / 2014-06-15
|
| 101 |
+
==================
|
| 102 |
+
|
| 103 |
+
* Initial implementation
|
node_modules/depd/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-2018 Douglas Christopher Wilson
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/depd/Readme.md
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# depd
|
| 2 |
+
|
| 3 |
+
[![NPM Version][npm-version-image]][npm-url]
|
| 4 |
+
[![NPM Downloads][npm-downloads-image]][npm-url]
|
| 5 |
+
[![Node.js Version][node-image]][node-url]
|
| 6 |
+
[![Linux Build][travis-image]][travis-url]
|
| 7 |
+
[![Windows Build][appveyor-image]][appveyor-url]
|
| 8 |
+
[![Coverage Status][coveralls-image]][coveralls-url]
|
| 9 |
+
|
| 10 |
+
Deprecate all the things
|
| 11 |
+
|
| 12 |
+
> With great modules comes great responsibility; mark things deprecated!
|
| 13 |
+
|
| 14 |
+
## Install
|
| 15 |
+
|
| 16 |
+
This module is installed directly using `npm`:
|
| 17 |
+
|
| 18 |
+
```sh
|
| 19 |
+
$ npm install depd
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
This module can also be bundled with systems like
|
| 23 |
+
[Browserify](http://browserify.org/) or [webpack](https://webpack.github.io/),
|
| 24 |
+
though by default this module will alter it's API to no longer display or
|
| 25 |
+
track deprecations.
|
| 26 |
+
|
| 27 |
+
## API
|
| 28 |
+
|
| 29 |
+
<!-- eslint-disable no-unused-vars -->
|
| 30 |
+
|
| 31 |
+
```js
|
| 32 |
+
var deprecate = require('depd')('my-module')
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
This library allows you to display deprecation messages to your users.
|
| 36 |
+
This library goes above and beyond with deprecation warnings by
|
| 37 |
+
introspection of the call stack (but only the bits that it is interested
|
| 38 |
+
in).
|
| 39 |
+
|
| 40 |
+
Instead of just warning on the first invocation of a deprecated
|
| 41 |
+
function and never again, this module will warn on the first invocation
|
| 42 |
+
of a deprecated function per unique call site, making it ideal to alert
|
| 43 |
+
users of all deprecated uses across the code base, rather than just
|
| 44 |
+
whatever happens to execute first.
|
| 45 |
+
|
| 46 |
+
The deprecation warnings from this module also include the file and line
|
| 47 |
+
information for the call into the module that the deprecated function was
|
| 48 |
+
in.
|
| 49 |
+
|
| 50 |
+
**NOTE** this library has a similar interface to the `debug` module, and
|
| 51 |
+
this module uses the calling file to get the boundary for the call stacks,
|
| 52 |
+
so you should always create a new `deprecate` object in each file and not
|
| 53 |
+
within some central file.
|
| 54 |
+
|
| 55 |
+
### depd(namespace)
|
| 56 |
+
|
| 57 |
+
Create a new deprecate function that uses the given namespace name in the
|
| 58 |
+
messages and will display the call site prior to the stack entering the
|
| 59 |
+
file this function was called from. It is highly suggested you use the
|
| 60 |
+
name of your module as the namespace.
|
| 61 |
+
|
| 62 |
+
### deprecate(message)
|
| 63 |
+
|
| 64 |
+
Call this function from deprecated code to display a deprecation message.
|
| 65 |
+
This message will appear once per unique caller site. Caller site is the
|
| 66 |
+
first call site in the stack in a different file from the caller of this
|
| 67 |
+
function.
|
| 68 |
+
|
| 69 |
+
If the message is omitted, a message is generated for you based on the site
|
| 70 |
+
of the `deprecate()` call and will display the name of the function called,
|
| 71 |
+
similar to the name displayed in a stack trace.
|
| 72 |
+
|
| 73 |
+
### deprecate.function(fn, message)
|
| 74 |
+
|
| 75 |
+
Call this function to wrap a given function in a deprecation message on any
|
| 76 |
+
call to the function. An optional message can be supplied to provide a custom
|
| 77 |
+
message.
|
| 78 |
+
|
| 79 |
+
### deprecate.property(obj, prop, message)
|
| 80 |
+
|
| 81 |
+
Call this function to wrap a given property on object in a deprecation message
|
| 82 |
+
on any accessing or setting of the property. An optional message can be supplied
|
| 83 |
+
to provide a custom message.
|
| 84 |
+
|
| 85 |
+
The method must be called on the object where the property belongs (not
|
| 86 |
+
inherited from the prototype).
|
| 87 |
+
|
| 88 |
+
If the property is a data descriptor, it will be converted to an accessor
|
| 89 |
+
descriptor in order to display the deprecation message.
|
| 90 |
+
|
| 91 |
+
### process.on('deprecation', fn)
|
| 92 |
+
|
| 93 |
+
This module will allow easy capturing of deprecation errors by emitting the
|
| 94 |
+
errors as the type "deprecation" on the global `process`. If there are no
|
| 95 |
+
listeners for this type, the errors are written to STDERR as normal, but if
|
| 96 |
+
there are any listeners, nothing will be written to STDERR and instead only
|
| 97 |
+
emitted. From there, you can write the errors in a different format or to a
|
| 98 |
+
logging source.
|
| 99 |
+
|
| 100 |
+
The error represents the deprecation and is emitted only once with the same
|
| 101 |
+
rules as writing to STDERR. The error has the following properties:
|
| 102 |
+
|
| 103 |
+
- `message` - This is the message given by the library
|
| 104 |
+
- `name` - This is always `'DeprecationError'`
|
| 105 |
+
- `namespace` - This is the namespace the deprecation came from
|
| 106 |
+
- `stack` - This is the stack of the call to the deprecated thing
|
| 107 |
+
|
| 108 |
+
Example `error.stack` output:
|
| 109 |
+
|
| 110 |
+
```
|
| 111 |
+
DeprecationError: my-cool-module deprecated oldfunction
|
| 112 |
+
at Object.<anonymous> ([eval]-wrapper:6:22)
|
| 113 |
+
at Module._compile (module.js:456:26)
|
| 114 |
+
at evalScript (node.js:532:25)
|
| 115 |
+
at startup (node.js:80:7)
|
| 116 |
+
at node.js:902:3
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
### process.env.NO_DEPRECATION
|
| 120 |
+
|
| 121 |
+
As a user of modules that are deprecated, the environment variable `NO_DEPRECATION`
|
| 122 |
+
is provided as a quick solution to silencing deprecation warnings from being
|
| 123 |
+
output. The format of this is similar to that of `DEBUG`:
|
| 124 |
+
|
| 125 |
+
```sh
|
| 126 |
+
$ NO_DEPRECATION=my-module,othermod node app.js
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
This will suppress deprecations from being output for "my-module" and "othermod".
|
| 130 |
+
The value is a list of comma-separated namespaces. To suppress every warning
|
| 131 |
+
across all namespaces, use the value `*` for a namespace.
|
| 132 |
+
|
| 133 |
+
Providing the argument `--no-deprecation` to the `node` executable will suppress
|
| 134 |
+
all deprecations (only available in Node.js 0.8 or higher).
|
| 135 |
+
|
| 136 |
+
**NOTE** This will not suppress the deperecations given to any "deprecation"
|
| 137 |
+
event listeners, just the output to STDERR.
|
| 138 |
+
|
| 139 |
+
### process.env.TRACE_DEPRECATION
|
| 140 |
+
|
| 141 |
+
As a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION`
|
| 142 |
+
is provided as a solution to getting more detailed location information in deprecation
|
| 143 |
+
warnings by including the entire stack trace. The format of this is the same as
|
| 144 |
+
`NO_DEPRECATION`:
|
| 145 |
+
|
| 146 |
+
```sh
|
| 147 |
+
$ TRACE_DEPRECATION=my-module,othermod node app.js
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
This will include stack traces for deprecations being output for "my-module" and
|
| 151 |
+
"othermod". The value is a list of comma-separated namespaces. To trace every
|
| 152 |
+
warning across all namespaces, use the value `*` for a namespace.
|
| 153 |
+
|
| 154 |
+
Providing the argument `--trace-deprecation` to the `node` executable will trace
|
| 155 |
+
all deprecations (only available in Node.js 0.8 or higher).
|
| 156 |
+
|
| 157 |
+
**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`.
|
| 158 |
+
|
| 159 |
+
## Display
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
|
| 163 |
+
When a user calls a function in your library that you mark deprecated, they
|
| 164 |
+
will see the following written to STDERR (in the given colors, similar colors
|
| 165 |
+
and layout to the `debug` module):
|
| 166 |
+
|
| 167 |
+
```
|
| 168 |
+
bright cyan bright yellow
|
| 169 |
+
| | reset cyan
|
| 170 |
+
| | | |
|
| 171 |
+
▼ ▼ ▼ ▼
|
| 172 |
+
my-cool-module deprecated oldfunction [eval]-wrapper:6:22
|
| 173 |
+
▲ ▲ ▲ ▲
|
| 174 |
+
| | | |
|
| 175 |
+
namespace | | location of mycoolmod.oldfunction() call
|
| 176 |
+
| deprecation message
|
| 177 |
+
the word "deprecated"
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
If the user redirects their STDERR to a file or somewhere that does not support
|
| 181 |
+
colors, they see (similar layout to the `debug` module):
|
| 182 |
+
|
| 183 |
+
```
|
| 184 |
+
Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22
|
| 185 |
+
▲ ▲ ▲ ▲ ▲
|
| 186 |
+
| | | | |
|
| 187 |
+
timestamp of message namespace | | location of mycoolmod.oldfunction() call
|
| 188 |
+
| deprecation message
|
| 189 |
+
the word "deprecated"
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
## Examples
|
| 193 |
+
|
| 194 |
+
### Deprecating all calls to a function
|
| 195 |
+
|
| 196 |
+
This will display a deprecated message about "oldfunction" being deprecated
|
| 197 |
+
from "my-module" on STDERR.
|
| 198 |
+
|
| 199 |
+
```js
|
| 200 |
+
var deprecate = require('depd')('my-cool-module')
|
| 201 |
+
|
| 202 |
+
// message automatically derived from function name
|
| 203 |
+
// Object.oldfunction
|
| 204 |
+
exports.oldfunction = deprecate.function(function oldfunction () {
|
| 205 |
+
// all calls to function are deprecated
|
| 206 |
+
})
|
| 207 |
+
|
| 208 |
+
// specific message
|
| 209 |
+
exports.oldfunction = deprecate.function(function () {
|
| 210 |
+
// all calls to function are deprecated
|
| 211 |
+
}, 'oldfunction')
|
| 212 |
+
```
|
| 213 |
+
|
| 214 |
+
### Conditionally deprecating a function call
|
| 215 |
+
|
| 216 |
+
This will display a deprecated message about "weirdfunction" being deprecated
|
| 217 |
+
from "my-module" on STDERR when called with less than 2 arguments.
|
| 218 |
+
|
| 219 |
+
```js
|
| 220 |
+
var deprecate = require('depd')('my-cool-module')
|
| 221 |
+
|
| 222 |
+
exports.weirdfunction = function () {
|
| 223 |
+
if (arguments.length < 2) {
|
| 224 |
+
// calls with 0 or 1 args are deprecated
|
| 225 |
+
deprecate('weirdfunction args < 2')
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
```
|
| 229 |
+
|
| 230 |
+
When calling `deprecate` as a function, the warning is counted per call site
|
| 231 |
+
within your own module, so you can display different deprecations depending
|
| 232 |
+
on different situations and the users will still get all the warnings:
|
| 233 |
+
|
| 234 |
+
```js
|
| 235 |
+
var deprecate = require('depd')('my-cool-module')
|
| 236 |
+
|
| 237 |
+
exports.weirdfunction = function () {
|
| 238 |
+
if (arguments.length < 2) {
|
| 239 |
+
// calls with 0 or 1 args are deprecated
|
| 240 |
+
deprecate('weirdfunction args < 2')
|
| 241 |
+
} else if (typeof arguments[0] !== 'string') {
|
| 242 |
+
// calls with non-string first argument are deprecated
|
| 243 |
+
deprecate('weirdfunction non-string first arg')
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
### Deprecating property access
|
| 249 |
+
|
| 250 |
+
This will display a deprecated message about "oldprop" being deprecated
|
| 251 |
+
from "my-module" on STDERR when accessed. A deprecation will be displayed
|
| 252 |
+
when setting the value and when getting the value.
|
| 253 |
+
|
| 254 |
+
```js
|
| 255 |
+
var deprecate = require('depd')('my-cool-module')
|
| 256 |
+
|
| 257 |
+
exports.oldprop = 'something'
|
| 258 |
+
|
| 259 |
+
// message automatically derives from property name
|
| 260 |
+
deprecate.property(exports, 'oldprop')
|
| 261 |
+
|
| 262 |
+
// explicit message
|
| 263 |
+
deprecate.property(exports, 'oldprop', 'oldprop >= 0.10')
|
| 264 |
+
```
|
| 265 |
+
|
| 266 |
+
## License
|
| 267 |
+
|
| 268 |
+
[MIT](LICENSE)
|
| 269 |
+
|
| 270 |
+
[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/nodejs-depd/master?label=windows
|
| 271 |
+
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-depd
|
| 272 |
+
[coveralls-image]: https://badgen.net/coveralls/c/github/dougwilson/nodejs-depd/master
|
| 273 |
+
[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master
|
| 274 |
+
[node-image]: https://badgen.net/npm/node/depd
|
| 275 |
+
[node-url]: https://nodejs.org/en/download/
|
| 276 |
+
[npm-downloads-image]: https://badgen.net/npm/dm/depd
|
| 277 |
+
[npm-url]: https://npmjs.org/package/depd
|
| 278 |
+
[npm-version-image]: https://badgen.net/npm/v/depd
|
| 279 |
+
[travis-image]: https://badgen.net/travis/dougwilson/nodejs-depd/master?label=linux
|
| 280 |
+
[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd
|
node_modules/depd/index.js
ADDED
|
@@ -0,0 +1,538 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* depd
|
| 3 |
+
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
| 4 |
+
* MIT Licensed
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* Module dependencies.
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
var relative = require('path').relative
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Module exports.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
module.exports = depd
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Get the path to base files on.
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
var basePath = process.cwd()
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Determine if namespace is contained in the string.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
function containsNamespace (str, namespace) {
|
| 30 |
+
var vals = str.split(/[ ,]+/)
|
| 31 |
+
var ns = String(namespace).toLowerCase()
|
| 32 |
+
|
| 33 |
+
for (var i = 0; i < vals.length; i++) {
|
| 34 |
+
var val = vals[i]
|
| 35 |
+
|
| 36 |
+
// namespace contained
|
| 37 |
+
if (val && (val === '*' || val.toLowerCase() === ns)) {
|
| 38 |
+
return true
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
return false
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Convert a data descriptor to accessor descriptor.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
function convertDataDescriptorToAccessor (obj, prop, message) {
|
| 50 |
+
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
|
| 51 |
+
var value = descriptor.value
|
| 52 |
+
|
| 53 |
+
descriptor.get = function getter () { return value }
|
| 54 |
+
|
| 55 |
+
if (descriptor.writable) {
|
| 56 |
+
descriptor.set = function setter (val) { return (value = val) }
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
delete descriptor.value
|
| 60 |
+
delete descriptor.writable
|
| 61 |
+
|
| 62 |
+
Object.defineProperty(obj, prop, descriptor)
|
| 63 |
+
|
| 64 |
+
return descriptor
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Create arguments string to keep arity.
|
| 69 |
+
*/
|
| 70 |
+
|
| 71 |
+
function createArgumentsString (arity) {
|
| 72 |
+
var str = ''
|
| 73 |
+
|
| 74 |
+
for (var i = 0; i < arity; i++) {
|
| 75 |
+
str += ', arg' + i
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
return str.substr(2)
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/**
|
| 82 |
+
* Create stack string from stack.
|
| 83 |
+
*/
|
| 84 |
+
|
| 85 |
+
function createStackString (stack) {
|
| 86 |
+
var str = this.name + ': ' + this.namespace
|
| 87 |
+
|
| 88 |
+
if (this.message) {
|
| 89 |
+
str += ' deprecated ' + this.message
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
for (var i = 0; i < stack.length; i++) {
|
| 93 |
+
str += '\n at ' + stack[i].toString()
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
return str
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
/**
|
| 100 |
+
* Create deprecate for namespace in caller.
|
| 101 |
+
*/
|
| 102 |
+
|
| 103 |
+
function depd (namespace) {
|
| 104 |
+
if (!namespace) {
|
| 105 |
+
throw new TypeError('argument namespace is required')
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
var stack = getStack()
|
| 109 |
+
var site = callSiteLocation(stack[1])
|
| 110 |
+
var file = site[0]
|
| 111 |
+
|
| 112 |
+
function deprecate (message) {
|
| 113 |
+
// call to self as log
|
| 114 |
+
log.call(deprecate, message)
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
deprecate._file = file
|
| 118 |
+
deprecate._ignored = isignored(namespace)
|
| 119 |
+
deprecate._namespace = namespace
|
| 120 |
+
deprecate._traced = istraced(namespace)
|
| 121 |
+
deprecate._warned = Object.create(null)
|
| 122 |
+
|
| 123 |
+
deprecate.function = wrapfunction
|
| 124 |
+
deprecate.property = wrapproperty
|
| 125 |
+
|
| 126 |
+
return deprecate
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
/**
|
| 130 |
+
* Determine if event emitter has listeners of a given type.
|
| 131 |
+
*
|
| 132 |
+
* The way to do this check is done three different ways in Node.js >= 0.8
|
| 133 |
+
* so this consolidates them into a minimal set using instance methods.
|
| 134 |
+
*
|
| 135 |
+
* @param {EventEmitter} emitter
|
| 136 |
+
* @param {string} type
|
| 137 |
+
* @returns {boolean}
|
| 138 |
+
* @private
|
| 139 |
+
*/
|
| 140 |
+
|
| 141 |
+
function eehaslisteners (emitter, type) {
|
| 142 |
+
var count = typeof emitter.listenerCount !== 'function'
|
| 143 |
+
? emitter.listeners(type).length
|
| 144 |
+
: emitter.listenerCount(type)
|
| 145 |
+
|
| 146 |
+
return count > 0
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* Determine if namespace is ignored.
|
| 151 |
+
*/
|
| 152 |
+
|
| 153 |
+
function isignored (namespace) {
|
| 154 |
+
if (process.noDeprecation) {
|
| 155 |
+
// --no-deprecation support
|
| 156 |
+
return true
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
var str = process.env.NO_DEPRECATION || ''
|
| 160 |
+
|
| 161 |
+
// namespace ignored
|
| 162 |
+
return containsNamespace(str, namespace)
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
/**
|
| 166 |
+
* Determine if namespace is traced.
|
| 167 |
+
*/
|
| 168 |
+
|
| 169 |
+
function istraced (namespace) {
|
| 170 |
+
if (process.traceDeprecation) {
|
| 171 |
+
// --trace-deprecation support
|
| 172 |
+
return true
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
var str = process.env.TRACE_DEPRECATION || ''
|
| 176 |
+
|
| 177 |
+
// namespace traced
|
| 178 |
+
return containsNamespace(str, namespace)
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/**
|
| 182 |
+
* Display deprecation message.
|
| 183 |
+
*/
|
| 184 |
+
|
| 185 |
+
function log (message, site) {
|
| 186 |
+
var haslisteners = eehaslisteners(process, 'deprecation')
|
| 187 |
+
|
| 188 |
+
// abort early if no destination
|
| 189 |
+
if (!haslisteners && this._ignored) {
|
| 190 |
+
return
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
var caller
|
| 194 |
+
var callFile
|
| 195 |
+
var callSite
|
| 196 |
+
var depSite
|
| 197 |
+
var i = 0
|
| 198 |
+
var seen = false
|
| 199 |
+
var stack = getStack()
|
| 200 |
+
var file = this._file
|
| 201 |
+
|
| 202 |
+
if (site) {
|
| 203 |
+
// provided site
|
| 204 |
+
depSite = site
|
| 205 |
+
callSite = callSiteLocation(stack[1])
|
| 206 |
+
callSite.name = depSite.name
|
| 207 |
+
file = callSite[0]
|
| 208 |
+
} else {
|
| 209 |
+
// get call site
|
| 210 |
+
i = 2
|
| 211 |
+
depSite = callSiteLocation(stack[i])
|
| 212 |
+
callSite = depSite
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
// get caller of deprecated thing in relation to file
|
| 216 |
+
for (; i < stack.length; i++) {
|
| 217 |
+
caller = callSiteLocation(stack[i])
|
| 218 |
+
callFile = caller[0]
|
| 219 |
+
|
| 220 |
+
if (callFile === file) {
|
| 221 |
+
seen = true
|
| 222 |
+
} else if (callFile === this._file) {
|
| 223 |
+
file = this._file
|
| 224 |
+
} else if (seen) {
|
| 225 |
+
break
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
var key = caller
|
| 230 |
+
? depSite.join(':') + '__' + caller.join(':')
|
| 231 |
+
: undefined
|
| 232 |
+
|
| 233 |
+
if (key !== undefined && key in this._warned) {
|
| 234 |
+
// already warned
|
| 235 |
+
return
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
this._warned[key] = true
|
| 239 |
+
|
| 240 |
+
// generate automatic message from call site
|
| 241 |
+
var msg = message
|
| 242 |
+
if (!msg) {
|
| 243 |
+
msg = callSite === depSite || !callSite.name
|
| 244 |
+
? defaultMessage(depSite)
|
| 245 |
+
: defaultMessage(callSite)
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
// emit deprecation if listeners exist
|
| 249 |
+
if (haslisteners) {
|
| 250 |
+
var err = DeprecationError(this._namespace, msg, stack.slice(i))
|
| 251 |
+
process.emit('deprecation', err)
|
| 252 |
+
return
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
// format and write message
|
| 256 |
+
var format = process.stderr.isTTY
|
| 257 |
+
? formatColor
|
| 258 |
+
: formatPlain
|
| 259 |
+
var output = format.call(this, msg, caller, stack.slice(i))
|
| 260 |
+
process.stderr.write(output + '\n', 'utf8')
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
/**
|
| 264 |
+
* Get call site location as array.
|
| 265 |
+
*/
|
| 266 |
+
|
| 267 |
+
function callSiteLocation (callSite) {
|
| 268 |
+
var file = callSite.getFileName() || '<anonymous>'
|
| 269 |
+
var line = callSite.getLineNumber()
|
| 270 |
+
var colm = callSite.getColumnNumber()
|
| 271 |
+
|
| 272 |
+
if (callSite.isEval()) {
|
| 273 |
+
file = callSite.getEvalOrigin() + ', ' + file
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
var site = [file, line, colm]
|
| 277 |
+
|
| 278 |
+
site.callSite = callSite
|
| 279 |
+
site.name = callSite.getFunctionName()
|
| 280 |
+
|
| 281 |
+
return site
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
/**
|
| 285 |
+
* Generate a default message from the site.
|
| 286 |
+
*/
|
| 287 |
+
|
| 288 |
+
function defaultMessage (site) {
|
| 289 |
+
var callSite = site.callSite
|
| 290 |
+
var funcName = site.name
|
| 291 |
+
|
| 292 |
+
// make useful anonymous name
|
| 293 |
+
if (!funcName) {
|
| 294 |
+
funcName = '<anonymous@' + formatLocation(site) + '>'
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
var context = callSite.getThis()
|
| 298 |
+
var typeName = context && callSite.getTypeName()
|
| 299 |
+
|
| 300 |
+
// ignore useless type name
|
| 301 |
+
if (typeName === 'Object') {
|
| 302 |
+
typeName = undefined
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
// make useful type name
|
| 306 |
+
if (typeName === 'Function') {
|
| 307 |
+
typeName = context.name || typeName
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
return typeName && callSite.getMethodName()
|
| 311 |
+
? typeName + '.' + funcName
|
| 312 |
+
: funcName
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
/**
|
| 316 |
+
* Format deprecation message without color.
|
| 317 |
+
*/
|
| 318 |
+
|
| 319 |
+
function formatPlain (msg, caller, stack) {
|
| 320 |
+
var timestamp = new Date().toUTCString()
|
| 321 |
+
|
| 322 |
+
var formatted = timestamp +
|
| 323 |
+
' ' + this._namespace +
|
| 324 |
+
' deprecated ' + msg
|
| 325 |
+
|
| 326 |
+
// add stack trace
|
| 327 |
+
if (this._traced) {
|
| 328 |
+
for (var i = 0; i < stack.length; i++) {
|
| 329 |
+
formatted += '\n at ' + stack[i].toString()
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
return formatted
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
if (caller) {
|
| 336 |
+
formatted += ' at ' + formatLocation(caller)
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
return formatted
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
/**
|
| 343 |
+
* Format deprecation message with color.
|
| 344 |
+
*/
|
| 345 |
+
|
| 346 |
+
function formatColor (msg, caller, stack) {
|
| 347 |
+
var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan
|
| 348 |
+
' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow
|
| 349 |
+
' \x1b[0m' + msg + '\x1b[39m' // reset
|
| 350 |
+
|
| 351 |
+
// add stack trace
|
| 352 |
+
if (this._traced) {
|
| 353 |
+
for (var i = 0; i < stack.length; i++) {
|
| 354 |
+
formatted += '\n \x1b[36mat ' + stack[i].toString() + '\x1b[39m' // cyan
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
return formatted
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
if (caller) {
|
| 361 |
+
formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
return formatted
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
/**
|
| 368 |
+
* Format call site location.
|
| 369 |
+
*/
|
| 370 |
+
|
| 371 |
+
function formatLocation (callSite) {
|
| 372 |
+
return relative(basePath, callSite[0]) +
|
| 373 |
+
':' + callSite[1] +
|
| 374 |
+
':' + callSite[2]
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
/**
|
| 378 |
+
* Get the stack as array of call sites.
|
| 379 |
+
*/
|
| 380 |
+
|
| 381 |
+
function getStack () {
|
| 382 |
+
var limit = Error.stackTraceLimit
|
| 383 |
+
var obj = {}
|
| 384 |
+
var prep = Error.prepareStackTrace
|
| 385 |
+
|
| 386 |
+
Error.prepareStackTrace = prepareObjectStackTrace
|
| 387 |
+
Error.stackTraceLimit = Math.max(10, limit)
|
| 388 |
+
|
| 389 |
+
// capture the stack
|
| 390 |
+
Error.captureStackTrace(obj)
|
| 391 |
+
|
| 392 |
+
// slice this function off the top
|
| 393 |
+
var stack = obj.stack.slice(1)
|
| 394 |
+
|
| 395 |
+
Error.prepareStackTrace = prep
|
| 396 |
+
Error.stackTraceLimit = limit
|
| 397 |
+
|
| 398 |
+
return stack
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
/**
|
| 402 |
+
* Capture call site stack from v8.
|
| 403 |
+
*/
|
| 404 |
+
|
| 405 |
+
function prepareObjectStackTrace (obj, stack) {
|
| 406 |
+
return stack
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
/**
|
| 410 |
+
* Return a wrapped function in a deprecation message.
|
| 411 |
+
*/
|
| 412 |
+
|
| 413 |
+
function wrapfunction (fn, message) {
|
| 414 |
+
if (typeof fn !== 'function') {
|
| 415 |
+
throw new TypeError('argument fn must be a function')
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
var args = createArgumentsString(fn.length)
|
| 419 |
+
var stack = getStack()
|
| 420 |
+
var site = callSiteLocation(stack[1])
|
| 421 |
+
|
| 422 |
+
site.name = fn.name
|
| 423 |
+
|
| 424 |
+
// eslint-disable-next-line no-new-func
|
| 425 |
+
var deprecatedfn = new Function('fn', 'log', 'deprecate', 'message', 'site',
|
| 426 |
+
'"use strict"\n' +
|
| 427 |
+
'return function (' + args + ') {' +
|
| 428 |
+
'log.call(deprecate, message, site)\n' +
|
| 429 |
+
'return fn.apply(this, arguments)\n' +
|
| 430 |
+
'}')(fn, log, this, message, site)
|
| 431 |
+
|
| 432 |
+
return deprecatedfn
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
/**
|
| 436 |
+
* Wrap property in a deprecation message.
|
| 437 |
+
*/
|
| 438 |
+
|
| 439 |
+
function wrapproperty (obj, prop, message) {
|
| 440 |
+
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
| 441 |
+
throw new TypeError('argument obj must be object')
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
|
| 445 |
+
|
| 446 |
+
if (!descriptor) {
|
| 447 |
+
throw new TypeError('must call property on owner object')
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
if (!descriptor.configurable) {
|
| 451 |
+
throw new TypeError('property must be configurable')
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
var deprecate = this
|
| 455 |
+
var stack = getStack()
|
| 456 |
+
var site = callSiteLocation(stack[1])
|
| 457 |
+
|
| 458 |
+
// set site name
|
| 459 |
+
site.name = prop
|
| 460 |
+
|
| 461 |
+
// convert data descriptor
|
| 462 |
+
if ('value' in descriptor) {
|
| 463 |
+
descriptor = convertDataDescriptorToAccessor(obj, prop, message)
|
| 464 |
+
}
|
| 465 |
+
|
| 466 |
+
var get = descriptor.get
|
| 467 |
+
var set = descriptor.set
|
| 468 |
+
|
| 469 |
+
// wrap getter
|
| 470 |
+
if (typeof get === 'function') {
|
| 471 |
+
descriptor.get = function getter () {
|
| 472 |
+
log.call(deprecate, message, site)
|
| 473 |
+
return get.apply(this, arguments)
|
| 474 |
+
}
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
// wrap setter
|
| 478 |
+
if (typeof set === 'function') {
|
| 479 |
+
descriptor.set = function setter () {
|
| 480 |
+
log.call(deprecate, message, site)
|
| 481 |
+
return set.apply(this, arguments)
|
| 482 |
+
}
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
Object.defineProperty(obj, prop, descriptor)
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
/**
|
| 489 |
+
* Create DeprecationError for deprecation
|
| 490 |
+
*/
|
| 491 |
+
|
| 492 |
+
function DeprecationError (namespace, message, stack) {
|
| 493 |
+
var error = new Error()
|
| 494 |
+
var stackString
|
| 495 |
+
|
| 496 |
+
Object.defineProperty(error, 'constructor', {
|
| 497 |
+
value: DeprecationError
|
| 498 |
+
})
|
| 499 |
+
|
| 500 |
+
Object.defineProperty(error, 'message', {
|
| 501 |
+
configurable: true,
|
| 502 |
+
enumerable: false,
|
| 503 |
+
value: message,
|
| 504 |
+
writable: true
|
| 505 |
+
})
|
| 506 |
+
|
| 507 |
+
Object.defineProperty(error, 'name', {
|
| 508 |
+
enumerable: false,
|
| 509 |
+
configurable: true,
|
| 510 |
+
value: 'DeprecationError',
|
| 511 |
+
writable: true
|
| 512 |
+
})
|
| 513 |
+
|
| 514 |
+
Object.defineProperty(error, 'namespace', {
|
| 515 |
+
configurable: true,
|
| 516 |
+
enumerable: false,
|
| 517 |
+
value: namespace,
|
| 518 |
+
writable: true
|
| 519 |
+
})
|
| 520 |
+
|
| 521 |
+
Object.defineProperty(error, 'stack', {
|
| 522 |
+
configurable: true,
|
| 523 |
+
enumerable: false,
|
| 524 |
+
get: function () {
|
| 525 |
+
if (stackString !== undefined) {
|
| 526 |
+
return stackString
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
// prepare stack trace
|
| 530 |
+
return (stackString = createStackString.call(this, stack))
|
| 531 |
+
},
|
| 532 |
+
set: function setter (val) {
|
| 533 |
+
stackString = val
|
| 534 |
+
}
|
| 535 |
+
})
|
| 536 |
+
|
| 537 |
+
return error
|
| 538 |
+
}
|
node_modules/depd/lib/browser/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* depd
|
| 3 |
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
| 4 |
+
* MIT Licensed
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
'use strict'
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Module exports.
|
| 11 |
+
* @public
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
module.exports = depd
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Create deprecate for namespace in caller.
|
| 18 |
+
*/
|
| 19 |
+
|
| 20 |
+
function depd (namespace) {
|
| 21 |
+
if (!namespace) {
|
| 22 |
+
throw new TypeError('argument namespace is required')
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
function deprecate (message) {
|
| 26 |
+
// no-op in browser
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
deprecate._file = undefined
|
| 30 |
+
deprecate._ignored = true
|
| 31 |
+
deprecate._namespace = namespace
|
| 32 |
+
deprecate._traced = false
|
| 33 |
+
deprecate._warned = Object.create(null)
|
| 34 |
+
|
| 35 |
+
deprecate.function = wrapfunction
|
| 36 |
+
deprecate.property = wrapproperty
|
| 37 |
+
|
| 38 |
+
return deprecate
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Return a wrapped function in a deprecation message.
|
| 43 |
+
*
|
| 44 |
+
* This is a no-op version of the wrapper, which does nothing but call
|
| 45 |
+
* validation.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
function wrapfunction (fn, message) {
|
| 49 |
+
if (typeof fn !== 'function') {
|
| 50 |
+
throw new TypeError('argument fn must be a function')
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
return fn
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Wrap property in a deprecation message.
|
| 58 |
+
*
|
| 59 |
+
* This is a no-op version of the wrapper, which does nothing but call
|
| 60 |
+
* validation.
|
| 61 |
+
*/
|
| 62 |
+
|
| 63 |
+
function wrapproperty (obj, prop, message) {
|
| 64 |
+
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
| 65 |
+
throw new TypeError('argument obj must be object')
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
|
| 69 |
+
|
| 70 |
+
if (!descriptor) {
|
| 71 |
+
throw new TypeError('must call property on owner object')
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
if (!descriptor.configurable) {
|
| 75 |
+
throw new TypeError('property must be configurable')
|
| 76 |
+
}
|
| 77 |
+
}
|
node_modules/depd/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "depd",
|
| 3 |
+
"description": "Deprecate all the things",
|
| 4 |
+
"version": "2.0.0",
|
| 5 |
+
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"keywords": [
|
| 8 |
+
"deprecate",
|
| 9 |
+
"deprecated"
|
| 10 |
+
],
|
| 11 |
+
"repository": "dougwilson/nodejs-depd",
|
| 12 |
+
"browser": "lib/browser/index.js",
|
| 13 |
+
"devDependencies": {
|
| 14 |
+
"benchmark": "2.1.4",
|
| 15 |
+
"beautify-benchmark": "0.2.4",
|
| 16 |
+
"eslint": "5.7.0",
|
| 17 |
+
"eslint-config-standard": "12.0.0",
|
| 18 |
+
"eslint-plugin-import": "2.14.0",
|
| 19 |
+
"eslint-plugin-markdown": "1.0.0-beta.7",
|
| 20 |
+
"eslint-plugin-node": "7.0.1",
|
| 21 |
+
"eslint-plugin-promise": "4.0.1",
|
| 22 |
+
"eslint-plugin-standard": "4.0.0",
|
| 23 |
+
"istanbul": "0.4.5",
|
| 24 |
+
"mocha": "5.2.0",
|
| 25 |
+
"safe-buffer": "5.1.2",
|
| 26 |
+
"uid-safe": "2.1.5"
|
| 27 |
+
},
|
| 28 |
+
"files": [
|
| 29 |
+
"lib/",
|
| 30 |
+
"History.md",
|
| 31 |
+
"LICENSE",
|
| 32 |
+
"index.js",
|
| 33 |
+
"Readme.md"
|
| 34 |
+
],
|
| 35 |
+
"engines": {
|
| 36 |
+
"node": ">= 0.8"
|
| 37 |
+
},
|
| 38 |
+
"scripts": {
|
| 39 |
+
"bench": "node benchmark/index.js",
|
| 40 |
+
"lint": "eslint --plugin markdown --ext js,md .",
|
| 41 |
+
"test": "mocha --reporter spec --bail test/",
|
| 42 |
+
"test-ci": "istanbul cover --print=none node_modules/mocha/bin/_mocha -- --reporter spec test/ && istanbul report lcovonly text-summary",
|
| 43 |
+
"test-cov": "istanbul cover --print=none node_modules/mocha/bin/_mocha -- --reporter dot test/ && istanbul report lcov text-summary"
|
| 44 |
+
}
|
| 45 |
+
}
|
node_modules/dequal/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export function dequal(foo: any, bar: any): boolean;
|
node_modules/dequal/license
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in
|
| 13 |
+
all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 21 |
+
THE SOFTWARE.
|
node_modules/dequal/lite/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export function dequal(foo: any, bar: any): boolean;
|