@contrast/agent 4.5.2 → 4.6.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.
- package/lib/assess/policy/propagators.json +20 -0
- package/lib/assess/policy/signatures.json +10 -0
- package/lib/core/config/options.js +3 -2
- package/lib/core/stacktrace.js +2 -1
- package/lib/hooks/frameworks/base.js +8 -2
- package/lib/hooks/frameworks/http.js +23 -16
- package/lib/hooks/frameworks/http2.js +73 -0
- package/lib/hooks/frameworks/index.js +8 -3
- package/lib/hooks/http.js +112 -128
- package/lib/hooks/require.js +16 -22
- package/lib/instrumentation.js +0 -3
- package/package.json +12 -15
- package/lib/hooks/frameworks/https.js +0 -42
- package/node_modules/bindings/LICENSE.md +0 -22
- package/node_modules/bindings/README.md +0 -98
- package/node_modules/bindings/bindings.js +0 -221
- package/node_modules/bindings/package.json +0 -32
- package/node_modules/file-uri-to-path/.npmignore +0 -1
- package/node_modules/file-uri-to-path/.travis.yml +0 -30
- package/node_modules/file-uri-to-path/History.md +0 -21
- package/node_modules/file-uri-to-path/LICENSE +0 -20
- package/node_modules/file-uri-to-path/README.md +0 -74
- package/node_modules/file-uri-to-path/index.d.ts +0 -2
- package/node_modules/file-uri-to-path/index.js +0 -66
- package/node_modules/file-uri-to-path/package.json +0 -36
- package/node_modules/file-uri-to-path/test/test.js +0 -24
- package/node_modules/file-uri-to-path/test/tests.json +0 -13
- package/node_modules/glossy/LICENSE +0 -19
- package/node_modules/glossy/README.md +0 -129
- package/node_modules/glossy/index.js +0 -12
- package/node_modules/glossy/lib/glossy/parse.js +0 -520
- package/node_modules/glossy/lib/glossy/produce.js +0 -459
- package/node_modules/glossy/package.json +0 -47
- package/node_modules/glossy/test/decide.js +0 -7
- package/node_modules/glossy/test/decode_pri.js +0 -24
- package/node_modules/glossy/test/parse_3164.js +0 -104
- package/node_modules/glossy/test/parse_5424.js +0 -106
- package/node_modules/glossy/test/parse_5848.js +0 -40
- package/node_modules/glossy/test/parse_8601.js +0 -14
- package/node_modules/glossy/test/parse_rfc3339.js +0 -9
- package/node_modules/glossy/test/produce.js +0 -162
- package/node_modules/glossy/test/runner.js +0 -40
- package/node_modules/glossy/test/structure_data.js +0 -24
- package/node_modules/nan/CHANGELOG.md +0 -537
- package/node_modules/nan/LICENSE.md +0 -13
- package/node_modules/nan/README.md +0 -455
- package/node_modules/nan/doc/asyncworker.md +0 -146
- package/node_modules/nan/doc/buffers.md +0 -54
- package/node_modules/nan/doc/callback.md +0 -76
- package/node_modules/nan/doc/converters.md +0 -41
- package/node_modules/nan/doc/errors.md +0 -226
- package/node_modules/nan/doc/json.md +0 -62
- package/node_modules/nan/doc/maybe_types.md +0 -583
- package/node_modules/nan/doc/methods.md +0 -664
- package/node_modules/nan/doc/new.md +0 -147
- package/node_modules/nan/doc/node_misc.md +0 -123
- package/node_modules/nan/doc/object_wrappers.md +0 -263
- package/node_modules/nan/doc/persistent.md +0 -296
- package/node_modules/nan/doc/scopes.md +0 -73
- package/node_modules/nan/doc/script.md +0 -38
- package/node_modules/nan/doc/string_bytes.md +0 -62
- package/node_modules/nan/doc/v8_internals.md +0 -199
- package/node_modules/nan/doc/v8_misc.md +0 -85
- package/node_modules/nan/include_dirs.js +0 -1
- package/node_modules/nan/nan.h +0 -2898
- package/node_modules/nan/nan_callbacks.h +0 -88
- package/node_modules/nan/nan_callbacks_12_inl.h +0 -514
- package/node_modules/nan/nan_callbacks_pre_12_inl.h +0 -520
- package/node_modules/nan/nan_converters.h +0 -72
- package/node_modules/nan/nan_converters_43_inl.h +0 -68
- package/node_modules/nan/nan_converters_pre_43_inl.h +0 -42
- package/node_modules/nan/nan_define_own_property_helper.h +0 -29
- package/node_modules/nan/nan_implementation_12_inl.h +0 -430
- package/node_modules/nan/nan_implementation_pre_12_inl.h +0 -263
- package/node_modules/nan/nan_json.h +0 -166
- package/node_modules/nan/nan_maybe_43_inl.h +0 -356
- package/node_modules/nan/nan_maybe_pre_43_inl.h +0 -268
- package/node_modules/nan/nan_new.h +0 -340
- package/node_modules/nan/nan_object_wrap.h +0 -156
- package/node_modules/nan/nan_persistent_12_inl.h +0 -132
- package/node_modules/nan/nan_persistent_pre_12_inl.h +0 -242
- package/node_modules/nan/nan_private.h +0 -73
- package/node_modules/nan/nan_string_bytes.h +0 -305
- package/node_modules/nan/nan_typedarray_contents.h +0 -96
- package/node_modules/nan/nan_weak.h +0 -437
- package/node_modules/nan/package.json +0 -41
- package/node_modules/nan/tools/1to2.js +0 -412
- package/node_modules/nan/tools/README.md +0 -14
- package/node_modules/nan/tools/package.json +0 -19
- package/node_modules/unix-dgram/LICENSE +0 -13
- package/node_modules/unix-dgram/README.md +0 -107
- package/node_modules/unix-dgram/binding.gyp +0 -20
- package/node_modules/unix-dgram/build/Makefile +0 -324
- package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram/src/unix_dgram.o.d +0 -58
- package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram.node.d +0 -1
- package/node_modules/unix-dgram/build/Release/.deps/Release/unix_dgram.node.d +0 -1
- package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram/src/unix_dgram.o +0 -0
- package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram.node +0 -0
- package/node_modules/unix-dgram/build/Release/unix_dgram.node +0 -0
- package/node_modules/unix-dgram/build/binding.Makefile +0 -6
- package/node_modules/unix-dgram/build/config.gypi +0 -213
- package/node_modules/unix-dgram/build/unix_dgram.target.mk +0 -159
- package/node_modules/unix-dgram/lib/unix_dgram.js +0 -168
- package/node_modules/unix-dgram/package.json +0 -36
- package/node_modules/unix-dgram/src/unix_dgram.cc +0 -404
- package/node_modules/unix-dgram/src/win_dummy.cc +0 -7
- package/node_modules/unix-dgram/test/test-connect-callback.js +0 -68
- package/node_modules/unix-dgram/test/test-connect.js +0 -53
- package/node_modules/unix-dgram/test/test-dgram-unix.js +0 -58
- package/node_modules/unix-dgram/test/test-send-error.js +0 -26
- package/node_modules/winston-syslog/.eslintrc +0 -7
- package/node_modules/winston-syslog/.travis.yml +0 -14
- package/node_modules/winston-syslog/CHANGELOG.md +0 -9
- package/node_modules/winston-syslog/LICENSE +0 -20
- package/node_modules/winston-syslog/README.md +0 -135
- package/node_modules/winston-syslog/lib/utils.js +0 -26
- package/node_modules/winston-syslog/lib/winston-syslog.js +0 -385
- package/node_modules/winston-syslog/package.json +0 -56
- package/node_modules/winston-syslog/test/format-test.js +0 -122
- package/node_modules/winston-syslog/test/syslog-test.js +0 -95
- package/node_modules/winston-syslog/test/unix-connect-test.js +0 -133
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/agent",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "Node.js security instrumentation by Contrast Security",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"security",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"extract-licenses": "node scripts/extract-licenses",
|
|
39
39
|
"fix": "eslint . --fix",
|
|
40
40
|
"prepare": "husky install || exit 0",
|
|
41
|
-
"preversion": "npm run test:gh-ci"
|
|
41
|
+
"preversion": "npm run test:gh-ci",
|
|
42
|
+
"initsecrets": "scripts/detect-secrets.sh"
|
|
42
43
|
},
|
|
43
44
|
"lint-staged": {
|
|
44
45
|
"*.js": "eslint --fix",
|
|
@@ -74,11 +75,10 @@
|
|
|
74
75
|
"@contrast/fn-inspect": "^2.4.2",
|
|
75
76
|
"@contrast/heapdump": "^1.1.0",
|
|
76
77
|
"@contrast/protobuf-api": "^3.2.0",
|
|
77
|
-
"@contrast/require-hook": "^2.0.
|
|
78
|
+
"@contrast/require-hook": "^2.0.6",
|
|
78
79
|
"@contrast/synchronous-source-maps": "^1.1.0",
|
|
79
80
|
"amqp-connection-manager": "^3.2.2",
|
|
80
81
|
"amqplib": "^0.8.0",
|
|
81
|
-
"base64url": "^3.0.1",
|
|
82
82
|
"big-integer": "^1.6.36",
|
|
83
83
|
"bluebird": "^3.5.3",
|
|
84
84
|
"builtin-modules": "^3.2.0",
|
|
@@ -94,18 +94,14 @@
|
|
|
94
94
|
"jspack": "0.0.4",
|
|
95
95
|
"lodash": "^4.17.21",
|
|
96
96
|
"make-dir": "^3.1.0",
|
|
97
|
-
"moment": "^2.21.0",
|
|
98
97
|
"multi-stage-sourcemap": "^0.3.1",
|
|
99
98
|
"on-finished": "^2.3.0",
|
|
100
99
|
"parseurl": "^1.3.3",
|
|
101
100
|
"prom-client": "^12.0.0",
|
|
102
101
|
"recursive-readdir": "^2.2.2",
|
|
103
|
-
"request": "^2.88.0",
|
|
104
102
|
"semver": "^7.3.2",
|
|
105
|
-
"source-map": "^0.7.3",
|
|
106
103
|
"winston": "^3.1.0",
|
|
107
104
|
"winston-daily-rotate-file": "^3.5.1",
|
|
108
|
-
"winston-syslog": "2.1.0",
|
|
109
105
|
"yaml": "^1.10.0"
|
|
110
106
|
},
|
|
111
107
|
"devDependencies": {
|
|
@@ -113,7 +109,7 @@
|
|
|
113
109
|
"@bmacnaughton/string-generator": "^1.0.0",
|
|
114
110
|
"@contrast/eslint-config": "^2.0.1",
|
|
115
111
|
"@contrast/fake-module": "file:test/mock/contrast-fake",
|
|
116
|
-
"@contrast/screener-service": "^1.12.
|
|
112
|
+
"@contrast/screener-service": "^1.12.5",
|
|
117
113
|
"@hapi/boom": "file:test/mock/boom",
|
|
118
114
|
"@hapi/hapi": "file:test/mock/hapi",
|
|
119
115
|
"@ls-lint/ls-lint": "^1.8.1",
|
|
@@ -130,9 +126,10 @@
|
|
|
130
126
|
"config": "^3.3.3",
|
|
131
127
|
"csv-writer": "^1.2.0",
|
|
132
128
|
"deasync": "^0.1.20",
|
|
129
|
+
"dustjs-linkedin": "^3.0.0",
|
|
133
130
|
"ejs": "^3.1.6",
|
|
134
131
|
"escape-html": "^1.0.3",
|
|
135
|
-
"eslint": "^
|
|
132
|
+
"eslint": "^8.2.0",
|
|
136
133
|
"eslint-config-prettier": "^6.11.0",
|
|
137
134
|
"eslint-plugin-mocha": "^7.0.1",
|
|
138
135
|
"eslint-plugin-node": "^11.1.0",
|
|
@@ -148,11 +145,11 @@
|
|
|
148
145
|
"jsdoc": "^3.6.7",
|
|
149
146
|
"libxmljs": "file:test/mock/libxmljs",
|
|
150
147
|
"libxmljs2": "file:test/mock/libxmljs2",
|
|
151
|
-
"lint-staged": "^
|
|
148
|
+
"lint-staged": "^12.0.2",
|
|
152
149
|
"madge": "^4.0.1",
|
|
153
150
|
"marsdb": "file:test/mock/marsdb",
|
|
154
|
-
"mocha": "^
|
|
155
|
-
"mochawesome": "^
|
|
151
|
+
"mocha": "^9.1.3",
|
|
152
|
+
"mochawesome": "^7.0.1",
|
|
156
153
|
"mongodb": "file:test/mock/mongodb",
|
|
157
154
|
"mongodb-npm": "npm:mongodb@^3.6.5",
|
|
158
155
|
"mustache": "^3.0.1",
|
|
@@ -161,7 +158,7 @@
|
|
|
161
158
|
"node-fetch": "^2.6.1",
|
|
162
159
|
"node-serialize": "file:test/mock/node-serialize",
|
|
163
160
|
"npm-license-crawler": "^0.2.1",
|
|
164
|
-
"nyc": "^15.
|
|
161
|
+
"nyc": "^15.1.0",
|
|
165
162
|
"pg": "file:test/mock/pg",
|
|
166
163
|
"pino": "^6.7.0",
|
|
167
164
|
"prettier": "^1.19.1",
|
|
@@ -177,7 +174,7 @@
|
|
|
177
174
|
"triple-beam": "^1.3.0",
|
|
178
175
|
"typeorm": "file:test/mock/typeorm",
|
|
179
176
|
"uuid": "^8.3.1",
|
|
180
|
-
"validator": "^13.
|
|
177
|
+
"validator": "^13.7.0",
|
|
181
178
|
"xpath": "file:test/mock/xpath"
|
|
182
179
|
},
|
|
183
180
|
"main": "bootstrap.js",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright: 2021 Contrast Security, Inc
|
|
3
|
-
Contact: support@contrastsecurity.com
|
|
4
|
-
License: Commercial
|
|
5
|
-
|
|
6
|
-
NOTICE: This Software and the patented inventions embodied within may only be
|
|
7
|
-
used as part of Contrast Security’s commercial offerings. Even though it is
|
|
8
|
-
made available through public repositories, use of this Software is subject to
|
|
9
|
-
the applicable End User Licensing Agreement found at
|
|
10
|
-
https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
11
|
-
between Contrast Security and the End User. The Software may not be reverse
|
|
12
|
-
engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
|
-
way not consistent with the End User License Agreement.
|
|
14
|
-
*/
|
|
15
|
-
'use strict';
|
|
16
|
-
|
|
17
|
-
const emitter = require('../../agent-emitter');
|
|
18
|
-
const { HTTP_EVENTS } = require('../../constants');
|
|
19
|
-
const HttpFramework = require('./http');
|
|
20
|
-
|
|
21
|
-
const id = 'https';
|
|
22
|
-
|
|
23
|
-
class HttpsFramework extends HttpFramework {
|
|
24
|
-
constructor(agent) {
|
|
25
|
-
super(agent, id);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Override for <code>HttpSource.prototype.handleServerCreate</code>.
|
|
30
|
-
* We override in order to emit the event with the proper callback argument -
|
|
31
|
-
* HTTPS servers take an `options` object as the first argument. We want the
|
|
32
|
-
* second callback argument.
|
|
33
|
-
* @param {*[]} args The arguments passed to the Server constructor
|
|
34
|
-
* @param {Server} server
|
|
35
|
-
*/
|
|
36
|
-
handleServerCreate(args, server) {
|
|
37
|
-
const callback = args[1];
|
|
38
|
-
emitter.emit(HTTP_EVENTS.SERVER_CREATE, callback, server);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
module.exports = HttpsFramework;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
|
|
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.
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
node-bindings
|
|
2
|
-
=============
|
|
3
|
-
### Helper module for loading your native module's `.node` file
|
|
4
|
-
|
|
5
|
-
This is a helper module for authors of Node.js native addon modules.
|
|
6
|
-
It is basically the "swiss army knife" of `require()`ing your native module's
|
|
7
|
-
`.node` file.
|
|
8
|
-
|
|
9
|
-
Throughout the course of Node's native addon history, addons have ended up being
|
|
10
|
-
compiled in a variety of different places, depending on which build tool and which
|
|
11
|
-
version of node was used. To make matters worse, now the `gyp` build tool can
|
|
12
|
-
produce either a __Release__ or __Debug__ build, each being built into different
|
|
13
|
-
locations.
|
|
14
|
-
|
|
15
|
-
This module checks _all_ the possible locations that a native addon would be built
|
|
16
|
-
at, and returns the first one that loads successfully.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Installation
|
|
20
|
-
------------
|
|
21
|
-
|
|
22
|
-
Install with `npm`:
|
|
23
|
-
|
|
24
|
-
``` bash
|
|
25
|
-
$ npm install --save bindings
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Or add it to the `"dependencies"` section of your `package.json` file.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Example
|
|
32
|
-
-------
|
|
33
|
-
|
|
34
|
-
`require()`ing the proper bindings file for the current node version, platform
|
|
35
|
-
and architecture is as simple as:
|
|
36
|
-
|
|
37
|
-
``` js
|
|
38
|
-
var bindings = require('bindings')('binding.node')
|
|
39
|
-
|
|
40
|
-
// Use your bindings defined in your C files
|
|
41
|
-
bindings.your_c_function()
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Nice Error Output
|
|
46
|
-
-----------------
|
|
47
|
-
|
|
48
|
-
When the `.node` file could not be loaded, `node-bindings` throws an Error with
|
|
49
|
-
a nice error message telling you exactly what was tried. You can also check the
|
|
50
|
-
`err.tries` Array property.
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
Error: Could not load the bindings file. Tried:
|
|
54
|
-
→ /Users/nrajlich/ref/build/binding.node
|
|
55
|
-
→ /Users/nrajlich/ref/build/Debug/binding.node
|
|
56
|
-
→ /Users/nrajlich/ref/build/Release/binding.node
|
|
57
|
-
→ /Users/nrajlich/ref/out/Debug/binding.node
|
|
58
|
-
→ /Users/nrajlich/ref/Debug/binding.node
|
|
59
|
-
→ /Users/nrajlich/ref/out/Release/binding.node
|
|
60
|
-
→ /Users/nrajlich/ref/Release/binding.node
|
|
61
|
-
→ /Users/nrajlich/ref/build/default/binding.node
|
|
62
|
-
→ /Users/nrajlich/ref/compiled/0.8.2/darwin/x64/binding.node
|
|
63
|
-
at bindings (/Users/nrajlich/ref/node_modules/bindings/bindings.js:84:13)
|
|
64
|
-
at Object.<anonymous> (/Users/nrajlich/ref/lib/ref.js:5:47)
|
|
65
|
-
at Module._compile (module.js:449:26)
|
|
66
|
-
at Object.Module._extensions..js (module.js:467:10)
|
|
67
|
-
at Module.load (module.js:356:32)
|
|
68
|
-
at Function.Module._load (module.js:312:12)
|
|
69
|
-
...
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
The searching for the `.node` file will originate from the first directory in which has a `package.json` file is found.
|
|
73
|
-
|
|
74
|
-
License
|
|
75
|
-
-------
|
|
76
|
-
|
|
77
|
-
(The MIT License)
|
|
78
|
-
|
|
79
|
-
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
|
|
80
|
-
|
|
81
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
82
|
-
a copy of this software and associated documentation files (the
|
|
83
|
-
'Software'), to deal in the Software without restriction, including
|
|
84
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
85
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
86
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
87
|
-
the following conditions:
|
|
88
|
-
|
|
89
|
-
The above copyright notice and this permission notice shall be
|
|
90
|
-
included in all copies or substantial portions of the Software.
|
|
91
|
-
|
|
92
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
93
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
94
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
95
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
96
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
97
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
98
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Module dependencies.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
var fs = require('fs'),
|
|
6
|
-
path = require('path'),
|
|
7
|
-
fileURLToPath = require('file-uri-to-path'),
|
|
8
|
-
join = path.join,
|
|
9
|
-
dirname = path.dirname,
|
|
10
|
-
exists =
|
|
11
|
-
(fs.accessSync &&
|
|
12
|
-
function(path) {
|
|
13
|
-
try {
|
|
14
|
-
fs.accessSync(path);
|
|
15
|
-
} catch (e) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
return true;
|
|
19
|
-
}) ||
|
|
20
|
-
fs.existsSync ||
|
|
21
|
-
path.existsSync,
|
|
22
|
-
defaults = {
|
|
23
|
-
arrow: process.env.NODE_BINDINGS_ARROW || ' → ',
|
|
24
|
-
compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled',
|
|
25
|
-
platform: process.platform,
|
|
26
|
-
arch: process.arch,
|
|
27
|
-
nodePreGyp:
|
|
28
|
-
'node-v' +
|
|
29
|
-
process.versions.modules +
|
|
30
|
-
'-' +
|
|
31
|
-
process.platform +
|
|
32
|
-
'-' +
|
|
33
|
-
process.arch,
|
|
34
|
-
version: process.versions.node,
|
|
35
|
-
bindings: 'bindings.node',
|
|
36
|
-
try: [
|
|
37
|
-
// node-gyp's linked version in the "build" dir
|
|
38
|
-
['module_root', 'build', 'bindings'],
|
|
39
|
-
// node-waf and gyp_addon (a.k.a node-gyp)
|
|
40
|
-
['module_root', 'build', 'Debug', 'bindings'],
|
|
41
|
-
['module_root', 'build', 'Release', 'bindings'],
|
|
42
|
-
// Debug files, for development (legacy behavior, remove for node v0.9)
|
|
43
|
-
['module_root', 'out', 'Debug', 'bindings'],
|
|
44
|
-
['module_root', 'Debug', 'bindings'],
|
|
45
|
-
// Release files, but manually compiled (legacy behavior, remove for node v0.9)
|
|
46
|
-
['module_root', 'out', 'Release', 'bindings'],
|
|
47
|
-
['module_root', 'Release', 'bindings'],
|
|
48
|
-
// Legacy from node-waf, node <= 0.4.x
|
|
49
|
-
['module_root', 'build', 'default', 'bindings'],
|
|
50
|
-
// Production "Release" buildtype binary (meh...)
|
|
51
|
-
['module_root', 'compiled', 'version', 'platform', 'arch', 'bindings'],
|
|
52
|
-
// node-qbs builds
|
|
53
|
-
['module_root', 'addon-build', 'release', 'install-root', 'bindings'],
|
|
54
|
-
['module_root', 'addon-build', 'debug', 'install-root', 'bindings'],
|
|
55
|
-
['module_root', 'addon-build', 'default', 'install-root', 'bindings'],
|
|
56
|
-
// node-pre-gyp path ./lib/binding/{node_abi}-{platform}-{arch}
|
|
57
|
-
['module_root', 'lib', 'binding', 'nodePreGyp', 'bindings']
|
|
58
|
-
]
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The main `bindings()` function loads the compiled bindings for a given module.
|
|
63
|
-
* It uses V8's Error API to determine the parent filename that this function is
|
|
64
|
-
* being invoked from, which is then used to find the root directory.
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
function bindings(opts) {
|
|
68
|
-
// Argument surgery
|
|
69
|
-
if (typeof opts == 'string') {
|
|
70
|
-
opts = { bindings: opts };
|
|
71
|
-
} else if (!opts) {
|
|
72
|
-
opts = {};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// maps `defaults` onto `opts` object
|
|
76
|
-
Object.keys(defaults).map(function(i) {
|
|
77
|
-
if (!(i in opts)) opts[i] = defaults[i];
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// Get the module root
|
|
81
|
-
if (!opts.module_root) {
|
|
82
|
-
opts.module_root = exports.getRoot(exports.getFileName());
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Ensure the given bindings name ends with .node
|
|
86
|
-
if (path.extname(opts.bindings) != '.node') {
|
|
87
|
-
opts.bindings += '.node';
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// https://github.com/webpack/webpack/issues/4175#issuecomment-342931035
|
|
91
|
-
var requireFunc =
|
|
92
|
-
typeof __webpack_require__ === 'function'
|
|
93
|
-
? __non_webpack_require__
|
|
94
|
-
: require;
|
|
95
|
-
|
|
96
|
-
var tries = [],
|
|
97
|
-
i = 0,
|
|
98
|
-
l = opts.try.length,
|
|
99
|
-
n,
|
|
100
|
-
b,
|
|
101
|
-
err;
|
|
102
|
-
|
|
103
|
-
for (; i < l; i++) {
|
|
104
|
-
n = join.apply(
|
|
105
|
-
null,
|
|
106
|
-
opts.try[i].map(function(p) {
|
|
107
|
-
return opts[p] || p;
|
|
108
|
-
})
|
|
109
|
-
);
|
|
110
|
-
tries.push(n);
|
|
111
|
-
try {
|
|
112
|
-
b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
|
|
113
|
-
if (!opts.path) {
|
|
114
|
-
b.path = n;
|
|
115
|
-
}
|
|
116
|
-
return b;
|
|
117
|
-
} catch (e) {
|
|
118
|
-
if (e.code !== 'MODULE_NOT_FOUND' &&
|
|
119
|
-
e.code !== 'QUALIFIED_PATH_RESOLUTION_FAILED' &&
|
|
120
|
-
!/not find/i.test(e.message)) {
|
|
121
|
-
throw e;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
err = new Error(
|
|
127
|
-
'Could not locate the bindings file. Tried:\n' +
|
|
128
|
-
tries
|
|
129
|
-
.map(function(a) {
|
|
130
|
-
return opts.arrow + a;
|
|
131
|
-
})
|
|
132
|
-
.join('\n')
|
|
133
|
-
);
|
|
134
|
-
err.tries = tries;
|
|
135
|
-
throw err;
|
|
136
|
-
}
|
|
137
|
-
module.exports = exports = bindings;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Gets the filename of the JavaScript file that invokes this function.
|
|
141
|
-
* Used to help find the root directory of a module.
|
|
142
|
-
* Optionally accepts an filename argument to skip when searching for the invoking filename
|
|
143
|
-
*/
|
|
144
|
-
|
|
145
|
-
exports.getFileName = function getFileName(calling_file) {
|
|
146
|
-
var origPST = Error.prepareStackTrace,
|
|
147
|
-
origSTL = Error.stackTraceLimit,
|
|
148
|
-
dummy = {},
|
|
149
|
-
fileName;
|
|
150
|
-
|
|
151
|
-
Error.stackTraceLimit = 10;
|
|
152
|
-
|
|
153
|
-
Error.prepareStackTrace = function(e, st) {
|
|
154
|
-
for (var i = 0, l = st.length; i < l; i++) {
|
|
155
|
-
fileName = st[i].getFileName();
|
|
156
|
-
if (fileName !== __filename) {
|
|
157
|
-
if (calling_file) {
|
|
158
|
-
if (fileName !== calling_file) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
} else {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// run the 'prepareStackTrace' function above
|
|
169
|
-
Error.captureStackTrace(dummy);
|
|
170
|
-
dummy.stack;
|
|
171
|
-
|
|
172
|
-
// cleanup
|
|
173
|
-
Error.prepareStackTrace = origPST;
|
|
174
|
-
Error.stackTraceLimit = origSTL;
|
|
175
|
-
|
|
176
|
-
// handle filename that starts with "file://"
|
|
177
|
-
var fileSchema = 'file://';
|
|
178
|
-
if (fileName.indexOf(fileSchema) === 0) {
|
|
179
|
-
fileName = fileURLToPath(fileName);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return fileName;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Gets the root directory of a module, given an arbitrary filename
|
|
187
|
-
* somewhere in the module tree. The "root directory" is the directory
|
|
188
|
-
* containing the `package.json` file.
|
|
189
|
-
*
|
|
190
|
-
* In: /home/nate/node-native-module/lib/index.js
|
|
191
|
-
* Out: /home/nate/node-native-module
|
|
192
|
-
*/
|
|
193
|
-
|
|
194
|
-
exports.getRoot = function getRoot(file) {
|
|
195
|
-
var dir = dirname(file),
|
|
196
|
-
prev;
|
|
197
|
-
while (true) {
|
|
198
|
-
if (dir === '.') {
|
|
199
|
-
// Avoids an infinite loop in rare cases, like the REPL
|
|
200
|
-
dir = process.cwd();
|
|
201
|
-
}
|
|
202
|
-
if (
|
|
203
|
-
exists(join(dir, 'package.json')) ||
|
|
204
|
-
exists(join(dir, 'node_modules'))
|
|
205
|
-
) {
|
|
206
|
-
// Found the 'package.json' file or 'node_modules' dir; we're done
|
|
207
|
-
return dir;
|
|
208
|
-
}
|
|
209
|
-
if (prev === dir) {
|
|
210
|
-
// Got to the top
|
|
211
|
-
throw new Error(
|
|
212
|
-
'Could not find module root given file: "' +
|
|
213
|
-
file +
|
|
214
|
-
'". Do you have a `package.json` file? '
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
// Try the parent dir next
|
|
218
|
-
prev = dir;
|
|
219
|
-
dir = join(dir, '..');
|
|
220
|
-
}
|
|
221
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "bindings",
|
|
3
|
-
"description": "Helper module for loading your native module's .node file",
|
|
4
|
-
"keywords": [
|
|
5
|
-
"native",
|
|
6
|
-
"addon",
|
|
7
|
-
"bindings",
|
|
8
|
-
"gyp",
|
|
9
|
-
"waf",
|
|
10
|
-
"c",
|
|
11
|
-
"c++"
|
|
12
|
-
],
|
|
13
|
-
"version": "1.5.0",
|
|
14
|
-
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git://github.com/TooTallNate/node-bindings.git"
|
|
18
|
-
},
|
|
19
|
-
"main": "./bindings.js",
|
|
20
|
-
"bugs": {
|
|
21
|
-
"url": "https://github.com/TooTallNate/node-bindings/issues"
|
|
22
|
-
},
|
|
23
|
-
"homepage": "https://github.com/TooTallNate/node-bindings",
|
|
24
|
-
"license": "MIT",
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"file-uri-to-path": "1.0.0"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
,"_resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz"
|
|
30
|
-
,"_integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ=="
|
|
31
|
-
,"_from": "bindings@1.5.0"
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/node_modules
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
sudo: false
|
|
2
|
-
|
|
3
|
-
language: node_js
|
|
4
|
-
|
|
5
|
-
node_js:
|
|
6
|
-
- "0.8"
|
|
7
|
-
- "0.10"
|
|
8
|
-
- "0.12"
|
|
9
|
-
- "1"
|
|
10
|
-
- "2"
|
|
11
|
-
- "3"
|
|
12
|
-
- "4"
|
|
13
|
-
- "5"
|
|
14
|
-
- "6"
|
|
15
|
-
- "7"
|
|
16
|
-
- "8"
|
|
17
|
-
|
|
18
|
-
install:
|
|
19
|
-
- PATH="`npm bin`:`npm bin -g`:$PATH"
|
|
20
|
-
# Node 0.8 comes with a too obsolete npm
|
|
21
|
-
- if [[ "`node --version`" =~ ^v0\.8\. ]]; then npm install -g npm@1.4.28 ; fi
|
|
22
|
-
# Install dependencies and build
|
|
23
|
-
- npm install
|
|
24
|
-
|
|
25
|
-
script:
|
|
26
|
-
# Output useful info for debugging
|
|
27
|
-
- node --version
|
|
28
|
-
- npm --version
|
|
29
|
-
# Run tests
|
|
30
|
-
- npm test
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
1.0.0 / 2017-07-06
|
|
3
|
-
==================
|
|
4
|
-
|
|
5
|
-
* update "mocha" to v3
|
|
6
|
-
* fixed unicode URI decoding (#6)
|
|
7
|
-
* add typings for Typescript
|
|
8
|
-
* README: use SVG Travis-CI badge
|
|
9
|
-
* add LICENSE file (MIT)
|
|
10
|
-
* add .travis.yml file (testing Node.js 0.8 through 8 currently)
|
|
11
|
-
* add README.md file
|
|
12
|
-
|
|
13
|
-
0.0.2 / 2014-01-27
|
|
14
|
-
==================
|
|
15
|
-
|
|
16
|
-
* index: invert the path separators on Windows
|
|
17
|
-
|
|
18
|
-
0.0.1 / 2014-01-27
|
|
19
|
-
==================
|
|
20
|
-
|
|
21
|
-
* initial commit
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
-
a copy of this software and associated documentation files (the
|
|
5
|
-
'Software'), to deal in the Software without restriction, including
|
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
-
the following conditions:
|
|
10
|
-
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
|
12
|
-
included in all copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
18
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
19
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
20
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
file-uri-to-path
|
|
2
|
-
================
|
|
3
|
-
### Convert a `file:` URI to a file path
|
|
4
|
-
[](https://travis-ci.org/TooTallNate/file-uri-to-path)
|
|
5
|
-
|
|
6
|
-
Accepts a `file:` URI and returns a regular file path suitable for use with the
|
|
7
|
-
`fs` module functions.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Installation
|
|
11
|
-
------------
|
|
12
|
-
|
|
13
|
-
Install with `npm`:
|
|
14
|
-
|
|
15
|
-
``` bash
|
|
16
|
-
$ npm install file-uri-to-path
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Example
|
|
21
|
-
-------
|
|
22
|
-
|
|
23
|
-
``` js
|
|
24
|
-
var uri2path = require('file-uri-to-path');
|
|
25
|
-
|
|
26
|
-
uri2path('file://localhost/c|/WINDOWS/clock.avi');
|
|
27
|
-
// "c:\\WINDOWS\\clock.avi"
|
|
28
|
-
|
|
29
|
-
uri2path('file:///c|/WINDOWS/clock.avi');
|
|
30
|
-
// "c:\\WINDOWS\\clock.avi"
|
|
31
|
-
|
|
32
|
-
uri2path('file://localhost/c:/WINDOWS/clock.avi');
|
|
33
|
-
// "c:\\WINDOWS\\clock.avi"
|
|
34
|
-
|
|
35
|
-
uri2path('file://hostname/path/to/the%20file.txt');
|
|
36
|
-
// "\\\\hostname\\path\\to\\the file.txt"
|
|
37
|
-
|
|
38
|
-
uri2path('file:///c:/path/to/the%20file.txt');
|
|
39
|
-
// "c:\\path\\to\\the file.txt"
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
API
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
### fileUriToPath(String uri) → String
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
License
|
|
51
|
-
-------
|
|
52
|
-
|
|
53
|
-
(The MIT License)
|
|
54
|
-
|
|
55
|
-
Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
|
|
56
|
-
|
|
57
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
58
|
-
a copy of this software and associated documentation files (the
|
|
59
|
-
'Software'), to deal in the Software without restriction, including
|
|
60
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
61
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
62
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
63
|
-
the following conditions:
|
|
64
|
-
|
|
65
|
-
The above copyright notice and this permission notice shall be
|
|
66
|
-
included in all copies or substantial portions of the Software.
|
|
67
|
-
|
|
68
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
69
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
70
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
71
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
72
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
73
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
74
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|