node-red-contrib-web-worldmap 5.1.5 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/CHANGELOG.md +6 -4
  2. package/README.md +6 -4
  3. package/node_modules/@types/geojson/README.md +1 -1
  4. package/node_modules/@types/geojson/index.d.ts +36 -2
  5. package/node_modules/@types/geojson/package.json +2 -2
  6. package/node_modules/{call-bind → call-bind-apply-helpers}/.eslintrc +1 -0
  7. package/node_modules/{has-property-descriptors → call-bind-apply-helpers}/.github/FUNDING.yml +1 -1
  8. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  9. package/node_modules/{call-bind → call-bind-apply-helpers}/LICENSE +1 -1
  10. package/node_modules/call-bind-apply-helpers/README.md +62 -0
  11. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  12. package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  13. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  14. package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  15. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  16. package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  17. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  18. package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  19. package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  20. package/node_modules/call-bind-apply-helpers/index.js +15 -0
  21. package/node_modules/call-bind-apply-helpers/package.json +85 -0
  22. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  23. package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  24. package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  25. package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  26. package/node_modules/call-bound/.eslintrc +13 -0
  27. package/node_modules/{call-bind → call-bound}/.github/FUNDING.yml +1 -1
  28. package/node_modules/call-bound/CHANGELOG.md +42 -0
  29. package/node_modules/{has-property-descriptors → call-bound}/LICENSE +1 -1
  30. package/node_modules/call-bound/README.md +53 -0
  31. package/node_modules/call-bound/index.d.ts +94 -0
  32. package/node_modules/call-bound/index.js +19 -0
  33. package/node_modules/{call-bind → call-bound}/package.json +29 -25
  34. package/node_modules/{call-bind/test/callBound.js → call-bound/test/index.js} +12 -5
  35. package/node_modules/call-bound/tsconfig.json +10 -0
  36. package/node_modules/compression/HISTORY.md +9 -1
  37. package/node_modules/compression/README.md +103 -30
  38. package/node_modules/compression/index.js +55 -13
  39. package/node_modules/compression/package.json +3 -2
  40. package/node_modules/{define-data-property → dunder-proto}/.github/FUNDING.yml +1 -1
  41. package/node_modules/dunder-proto/CHANGELOG.md +24 -0
  42. package/node_modules/dunder-proto/LICENSE +21 -0
  43. package/node_modules/dunder-proto/README.md +54 -0
  44. package/node_modules/dunder-proto/get.d.ts +5 -0
  45. package/node_modules/dunder-proto/get.js +30 -0
  46. package/node_modules/{has-proto → dunder-proto}/package.json +34 -36
  47. package/node_modules/dunder-proto/set.d.ts +5 -0
  48. package/node_modules/dunder-proto/set.js +35 -0
  49. package/node_modules/dunder-proto/test/get.js +34 -0
  50. package/node_modules/dunder-proto/test/index.js +4 -0
  51. package/node_modules/dunder-proto/test/set.js +50 -0
  52. package/node_modules/dunder-proto/tsconfig.json +9 -0
  53. package/node_modules/es-define-property/CHANGELOG.md +14 -0
  54. package/node_modules/es-define-property/index.js +1 -3
  55. package/node_modules/es-define-property/package.json +12 -12
  56. package/node_modules/es-define-property/test/index.js +1 -0
  57. package/node_modules/es-define-property/tsconfig.json +2 -42
  58. package/node_modules/es-object-atoms/.eslintrc +16 -0
  59. package/node_modules/{set-function-length → es-object-atoms}/.github/FUNDING.yml +1 -1
  60. package/node_modules/es-object-atoms/CHANGELOG.md +37 -0
  61. package/node_modules/{define-data-property → es-object-atoms}/LICENSE +1 -1
  62. package/node_modules/es-object-atoms/README.md +63 -0
  63. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  64. package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  65. package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  66. package/node_modules/es-object-atoms/ToObject.js +10 -0
  67. package/node_modules/es-object-atoms/index.d.ts +3 -0
  68. package/node_modules/es-object-atoms/index.js +4 -0
  69. package/node_modules/es-object-atoms/isObject.d.ts +3 -0
  70. package/node_modules/es-object-atoms/isObject.js +6 -0
  71. package/node_modules/es-object-atoms/package.json +80 -0
  72. package/node_modules/es-object-atoms/test/index.js +38 -0
  73. package/node_modules/es-object-atoms/tsconfig.json +6 -0
  74. package/node_modules/get-intrinsic/.eslintrc +4 -0
  75. package/node_modules/get-intrinsic/CHANGELOG.md +43 -0
  76. package/node_modules/get-intrinsic/index.js +40 -21
  77. package/node_modules/get-intrinsic/package.json +24 -20
  78. package/node_modules/get-intrinsic/test/GetIntrinsic.js +2 -2
  79. package/node_modules/get-proto/.eslintrc +10 -0
  80. package/node_modules/{has-proto → get-proto}/.github/FUNDING.yml +1 -1
  81. package/node_modules/get-proto/.nycrc +9 -0
  82. package/node_modules/get-proto/CHANGELOG.md +21 -0
  83. package/node_modules/{has-proto → get-proto}/LICENSE +1 -1
  84. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  85. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  86. package/node_modules/get-proto/README.md +50 -0
  87. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  88. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  89. package/node_modules/get-proto/index.d.ts +5 -0
  90. package/node_modules/get-proto/index.js +27 -0
  91. package/node_modules/{has-property-descriptors → get-proto}/package.json +35 -31
  92. package/node_modules/get-proto/test/index.js +68 -0
  93. package/node_modules/get-proto/tsconfig.json +9 -0
  94. package/node_modules/gopd/CHANGELOG.md +20 -0
  95. package/node_modules/gopd/gOPD.d.ts +1 -0
  96. package/node_modules/gopd/gOPD.js +4 -0
  97. package/node_modules/gopd/index.d.ts +5 -0
  98. package/node_modules/gopd/index.js +2 -3
  99. package/node_modules/gopd/package.json +16 -10
  100. package/node_modules/gopd/test/index.js +2 -1
  101. package/node_modules/has-symbols/CHANGELOG.md +16 -0
  102. package/node_modules/has-symbols/index.d.ts +3 -0
  103. package/node_modules/has-symbols/index.js +1 -0
  104. package/node_modules/has-symbols/package.json +19 -9
  105. package/node_modules/has-symbols/shams.d.ts +3 -0
  106. package/node_modules/has-symbols/shams.js +5 -2
  107. package/node_modules/has-symbols/test/shams/core-js.js +1 -0
  108. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +1 -0
  109. package/node_modules/has-symbols/test/tests.js +4 -2
  110. package/node_modules/has-symbols/tsconfig.json +10 -0
  111. package/node_modules/http-parser-js/http-parser.d.ts +6 -0
  112. package/node_modules/http-parser-js/http-parser.js +16 -9
  113. package/node_modules/http-parser-js/package.json +1 -1
  114. package/node_modules/math-intrinsics/.eslintrc +16 -0
  115. package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  116. package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  117. package/node_modules/math-intrinsics/LICENSE +21 -0
  118. package/node_modules/math-intrinsics/README.md +50 -0
  119. package/node_modules/math-intrinsics/abs.d.ts +1 -0
  120. package/node_modules/math-intrinsics/abs.js +4 -0
  121. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  122. package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  123. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  124. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  125. package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  126. package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  127. package/node_modules/math-intrinsics/floor.d.ts +1 -0
  128. package/node_modules/math-intrinsics/floor.js +4 -0
  129. package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  130. package/node_modules/math-intrinsics/isFinite.js +12 -0
  131. package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  132. package/node_modules/math-intrinsics/isInteger.js +16 -0
  133. package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  134. package/node_modules/math-intrinsics/isNaN.js +6 -0
  135. package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  136. package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  137. package/node_modules/math-intrinsics/max.d.ts +1 -0
  138. package/node_modules/math-intrinsics/max.js +4 -0
  139. package/node_modules/math-intrinsics/min.d.ts +1 -0
  140. package/node_modules/math-intrinsics/min.js +4 -0
  141. package/node_modules/math-intrinsics/mod.d.ts +3 -0
  142. package/node_modules/math-intrinsics/mod.js +9 -0
  143. package/node_modules/math-intrinsics/package.json +86 -0
  144. package/node_modules/math-intrinsics/pow.d.ts +1 -0
  145. package/node_modules/math-intrinsics/pow.js +4 -0
  146. package/node_modules/math-intrinsics/round.d.ts +1 -0
  147. package/node_modules/math-intrinsics/round.js +4 -0
  148. package/node_modules/math-intrinsics/sign.d.ts +3 -0
  149. package/node_modules/math-intrinsics/sign.js +11 -0
  150. package/node_modules/math-intrinsics/test/index.js +192 -0
  151. package/node_modules/math-intrinsics/tsconfig.json +3 -0
  152. package/node_modules/mime-db/HISTORY.md +21 -1
  153. package/node_modules/mime-db/README.md +7 -1
  154. package/node_modules/mime-db/db.json +252 -13
  155. package/node_modules/mime-db/package.json +4 -4
  156. package/node_modules/object-inspect/CHANGELOG.md +8 -0
  157. package/node_modules/object-inspect/index.js +10 -7
  158. package/node_modules/object-inspect/package.json +5 -4
  159. package/node_modules/object-inspect/test/values.js +50 -0
  160. package/node_modules/side-channel/.eslintrc +1 -0
  161. package/node_modules/side-channel/CHANGELOG.md +15 -0
  162. package/node_modules/side-channel/README.md +60 -1
  163. package/node_modules/side-channel/index.d.ts +9 -22
  164. package/node_modules/side-channel/index.js +20 -106
  165. package/node_modules/side-channel/package.json +20 -19
  166. package/node_modules/side-channel/test/index.js +76 -55
  167. package/node_modules/side-channel/tsconfig.json +2 -43
  168. package/node_modules/side-channel-list/.editorconfig +9 -0
  169. package/node_modules/side-channel-list/.eslintrc +11 -0
  170. package/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
  171. package/node_modules/side-channel-list/CHANGELOG.md +15 -0
  172. package/node_modules/side-channel-list/LICENSE +21 -0
  173. package/node_modules/side-channel-list/README.md +62 -0
  174. package/node_modules/side-channel-list/index.d.ts +13 -0
  175. package/node_modules/side-channel-list/index.js +113 -0
  176. package/node_modules/side-channel-list/list.d.ts +14 -0
  177. package/node_modules/side-channel-list/package.json +77 -0
  178. package/node_modules/side-channel-list/test/index.js +104 -0
  179. package/node_modules/side-channel-list/tsconfig.json +9 -0
  180. package/node_modules/side-channel-map/.editorconfig +9 -0
  181. package/node_modules/side-channel-map/.eslintrc +11 -0
  182. package/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
  183. package/node_modules/side-channel-map/.nycrc +13 -0
  184. package/node_modules/side-channel-map/CHANGELOG.md +22 -0
  185. package/node_modules/side-channel-map/LICENSE +21 -0
  186. package/node_modules/side-channel-map/README.md +62 -0
  187. package/node_modules/side-channel-map/index.d.ts +15 -0
  188. package/node_modules/side-channel-map/index.js +68 -0
  189. package/node_modules/side-channel-map/package.json +80 -0
  190. package/node_modules/side-channel-map/test/index.js +114 -0
  191. package/node_modules/side-channel-map/tsconfig.json +9 -0
  192. package/node_modules/side-channel-weakmap/.editorconfig +9 -0
  193. package/node_modules/side-channel-weakmap/.eslintrc +12 -0
  194. package/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
  195. package/node_modules/side-channel-weakmap/.nycrc +13 -0
  196. package/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
  197. package/node_modules/side-channel-weakmap/LICENSE +21 -0
  198. package/node_modules/side-channel-weakmap/README.md +62 -0
  199. package/node_modules/side-channel-weakmap/index.d.ts +15 -0
  200. package/node_modules/side-channel-weakmap/index.js +84 -0
  201. package/node_modules/side-channel-weakmap/package.json +87 -0
  202. package/node_modules/side-channel-weakmap/test/index.js +114 -0
  203. package/node_modules/side-channel-weakmap/tsconfig.json +9 -0
  204. package/package.json +1 -1
  205. package/worldmap/worldmap.js +29 -22
  206. package/worldmap.html +1 -0
  207. package/worldmap.js +5 -2
  208. package/node_modules/call-bind/.eslintignore +0 -1
  209. package/node_modules/call-bind/CHANGELOG.md +0 -93
  210. package/node_modules/call-bind/README.md +0 -64
  211. package/node_modules/call-bind/callBound.js +0 -15
  212. package/node_modules/call-bind/index.js +0 -35
  213. package/node_modules/call-bind/test/index.js +0 -80
  214. package/node_modules/define-data-property/.eslintrc +0 -24
  215. package/node_modules/define-data-property/CHANGELOG.md +0 -70
  216. package/node_modules/define-data-property/README.md +0 -67
  217. package/node_modules/define-data-property/index.d.ts +0 -12
  218. package/node_modules/define-data-property/index.js +0 -56
  219. package/node_modules/define-data-property/package.json +0 -106
  220. package/node_modules/define-data-property/test/index.js +0 -392
  221. package/node_modules/define-data-property/tsconfig.json +0 -59
  222. package/node_modules/has-property-descriptors/.eslintrc +0 -13
  223. package/node_modules/has-property-descriptors/CHANGELOG.md +0 -35
  224. package/node_modules/has-property-descriptors/README.md +0 -43
  225. package/node_modules/has-property-descriptors/index.js +0 -22
  226. package/node_modules/has-property-descriptors/test/index.js +0 -57
  227. package/node_modules/has-proto/CHANGELOG.md +0 -38
  228. package/node_modules/has-proto/README.md +0 -38
  229. package/node_modules/has-proto/index.d.ts +0 -3
  230. package/node_modules/has-proto/index.js +0 -15
  231. package/node_modules/has-proto/test/index.js +0 -19
  232. package/node_modules/has-proto/tsconfig.json +0 -49
  233. package/node_modules/set-function-length/.eslintrc +0 -27
  234. package/node_modules/set-function-length/CHANGELOG.md +0 -70
  235. package/node_modules/set-function-length/LICENSE +0 -21
  236. package/node_modules/set-function-length/README.md +0 -56
  237. package/node_modules/set-function-length/env.d.ts +0 -9
  238. package/node_modules/set-function-length/env.js +0 -25
  239. package/node_modules/set-function-length/index.d.ts +0 -7
  240. package/node_modules/set-function-length/index.js +0 -42
  241. package/node_modules/set-function-length/package.json +0 -102
  242. /package/node_modules/{call-bind → call-bind-apply-helpers}/.nycrc +0 -0
  243. /package/node_modules/{has-property-descriptors → call-bound}/.nycrc +0 -0
  244. /package/node_modules/{has-proto → dunder-proto}/.eslintrc +0 -0
  245. /package/node_modules/{define-data-property → dunder-proto}/.nycrc +0 -0
  246. /package/node_modules/{set-function-length → gopd}/tsconfig.json +0 -0
  247. /package/node_modules/{set-function-length → side-channel-list}/.nycrc +0 -0
@@ -30,12 +30,21 @@ var zlib = require('zlib')
30
30
  module.exports = compression
31
31
  module.exports.filter = shouldCompress
32
32
 
33
+ /**
34
+ * @const
35
+ * whether current node version has brotli support
36
+ */
37
+ var hasBrotliSupport = 'createBrotliCompress' in zlib
38
+
33
39
  /**
34
40
  * Module variables.
35
41
  * @private
36
42
  */
37
-
38
43
  var cacheControlNoTransformRegExp = /(?:^|,)\s*?no-transform\s*?(?:,|$)/
44
+ var SUPPORTED_ENCODING = hasBrotliSupport ? ['br', 'gzip', 'deflate', 'identity'] : ['gzip', 'deflate', 'identity']
45
+ var PREFERRED_ENCODING = hasBrotliSupport ? ['br', 'gzip'] : ['gzip']
46
+
47
+ var encodingSupported = ['gzip', 'deflate', 'identity', 'br']
39
48
 
40
49
  /**
41
50
  * Compress response data with gzip / deflate.
@@ -47,10 +56,22 @@ var cacheControlNoTransformRegExp = /(?:^|,)\s*?no-transform\s*?(?:,|$)/
47
56
 
48
57
  function compression (options) {
49
58
  var opts = options || {}
59
+ var optsBrotli = {}
60
+
61
+ if (hasBrotliSupport) {
62
+ Object.assign(optsBrotli, opts.brotli)
63
+
64
+ var brotliParams = {}
65
+ brotliParams[zlib.constants.BROTLI_PARAM_QUALITY] = 4
66
+
67
+ // set the default level to a reasonable value with balanced speed/ratio
68
+ optsBrotli.params = Object.assign(brotliParams, optsBrotli.params)
69
+ }
50
70
 
51
71
  // options
52
72
  var filter = opts.filter || shouldCompress
53
73
  var threshold = bytes.parse(opts.threshold)
74
+ var enforceEncoding = opts.enforceEncoding || 'identity'
54
75
 
55
76
  if (threshold == null) {
56
77
  threshold = 1024
@@ -80,8 +101,8 @@ function compression (options) {
80
101
  return false
81
102
  }
82
103
 
83
- if (!this._header) {
84
- this._implicitHeader()
104
+ if (!headersSent(res)) {
105
+ this.writeHead(this.statusCode)
85
106
  }
86
107
 
87
108
  return stream
@@ -94,13 +115,13 @@ function compression (options) {
94
115
  return false
95
116
  }
96
117
 
97
- if (!this._header) {
118
+ if (!headersSent(res)) {
98
119
  // estimate the length
99
120
  if (!this.getHeader('Content-Length')) {
100
121
  length = chunkLength(chunk, encoding)
101
122
  }
102
123
 
103
- this._implicitHeader()
124
+ this.writeHead(this.statusCode)
104
125
  }
105
126
 
106
127
  if (!stream) {
@@ -175,7 +196,12 @@ function compression (options) {
175
196
 
176
197
  // compression method
177
198
  var negotiator = new Negotiator(req)
178
- var method = negotiator.encoding(['gzip', 'deflate', 'identity'], ['gzip'])
199
+ var method = negotiator.encoding(SUPPORTED_ENCODING, PREFERRED_ENCODING)
200
+
201
+ // if no method is found, use the default encoding
202
+ if (!req.headers['accept-encoding'] && encodingSupported.indexOf(enforceEncoding) !== -1) {
203
+ method = enforceEncoding
204
+ }
179
205
 
180
206
  // negotiation failed
181
207
  if (!method || method === 'identity') {
@@ -187,7 +213,9 @@ function compression (options) {
187
213
  debug('%s compression', method)
188
214
  stream = method === 'gzip'
189
215
  ? zlib.createGzip(opts)
190
- : zlib.createDeflate(opts)
216
+ : method === 'br'
217
+ ? zlib.createBrotliCompress(optsBrotli)
218
+ : zlib.createDeflate(opts)
191
219
 
192
220
  // add buffered listeners to stream
193
221
  addListeners(stream, stream.on, listeners)
@@ -236,9 +264,9 @@ function chunkLength (chunk, encoding) {
236
264
  return 0
237
265
  }
238
266
 
239
- return !Buffer.isBuffer(chunk)
240
- ? Buffer.byteLength(chunk, encoding)
241
- : chunk.length
267
+ return Buffer.isBuffer(chunk)
268
+ ? chunk.length
269
+ : Buffer.byteLength(chunk, encoding)
242
270
  }
243
271
 
244
272
  /**
@@ -277,7 +305,21 @@ function shouldTransform (req, res) {
277
305
  */
278
306
 
279
307
  function toBuffer (chunk, encoding) {
280
- return !Buffer.isBuffer(chunk)
281
- ? Buffer.from(chunk, encoding)
282
- : chunk
308
+ return Buffer.isBuffer(chunk)
309
+ ? chunk
310
+ : Buffer.from(chunk, encoding)
311
+ }
312
+
313
+ /**
314
+ * Determine if the response headers have been sent.
315
+ *
316
+ * @param {object} res
317
+ * @returns {boolean}
318
+ * @private
319
+ */
320
+
321
+ function headersSent (res) {
322
+ return typeof res.headersSent !== 'boolean'
323
+ ? Boolean(res._header)
324
+ : res.headersSent
283
325
  }
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "compression",
3
3
  "description": "Node.js compression middleware",
4
- "version": "1.7.5",
4
+ "version": "1.8.0",
5
5
  "contributors": [
6
6
  "Douglas Christopher Wilson <doug@somethingdoug.com>",
7
7
  "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
8
8
  ],
9
9
  "license": "MIT",
10
10
  "repository": "expressjs/compression",
11
+ "keywords": ["compression", "gzip", "deflate", "middleware", "express", "brotli", "http", "stream"],
11
12
  "dependencies": {
12
13
  "bytes": "3.1.2",
13
14
  "compressible": "~2.0.18",
@@ -41,7 +42,7 @@
41
42
  "scripts": {
42
43
  "lint": "eslint .",
43
44
  "test": "mocha --check-leaks --reporter spec",
44
- "test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
45
+ "test-ci": "nyc --reporter=lcov --reporter=text npm test",
45
46
  "test-cov": "nyc --reporter=html --reporter=text npm test"
46
47
  }
47
48
  }
@@ -4,7 +4,7 @@ github: [ljharb]
4
4
  patreon: # Replace with a single Patreon username
5
5
  open_collective: # Replace with a single Open Collective username
6
6
  ko_fi: # Replace with a single Ko-fi username
7
- tidelift: npm/define-data-property
7
+ tidelift: npm/dunder-proto
8
8
  community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
9
  liberapay: # Replace with a single Liberapay username
10
10
  issuehunt: # Replace with a single IssueHunt username
@@ -0,0 +1,24 @@
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.0.1](https://github.com/es-shims/dunder-proto/compare/v1.0.0...v1.0.1) - 2024-12-16
9
+
10
+ ### Commits
11
+
12
+ - [Fix] do not crash when `--disable-proto=throw` [`6c367d9`](https://github.com/es-shims/dunder-proto/commit/6c367d919bc1604778689a297bbdbfea65752847)
13
+ - [Tests] ensure noproto tests only use the current version of dunder-proto [`b02365b`](https://github.com/es-shims/dunder-proto/commit/b02365b9cf889c4a2cac7be0c3cfc90a789af36c)
14
+ - [Dev Deps] update `@arethetypeswrong/cli`, `@types/tape` [`e3c5c3b`](https://github.com/es-shims/dunder-proto/commit/e3c5c3bd81cf8cef7dff2eca19e558f0e307f666)
15
+ - [Deps] update `call-bind-apply-helpers` [`19f1da0`](https://github.com/es-shims/dunder-proto/commit/19f1da028b8dd0d05c85bfd8f7eed2819b686450)
16
+
17
+ ## v1.0.0 - 2024-12-06
18
+
19
+ ### Commits
20
+
21
+ - Initial implementation, tests, readme, types [`a5b74b0`](https://github.com/es-shims/dunder-proto/commit/a5b74b0082f5270cb0905cd9a2e533cee7498373)
22
+ - Initial commit [`73fb5a3`](https://github.com/es-shims/dunder-proto/commit/73fb5a353b51ac2ab00c9fdeb0114daffd4c07a8)
23
+ - npm init [`80152dc`](https://github.com/es-shims/dunder-proto/commit/80152dc98155da4eb046d9f67a87ed96e8280a1d)
24
+ - Only apps should have lockfiles [`03e6660`](https://github.com/es-shims/dunder-proto/commit/03e6660a1d70dc401f3e217a031475ec537243dd)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ECMAScript Shims
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.
@@ -0,0 +1,54 @@
1
+ # dunder-proto <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
+ If available, the `Object.prototype.__proto__` accessor and mutator, call-bound.
11
+
12
+ ## Getting started
13
+
14
+ ```sh
15
+ npm install --save dunder-proto
16
+ ```
17
+
18
+ ## Usage/Examples
19
+
20
+ ```js
21
+ const assert = require('assert');
22
+ const getDunder = require('dunder-proto/get');
23
+ const setDunder = require('dunder-proto/set');
24
+
25
+ const obj = {};
26
+
27
+ assert.equal('toString' in obj, true);
28
+ assert.equal(getDunder(obj), Object.prototype);
29
+
30
+ setDunder(obj, null);
31
+
32
+ assert.equal('toString' in obj, false);
33
+ assert.equal(getDunder(obj), null);
34
+ ```
35
+
36
+ ## Tests
37
+
38
+ Clone the repo, `npm install`, and run `npm test`
39
+
40
+ [package-url]: https://npmjs.org/package/dunder-proto
41
+ [npm-version-svg]: https://versionbadg.es/es-shims/dunder-proto.svg
42
+ [deps-svg]: https://david-dm.org/es-shims/dunder-proto.svg
43
+ [deps-url]: https://david-dm.org/es-shims/dunder-proto
44
+ [dev-deps-svg]: https://david-dm.org/es-shims/dunder-proto/dev-status.svg
45
+ [dev-deps-url]: https://david-dm.org/es-shims/dunder-proto#info=devDependencies
46
+ [npm-badge-png]: https://nodei.co/npm/dunder-proto.png?downloads=true&stars=true
47
+ [license-image]: https://img.shields.io/npm/l/dunder-proto.svg
48
+ [license-url]: LICENSE
49
+ [downloads-image]: https://img.shields.io/npm/dm/dunder-proto.svg
50
+ [downloads-url]: https://npm-stat.com/charts.html?package=dunder-proto
51
+ [codecov-image]: https://codecov.io/gh/es-shims/dunder-proto/branch/main/graphs/badge.svg
52
+ [codecov-url]: https://app.codecov.io/gh/es-shims/dunder-proto/
53
+ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/dunder-proto
54
+ [actions-url]: https://github.com/es-shims/dunder-proto/actions
@@ -0,0 +1,5 @@
1
+ declare function getDunderProto(target: {}): object | null;
2
+
3
+ declare const x: false | typeof getDunderProto;
4
+
5
+ export = x;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var callBind = require('call-bind-apply-helpers');
4
+ var gOPD = require('gopd');
5
+
6
+ var hasProtoAccessor;
7
+ try {
8
+ // eslint-disable-next-line no-extra-parens, no-proto
9
+ hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
10
+ } catch (e) {
11
+ if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
12
+ throw e;
13
+ }
14
+ }
15
+
16
+ // eslint-disable-next-line no-extra-parens
17
+ var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
18
+
19
+ var $Object = Object;
20
+ var $getPrototypeOf = $Object.getPrototypeOf;
21
+
22
+ /** @type {import('./get')} */
23
+ module.exports = desc && typeof desc.get === 'function'
24
+ ? callBind([desc.get])
25
+ : typeof $getPrototypeOf === 'function'
26
+ ? /** @type {import('./get')} */ function getDunder(value) {
27
+ // eslint-disable-next-line eqeqeq
28
+ return $getPrototypeOf(value == null ? value : $Object(value));
29
+ }
30
+ : false;
@@ -1,67 +1,59 @@
1
1
  {
2
- "name": "has-proto",
3
- "version": "1.0.3",
4
- "description": "Does this environment have the ability to get the [[Prototype]] of an object on creation with `__proto__`?",
5
- "main": "index.js",
2
+ "name": "dunder-proto",
3
+ "version": "1.0.1",
4
+ "description": "If available, the `Object.prototype.__proto__` accessor and mutator, call-bound",
5
+ "main": false,
6
6
  "exports": {
7
- ".": "./index.js",
7
+ "./get": "./get.js",
8
+ "./set": "./set.js",
8
9
  "./package.json": "./package.json"
9
10
  },
10
11
  "sideEffects": false,
11
12
  "scripts": {
12
13
  "prepack": "npmignore --auto --commentLines=autogenerated",
13
- "prepublishOnly": "safe-publish-latest",
14
14
  "prepublish": "not-in-publish || npm run prepublishOnly",
15
- "lint": "eslint --ext=js,mjs .",
16
- "postlint": "tsc -p .",
15
+ "prepublishOnly": "safe-publish-latest",
16
+ "prelint": "evalmd README.md",
17
+ "lint": "eslint --ext=.js,.mjs .",
18
+ "postlint": "tsc -p . && attw -P",
17
19
  "pretest": "npm run lint",
18
- "tests-only": "tape 'test/**/*.js'",
20
+ "tests-only": "nyc tape 'test/**/*.js'",
19
21
  "test": "npm run tests-only",
20
- "posttest": "aud --production",
22
+ "posttest": "npx npm@'>= 10.2' audit --production",
21
23
  "version": "auto-changelog && git add CHANGELOG.md",
22
24
  "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
23
25
  },
24
26
  "repository": {
25
27
  "type": "git",
26
- "url": "git+https://github.com/inspect-js/has-proto.git"
28
+ "url": "git+https://github.com/es-shims/dunder-proto.git"
27
29
  },
28
- "keywords": [
29
- "prototype",
30
- "proto",
31
- "set",
32
- "get",
33
- "__proto__",
34
- "getPrototypeOf",
35
- "setPrototypeOf",
36
- "has"
37
- ],
38
30
  "author": "Jordan Harband <ljharb@gmail.com>",
39
- "funding": {
40
- "url": "https://github.com/sponsors/ljharb"
41
- },
42
31
  "license": "MIT",
43
32
  "bugs": {
44
- "url": "https://github.com/inspect-js/has-proto/issues"
33
+ "url": "https://github.com/es-shims/dunder-proto/issues"
45
34
  },
46
- "homepage": "https://github.com/inspect-js/has-proto#readme",
47
- "testling": {
48
- "files": "test/index.js"
35
+ "homepage": "https://github.com/es-shims/dunder-proto#readme",
36
+ "dependencies": {
37
+ "call-bind-apply-helpers": "^1.0.1",
38
+ "es-errors": "^1.3.0",
39
+ "gopd": "^1.2.0"
49
40
  },
50
41
  "devDependencies": {
51
- "@ljharb/eslint-config": "^21.1.0",
52
- "@types/tape": "^5.6.4",
53
- "aud": "^2.0.4",
54
- "auto-changelog": "^2.4.0",
42
+ "@arethetypeswrong/cli": "^0.17.1",
43
+ "@ljharb/eslint-config": "^21.1.1",
44
+ "@ljharb/tsconfig": "^0.2.2",
45
+ "@types/tape": "^5.7.0",
46
+ "auto-changelog": "^2.5.0",
47
+ "encoding": "^0.1.13",
55
48
  "eslint": "=8.8.0",
49
+ "evalmd": "^0.0.19",
56
50
  "in-publish": "^2.0.1",
57
51
  "npmignore": "^0.3.1",
52
+ "nyc": "^10.3.2",
58
53
  "safe-publish-latest": "^2.0.0",
59
- "tape": "^5.7.5",
54
+ "tape": "^5.9.0",
60
55
  "typescript": "next"
61
56
  },
62
- "engines": {
63
- "node": ">= 0.4"
64
- },
65
57
  "auto-changelog": {
66
58
  "output": "CHANGELOG.md",
67
59
  "template": "keepachangelog",
@@ -70,9 +62,15 @@
70
62
  "backfillLimit": false,
71
63
  "hideCredit": true
72
64
  },
65
+ "testling": {
66
+ "files": "test/index.js"
67
+ },
73
68
  "publishConfig": {
74
69
  "ignore": [
75
70
  ".github/workflows"
76
71
  ]
72
+ },
73
+ "engines": {
74
+ "node": ">= 0.4"
77
75
  }
78
76
  }
@@ -0,0 +1,5 @@
1
+ declare function setDunderProto<P extends null | object>(target: {}, proto: P): P;
2
+
3
+ declare const x: false | typeof setDunderProto;
4
+
5
+ export = x;
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var callBind = require('call-bind-apply-helpers');
4
+ var gOPD = require('gopd');
5
+ var $TypeError = require('es-errors/type');
6
+
7
+ /** @type {{ __proto__?: object | null }} */
8
+ var obj = {};
9
+ try {
10
+ obj.__proto__ = null; // eslint-disable-line no-proto
11
+ } catch (e) {
12
+ if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
13
+ throw e;
14
+ }
15
+ }
16
+
17
+ var hasProtoMutator = !('toString' in obj);
18
+
19
+ // eslint-disable-next-line no-extra-parens
20
+ var desc = gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
21
+
22
+ /** @type {import('./set')} */
23
+ module.exports = hasProtoMutator && (
24
+ // eslint-disable-next-line no-extra-parens
25
+ (!!desc && typeof desc.set === 'function' && /** @type {import('./set')} */ (callBind([desc.set])))
26
+ || /** @type {import('./set')} */ function setDunder(object, proto) {
27
+ // this is node v0.10 or older, which doesn't have Object.setPrototypeOf and has undeniable __proto__
28
+ if (object == null) { // eslint-disable-line eqeqeq
29
+ throw new $TypeError('set Object.prototype.__proto__ called on null or undefined');
30
+ }
31
+ // eslint-disable-next-line no-proto, no-param-reassign, no-extra-parens
32
+ /** @type {{ __proto__?: object | null }} */ (object).__proto__ = proto;
33
+ return proto;
34
+ }
35
+ );
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ var test = require('tape');
4
+
5
+ var getDunderProto = require('../get');
6
+
7
+ test('getDunderProto', { skip: !getDunderProto }, function (t) {
8
+ if (!getDunderProto) {
9
+ throw 'should never happen; this is just for type narrowing'; // eslint-disable-line no-throw-literal
10
+ }
11
+
12
+ // @ts-expect-error
13
+ t['throws'](function () { getDunderProto(); }, TypeError, 'throws if no argument');
14
+ // @ts-expect-error
15
+ t['throws'](function () { getDunderProto(undefined); }, TypeError, 'throws with undefined');
16
+ // @ts-expect-error
17
+ t['throws'](function () { getDunderProto(null); }, TypeError, 'throws with null');
18
+
19
+ t.equal(getDunderProto({}), Object.prototype);
20
+ t.equal(getDunderProto([]), Array.prototype);
21
+ t.equal(getDunderProto(function () {}), Function.prototype);
22
+ t.equal(getDunderProto(/./g), RegExp.prototype);
23
+ t.equal(getDunderProto(42), Number.prototype);
24
+ t.equal(getDunderProto(true), Boolean.prototype);
25
+ t.equal(getDunderProto('foo'), String.prototype);
26
+
27
+ t.end();
28
+ });
29
+
30
+ test('no dunder proto', { skip: !!getDunderProto }, function (t) {
31
+ t.notOk('__proto__' in Object.prototype, 'no __proto__ in Object.prototype');
32
+
33
+ t.end();
34
+ });
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ require('./get');
4
+ require('./set');
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ var test = require('tape');
4
+
5
+ var setDunderProto = require('../set');
6
+
7
+ test('setDunderProto', { skip: !setDunderProto }, function (t) {
8
+ if (!setDunderProto) {
9
+ throw 'should never happen; this is just for type narrowing'; // eslint-disable-line no-throw-literal
10
+ }
11
+
12
+ // @ts-expect-error
13
+ t['throws'](function () { setDunderProto(); }, TypeError, 'throws if no arguments');
14
+ // @ts-expect-error
15
+ t['throws'](function () { setDunderProto(undefined); }, TypeError, 'throws with undefined and nothing');
16
+ // @ts-expect-error
17
+ t['throws'](function () { setDunderProto(undefined, undefined); }, TypeError, 'throws with undefined and undefined');
18
+ // @ts-expect-error
19
+ t['throws'](function () { setDunderProto(null); }, TypeError, 'throws with null and undefined');
20
+ // @ts-expect-error
21
+ t['throws'](function () { setDunderProto(null, undefined); }, TypeError, 'throws with null and undefined');
22
+
23
+ /** @type {{ inherited?: boolean }} */
24
+ var obj = {};
25
+ t.ok('toString' in obj, 'object initially has toString');
26
+
27
+ setDunderProto(obj, null);
28
+ t.notOk('toString' in obj, 'object no longer has toString');
29
+
30
+ t.notOk('inherited' in obj, 'object lacks inherited property');
31
+ setDunderProto(obj, { inherited: true });
32
+ t.equal(obj.inherited, true, 'object has inherited property');
33
+
34
+ t.end();
35
+ });
36
+
37
+ test('no dunder proto', { skip: !!setDunderProto }, function (t) {
38
+ if ('__proto__' in Object.prototype) {
39
+ t['throws'](
40
+ // @ts-expect-error
41
+ function () { ({}).__proto__ = null; }, // eslint-disable-line no-proto
42
+ Error,
43
+ 'throws when setting Object.prototype.__proto__'
44
+ );
45
+ } else {
46
+ t.notOk('__proto__' in Object.prototype, 'no __proto__ in Object.prototype');
47
+ }
48
+
49
+ t.end();
50
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@ljharb/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "ES2021",
5
+ },
6
+ "exclude": [
7
+ "coverage",
8
+ ],
9
+ }
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [v1.0.1](https://github.com/ljharb/es-define-property/compare/v1.0.0...v1.0.1) - 2024-12-06
9
+
10
+ ### Commits
11
+
12
+ - [types] use shared tsconfig [`954a663`](https://github.com/ljharb/es-define-property/commit/954a66360326e508a0e5daa4b07493d58f5e110e)
13
+ - [actions] split out node 10-20, and 20+ [`3a8e84b`](https://github.com/ljharb/es-define-property/commit/3a8e84b23883f26ff37b3e82ff283834228e18c6)
14
+ - [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/get-intrinsic`, `@types/tape`, `auto-changelog`, `gopd`, `tape` [`86ae27b`](https://github.com/ljharb/es-define-property/commit/86ae27bb8cc857b23885136fad9cbe965ae36612)
15
+ - [Refactor] avoid using `get-intrinsic` [`02480c0`](https://github.com/ljharb/es-define-property/commit/02480c0353ef6118965282977c3864aff53d98b1)
16
+ - [Tests] replace `aud` with `npm audit` [`f6093ff`](https://github.com/ljharb/es-define-property/commit/f6093ff74ab51c98015c2592cd393bd42478e773)
17
+ - [Tests] configure testling [`7139e66`](https://github.com/ljharb/es-define-property/commit/7139e66959247a56086d9977359caef27c6849e7)
18
+ - [Dev Deps] update `tape` [`b901b51`](https://github.com/ljharb/es-define-property/commit/b901b511a75e001a40ce1a59fef7d9ffcfc87482)
19
+ - [Tests] fix types in tests [`469d269`](https://github.com/ljharb/es-define-property/commit/469d269fd141b1e773ec053a9fa35843493583e0)
20
+ - [Dev Deps] add missing peer dep [`733acfb`](https://github.com/ljharb/es-define-property/commit/733acfb0c4c96edf337e470b89a25a5b3724c352)
21
+
8
22
  ## v1.0.0 - 2024-02-12
9
23
 
10
24
  ### Commits
@@ -1,9 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var GetIntrinsic = require('get-intrinsic');
4
-
5
3
  /** @type {import('.')} */
6
- var $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false;
4
+ var $defineProperty = Object.defineProperty || false;
7
5
  if ($defineProperty) {
8
6
  try {
9
7
  $defineProperty({}, 'a', { value: 1 });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-define-property",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "`Object.defineProperty`, but not IE 8's broken one.",
5
5
  "main": "index.js",
6
6
  "types": "./index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "pretest": "npm run lint",
20
20
  "tests-only": "nyc tape 'test/**/*.js'",
21
21
  "test": "npm run tests-only",
22
- "posttest": "aud --production",
22
+ "posttest": "npx npm@'>= 10.2' audit --production",
23
23
  "version": "auto-changelog && git add CHANGELOG.md",
24
24
  "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
25
25
  },
@@ -42,29 +42,29 @@
42
42
  "url": "https://github.com/ljharb/es-define-property/issues"
43
43
  },
44
44
  "homepage": "https://github.com/ljharb/es-define-property#readme",
45
- "dependencies": {
46
- "get-intrinsic": "^1.2.4"
47
- },
48
45
  "devDependencies": {
49
- "@ljharb/eslint-config": "^21.1.0",
50
- "@types/get-intrinsic": "^1.2.2",
46
+ "@ljharb/eslint-config": "^21.1.1",
47
+ "@ljharb/tsconfig": "^0.2.2",
51
48
  "@types/gopd": "^1.0.3",
52
- "@types/tape": "^5.6.4",
53
- "aud": "^2.0.4",
54
- "auto-changelog": "^2.4.0",
49
+ "@types/tape": "^5.6.5",
50
+ "auto-changelog": "^2.5.0",
51
+ "encoding": "^0.1.13",
55
52
  "eslint": "^8.8.0",
56
53
  "evalmd": "^0.0.19",
57
- "gopd": "^1.0.1",
54
+ "gopd": "^1.2.0",
58
55
  "in-publish": "^2.0.1",
59
56
  "npmignore": "^0.3.1",
60
57
  "nyc": "^10.3.2",
61
58
  "safe-publish-latest": "^2.0.0",
62
- "tape": "^5.7.4",
59
+ "tape": "^5.9.0",
63
60
  "typescript": "next"
64
61
  },
65
62
  "engines": {
66
63
  "node": ">= 0.4"
67
64
  },
65
+ "testling": {
66
+ "files": "test/index.js"
67
+ },
68
68
  "auto-changelog": {
69
69
  "output": "CHANGELOG.md",
70
70
  "template": "keepachangelog",