1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-17 01:16:00 +00:00
This commit is contained in:
MatteZ02
2020-03-03 22:30:50 +02:00
parent edfcc6f474
commit 30022c7634
11800 changed files with 1984416 additions and 1 deletions

12
node_modules/ref/.npmignore generated vendored Normal file
View File

@ -0,0 +1,12 @@
npm-debug.log
/build
/node_modules
/docs/index.html
# ignore root-level single-letter file dev files
?.js
#IDE
/.idea
.kdev*

33
node_modules/ref/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,33 @@
sudo: false
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
language: node_js
node_js:
- "0.10"
- "0.12"
- "3.2"
- "4"
- "5"
- "6"
- "7"
install:
- PATH="`npm bin`:`npm bin -g`:$PATH"
# Install dependencies and build
- npm install
script:
# Output useful info for debugging
- node --version
- npm --version
# Run tests
- npm test

331
node_modules/ref/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,331 @@
1.3.5 / 2017-01-27
==================
* [[`a1b8216fe7`](https://github.com/TooTallNate/ref/commit/a1b8216fe7)] - fix `util.inspect()` overriding on Node v7 (Nathan Rajlich)
* [[`0e26fcf81e`](https://github.com/TooTallNate/ref/commit/0e26fcf81e)] - **appveyor**: drop node v2 and v3 (Nathan Rajlich)
* [[`9e9078a4e1`](https://github.com/TooTallNate/ref/commit/9e9078a4e1)] - **travis**: drop node v1 and v2 (Nathan Rajlich)
* [[`615016ac1a`](https://github.com/TooTallNate/ref/commit/615016ac1a)] - **test**: fix `util.inspect()` test (Nathan Rajlich)
* [[`e1fe604c05`](https://github.com/TooTallNate/ref/commit/e1fe604c05)] - **test**: fix tests after V8 6.0 GC changes (Michaël Zasso, #85)
1.3.4 / 2017-01-27
==================
* [[`32637be7e4`](https://github.com/TooTallNate/ref/commit/32637be7e4)] - CI stuffs (Nathan Rajlich)
* [[`55716fd9e3`](https://github.com/TooTallNate/ref/commit/55716fd9e3)] - always use `defineProperty()` for `name` (Nathan Rajlich)
* [[`786b73941e`](https://github.com/TooTallNate/ref/commit/786b73941e)] - **refType**: force name to writable before updating it (Joel Martin) (#67)
1.3.3 / 2016-11-03
==================
* [[`3f0a2d4775`](https://github.com/TooTallNate/ref/commit/3f0a2d4775)] - rename History.md to CHANGELOG.md (Nathan Rajlich)
* [[`30fe405ae5`](https://github.com/TooTallNate/ref/commit/30fe405ae5)] - Merge pull request #62 from mhertsch/master (Nathan Rajlich)
* [[`6fdb4b7b23`](https://github.com/TooTallNate/ref/commit/6fdb4b7b23)] - Replaced ForceSet with Nan::ForceSet to remove deprecation warnings when using node 6.9.1 (Michael Hertsch)
* [[`000b2a7889`](https://github.com/TooTallNate/ref/commit/000b2a7889)] - **travis**: test node v6 (Nathan Rajlich)
1.3.2 / 2016-01-10
==================
* int64: fix failing OS X tests now
* int64: better error handling for Linux
1.3.1 / 2015-12-02
==================
* writeUInt64: better error checking for `WriteUInt64()`
* writeUInt64: allow hex or octal input string values
1.3.0 / 2015-12-02
==================
* writeInt64: better error checking for `WriteInt64()`
* writeInt64: allow hex or octal input string values
* appveyor: test node v5
* travis: test node v5
1.2.0 / 2015-10-08
==================
* force Buffer length to 0 if NULL is read (#42, @saneki)
1.1.3 / 2015-09-23
==================
* appveyor: remove v1
* speed increase by avoiding `JSON.stringify()` constant call (#39, @dan-tull)
1.1.2 / 2015-09-19
==================
* CString: allow a Buffer to be used as backing store in `set()` (https://github.com/node-ffi/node-ffi/issues/169)
* travis, appveyor: test Node.js v4
1.1.1 / 2015-09-14
==================
* remove unused WrapPointer overload (fix compile warning)
* appveyor: better Windows testing
1.1.0 / 2015-08-26
==================
* appveyor: 2.5 + 3 added
* appveyor: attempt to fix v0.8 and v0.10
* int64 conversion works with debug mode iojs runtime
* persistent size fixed
* better automated testing
* package: update "weak" to v1
* package: add "MIT" license field
* NAN 2.0 support (#33, @unbornchikken)
1.0.2 / 2015-05-09
==================
* package: update "nan" to v1.8.4 (#30, @mafintosh)
* README: use SVG for appveyor badge
1.0.1 / 2015-03-22
==================
* package: update "nan" to v1.7.0
* appveyor: test node v0.12, don't test v0.11
* travis: test node v0.12, don't test v0.11
* README: add link to Known Types page
1.0.0 / 2015-01-20
==================
* bumping to v1.0.0 for better semver semantics
* travis: don't test node v0.8.x
0.3.5 / 2015-01-18
==================
* src: add SET_SIZEOF and SET_ALIGNOF macros
0.3.4 / 2015-01-18
==================
* package: update "nan" to v1.5.1
* travis: don't test node v0.6.x
* use `v8::Object::ForceSet` instead of `v8::Object:Set` (#20, @sarangsapre)
0.3.3 / 2014-12-29
==================
* package: allow any "debug" v2
* add support for `Buffer#reinterpret()` with `offset` (#18, @deepak1556)
0.3.2 / 2014-06-19
==================
* src: fix comment typo
* src: define our own `kMaxLength` constant
0.3.1 / 2014-06-09
==================
* src: allow Buffers returned from `reinterpretUntilZeros()` up to `kMaxLength` bytes
* test: move the reinterpretUntilZeros() tests to their own file
* test: fix `Buffer#inspect()` test on Windows
0.3.0 / 2014-06-08
==================
* ref: use `hexAddress()` for the Buffer inspect() override
* ref: add `hexAddress()` function
* src: use `NanEscapableScope` where appropriate
* src: use `uintptr_t` to ensure a positive address
* src: better _snprintf_s #define macro (#12, @fjhub)
* package: update "debug" to v1.0.1
0.2.3 / 2014-06-04
==================
* package: update "nan" to v1.2.0
* src: remove commented code
0.2.2 / 2014-06-01
==================
* package: update "nan" to v1.1.2
* travis: remove IRC notifications from Travis
0.2.1 / 2014-05-27
==================
* package: pin dev dependency versions
* package: use explicit nan commit with LLVM fix
* README: use https for Travis URL
* travis: test node v0.6.x
0.2.0 / 2014-05-26
==================
* binding: use `rvagg/nan` for node v0.8, v0.10, and v0.11 compat
* package: update "nan" to v1.1.0
* package: remove "engines" section
* README: add appveyor test badge
* README: use .svg for Travis badge
* add appveyor.yml file
* .travis: don't test node v0.9.x
* package: beautify
* add a `persistent` option to writeObject()
* make passing `ref.NULL` to allocCString() work as expected
* docs: document the "length" parameter of ref.readPointer()
0.1.3 / 2012-09-25
==================
* fix compiler warnings on Windows
0.1.2 / 2012-09-02
==================
* allow an offset as the third argument to the "reinterpret" functions
0.1.1 / 2012-08-03
==================
* prevent multiple instances of ref from chaining inspects in "overwriteInspect"
0.1.0 / 2012-07-22
==================
* initial release of the documentation (http://tootallnate.github.com/ref)
* binding: make "endianness" and "NULL" be 'frozen'
* lib: make derefType() throw an Error when given a "type" with indirection 1
* augment the Buffer#inspect() function to print out the memory address as well
0.0.20 / 2012-06-27
===================
* rename the `Utf8String` type to `CString` (#5)
* make `Utf8String` an alias to `CString` and deprecated
* more work on docs (not yet ready)
0.0.19 / 2012-06-25
==================
* use node-bindings
0.0.18 / 2012-06-21
===================
* add the non-native-endian read+write int64 functions
* starting on some real (inline) documentation
0.0.17 / 2012-06-05
===================
* allow the "bool" type to write arbitrary number values (0-255) to it
* Utf8String: return JS `null` when reading a pointer pointing to NULL
* make `reinterpret()` and `reinterpretUntilZeros()` throw an Error when given a NULL pointer
* make `ref.get()` and `ref.set()` coerce their optional type when given
* some more tests
0.0.16 / 2012-06-01
===================
* use Object.create() and Object.getPrototypeOf() for `refType()` and `derefType()`
* remove `cloneType()`
* make reading from a NULL pointer always throw an Error:
* readCString()
* readPointer()
* readObject()
* readInt64()
* readUInt64()
0.0.15 / 2012-05-31
===================
* fix possible segmentation fault with `readObject()`
* fix possible segmentation fault with `readPointer()`
0.0.14 / 2012-05-31
===================
* fix possible segmentation fault with `readCString()`
0.0.13 / 2012-05-30
===================
* make `refType()` coerce string types properly
* make the `bool` type inherit from a proper fixed type (like `uint8`)
0.0.12 / 2012-05-30
===================
* make the "char" and "uchar" types accept JS String values
* make the synonym types (i.e. longlong is a synonym for int64) be distinct objects, rather than simple JS references
* fix coersion of a string value of "Object"
* added the `reinterpretUntilZeros()` function
0.0.11 / 2012-05-17
===================
* always do string type coersion, like on `alloc()`
* add a "bool" type, which works with JS `true`/`false` values
0.0.10 / 2012-05-15
===================
* fix compiler error on Solaris
* fix compiler errors on Windows
0.0.9 / 2012-05-13
==================
* allow `ref.alloc()` to not have a value being set with it
* add the `coerceType()` function (get a proper "type" instance from a string)
* add the Utf8String type back over from node-ffi
* conditionally extend SlowBuffer.prototype for node >= v0.7.9
0.0.8 / 2012-05-12
==================
* make the `void` type "set()" function be a no-op instead of throwing
* added some more test cases
0.0.7 / 2012-05-09
==================
* added the `reinterpret()` function
0.0.6 / 2012-05-09
==================
* add `alignof` mappings for the types
* add an `Object` type
* set the `alignment` property on the built-in types
0.0.5 / 2012-05-09
==================
* quickly add get() and set() functions
* use the `PRId64` and `PRIu64` snprintf types
0.0.4 / 2012-05-08
==================
* README improvements; some API documentation
* removed some leftover debugging statements
0.0.3 / 2012-05-08
==================
* added `readCString()` function (to `Buffer.prototype` as well)
* added `writeCString()` function (to `Buffer.prototype` as well)
* added an `allocCString()` function
* removed the `Utf8String` type; moved it to node-ffi
* made `ref.NULL` be a 'void' type
0.0.2 / 2012-05-05
==================
* Added missing includes for Linux, etc.
0.0.1 / 2012-05-04
==================
* Initial release

165
node_modules/ref/README.md generated vendored Normal file
View File

@ -0,0 +1,165 @@
ref
===
### Turn Buffer instances into "pointers"
[![Build Status](https://secure.travis-ci.org/TooTallNate/ref.svg)](https://travis-ci.org/TooTallNate/ref)
[![Build Status](https://ci.appveyor.com/api/projects/status/n8mswogp2im4uot8?svg=true)](https://ci.appveyor.com/project/TooTallNate/ref)
This module is inspired by the old `Pointer` class from node-ffi, but with the
intent of using Node's fast `Buffer` instances instead of a slow C++ `Pointer`
class. These two concepts were previously very similar, but now this module
brings over the functionality that Pointers had and Buffers are missing, so
now Buffers are a lot more powerful.
### Features:
* Get the memory address of any `Buffer` instance
* Read/write references to JavaScript Objects into `Buffer` instances
* Read/write `Buffer` instances' memory addresses to other `Buffer` instances
* Read/write `int64_t` and `uint64_t` data values (Numbers or Strings)
* A "type" convention, so that you can specify a buffer as an `int *`,
and reference/dereference at will.
* Offers a buffer instance representing the `NULL` pointer
Installation
------------
Install with `npm`:
``` bash
$ npm install ref
```
Examples
--------
#### referencing and derefencing
``` js
var ref = require('ref')
// so we can all agree that a buffer with the int value written
// to it could be represented as an "int *"
var buf = new Buffer(4)
buf.writeInt32LE(12345, 0)
// first, what is the memory address of the buffer?
console.log(buf.address()) // ← 140362165284824
// using `ref`, you can set the "type", and gain magic abilities!
buf.type = ref.types.int
// now we can dereference to get the "meaningful" value
console.log(buf.deref()) // ← 12345
// you can also get references to the original buffer if you need it.
// this buffer could be thought of as an "int **"
var one = buf.ref()
// and you can dereference all the way back down to an int
console.log(one.deref().deref()) // ← 12345
```
See the [full API Docs][docs] for more examples.
The "type" interface
--------------------
You can easily define your own "type" objects at attach to `Buffer` instances.
It just needs to be a regular JavaScript Object that contains the following
properties:
| **Name** | **Data Type** | **Description**
|:--------------|:---------------------------------|:----------------------------------
| `size` | Number | The size in bytes required to hold this type.
| `indirection` | Number | The current level of indirection of the buffer. Usually this would be _1_, and gets incremented on Buffers from `ref()` calls. A value of less than or equal to _0_ is invalid.
| `get` | Function (buffer, offset) | The function to invoke when dereferencing this type when the indirection level is _1_.
| `set` | Function (buffer, offset, value) | The function to invoke when setting a value to a buffer instance.
| `name` | String | _(optional)_ The name to use during debugging for this type.
| `alignment` | Number | _(optional)_ The alignment of this type when placed in a struct. Defaults to the type's `size`.
Be sure to check out the Wiki page of ["Known
Types"](https://github.com/TooTallNate/ref/wiki/Known-%22types%22), for the list
of built-in ref types, as well as known external type implementations.
For example, you could define a "bigint" type that dereferences into a
[`bigint`](https://github.com/substack/node-bigint) instance:
``` js
var ref = require('ref')
var bigint = require('bigint')
// define the "type" instance according to the spec
var BigintType = {
size: ref.sizeof.int64
, indirection: 1
, get: function (buffer, offset) {
// return a bigint instance from the buffer
return bigint.fromBuffer(buffer)
}
, set: function (buffer, offset, value) {
// 'value' would be a bigint instance
var val = value.toString()
return ref.writeInt64(buffer, offset || 0, val)
}
}
// now we can create instances of the type from existing buffers.
// "buf" is some Buffer instance returned from some external data
// source, which should contain "bigint" binary data.
buf.type = BigintType
// and now you can create "bigint" instances using this generic "types" API
var val = buf.deref()
.add('1234')
.sqrt()
.shiftLeft(5)
```
Build the docs
--------------
Install the dev dependencies:
``` bash
$ npm install
```
Generate the docs:
``` bash
$ npm run docs
```
License
-------
(The MIT License)
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[docs]: http://tootallnate.github.com/ref

42
node_modules/ref/appveyor.yml generated vendored Normal file
View File

@ -0,0 +1,42 @@
# http://www.appveyor.com/docs/appveyor-yml
# Test against these versions of Node.js.
environment:
# Visual Studio Version
MSVS_VERSION: 2013
# Test against these versions of Node.js and io.js
matrix:
# node.js
- nodejs_version: "0.10"
- nodejs_version: "0.12"
# io.js
- nodejs_version: "4"
- nodejs_version: "5"
- nodejs_version: "6"
- nodejs_version: "7"
platform:
- x86
- x64
# Install scripts. (runs after repo cloning)
install:
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
- npm install -g npm@3
- set PATH=%APPDATA%\npm;%PATH%
# Typical npm stuff.
- npm install --msvs_version=%MSVS_VERSION%
# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- npm test
# Don't actually build.
build: off
# Set build version format here instead of in the admin panel.
version: "{build}"

11
node_modules/ref/binding.gyp generated vendored Normal file
View File

@ -0,0 +1,11 @@
{
'targets': [
{
'target_name': 'binding',
'sources': [ 'src/binding.cc' ],
'include_dirs': [
'<!(node -e "require(\'nan\')")'
],
}
]
}

BIN
node_modules/ref/build/Release/binding.exp generated vendored Normal file

Binary file not shown.

BIN
node_modules/ref/build/Release/binding.iobj generated vendored Normal file

Binary file not shown.

BIN
node_modules/ref/build/Release/binding.ipdb generated vendored Normal file

Binary file not shown.

BIN
node_modules/ref/build/Release/binding.lib generated vendored Normal file

Binary file not shown.

3079
node_modules/ref/build/Release/binding.map generated vendored Normal file

File diff suppressed because it is too large Load Diff

BIN
node_modules/ref/build/Release/binding.node generated vendored Normal file

Binary file not shown.

BIN
node_modules/ref/build/Release/binding.pdb generated vendored Normal file

Binary file not shown.

BIN
node_modules/ref/build/Release/obj/binding/binding.obj generated vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native64Bit:WindowsTargetPlatformVersion=10.0.17763.0
Release|x64|C:\Users\matia\Documents\GitHub\Musix-V3\node_modules\ref\build\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

19
node_modules/ref/build/binding.sln generated vendored Normal file
View File

@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2015
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "binding", "binding.vcxproj", "{80D8AB1F-8AF2-D0BA-23FD-FC41A892E436}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{80D8AB1F-8AF2-D0BA-23FD-FC41A892E436}.Debug|x64.ActiveCfg = Debug|x64
{80D8AB1F-8AF2-D0BA-23FD-FC41A892E436}.Debug|x64.Build.0 = Debug|x64
{80D8AB1F-8AF2-D0BA-23FD-FC41A892E436}.Release|x64.ActiveCfg = Release|x64
{80D8AB1F-8AF2-D0BA-23FD-FC41A892E436}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

152
node_modules/ref/build/binding.vcxproj generated vendored Normal file
View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{80D8AB1F-8AF2-D0BA-23FD-FC41A892E436}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>binding</RootNamespace>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Label="Locals">
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props"/>
<ImportGroup Label="ExtensionSettings"/>
<ImportGroup Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
</ImportGroup>
<PropertyGroup Label="UserMacros"/>
<PropertyGroup>
<ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\bin\;$(MSBuildProjectDirectory)\..\bin\</ExecutablePath>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<IntDir>$(Configuration)\obj\$(ProjectName)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.node</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.node</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.node</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.node</TargetExt>
<TargetName>$(ProjectName)</TargetName>
<TargetPath>$(OutDir)\$(ProjectName).node</TargetPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>C:\Users\matia\.node-gyp\10.16.3\include\node;C:\Users\matia\.node-gyp\10.16.3\src;C:\Users\matia\.node-gyp\10.16.3\deps\openssl\config;C:\Users\matia\.node-gyp\10.16.3\deps\openssl\openssl\include;C:\Users\matia\.node-gyp\10.16.3\deps\uv\include;C:\Users\matia\.node-gyp\10.16.3\deps\zlib;C:\Users\matia\.node-gyp\10.16.3\deps\v8\include;..\..\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<BufferSecurityCheck>true</BufferSecurityCheck>
<CompileAsWinRT>false</CompileAsWinRT>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>false</ExceptionHandling>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<OmitFramePointers>false</OmitFramePointers>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=binding;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;BUILDING_NODE_EXTENSION;DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<StringPooling>true</StringPooling>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWarningAsError>false</TreatWarningAsError>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;&quot;C:\Users\matia\.node-gyp\10.16.3\x64\node.lib&quot;</AdditionalDependencies>
<AdditionalOptions>/ignore:4199 %(AdditionalOptions)</AdditionalOptions>
<AllowIsolation>true</AllowIsolation>
<DataExecutionPrevention>true</DataExecutionPrevention>
<DelayLoadDLLs>iojs.exe;node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<MapExports>true</MapExports>
<OutputFile>$(OutDir)$(ProjectName).node</OutputFile>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetExt>.node</TargetExt>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>C:\Users\matia\.node-gyp\10.16.3\include\node;C:\Users\matia\.node-gyp\10.16.3\src;C:\Users\matia\.node-gyp\10.16.3\deps\openssl\config;C:\Users\matia\.node-gyp\10.16.3\deps\openssl\openssl\include;C:\Users\matia\.node-gyp\10.16.3\deps\uv\include;C:\Users\matia\.node-gyp\10.16.3\deps\zlib;C:\Users\matia\.node-gyp\10.16.3\deps\v8\include;..\..\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=binding;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;BUILDING_NODE_EXTENSION;DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>C:\Users\matia\.node-gyp\10.16.3\include\node;C:\Users\matia\.node-gyp\10.16.3\src;C:\Users\matia\.node-gyp\10.16.3\deps\openssl\config;C:\Users\matia\.node-gyp\10.16.3\deps\openssl\openssl\include;C:\Users\matia\.node-gyp\10.16.3\deps\uv\include;C:\Users\matia\.node-gyp\10.16.3\deps\zlib;C:\Users\matia\.node-gyp\10.16.3\deps\v8\include;..\..\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<BufferSecurityCheck>true</BufferSecurityCheck>
<CompileAsWinRT>false</CompileAsWinRT>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>false</ExceptionHandling>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<FunctionLevelLinking>true</FunctionLevelLinking>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<OmitFramePointers>true</OmitFramePointers>
<Optimization>Full</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=binding;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;BUILDING_NODE_EXTENSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<StringPooling>true</StringPooling>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWarningAsError>false</TreatWarningAsError>
<WarningLevel>Level3</WarningLevel>
<WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
<Lib>
<AdditionalOptions>/LTCG:INCREMENTAL %(AdditionalOptions)</AdditionalOptions>
</Lib>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;&quot;C:\Users\matia\.node-gyp\10.16.3\x64\node.lib&quot;</AdditionalDependencies>
<AdditionalOptions>/ignore:4199 /LTCG:INCREMENTAL %(AdditionalOptions)</AdditionalOptions>
<AllowIsolation>true</AllowIsolation>
<DataExecutionPrevention>true</DataExecutionPrevention>
<DelayLoadDLLs>iojs.exe;node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<MapExports>true</MapExports>
<OptimizeReferences>true</OptimizeReferences>
<OutputFile>$(OutDir)$(ProjectName).node</OutputFile>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetExt>.node</TargetExt>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>C:\Users\matia\.node-gyp\10.16.3\include\node;C:\Users\matia\.node-gyp\10.16.3\src;C:\Users\matia\.node-gyp\10.16.3\deps\openssl\config;C:\Users\matia\.node-gyp\10.16.3\deps\openssl\openssl\include;C:\Users\matia\.node-gyp\10.16.3\deps\uv\include;C:\Users\matia\.node-gyp\10.16.3\deps\zlib;C:\Users\matia\.node-gyp\10.16.3\deps\v8\include;..\..\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=binding;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;BUILDING_NODE_EXTENSION;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="..\binding.gyp"/>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\binding.cc"/>
<ClCompile Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc"/>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets"/>
<ImportGroup Label="ExtensionTargets"/>
</Project>

49
node_modules/ref/build/binding.vcxproj.filters generated vendored Normal file
View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="..">
<UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
</Filter>
<Filter Include="..\src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter>
<Filter Include="C:">
<UniqueIdentifier>{7B735499-E5DD-1C2B-6C26-70023832A1CF}</UniqueIdentifier>
</Filter>
<Filter Include="C:\Program Files">
<UniqueIdentifier>{92EF4BA8-6BC2-65D1-451F-28EBD4AE726A}</UniqueIdentifier>
</Filter>
<Filter Include="C:\Program Files\nodejs">
<UniqueIdentifier>{A3C8E949-BCF6-0C67-6656-340A2A097708}</UniqueIdentifier>
</Filter>
<Filter Include="C:\Program Files\nodejs\node_modules">
<UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
</Filter>
<Filter Include="C:\Program Files\nodejs\node_modules\npm">
<UniqueIdentifier>{741E0E76-39B2-B1AB-9FA1-F1A20B16F295}</UniqueIdentifier>
</Filter>
<Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules">
<UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
</Filter>
<Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp">
<UniqueIdentifier>{77348C0E-2034-7791-74D5-63C077DF5A3B}</UniqueIdentifier>
</Filter>
<Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter>
<Filter Include="..">
<UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\binding.cc">
<Filter>..\src</Filter>
</ClCompile>
<ClCompile Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc">
<Filter>C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src</Filter>
</ClCompile>
<None Include="..\binding.gyp">
<Filter>..</Filter>
</None>
</ItemGroup>
</Project>

197
node_modules/ref/build/config.gypi generated vendored Normal file
View File

@ -0,0 +1,197 @@
# Do not edit. File was generated by node-gyp's "configure" step
{
"target_defaults": {
"cflags": [],
"default_configuration": "Release",
"defines": [],
"include_dirs": [],
"libraries": [],
"msbuild_toolset": "v141",
"msvs_windows_target_platform_version": "10.0.17763.0"
},
"variables": {
"asan": 0,
"build_v8_with_gn": "false",
"coverage": "false",
"debug_nghttp2": "false",
"enable_lto": "false",
"enable_pgo_generate": "false",
"enable_pgo_use": "false",
"force_dynamic_crt": 0,
"host_arch": "x64",
"icu_data_in": "..\\..\\deps/icu-small\\source/data/in\\icudt64l.dat",
"icu_endianness": "l",
"icu_gyp_path": "tools/icu/icu-generic.gyp",
"icu_locales": "en,root",
"icu_path": "deps/icu-small",
"icu_small": "true",
"icu_ver_major": "64",
"nasm_version": "2.14",
"node_byteorder": "little",
"node_debug_lib": "false",
"node_enable_d8": "false",
"node_enable_v8_vtunejit": "false",
"node_install_npm": "true",
"node_module_version": 64,
"node_no_browser_globals": "false",
"node_prefix": "/usr/local",
"node_release_urlbase": "https://nodejs.org/download/release/",
"node_shared": "false",
"node_shared_cares": "false",
"node_shared_http_parser": "false",
"node_shared_libuv": "false",
"node_shared_nghttp2": "false",
"node_shared_openssl": "false",
"node_shared_zlib": "false",
"node_tag": "",
"node_target_type": "executable",
"node_use_bundled_v8": "true",
"node_use_dtrace": "false",
"node_use_etw": "true",
"node_use_large_pages": "false",
"node_use_openssl": "true",
"node_use_pch": "false",
"node_use_perfctr": "true",
"node_use_v8_platform": "true",
"node_with_ltcg": "true",
"node_without_node_options": "false",
"openssl_fips": "",
"openssl_no_asm": 0,
"shlib_suffix": "so.64",
"target_arch": "x64",
"v8_enable_gdbjit": 0,
"v8_enable_i18n_support": 1,
"v8_enable_inspector": 1,
"v8_no_strict_aliasing": 1,
"v8_optimized_debug": 0,
"v8_promise_internal_field_count": 1,
"v8_random_seed": 0,
"v8_trace_maps": 0,
"v8_typed_array_max_size_in_heap": 0,
"v8_use_snapshot": "true",
"want_separate_host_toolset": 0,
"nodedir": "C:\\Users\\matia\\.node-gyp\\10.16.3",
"standalone_static_library": 1,
"msbuild_path": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\MSBuild.exe",
"access": "",
"allow_same_version": "",
"also": "",
"always_auth": "",
"audit": "true",
"audit_level": "low",
"auth_type": "legacy",
"before": "",
"bin_links": "true",
"browser": "",
"ca": "",
"cache": "C:\\Users\\matia\\AppData\\Roaming\\npm-cache",
"cache_lock_retries": "10",
"cache_lock_stale": "60000",
"cache_lock_wait": "10000",
"cache_max": "Infinity",
"cache_min": "10",
"cert": "",
"cidr": "",
"color": "true",
"commit_hooks": "true",
"depth": "Infinity",
"description": "true",
"dev": "",
"dry_run": "",
"editor": "notepad.exe",
"engine_strict": "",
"fetch_retries": "2",
"fetch_retry_factor": "10",
"fetch_retry_maxtimeout": "60000",
"fetch_retry_mintimeout": "10000",
"force": "",
"git": "git",
"git_tag_version": "true",
"global": "",
"globalconfig": "C:\\Users\\matia\\AppData\\Roaming\\npm\\etc\\npmrc",
"globalignorefile": "C:\\Users\\matia\\AppData\\Roaming\\npm\\etc\\npmignore",
"global_style": "",
"group": "",
"ham_it_up": "",
"heading": "npm",
"https_proxy": "",
"if_present": "",
"ignore_prepublish": "",
"ignore_scripts": "",
"init_author_email": "",
"init_author_name": "",
"init_author_url": "",
"init_license": "ISC",
"init_module": "C:\\Users\\matia\\.npm-init.js",
"init_version": "1.0.0",
"json": "",
"key": "",
"legacy_bundling": "",
"link": "",
"local_address": "",
"logs_max": "10",
"long": "",
"maxsockets": "50",
"message": "%s",
"metrics_registry": "https://registry.npmjs.org/",
"node_gyp": "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js",
"node_options": "",
"node_version": "10.16.3",
"noproxy": "",
"offline": "",
"onload_script": "",
"only": "",
"optional": "true",
"otp": "",
"package_lock": "true",
"package_lock_only": "",
"parseable": "",
"prefer_offline": "",
"prefer_online": "",
"prefix": "C:\\Users\\matia\\AppData\\Roaming\\npm",
"preid": "",
"production": "",
"progress": "true",
"read_only": "",
"rebuild_bundle": "true",
"registry": "https://registry.npmjs.org/",
"rollback": "true",
"save": "true",
"save_bundle": "",
"save_dev": "",
"save_exact": "",
"save_optional": "",
"save_prefix": "^",
"save_prod": "",
"scope": "",
"scripts_prepend_node_path": "warn-only",
"script_shell": "",
"searchexclude": "",
"searchlimit": "20",
"searchopts": "",
"searchstaleness": "900",
"send_metrics": "",
"shell": "C:\\WINDOWS\\system32\\cmd.exe",
"shrinkwrap": "true",
"sign_git_commit": "",
"sign_git_tag": "",
"sso_poll_frequency": "500",
"sso_type": "oauth",
"strict_ssl": "true",
"tag": "latest",
"tag_version_prefix": "v",
"timing": "",
"tmp": "C:\\Users\\matia\\AppData\\Local\\Temp",
"umask": "0000",
"unicode": "",
"unsafe_perm": "true",
"update_notifier": "true",
"usage": "",
"user": "",
"userconfig": "C:\\Users\\matia\\.npmrc",
"user_agent": "npm/6.9.0 node/v10.16.3 win32 x64",
"version": "",
"versions": "",
"viewer": "browser"
}
}

153
node_modules/ref/docs/compile.js generated vendored Normal file
View File

@ -0,0 +1,153 @@
/**
* Module dependencies.
*/
var fs = require('fs')
var dox = require('dox')
var jade = require('jade')
var marked = require('marked')
var hljs = require('highlight.js')
var assert = require('assert')
fs.readFile(__dirname + '/../lib/ref.js', 'utf8', function (err, data) {
if (err) throw err
// don't depend on dox for parsing the Markdown (raw: true)
var docs = dox.parseComments(data, { raw: true })
var base = 0
var sections = []
docs.forEach(function (doc, i) {
doc.tags.forEach(function (t) {
if (t.type === 'section') {
sections.push(docs.slice(base, i))
base = i
}
if (t.type === 'name') {
doc.name = t.string
}
if (t.type === 'type') {
doc.type = t.types[0]
}
})
if (!doc.name) {
doc.name = doc.ctx && doc.ctx.name
}
if (!doc.type) {
doc.type = doc.ctx && doc.ctx.type || 'property'
}
})
sections.push(docs.slice(base))
assert.equal(sections.length, 3)
// get the 3 sections
var exports = sections[0]
var types = sections[1]
var extensions = sections[2]
// move NULL_POINTER from "types" to "exports"
var null_pointer = types.pop()
assert.equal(null_pointer.name, 'NULL_POINTER')
exports.push(null_pointer)
// extract the "return" and "param" types
exports.forEach(function (doc) {
doc.tags.forEach(function (t) {
if (t.description) {
// parse the Markdown descriptions
t.description = markdown(t.description).trim()
// remove the surrounding <p> tags
t.description = t.description.substring(3, t.description.length - 4)
}
})
doc.returnType = doc.tags.filter(function (t) {
return t.type == 'return'
})[0]
doc.paramTypes = doc.tags.filter(function (t) {
return t.type == 'param'
})
})
// sort
exports = exports.sort(sort)
extensions = extensions.sort(sort)
// parse and highlight the Markdown descriptions
;[exports, types, extensions].forEach(function (docs) {
docs.forEach(function (doc) {
var desc = doc.description
desc.full = markdown(desc.full)
desc.summary = markdown(desc.summary)
desc.body = markdown(desc.body)
})
})
// get a reference to the ref export doc object for every Buffer extension doc
extensions.forEach(function (doc) {
doc.ref = exports.filter(function (ref) {
return ref.name === doc.name
})[0]
})
fs.readFile(__dirname + '/index.jade', 'utf8', function (err, template) {
if (err) throw err
template = jade.compile(template)
var html = template({
exports: sections[0]
, types: sections[1]
, extensions: sections[2]
, package: require('../package.json')
, markdown: markdown
, highlight: highlight
})
fs.writeFile(__dirname + '/index.html', html, function (err) {
if (err) throw err
})
})
})
/**
* Sorts an array of dox objects by doc.name. If the first letter is an '_' then
* it is considered "private" and gets sorted at the bottom.
*/
function sort (a, b) {
var aname = a.name
var bname = b.name
var aprivate = a.isPrivate
var bprivate = b.isPrivate
if (aprivate && !bprivate) {
return 1
}
if (bprivate && !aprivate) {
return -1
}
return aname > bname ? 1 : -1
}
/**
* Parses Markdown into highlighted HTML.
*/
function markdown (code) {
if (!code) return code
return marked(code, {
gfm: true
, highlight: highlight
})
}
/**
* Add syntax highlighting HTML to the given `code` block.
* `lang` defaults to "javascript" if no valid name is given.
*/
function highlight (code, lang) {
if (!hljs.LANGUAGES.hasOwnProperty(lang)) {
lang = 'javascript'
}
return hljs.highlight(lang, code).value
}

12
node_modules/ref/docs/gh-pages.sh generated vendored Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
DIR=`dirname $0`
TMP_DOC_DIR="/tmp/ref_docs"
npm run docs \
&& rm -rf $TMP_DOC_DIR \
&& mkdir -p $TMP_DOC_DIR \
&& cp -Lrf {"$DIR/index.html","$DIR/images","$DIR/scripts","$DIR/stylesheets"} $TMP_DOC_DIR \
&& git checkout gh-pages \
&& cp -Lrf $TMP_DOC_DIR/* . \
&& echo "done"

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
node_modules/ref/docs/images/apple-touch-icon-72x72.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
node_modules/ref/docs/images/apple-touch-icon.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
node_modules/ref/docs/images/favicon.ico generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
node_modules/ref/docs/images/ref.pxm generated vendored Normal file

Binary file not shown.

264
node_modules/ref/docs/index.jade generated vendored Normal file
View File

@ -0,0 +1,264 @@
doctype 5
html(lang="en")
head
meta(charset="utf-8")
title "ref" documentation v#{package.version}
meta(name="description", content=package.description)
meta(name="keywords", content=['node.js', package.name].concat(package.keywords).join(', '))
meta(name="author", content="Nathan Rajlich")
meta(name="viewport", content="width=device-width, initial-scale=1, maximum-scale=1")
link(rel="stylesheet", href="stylesheets/hightlight.css")
link(rel="stylesheet", href="stylesheets/base.css")
link(rel="stylesheet", href="stylesheets/skeleton.css")
link(rel="stylesheet", href="stylesheets/layout.css")
link(rel="shortcut icon", href="images/favicon.ico")
link(rel="apple-touch-icon", href="images/apple-touch-icon.png")
link(rel="apple-touch-icon", sizes="72x72", href="images/apple-touch-icon-72x72.png")
link(rel="apple-touch-icon", sizes="114x114", href="images/apple-touch-icon-114x114.png")
body
.container
.columns.three.logo
a(href="")
h1 #{package.name}
span.pointer *
span.version v#{package.version}
.columns.thirteen.subtitle
h3= package.description
.columns.sixteen.intro
h4 What is <code>ref</code>?
p
code ref
| is a native addon for
a(href="http://nodejs.org") Node.js
| that aids in doing C programming in JavaScript, by extending
| the built-in
a(href="http://nodejs.org/api/buffer.html")
code Buffer
| class
| with some fancy additions like:
ul
li Getting the memory address of a Buffer
li Checking the endianness of the processor
li Checking if a Buffer represents the NULL pointer
li Reading and writing "pointers" with Buffers
li Reading and writing C Strings (NULL-terminated)
li Reading and writing JavaScript Object references
li Reading and writing
strong int64_t
| and
strong uint64_t
| values
li A "type" convention to define the contents of a Buffer
p
| There is indeed a lot of
em meat
| to
code ref
| , but it all fits together in one way or another in the end.
br
| For simplicity,
code ref
| 's API can be broken down into 3 sections:
a.nav.columns.five(href='#exports')
h4 ref <code>exports</code>
p
| All the static versions of
code ref
| 's functions and default "types" available on the exports returned from
code require('ref')
| .
a.nav.columns.five(href='#types')
h4 <em>"type"</em> system
p
| The
em "type"
| system allows you to define a "type" on any Buffer instance, and then
| use generic
code ref()
| and
code deref()
| functions to reference and dereference values.
a.nav.columns.five(href='#extensions')
h4 <code>Buffer</code> extensions
p
code Buffer.prototype
| gets extended with some convenience functions. These all just mirror
| their static counterpart, using the Buffer's
code this
| variable as the
code buffer
| variable.
hr
.columns.eight.section.exports
a(name="exports")
a(href="#exports")
h2 ref exports
.columns.sixteen.intro
p
| This section documents all the functions exported from
code require('ref')
| .
each doc in exports
if (!doc.ignore)
.columns.sixteen.section
a(name='exports-' + doc.name)
a(href='#exports-' + doc.name)
isFunc = doc.type == 'method' || doc.isPrivate
h3
| ref.#{doc.name}
if (isFunc)
| (
each param, i in doc.paramTypes
span.param #{param.types.join('|')} #{param.name}
if (i + 1 < doc.paramTypes.length)
| ,
| )
if (doc.returnType)
|
span.rtn &rarr; #{doc.returnType.types.join('|')}
if (!isFunc)
|
span.rtn &rArr; #{doc.type}
if (doc.paramTypes.length > 0 || doc.returnType)
ul
each param in doc.paramTypes
li #{param.name} - !{param.description}
if (doc.returnType)
li
strong Return:
| !{doc.returnType.description}
!= (doc && doc.description.full || '').replace(/\<br ?\/?\>/g, ' ')
hr
.columns.eight.section.types
a(name="types")
a(href="#types")
h2
em "type"
| system
.columns.sixteen.intro.types
p
| A "type" in
code ref
| is simply an plain 'ol JavaScript Object, with a set
| of expected properties attached that implement the logic for getting
| &amp; setting values on a given
code Buffer
| instance.
p
| To attach a "type" to a Buffer instance, you simply attach the "type"
| object to the Buffer's <code>type</code> property.
code ref
| comes with a set of commonly used types which are described in this
| section.
h4 Creating your own "type"
p
| It's trivial to create your own "type" that reads and writes your
| own custom datatype/class to and from Buffer instances using
code ref
| 's unified API.
br
| To create your own "type", simply create a JavaScript Object with
| the following properties defined:
table
tr
th Name
th Data Type
th Description
tr
td: code size
td: code Number
td The size in bytes required to hold this datatype.
tr
td: code indirection
td: code Number
td
| The current level of indirection of the buffer. When defining
| your own "types", just set this value to <code>1</code>.
tr
td: code get
td: code Function
td
| The function to invoke when
a(href="#exports-get")
code ref.get()
| is invoked on a buffer of this type.
tr
td: code set
td: code Function
td
| The function to invoke when
a(href="#exports-set")
code ref.set()
| is invoked on a buffer of this type.
tr
td: code name
td: code String
td
em (Optional)
| The name to use during debugging for this datatype.
tr
td: code alignment
td: code Number
td
em (Optional)
| The alignment of this datatype when placed inside a struct.
| Defaults to the type's
code size
| .
h4 The built-in "types"
p
| Here is the list of
code ref
| 's built-in "type" Objects. All these built-in "types" can be found
| on the
code ref.types
| export Object. All the built-in types use "native endianness" when
| multi-byte datatypes are involved.
each doc in types
if (!doc.ignore)
.columns.sixteen.section
a(name='types-' + doc.name)
a(href='#types-' + doc.name)
h3 types.#{doc.name}
!= doc.description.full.replace(/\<br ?\/?\>/g, ' ')
hr
.columns.eight.section.exports
a(name="extensions")
a(href="#extensions")
h2 Buffer extensions
.columns.sixteen.intro
p
code Buffer.prototype
| gets extended with some convenience functions that you can use in
| your modules and/or applications.
each doc in extensions
if (!doc.ignore)
.columns.sixteen.section
a(name='extensions-' + doc.name)
a(href='#extensions-' + doc.name)
h3 Buffer##{doc.name}()
if (doc.name === 'inspect')
!= doc.description.full.replace(/\<br ?\/?\>/g, ' ')
else
p
| Shorthand for
a(href='#exports-' + doc.name)
code ref.#{doc.name}(this, …)
| .
!= (doc.ref && doc.ref.description.full || '').replace(/\<br ?\/?\>/g, ' ')
.ribbon
a(href="https://github.com/TooTallNate/ref", rel="me") Fork me on GitHub
script(src="scripts/jquery-1.7.2.min.js")
script(src="scripts/main.js")

4
node_modules/ref/docs/scripts/jquery-1.7.2.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

25
node_modules/ref/docs/scripts/main.js generated vendored Normal file
View File

@ -0,0 +1,25 @@
/**
* Animated scroll to named anchors.
*/
$(document.body).on('click', 'a', function () {
var href = $(this).attr('href')
if (href[0] === '#') {
scrollTo(href)
window.history && history.pushState({}, name, href)
return false
}
})
function scrollTo (hash) {
var name = hash.substring(1)
var target = $('a[name="' + name + '"]')
if (target.length) {
$('html, body').animate({ scrollTop: target.offset().top }
, { duration: 500, easing: 'swing'})
} else {
console.log('documentation not written: %s', name)
}
return target
}

267
node_modules/ref/docs/stylesheets/base.css generated vendored Normal file
View File

@ -0,0 +1,267 @@
/*
* Skeleton V1.2
* Copyright 2011, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 6/20/2012
*/
/* Table of Content
==================================================
#Reset & Basics
#Basic Styles
#Site Styles
#Typography
#Links
#Lists
#Images
#Buttons
#Forms
#Misc */
/* #Reset & Basics (Inspired by E. Meyers)
================================================== */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline; }
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block; }
body {
line-height: 1; }
ol, ul {
list-style: none; }
blockquote, q {
quotes: none; }
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none; }
table {
border-collapse: collapse;
border-spacing: 0; }
/* #Basic Styles
================================================== */
body {
background: #fff;
font: 14px/21px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #444;
-webkit-font-smoothing: antialiased; /* Fix for webkit rendering */
-webkit-text-size-adjust: 100%;
}
/* #Typography
================================================== */
h1, h2, h3, h4, h5, h6 {
color: #181818;
font-family: "Georgia", "Times New Roman", serif;
font-weight: normal; }
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { font-weight: inherit; }
h1 { font-size: 46px; line-height: 50px; margin-bottom: 14px;}
h2 { font-size: 35px; line-height: 40px; margin-bottom: 10px; }
h3 { font-size: 28px; line-height: 34px; margin-bottom: 8px; }
h4 { font-size: 21px; line-height: 30px; margin-bottom: 4px; }
h5 { font-size: 17px; line-height: 24px; }
h6 { font-size: 14px; line-height: 21px; }
.subheader { color: #777; }
p { margin: 0 0 20px 0; }
p img { margin: 0; }
p.lead { font-size: 21px; line-height: 27px; color: #777; }
em { font-style: italic; }
strong { font-weight: bold; color: #333; }
small { font-size: 80%; }
/* Blockquotes */
blockquote, blockquote p { font-size: 17px; line-height: 24px; color: #777; font-style: italic; }
blockquote { margin: 0 0 20px; padding: 9px 20px 0 19px; border-left: 1px solid #ddd; }
blockquote cite { display: block; font-size: 12px; color: #555; }
blockquote cite:before { content: "\2014 \0020"; }
blockquote cite a, blockquote cite a:visited, blockquote cite a:visited { color: #555; }
hr { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 10px 0 30px; height: 0; }
/* #Links
================================================== */
a, a:visited { color: #333; text-decoration: underline; outline: 0; }
a:hover, a:focus { color: #000; }
p a, p a:visited { line-height: inherit; }
/* #Lists
================================================== */
ul, ol { margin-bottom: 20px; }
ul { list-style: none outside; }
ol { list-style: decimal; }
ol, ul.square, ul.circle, ul.disc { margin-left: 30px; }
ul.square { list-style: square outside; }
ul.circle { list-style: circle outside; }
ul.disc { list-style: disc outside; }
ul ul, ul ol,
ol ol, ol ul { margin: 4px 0 5px 30px; font-size: 90%; }
ul ul li, ul ol li,
ol ol li, ol ul li { margin-bottom: 6px; }
li { line-height: 18px; margin-bottom: 12px; }
ul.large li { line-height: 21px; }
li p { line-height: 21px; }
/* #Images
================================================== */
img.scale-with-grid {
max-width: 100%;
height: auto; }
/* #Buttons
================================================== */
.button,
button,
input[type="submit"],
input[type="reset"],
input[type="button"] {
background: #eee; /* Old browsers */
background: #eee -moz-linear-gradient(top, rgba(255,255,255,.2) 0%, rgba(0,0,0,.2) 100%); /* FF3.6+ */
background: #eee -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.2)), color-stop(100%,rgba(0,0,0,.2))); /* Chrome,Safari4+ */
background: #eee -webkit-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* Chrome10+,Safari5.1+ */
background: #eee -o-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* Opera11.10+ */
background: #eee -ms-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* IE10+ */
background: #eee linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* W3C */
border: 1px solid #aaa;
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
color: #444;
display: inline-block;
font-size: 11px;
font-weight: bold;
text-decoration: none;
text-shadow: 0 1px rgba(255, 255, 255, .75);
cursor: pointer;
margin-bottom: 20px;
line-height: normal;
padding: 8px 10px;
font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; }
.button:hover,
button:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
input[type="button"]:hover {
color: #222;
background: #ddd; /* Old browsers */
background: #ddd -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); /* FF3.6+ */
background: #ddd -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.3)), color-stop(100%,rgba(0,0,0,.3))); /* Chrome,Safari4+ */
background: #ddd -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* Chrome10+,Safari5.1+ */
background: #ddd -o-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* Opera11.10+ */
background: #ddd -ms-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* IE10+ */
background: #ddd linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* W3C */
border: 1px solid #888;
border-top: 1px solid #aaa;
border-left: 1px solid #aaa; }
.button:active,
button:active,
input[type="submit"]:active,
input[type="reset"]:active,
input[type="button"]:active {
border: 1px solid #666;
background: #ccc; /* Old browsers */
background: #ccc -moz-linear-gradient(top, rgba(255,255,255,.35) 0%, rgba(10,10,10,.4) 100%); /* FF3.6+ */
background: #ccc -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.35)), color-stop(100%,rgba(10,10,10,.4))); /* Chrome,Safari4+ */
background: #ccc -webkit-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* Chrome10+,Safari5.1+ */
background: #ccc -o-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* Opera11.10+ */
background: #ccc -ms-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* IE10+ */
background: #ccc linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* W3C */ }
.button.full-width,
button.full-width,
input[type="submit"].full-width,
input[type="reset"].full-width,
input[type="button"].full-width {
width: 100%;
padding-left: 0 !important;
padding-right: 0 !important;
text-align: center; }
/* Fix for odd Mozilla border & padding issues */
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/* #Forms
================================================== */
form {
margin-bottom: 20px; }
fieldset {
margin-bottom: 20px; }
input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
border: 1px solid #ccc;
padding: 6px 4px;
outline: none;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
font: 13px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #777;
margin: 0;
width: 210px;
max-width: 100%;
display: block;
margin-bottom: 20px;
background: #fff; }
select {
padding: 0; }
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus {
border: 1px solid #aaa;
color: #444;
-moz-box-shadow: 0 0 3px rgba(0,0,0,.2);
-webkit-box-shadow: 0 0 3px rgba(0,0,0,.2);
box-shadow: 0 0 3px rgba(0,0,0,.2); }
textarea {
min-height: 60px; }
label,
legend {
display: block;
font-weight: bold;
font-size: 13px; }
select {
width: 220px; }
input[type="checkbox"] {
display: inline; }
label span,
legend span {
font-weight: normal;
font-size: 13px;
color: #444; }
/* #Misc
================================================== */
.remove-bottom { margin-bottom: 0 !important; }
.half-bottom { margin-bottom: 10px !important; }
.add-bottom { margin-bottom: 20px !important; }

212
node_modules/ref/docs/stylesheets/layout.css generated vendored Normal file
View File

@ -0,0 +1,212 @@
/*
* Skeleton V1.2
* Copyright 2011, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 6/20/2012
*/
/* Table of Content
==================================================
#Site Styles
#Page Styles
#Media Queries
#Font-Face */
/* #Site Styles
================================================== */
/* #Page Styles
================================================== */
/* #Media Queries
================================================== */
/* Smaller than standard 960 (devices and browsers) */
@media only screen and (max-width: 959px) {}
/* Tablet Portrait size to standard 960 (devices and browsers) */
@media only screen and (min-width: 768px) and (max-width: 959px) {}
/* All Mobile Sizes (devices and browser) */
@media only screen and (max-width: 767px) {}
/* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
@media only screen and (min-width: 480px) and (max-width: 767px) {}
/* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
@media only screen and (max-width: 479px) {}
/* #Font-Face
================================================== */
/* This is the proper syntax for an @font-face file
Just create a "fonts" folder at the root,
copy your FontName into code below and remove
comment brackets */
/* @font-face {
font-family: 'FontName';
src: url('../fonts/FontName.eot');
src: url('../fonts/FontName.eot?iefix') format('eot'),
url('../fonts/FontName.woff') format('woff'),
url('../fonts/FontName.ttf') format('truetype'),
url('../fonts/FontName.svg#webfontZam02nTh') format('svg');
font-weight: normal;
font-style: normal; }
*/
/* `ref` stuff */
code, pre {
background-color: #fcf8f2;
border: solid 1px rgba(68, 68, 68, 0.3);
border-radius: 2px;
padding: 1px 2px;
-webkit-transition-property: background-color;
-webkit-transition-duration: 0.5s;
-webkit-transition-delay: 0s;
}
pre {
padding: 10px;
}
pre code {
background-color: transparent;
border: none;
padding: 0px;
}
th {
font-weight: bold;
}
a {
text-decoration: none;
}
p {
margin: 10px 0;
}
p a {
text-decoration: underline;
}
ul {
list-style: disc;
margin-left: 40px;
}
h3 {
color: #777;
}
.container {
margin: 100px auto;
}
.logo h1 .pointer {
color: #dbe8d9;
-webkit-transition-property: color;
-webkit-transition-duration: 0.5s;
-webkit-transition-delay: 0s;
}
.logo h1:hover .pointer {
color: #444;
}
.logo h1 .version {
color: #aaa;
font-size: 0.3em;
position: absolute;
top: 12px;
left: 70px;
}
.types table, .types tr {
border: solid 1px #444;
}
.types td, .types th {
border: solid 1px #444;
padding: 4px;
}
.param, .rtn {
display: inline-block;
font-size: 0.8em;
font-style: italic;
color: #444;
}
a.nav {
border: solid 1px transparent;
border-radius: 2px;
padding: 3px;
margin-bottom: 20px;
text-decoration: none;
background-color: transparent;
-webkit-transition-property: background-color, border-color;
-webkit-transition-duration: 0.5s;
-webkit-transition-delay: 0s;
}
a.nav:hover {
background-color: #fcf8f2;
border-color: rgba(68, 68, 68, 0.3);
}
a.nav:hover code {
background-color: #dbe8d9;
}
.subtitle h3 {
margin-top: 18px;
}
.section {
margin-top: 40px;
}
/* GitHub Ribbon
* http://unindented.org/articles/2009/10/github-ribbon-using-css-transforms */
.ribbon {
background-color: #fcf8f2;
overflow: hidden;
/* top right corner */
position: fixed;
right: -3em;
top: 2.5em;
/* 45 deg ccw rotation */
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
/* shadow */
-moz-box-shadow: 0 0 0.5em #888;
-webkit-box-shadow: 0 0 0.5em #888;
/* hover transition */
-webkit-transition-property: background-color;
-webkit-transition-duration: 0.3s;
-webkit-transition-delay: 0s;
}
.ribbon a {
border: solid 1px rgba(68, 68, 68, 0.4);
color: #444;
display: block;
font: bold 81.25% 'Helvetiva Neue', Helvetica, Arial, sans-serif;
margin: 0.05em 0 0.075em 0;
padding: 0.5em 3.5em;
text-align: center;
text-decoration: none;
/* shadow */
text-shadow: 0 0 0.5em #888;
}
.ribbon:hover {
background-color: #dbe8d9;
}

242
node_modules/ref/docs/stylesheets/skeleton.css generated vendored Normal file
View File

@ -0,0 +1,242 @@
/*
* Skeleton V1.2
* Copyright 2011, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 6/20/2012
*/
/* Table of Contents
==================================================
#Base 960 Grid
#Tablet (Portrait)
#Mobile (Portrait)
#Mobile (Landscape)
#Clearing */
/* #Base 960 Grid
================================================== */
.container { position: relative; width: 960px; margin: 0 auto; padding: 0; }
.container .column,
.container .columns { float: left; display: inline; margin-left: 10px; margin-right: 10px; }
.row { margin-bottom: 20px; }
/* Nested Column Classes */
.column.alpha, .columns.alpha { margin-left: 0; }
.column.omega, .columns.omega { margin-right: 0; }
/* Base Grid */
.container .one.column,
.container .one.columns { width: 40px; }
.container .two.columns { width: 100px; }
.container .three.columns { width: 160px; }
.container .four.columns { width: 220px; }
.container .five.columns { width: 280px; }
.container .six.columns { width: 340px; }
.container .seven.columns { width: 400px; }
.container .eight.columns { width: 460px; }
.container .nine.columns { width: 520px; }
.container .ten.columns { width: 580px; }
.container .eleven.columns { width: 640px; }
.container .twelve.columns { width: 700px; }
.container .thirteen.columns { width: 760px; }
.container .fourteen.columns { width: 820px; }
.container .fifteen.columns { width: 880px; }
.container .sixteen.columns { width: 940px; }
.container .one-third.column { width: 300px; }
.container .two-thirds.column { width: 620px; }
/* Offsets */
.container .offset-by-one { padding-left: 60px; }
.container .offset-by-two { padding-left: 120px; }
.container .offset-by-three { padding-left: 180px; }
.container .offset-by-four { padding-left: 240px; }
.container .offset-by-five { padding-left: 300px; }
.container .offset-by-six { padding-left: 360px; }
.container .offset-by-seven { padding-left: 420px; }
.container .offset-by-eight { padding-left: 480px; }
.container .offset-by-nine { padding-left: 540px; }
.container .offset-by-ten { padding-left: 600px; }
.container .offset-by-eleven { padding-left: 660px; }
.container .offset-by-twelve { padding-left: 720px; }
.container .offset-by-thirteen { padding-left: 780px; }
.container .offset-by-fourteen { padding-left: 840px; }
.container .offset-by-fifteen { padding-left: 900px; }
/* #Tablet (Portrait)
================================================== */
/* Note: Design for a width of 768px */
@media only screen and (min-width: 768px) and (max-width: 959px) {
.container { width: 768px; }
.container .column,
.container .columns { margin-left: 10px; margin-right: 10px; }
.column.alpha, .columns.alpha { margin-left: 0; margin-right: 10px; }
.column.omega, .columns.omega { margin-right: 0; margin-left: 10px; }
.alpha.omega { margin-left: 0; margin-right: 0; }
.container .one.column,
.container .one.columns { width: 28px; }
.container .two.columns { width: 76px; }
.container .three.columns { width: 124px; }
.container .four.columns { width: 172px; }
.container .five.columns { width: 220px; }
.container .six.columns { width: 268px; }
.container .seven.columns { width: 316px; }
.container .eight.columns { width: 364px; }
.container .nine.columns { width: 412px; }
.container .ten.columns { width: 460px; }
.container .eleven.columns { width: 508px; }
.container .twelve.columns { width: 556px; }
.container .thirteen.columns { width: 604px; }
.container .fourteen.columns { width: 652px; }
.container .fifteen.columns { width: 700px; }
.container .sixteen.columns { width: 748px; }
.container .one-third.column { width: 236px; }
.container .two-thirds.column { width: 492px; }
/* Offsets */
.container .offset-by-one { padding-left: 48px; }
.container .offset-by-two { padding-left: 96px; }
.container .offset-by-three { padding-left: 144px; }
.container .offset-by-four { padding-left: 192px; }
.container .offset-by-five { padding-left: 240px; }
.container .offset-by-six { padding-left: 288px; }
.container .offset-by-seven { padding-left: 336px; }
.container .offset-by-eight { padding-left: 384px; }
.container .offset-by-nine { padding-left: 432px; }
.container .offset-by-ten { padding-left: 480px; }
.container .offset-by-eleven { padding-left: 528px; }
.container .offset-by-twelve { padding-left: 576px; }
.container .offset-by-thirteen { padding-left: 624px; }
.container .offset-by-fourteen { padding-left: 672px; }
.container .offset-by-fifteen { padding-left: 720px; }
}
/* #Mobile (Portrait)
================================================== */
/* Note: Design for a width of 320px */
@media only screen and (max-width: 767px) {
.container { width: 300px; }
.container .columns,
.container .column { margin: 0; }
.container .one.column,
.container .one.columns,
.container .two.columns,
.container .three.columns,
.container .four.columns,
.container .five.columns,
.container .six.columns,
.container .seven.columns,
.container .eight.columns,
.container .nine.columns,
.container .ten.columns,
.container .eleven.columns,
.container .twelve.columns,
.container .thirteen.columns,
.container .fourteen.columns,
.container .fifteen.columns,
.container .sixteen.columns,
.container .one-third.column,
.container .two-thirds.column { width: 300px; }
/* Offsets */
.container .offset-by-one,
.container .offset-by-two,
.container .offset-by-three,
.container .offset-by-four,
.container .offset-by-five,
.container .offset-by-six,
.container .offset-by-seven,
.container .offset-by-eight,
.container .offset-by-nine,
.container .offset-by-ten,
.container .offset-by-eleven,
.container .offset-by-twelve,
.container .offset-by-thirteen,
.container .offset-by-fourteen,
.container .offset-by-fifteen { padding-left: 0; }
}
/* #Mobile (Landscape)
================================================== */
/* Note: Design for a width of 480px */
@media only screen and (min-width: 480px) and (max-width: 767px) {
.container { width: 420px; }
.container .columns,
.container .column { margin: 0; }
.container .one.column,
.container .one.columns,
.container .two.columns,
.container .three.columns,
.container .four.columns,
.container .five.columns,
.container .six.columns,
.container .seven.columns,
.container .eight.columns,
.container .nine.columns,
.container .ten.columns,
.container .eleven.columns,
.container .twelve.columns,
.container .thirteen.columns,
.container .fourteen.columns,
.container .fifteen.columns,
.container .sixteen.columns,
.container .one-third.column,
.container .two-thirds.column { width: 420px; }
}
/* #Clearing
================================================== */
/* Self Clearing Goodness */
.container:after { content: "\0020"; display: block; height: 0; clear: both; visibility: hidden; }
/* Use clearfix class on parent to clear nested columns,
or wrap each row of columns in a <div class="row"> */
.clearfix:before,
.clearfix:after,
.row:before,
.row:after {
content: '\0020';
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0; }
.row:after,
.clearfix:after {
clear: both; }
.row,
.clearfix {
zoom: 1; }
/* You can also use a <br class="clear" /> to clear columns */
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}

1463
node_modules/ref/lib/ref.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/ref/node_modules/debug/.coveralls.yml generated vendored Normal file
View File

@ -0,0 +1 @@
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve

11
node_modules/ref/node_modules/debug/.eslintrc generated vendored Normal file
View File

@ -0,0 +1,11 @@
{
"env": {
"browser": true,
"node": true
},
"rules": {
"no-console": 0,
"no-empty": [1, { "allowEmptyCatch": true }]
},
"extends": "eslint:recommended"
}

9
node_modules/ref/node_modules/debug/.npmignore generated vendored Normal file
View File

@ -0,0 +1,9 @@
support
test
examples
example
*.sock
dist
yarn.lock
coverage
bower.json

14
node_modules/ref/node_modules/debug/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,14 @@
language: node_js
node_js:
- "6"
- "5"
- "4"
install:
- make node_modules
script:
- make lint
- make test
- make coveralls

362
node_modules/ref/node_modules/debug/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,362 @@
2.6.9 / 2017-09-22
==================
* remove ReDoS regexp in %o formatter (#504)
2.6.8 / 2017-05-18
==================
* Fix: Check for undefined on browser globals (#462, @marbemac)
2.6.7 / 2017-05-16
==================
* Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom)
* Fix: Inline extend function in node implementation (#452, @dougwilson)
* Docs: Fix typo (#455, @msasad)
2.6.5 / 2017-04-27
==================
* Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek)
* Misc: clean up browser reference checks (#447, @thebigredgeek)
* Misc: add npm-debug.log to .gitignore (@thebigredgeek)
2.6.4 / 2017-04-20
==================
* Fix: bug that would occure if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
* Chore: ignore bower.json in npm installations. (#437, @joaovieira)
* Misc: update "ms" to v0.7.3 (@tootallnate)
2.6.3 / 2017-03-13
==================
* Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts)
* Docs: Changelog fix (@thebigredgeek)
2.6.2 / 2017-03-10
==================
* Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
* Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
* Docs: Add Slackin invite badge (@tootallnate)
2.6.1 / 2017-02-10
==================
* Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
* Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
* Fix: IE8 "Expected identifier" error (#414, @vgoma)
* Fix: Namespaces would not disable once enabled (#409, @musikov)
2.6.0 / 2016-12-28
==================
* Fix: added better null pointer checks for browser useColors (@thebigredgeek)
* Improvement: removed explicit `window.debug` export (#404, @tootallnate)
* Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
2.5.2 / 2016-12-25
==================
* Fix: reference error on window within webworkers (#393, @KlausTrainer)
* Docs: fixed README typo (#391, @lurch)
* Docs: added notice about v3 api discussion (@thebigredgeek)
2.5.1 / 2016-12-20
==================
* Fix: babel-core compatibility
2.5.0 / 2016-12-20
==================
* Fix: wrong reference in bower file (@thebigredgeek)
* Fix: webworker compatibility (@thebigredgeek)
* Fix: output formatting issue (#388, @kribblo)
* Fix: babel-loader compatibility (#383, @escwald)
* Misc: removed built asset from repo and publications (@thebigredgeek)
* Misc: moved source files to /src (#378, @yamikuronue)
* Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
* Test: coveralls integration (#378, @yamikuronue)
* Docs: simplified language in the opening paragraph (#373, @yamikuronue)
2.4.5 / 2016-12-17
==================
* Fix: `navigator` undefined in Rhino (#376, @jochenberger)
* Fix: custom log function (#379, @hsiliev)
* Improvement: bit of cleanup + linting fixes (@thebigredgeek)
* Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
* Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
2.4.4 / 2016-12-14
==================
* Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
2.4.3 / 2016-12-14
==================
* Fix: navigation.userAgent error for react native (#364, @escwald)
2.4.2 / 2016-12-14
==================
* Fix: browser colors (#367, @tootallnate)
* Misc: travis ci integration (@thebigredgeek)
* Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
2.4.1 / 2016-12-13
==================
* Fix: typo that broke the package (#356)
2.4.0 / 2016-12-13
==================
* Fix: bower.json references unbuilt src entry point (#342, @justmatt)
* Fix: revert "handle regex special characters" (@tootallnate)
* Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
* Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
* Improvement: allow colors in workers (#335, @botverse)
* Improvement: use same color for same namespace. (#338, @lchenay)
2.3.3 / 2016-11-09
==================
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
2.3.2 / 2016-11-09
==================
* Fix: be super-safe in index.js as well (@TooTallNate)
* Fix: should check whether process exists (Tom Newby)
2.3.1 / 2016-11-09
==================
* Fix: Added electron compatibility (#324, @paulcbetts)
* Improvement: Added performance optimizations (@tootallnate)
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
2.3.0 / 2016-11-07
==================
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
* Readme: fix USE_COLORS to DEBUG_COLORS
* Readme: Doc fixes for format string sugar (#269, @mlucool)
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
* Readme: better docs for browser support (#224, @matthewmueller)
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
* Misc: Updated contributors (@thebigredgeek)
2.2.0 / 2015-05-09
==================
* package: update "ms" to v0.7.1 (#202, @dougwilson)
* README: add logging to file example (#193, @DanielOchoa)
* README: fixed a typo (#191, @amir-s)
* browser: expose `storage` (#190, @stephenmathieson)
* Makefile: add a `distclean` target (#189, @stephenmathieson)
2.1.3 / 2015-03-13
==================
* Updated stdout/stderr example (#186)
* Updated example/stdout.js to match debug current behaviour
* Renamed example/stderr.js to stdout.js
* Update Readme.md (#184)
* replace high intensity foreground color for bold (#182, #183)
2.1.2 / 2015-03-01
==================
* dist: recompile
* update "ms" to v0.7.0
* package: update "browserify" to v9.0.3
* component: fix "ms.js" repo location
* changed bower package name
* updated documentation about using debug in a browser
* fix: security error on safari (#167, #168, @yields)
2.1.1 / 2014-12-29
==================
* browser: use `typeof` to check for `console` existence
* browser: check for `console.log` truthiness (fix IE 8/9)
* browser: add support for Chrome apps
* Readme: added Windows usage remarks
* Add `bower.json` to properly support bower install
2.1.0 / 2014-10-15
==================
* node: implement `DEBUG_FD` env variable support
* package: update "browserify" to v6.1.0
* package: add "license" field to package.json (#135, @panuhorsmalahti)
2.0.0 / 2014-09-01
==================
* package: update "browserify" to v5.11.0
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
1.0.4 / 2014-07-15
==================
* dist: recompile
* example: remove `console.info()` log usage
* example: add "Content-Type" UTF-8 header to browser example
* browser: place %c marker after the space character
* browser: reset the "content" color via `color: inherit`
* browser: add colors support for Firefox >= v31
* debug: prefer an instance `log()` function over the global one (#119)
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
1.0.3 / 2014-07-09
==================
* Add support for multiple wildcards in namespaces (#122, @seegno)
* browser: fix lint
1.0.2 / 2014-06-10
==================
* browser: update color palette (#113, @gscottolson)
* common: make console logging function configurable (#108, @timoxley)
* node: fix %o colors on old node <= 0.8.x
* Makefile: find node path using shell/which (#109, @timoxley)
1.0.1 / 2014-06-06
==================
* browser: use `removeItem()` to clear localStorage
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
* package: add "contributors" section
* node: fix comment typo
* README: list authors
1.0.0 / 2014-06-04
==================
* make ms diff be global, not be scope
* debug: ignore empty strings in enable()
* node: make DEBUG_COLORS able to disable coloring
* *: export the `colors` array
* npmignore: don't publish the `dist` dir
* Makefile: refactor to use browserify
* package: add "browserify" as a dev dependency
* Readme: add Web Inspector Colors section
* node: reset terminal color for the debug content
* node: map "%o" to `util.inspect()`
* browser: map "%j" to `JSON.stringify()`
* debug: add custom "formatters"
* debug: use "ms" module for humanizing the diff
* Readme: add "bash" syntax highlighting
* browser: add Firebug color support
* browser: add colors for WebKit browsers
* node: apply log to `console`
* rewrite: abstract common logic for Node & browsers
* add .jshintrc file
0.8.1 / 2014-04-14
==================
* package: re-add the "component" section
0.8.0 / 2014-03-30
==================
* add `enable()` method for nodejs. Closes #27
* change from stderr to stdout
* remove unnecessary index.js file
0.7.4 / 2013-11-13
==================
* remove "browserify" key from package.json (fixes something in browserify)
0.7.3 / 2013-10-30
==================
* fix: catch localStorage security error when cookies are blocked (Chrome)
* add debug(err) support. Closes #46
* add .browser prop to package.json. Closes #42
0.7.2 / 2013-02-06
==================
* fix package.json
* fix: Mobile Safari (private mode) is broken with debug
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
0.7.1 / 2013-02-05
==================
* add repository URL to package.json
* add DEBUG_COLORED to force colored output
* add browserify support
* fix component. Closes #24
0.7.0 / 2012-05-04
==================
* Added .component to package.json
* Added debug.component.js build
0.6.0 / 2012-03-16
==================
* Added support for "-" prefix in DEBUG [Vinay Pulim]
* Added `.enabled` flag to the node version [TooTallNate]
0.5.0 / 2012-02-02
==================
* Added: humanize diffs. Closes #8
* Added `debug.disable()` to the CS variant
* Removed padding. Closes #10
* Fixed: persist client-side variant again. Closes #9
0.4.0 / 2012-02-01
==================
* Added browser variant support for older browsers [TooTallNate]
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
* Added padding to diff (moved it to the right)
0.3.0 / 2012-01-26
==================
* Added millisecond diff when isatty, otherwise UTC string
0.2.0 / 2012-01-22
==================
* Added wildcard support
0.1.0 / 2011-12-02
==================
* Added: remove colors unless stderr isatty [TooTallNate]
0.0.1 / 2010-01-03
==================
* Initial release

19
node_modules/ref/node_modules/debug/LICENSE generated vendored Normal file
View File

@ -0,0 +1,19 @@
(The MIT License)
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the 'Software'), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

50
node_modules/ref/node_modules/debug/Makefile generated vendored Normal file
View File

@ -0,0 +1,50 @@
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
# BIN directory
BIN := $(THIS_DIR)/node_modules/.bin
# Path
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
# applications
NODE ?= $(shell which node)
YARN ?= $(shell which yarn)
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
BROWSERIFY ?= $(NODE) $(BIN)/browserify
.FORCE:
install: node_modules
node_modules: package.json
@NODE_ENV= $(PKG) install
@touch node_modules
lint: .FORCE
eslint browser.js debug.js index.js node.js
test-node: .FORCE
istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
test-browser: .FORCE
mkdir -p dist
@$(BROWSERIFY) \
--standalone debug \
. > dist/debug.js
karma start --single-run
rimraf dist
test: .FORCE
concurrently \
"make test-node" \
"make test-browser"
coveralls:
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
.PHONY: all install clean distclean

312
node_modules/ref/node_modules/debug/README.md generated vendored Normal file
View File

@ -0,0 +1,312 @@
# debug
[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
A tiny node.js debugging utility modelled after node core's debugging technique.
**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)**
## Installation
```bash
$ npm install debug
```
## Usage
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
Example _app.js_:
```js
var debug = require('debug')('http')
, http = require('http')
, name = 'My App';
// fake app
debug('booting %s', name);
http.createServer(function(req, res){
debug(req.method + ' ' + req.url);
res.end('hello\n');
}).listen(3000, function(){
debug('listening');
});
// fake worker of some kind
require('./worker');
```
Example _worker.js_:
```js
var debug = require('debug')('worker');
setInterval(function(){
debug('doing some work');
}, 1000);
```
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
#### Windows note
On Windows the environment variable is set using the `set` command.
```cmd
set DEBUG=*,-not_this
```
Note that PowerShell uses different syntax to set environment variables.
```cmd
$env:DEBUG = "*,-not_this"
```
Then, run the program to be debugged as usual.
## Millisecond diff
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
## Conventions
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
## Wildcards
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
## Environment Variables
When running through Node.js, you can set a few environment variables that will
change the behavior of the debug logging:
| Name | Purpose |
|-----------|-------------------------------------------------|
| `DEBUG` | Enables/disables specific debugging namespaces. |
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
| `DEBUG_DEPTH` | Object inspection depth. |
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
__Note:__ The environment variables beginning with `DEBUG_` end up being
converted into an Options object that gets used with `%o`/`%O` formatters.
See the Node.js documentation for
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
for the complete list.
## Formatters
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters:
| Formatter | Representation |
|-----------|----------------|
| `%O` | Pretty-print an Object on multiple lines. |
| `%o` | Pretty-print an Object all on a single line. |
| `%s` | String. |
| `%d` | Number (both integer and float). |
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
| `%%` | Single percent sign ('%'). This does not consume an argument. |
### Custom formatters
You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like:
```js
const createDebug = require('debug')
createDebug.formatters.h = (v) => {
return v.toString('hex')
}
// …elsewhere
const debug = createDebug('foo')
debug('this is hex: %h', new Buffer('hello world'))
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
```
## Browser support
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
if you don't want to build it yourself.
Debug's enable state is currently persisted by `localStorage`.
Consider the situation shown below where you have `worker:a` and `worker:b`,
and wish to debug both. You can enable this using `localStorage.debug`:
```js
localStorage.debug = 'worker:*'
```
And then refresh the page.
```js
a = debug('worker:a');
b = debug('worker:b');
setInterval(function(){
a('doing some work');
}, 1000);
setInterval(function(){
b('doing some work');
}, 1200);
```
#### Web Inspector Colors
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
option. These are WebKit web inspectors, Firefox ([since version
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
and the Firebug plugin for Firefox (any version).
Colored output looks something like:
![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
## Output streams
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
Example _stdout.js_:
```js
var debug = require('debug');
var error = debug('app:error');
// by default stderr is used
error('goes to stderr!');
var log = debug('app:log');
// set this namespace to log via console.log
log.log = console.log.bind(console); // don't forget to bind to console!
log('goes to stdout');
error('still goes to stderr!');
// set all output to go via console.info
// overrides all per-namespace log settings
debug.log = console.info.bind(console);
error('now goes to stdout via console.info');
log('still goes to stdout, but via console.info now');
```
## Authors
- TJ Holowaychuk
- Nathan Rajlich
- Andrew Rhyne
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
## Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
## License
(The MIT License)
Copyright (c) 2014-2016 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

19
node_modules/ref/node_modules/debug/component.json generated vendored Normal file
View File

@ -0,0 +1,19 @@
{
"name": "debug",
"repo": "visionmedia/debug",
"description": "small debugging utility",
"version": "2.6.9",
"keywords": [
"debug",
"log",
"debugger"
],
"main": "src/browser.js",
"scripts": [
"src/browser.js",
"src/debug.js"
],
"dependencies": {
"rauchg/ms.js": "0.7.1"
}
}

70
node_modules/ref/node_modules/debug/karma.conf.js generated vendored Normal file
View File

@ -0,0 +1,70 @@
// Karma configuration
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai', 'sinon'],
// list of files / patterns to load in the browser
files: [
'dist/debug.js',
'test/*spec.js'
],
// list of files to exclude
exclude: [
'src/node.js'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}

1
node_modules/ref/node_modules/debug/node.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('./src/node');

88
node_modules/ref/node_modules/debug/package.json generated vendored Normal file
View File

@ -0,0 +1,88 @@
{
"_from": "debug@2",
"_id": "debug@2.6.9",
"_inBundle": false,
"_integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"_location": "/ref/debug",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "debug@2",
"name": "debug",
"escapedName": "debug",
"rawSpec": "2",
"saveSpec": null,
"fetchSpec": "2"
},
"_requiredBy": [
"/ref"
],
"_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"_shasum": "5d128515df134ff327e90a4c93f4e077a536341f",
"_spec": "debug@2",
"_where": "C:\\Users\\matia\\Documents\\GitHub\\Musix-V3\\node_modules\\ref",
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
},
"browser": "./src/browser.js",
"bugs": {
"url": "https://github.com/visionmedia/debug/issues"
},
"bundleDependencies": false,
"component": {
"scripts": {
"debug/index.js": "browser.js",
"debug/debug.js": "debug.js"
}
},
"contributors": [
{
"name": "Nathan Rajlich",
"email": "nathan@tootallnate.net",
"url": "http://n8.io"
},
{
"name": "Andrew Rhyne",
"email": "rhyneandrew@gmail.com"
}
],
"dependencies": {
"ms": "2.0.0"
},
"deprecated": false,
"description": "small debugging utility",
"devDependencies": {
"browserify": "9.0.3",
"chai": "^3.5.0",
"concurrently": "^3.1.0",
"coveralls": "^2.11.15",
"eslint": "^3.12.1",
"istanbul": "^0.4.5",
"karma": "^1.3.0",
"karma-chai": "^0.1.0",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sinon": "^1.0.5",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.2.0",
"rimraf": "^2.5.4",
"sinon": "^1.17.6",
"sinon-chai": "^2.8.0"
},
"homepage": "https://github.com/visionmedia/debug#readme",
"keywords": [
"debug",
"log",
"debugger"
],
"license": "MIT",
"main": "./src/index.js",
"name": "debug",
"repository": {
"type": "git",
"url": "git://github.com/visionmedia/debug.git"
},
"version": "2.6.9"
}

185
node_modules/ref/node_modules/debug/src/browser.js generated vendored Normal file
View File

@ -0,0 +1,185 @@
/**
* This is the web browser implementation of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = require('./debug');
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = 'undefined' != typeof chrome
&& 'undefined' != typeof chrome.storage
? chrome.storage.local
: localstorage();
/**
* Colors.
*/
exports.colors = [
'lightseagreen',
'forestgreen',
'goldenrod',
'dodgerblue',
'darkorchid',
'crimson'
];
/**
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known
* to support "%c" CSS customizations.
*
* TODO: add a `localStorage` variable to explicitly enable/disable colors
*/
function useColors() {
// NB: In an Electron preload script, document will be defined but not fully
// initialized. Since we know we're in Chrome, we'll just detect this case
// explicitly
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
return true;
}
// is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
// is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
// is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
// double check webkit in userAgent just in case we are in a worker
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
exports.formatters.j = function(v) {
try {
return JSON.stringify(v);
} catch (err) {
return '[UnexpectedJSONParseError]: ' + err.message;
}
};
/**
* Colorize log arguments if enabled.
*
* @api public
*/
function formatArgs(args) {
var useColors = this.useColors;
args[0] = (useColors ? '%c' : '')
+ this.namespace
+ (useColors ? ' %c' : ' ')
+ args[0]
+ (useColors ? '%c ' : ' ')
+ '+' + exports.humanize(this.diff);
if (!useColors) return;
var c = 'color: ' + this.color;
args.splice(1, 0, c, 'color: inherit')
// the final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into
var index = 0;
var lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, function(match) {
if ('%%' === match) return;
index++;
if ('%c' === match) {
// we only are interested in the *last* %c
// (the user may have provided their own)
lastC = index;
}
});
args.splice(lastC, 0, c);
}
/**
* Invokes `console.log()` when available.
* No-op when `console.log` is not a "function".
*
* @api public
*/
function log() {
// this hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return 'object' === typeof console
&& console.log
&& Function.prototype.apply.call(console.log, console, arguments);
}
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
try {
if (null == namespaces) {
exports.storage.removeItem('debug');
} else {
exports.storage.debug = namespaces;
}
} catch(e) {}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
var r;
try {
r = exports.storage.debug;
} catch(e) {}
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG;
}
return r;
}
/**
* Enable namespaces listed in `localStorage.debug` initially.
*/
exports.enable(load());
/**
* Localstorage attempts to return the localstorage.
*
* This is necessary because safari throws
* when a user disables cookies/localstorage
* and you attempt to access it.
*
* @return {LocalStorage}
* @api private
*/
function localstorage() {
try {
return window.localStorage;
} catch (e) {}
}

202
node_modules/ref/node_modules/debug/src/debug.js generated vendored Normal file
View File

@ -0,0 +1,202 @@
/**
* This is the common logic for both the Node.js and web browser
* implementations of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
exports.coerce = coerce;
exports.disable = disable;
exports.enable = enable;
exports.enabled = enabled;
exports.humanize = require('ms');
/**
* The currently active debug mode names, and names to skip.
*/
exports.names = [];
exports.skips = [];
/**
* Map of special "%n" handling functions, for the debug "format" argument.
*
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
*/
exports.formatters = {};
/**
* Previous log timestamp.
*/
var prevTime;
/**
* Select a color.
* @param {String} namespace
* @return {Number}
* @api private
*/
function selectColor(namespace) {
var hash = 0, i;
for (i in namespace) {
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
return exports.colors[Math.abs(hash) % exports.colors.length];
}
/**
* Create a debugger with the given `namespace`.
*
* @param {String} namespace
* @return {Function}
* @api public
*/
function createDebug(namespace) {
function debug() {
// disabled?
if (!debug.enabled) return;
var self = debug;
// set `diff` timestamp
var curr = +new Date();
var ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.curr = curr;
prevTime = curr;
// turn the `arguments` into a proper Array
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
args[0] = exports.coerce(args[0]);
if ('string' !== typeof args[0]) {
// anything else let's inspect with %O
args.unshift('%O');
}
// apply any `formatters` transformations
var index = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
// if we encounter an escaped % then don't increase the array index
if (match === '%%') return match;
index++;
var formatter = exports.formatters[format];
if ('function' === typeof formatter) {
var val = args[index];
match = formatter.call(self, val);
// now we need to remove `args[index]` since it's inlined in the `format`
args.splice(index, 1);
index--;
}
return match;
});
// apply env-specific formatting (colors, etc.)
exports.formatArgs.call(self, args);
var logFn = debug.log || exports.log || console.log.bind(console);
logFn.apply(self, args);
}
debug.namespace = namespace;
debug.enabled = exports.enabled(namespace);
debug.useColors = exports.useColors();
debug.color = selectColor(namespace);
// env-specific initialization logic for debug instances
if ('function' === typeof exports.init) {
exports.init(debug);
}
return debug;
}
/**
* Enables a debug mode by namespaces. This can include modes
* separated by a colon and wildcards.
*
* @param {String} namespaces
* @api public
*/
function enable(namespaces) {
exports.save(namespaces);
exports.names = [];
exports.skips = [];
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
var len = split.length;
for (var i = 0; i < len; i++) {
if (!split[i]) continue; // ignore empty strings
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
} else {
exports.names.push(new RegExp('^' + namespaces + '$'));
}
}
}
/**
* Disable debug output.
*
* @api public
*/
function disable() {
exports.enable('');
}
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
function enabled(name) {
var i, len;
for (i = 0, len = exports.skips.length; i < len; i++) {
if (exports.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = exports.names.length; i < len; i++) {
if (exports.names[i].test(name)) {
return true;
}
}
return false;
}
/**
* Coerce `val`.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}

10
node_modules/ref/node_modules/debug/src/index.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
/**
* Detect Electron renderer process, which is node, but we should
* treat as a browser.
*/
if (typeof process !== 'undefined' && process.type === 'renderer') {
module.exports = require('./browser.js');
} else {
module.exports = require('./node.js');
}

View File

@ -0,0 +1,15 @@
module.exports = inspectorLog;
// black hole
const nullStream = new (require('stream').Writable)();
nullStream._write = () => {};
/**
* Outputs a `console.log()` to the Node.js Inspector console *only*.
*/
function inspectorLog() {
const stdout = console._stdout;
console._stdout = nullStream;
console.log.apply(console, arguments);
console._stdout = stdout;
}

248
node_modules/ref/node_modules/debug/src/node.js generated vendored Normal file
View File

@ -0,0 +1,248 @@
/**
* Module dependencies.
*/
var tty = require('tty');
var util = require('util');
/**
* This is the Node.js implementation of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = require('./debug');
exports.init = init;
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
/**
* Colors.
*/
exports.colors = [6, 2, 3, 4, 5, 1];
/**
* Build up the default `inspectOpts` object from the environment variables.
*
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
*/
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
return /^debug_/i.test(key);
}).reduce(function (obj, key) {
// camel-case
var prop = key
.substring(6)
.toLowerCase()
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
// coerce string value into JS value
var val = process.env[key];
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
else if (val === 'null') val = null;
else val = Number(val);
obj[prop] = val;
return obj;
}, {});
/**
* The file descriptor to write the `debug()` calls to.
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
*
* $ DEBUG_FD=3 node script.js 3>debug.log
*/
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
if (1 !== fd && 2 !== fd) {
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')()
}
var stream = 1 === fd ? process.stdout :
2 === fd ? process.stderr :
createWritableStdioStream(fd);
/**
* Is stdout a TTY? Colored output is enabled when `true`.
*/
function useColors() {
return 'colors' in exports.inspectOpts
? Boolean(exports.inspectOpts.colors)
: tty.isatty(fd);
}
/**
* Map %o to `util.inspect()`, all on a single line.
*/
exports.formatters.o = function(v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts)
.split('\n').map(function(str) {
return str.trim()
}).join(' ');
};
/**
* Map %o to `util.inspect()`, allowing multiple lines if needed.
*/
exports.formatters.O = function(v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts);
};
/**
* Adds ANSI color escape codes if enabled.
*
* @api public
*/
function formatArgs(args) {
var name = this.namespace;
var useColors = this.useColors;
if (useColors) {
var c = this.color;
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
} else {
args[0] = new Date().toUTCString()
+ ' ' + name + ' ' + args[0];
}
}
/**
* Invokes `util.format()` with the specified arguments and writes to `stream`.
*/
function log() {
return stream.write(util.format.apply(util, arguments) + '\n');
}
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
if (null == namespaces) {
// If you set a process.env field to null or undefined, it gets cast to the
// string 'null' or 'undefined'. Just delete instead.
delete process.env.DEBUG;
} else {
process.env.DEBUG = namespaces;
}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
return process.env.DEBUG;
}
/**
* Copied from `node/src/node.js`.
*
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
*/
function createWritableStdioStream (fd) {
var stream;
var tty_wrap = process.binding('tty_wrap');
// Note stream._type is used for test-module-load-list.js
switch (tty_wrap.guessHandleType(fd)) {
case 'TTY':
stream = new tty.WriteStream(fd);
stream._type = 'tty';
// Hack to have stream not keep the event loop alive.
// See https://github.com/joyent/node/issues/1726
if (stream._handle && stream._handle.unref) {
stream._handle.unref();
}
break;
case 'FILE':
var fs = require('fs');
stream = new fs.SyncWriteStream(fd, { autoClose: false });
stream._type = 'fs';
break;
case 'PIPE':
case 'TCP':
var net = require('net');
stream = new net.Socket({
fd: fd,
readable: false,
writable: true
});
// FIXME Should probably have an option in net.Socket to create a
// stream from an existing fd which is writable only. But for now
// we'll just add this hack and set the `readable` member to false.
// Test: ./node test/fixtures/echo.js < /etc/passwd
stream.readable = false;
stream.read = null;
stream._type = 'pipe';
// FIXME Hack to have stream not keep the event loop alive.
// See https://github.com/joyent/node/issues/1726
if (stream._handle && stream._handle.unref) {
stream._handle.unref();
}
break;
default:
// Probably an error on in uv_guess_handle()
throw new Error('Implement me. Unknown stream file type!');
}
// For supporting legacy API we put the FD here.
stream.fd = fd;
stream._isStdio = true;
return stream;
}
/**
* Init logic for `debug` instances.
*
* Create a new `inspectOpts` object in case `useColors` is set
* differently for a particular `debug` instance.
*/
function init (debug) {
debug.inspectOpts = {};
var keys = Object.keys(exports.inspectOpts);
for (var i = 0; i < keys.length; i++) {
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
}
}
/**
* Enable namespaces listed in `process.env.DEBUG` initially.
*/
exports.enable(load());

152
node_modules/ref/node_modules/ms/index.js generated vendored Normal file
View File

@ -0,0 +1,152 @@
/**
* Helpers.
*/
var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var y = d * 365.25;
/**
* Parse or format the given `val`.
*
* Options:
*
* - `long` verbose formatting [false]
*
* @param {String|Number} val
* @param {Object} [options]
* @throws {Error} throw an error if val is not a non-empty string or a number
* @return {String|Number}
* @api public
*/
module.exports = function(val, options) {
options = options || {};
var type = typeof val;
if (type === 'string' && val.length > 0) {
return parse(val);
} else if (type === 'number' && isNaN(val) === false) {
return options.long ? fmtLong(val) : fmtShort(val);
}
throw new Error(
'val is not a non-empty string or a valid number. val=' +
JSON.stringify(val)
);
};
/**
* Parse the given `str` and return milliseconds.
*
* @param {String} str
* @return {Number}
* @api private
*/
function parse(str) {
str = String(str);
if (str.length > 100) {
return;
}
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
str
);
if (!match) {
return;
}
var n = parseFloat(match[1]);
var type = (match[2] || 'ms').toLowerCase();
switch (type) {
case 'years':
case 'year':
case 'yrs':
case 'yr':
case 'y':
return n * y;
case 'days':
case 'day':
case 'd':
return n * d;
case 'hours':
case 'hour':
case 'hrs':
case 'hr':
case 'h':
return n * h;
case 'minutes':
case 'minute':
case 'mins':
case 'min':
case 'm':
return n * m;
case 'seconds':
case 'second':
case 'secs':
case 'sec':
case 's':
return n * s;
case 'milliseconds':
case 'millisecond':
case 'msecs':
case 'msec':
case 'ms':
return n;
default:
return undefined;
}
}
/**
* Short format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function fmtShort(ms) {
if (ms >= d) {
return Math.round(ms / d) + 'd';
}
if (ms >= h) {
return Math.round(ms / h) + 'h';
}
if (ms >= m) {
return Math.round(ms / m) + 'm';
}
if (ms >= s) {
return Math.round(ms / s) + 's';
}
return ms + 'ms';
}
/**
* Long format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function fmtLong(ms) {
return plural(ms, d, 'day') ||
plural(ms, h, 'hour') ||
plural(ms, m, 'minute') ||
plural(ms, s, 'second') ||
ms + ' ms';
}
/**
* Pluralization helper.
*/
function plural(ms, n, name) {
if (ms < n) {
return;
}
if (ms < n * 1.5) {
return Math.floor(ms / n) + ' ' + name;
}
return Math.ceil(ms / n) + ' ' + name + 's';
}

21
node_modules/ref/node_modules/ms/license.md generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Zeit, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

69
node_modules/ref/node_modules/ms/package.json generated vendored Normal file
View File

@ -0,0 +1,69 @@
{
"_from": "ms@2.0.0",
"_id": "ms@2.0.0",
"_inBundle": false,
"_integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"_location": "/ref/ms",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "ms@2.0.0",
"name": "ms",
"escapedName": "ms",
"rawSpec": "2.0.0",
"saveSpec": null,
"fetchSpec": "2.0.0"
},
"_requiredBy": [
"/ref/debug"
],
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8",
"_spec": "ms@2.0.0",
"_where": "C:\\Users\\matia\\Documents\\GitHub\\Musix-V3\\node_modules\\ref\\node_modules\\debug",
"bugs": {
"url": "https://github.com/zeit/ms/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Tiny milisecond conversion utility",
"devDependencies": {
"eslint": "3.19.0",
"expect.js": "0.3.1",
"husky": "0.13.3",
"lint-staged": "3.4.1",
"mocha": "3.4.1"
},
"eslintConfig": {
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true
}
},
"files": [
"index.js"
],
"homepage": "https://github.com/zeit/ms#readme",
"license": "MIT",
"lint-staged": {
"*.js": [
"npm run lint",
"prettier --single-quote --write",
"git add"
]
},
"main": "./index",
"name": "ms",
"repository": {
"type": "git",
"url": "git+https://github.com/zeit/ms.git"
},
"scripts": {
"lint": "eslint lib/* bin/*",
"precommit": "lint-staged",
"test": "mocha tests.js"
},
"version": "2.0.0"
}

51
node_modules/ref/node_modules/ms/readme.md generated vendored Normal file
View File

@ -0,0 +1,51 @@
# ms
[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/)
Use this package to easily convert various time formats to milliseconds.
## Examples
```js
ms('2 days') // 172800000
ms('1d') // 86400000
ms('10h') // 36000000
ms('2.5 hrs') // 9000000
ms('2h') // 7200000
ms('1m') // 60000
ms('5s') // 5000
ms('1y') // 31557600000
ms('100') // 100
```
### Convert from milliseconds
```js
ms(60000) // "1m"
ms(2 * 60000) // "2m"
ms(ms('10 hours')) // "10h"
```
### Time format written-out
```js
ms(60000, { long: true }) // "1 minute"
ms(2 * 60000, { long: true }) // "2 minutes"
ms(ms('10 hours'), { long: true }) // "10 hours"
```
## Features
- Works both in [node](https://nodejs.org) and in the browser.
- If a number is supplied to `ms`, a string with a unit is returned.
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`).
- If you pass a string with a number and a valid unit, the number of equivalent ms is returned.
## Caught a bug?
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
2. Link the package to the global module directory: `npm link`
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms!
As always, you can run the tests using: `npm test`

80
node_modules/ref/package.json generated vendored Normal file
View File

@ -0,0 +1,80 @@
{
"_from": "ref@1",
"_id": "ref@1.3.5",
"_inBundle": false,
"_integrity": "sha512-2cBCniTtxcGUjDpvFfVpw323a83/0RLSGJJY5l5lcomZWhYpU2cuLdsvYqMixvsdLJ9+sTdzEkju8J8ZHDM2nA==",
"_location": "/ref",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "ref@1",
"name": "ref",
"escapedName": "ref",
"rawSpec": "1",
"saveSpec": null,
"fetchSpec": "1"
},
"_requiredBy": [
"/ref-struct"
],
"_resolved": "https://registry.npmjs.org/ref/-/ref-1.3.5.tgz",
"_shasum": "0e33f080cdb94a3d95312b2b3b1fd0f82044ca0f",
"_spec": "ref@1",
"_where": "C:\\Users\\matia\\Documents\\GitHub\\Musix-V3\\node_modules\\ref-struct",
"author": {
"name": "Nathan Rajlich",
"email": "nathan@tootallnate.net",
"url": "http://tootallnate.net"
},
"bugs": {
"url": "https://github.com/TooTallNate/ref/issues"
},
"bundleDependencies": false,
"dependencies": {
"bindings": "1",
"debug": "2",
"nan": "2"
},
"deprecated": false,
"description": "Turn Buffer instances into \"pointers\"",
"devDependencies": {
"dox": "0.4.4",
"highlight.js": "1",
"jade": "^0.35.0",
"marked": "^0.3.2",
"mocha": "*",
"weak": "1"
},
"gypfile": true,
"homepage": "https://github.com/TooTallNate/ref#readme",
"keywords": [
"native",
"buffer",
"extensions",
"c++",
"pointer",
"reference",
"dereference",
"type",
"int",
"long",
"float",
"double",
"byte",
"64"
],
"license": "MIT",
"main": "./lib/ref.js",
"name": "ref",
"repository": {
"type": "git",
"url": "git://github.com/TooTallNate/ref.git"
},
"scripts": {
"docs": "node docs/compile",
"install": "node-gyp rebuild",
"test": "mocha -gc --reporter spec --use_strict"
},
"version": "1.3.5"
}

660
node_modules/ref/src/binding.cc generated vendored Normal file
View File

@ -0,0 +1,660 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "node.h"
#include "node_buffer.h"
#include "nan.h"
#ifdef _WIN32
#define __alignof__ __alignof
#define snprintf(buf, bufSize, format, arg) _snprintf_s(buf, bufSize, _TRUNCATE, format, arg)
#define strtoll _strtoi64
#define strtoull _strtoui64
#define PRId64 "lld"
#define PRIu64 "llu"
#else
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#endif
using namespace v8;
using namespace node;
namespace {
// used by the Int64 functions to determine whether to return a Number
// or String based on whether or not a Number will lose precision.
// http://stackoverflow.com/q/307179/376773
#define JS_MAX_INT +9007199254740992LL
#define JS_MIN_INT -9007199254740992LL
// mirrors deps/v8/src/objects.h.
// we could use `node::Buffer::kMaxLength`, but it's not defined on node v0.6.x
static const unsigned int kMaxLength = 0x3fffffff;
// get int64 from a value
inline int64_t GetInt64(Local<Value> value) {
return value->IsNumber() ? Nan::To<int64_t>(value).FromJust() : 0;
}
/*
* Returns the pointer address as a Number of the given Buffer instance.
* It's recommended to use `hexAddress()` in most cases instead of this function.
*
* WARNING: a JavaScript Number cannot precisely store a full 64-bit memory
* address, so there's a possibility of an inaccurate value being returned
* on 64-bit systems.
*
* info[0] - Buffer - the Buffer instance get the memory address of
* info[1] - Number - optional (0) - the offset of the Buffer start at
*/
NAN_METHOD(Address) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("address: Buffer instance expected");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
uintptr_t intptr = (uintptr_t)ptr;
Local<Number> rtn = Nan::New(static_cast<double>(intptr));
info.GetReturnValue().Set(rtn);
}
/**
* Returns the pointer address as a hexadecimal String. This function
* is safe to use for displaying memory addresses, as compared to the
* `address()` function which could overflow since it returns a Number.
*
* info[0] - Buffer - the Buffer instance get the memory address of
* info[1] - Number - optional (0) - the offset of the Buffer start at
*/
NAN_METHOD(HexAddress) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("hexAddress: Buffer instance expected");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
char strbuf[30]; /* should be plenty... */
snprintf(strbuf, 30, "%p", ptr);
Local<String> val;
if (strbuf[0] == '0' && strbuf[1] == 'x') {
/* strip the leading "0x" from the address */
val = Nan::New(strbuf + 2).ToLocalChecked();
} else {
val = Nan::New(strbuf).ToLocalChecked();
}
info.GetReturnValue().Set(val);
}
/*
* Returns "true" if the given Buffer points to NULL, "false" otherwise.
*
* info[0] - Buffer - the Buffer instance to check for NULL
* info[1] - Number - optional (0) - the offset of the Buffer start at
*/
NAN_METHOD(IsNull) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("isNull: Buffer instance expected");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
Local<Value> rtn = Nan::New(ptr == NULL);
info.GetReturnValue().Set(rtn);
}
/**
* Returns the machine endianness as C String; either "BE" or "LE".
*/
const char *CheckEndianness() {
int i = 1;
bool is_bigendian = (*(char *)&i) == 0;
if (is_bigendian) {
return "BE";
} else {
return "LE";
}
}
/*
* Converts an arbitrary pointer to a node Buffer with specified length
*/
void wrap_pointer_cb(char *data, void *hint) {
}
inline Local<Value> WrapPointer(char *ptr, size_t length) {
Nan::EscapableHandleScope scope;
if (ptr == NULL) length = 0;
return scope.Escape(Nan::NewBuffer(ptr, length, wrap_pointer_cb, NULL).ToLocalChecked());
}
/*
* Creates the "null_pointer_buffer" Buffer instance that points to NULL.
* It has a length of 0 so that you don't accidentally try to deref the NULL
* pointer in JS-land by doing something like: `ref.NULL[0]`.
*/
inline Local<Value> WrapNullPointer() {
return WrapPointer((char*)NULL, 0);
}
/*
* Retreives a JS Object instance that was previously stored in
* the given Buffer instance at the given offset.
*
* info[0] - Buffer - the "buf" Buffer instance to read from
* info[1] - Number - the offset from the "buf" buffer's address to read from
*/
NAN_METHOD(ReadObject) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("readObject: Buffer instance expected");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
if (ptr == NULL) {
return Nan::ThrowError("readObject: Cannot read from NULL pointer");
}
Persistent<Object>* prtn = reinterpret_cast<Persistent<Object>*>(ptr);
Local<Value> rtn = Nan::New(*prtn);
info.GetReturnValue().Set(rtn);
}
/*
* Callback function for when the weak persistent object from WriteObject
* gets garbage collected. We just have to dispose of our weak reference now.
*/
void write_object_cb(const Nan::WeakCallbackInfo<void>& data) {
//fprintf(stderr, "write_object_cb\n");
//NanDisposePersistent(data.GetValue());
}
/*
* Writes a Persistent reference to given Object to the given Buffer
* instance and offset.
*
* info[0] - Buffer - the "buf" Buffer instance to write to
* info[1] - Number - the offset from the "buf" buffer's address to write to
* info[2] - Object - the "obj" Object which will have a new Persistent reference
* created for the obj, who'se memory address will be written
* info[3] - Boolean - `false` by default. if `true` is passed in then a
* persistent reference will be written to the Buffer instance.
* A weak reference gets written by default.
*/
NAN_METHOD(WriteObject) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("writeObject: Buffer instance expected");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
Nan::Persistent<Object>* pptr = reinterpret_cast<Nan::Persistent<Object>*>(ptr);
Local<Object> val = info[2].As<Object>();
bool persistent = info[3]->BooleanValue();
if (persistent) {
(*pptr).Reset(val);
} else {
void *user_data = NULL;
Nan::Persistent<Object> p2(val);
p2.SetWeak(user_data, write_object_cb, Nan::WeakCallbackType::kParameter);
memcpy(pptr, &p2, sizeof(Nan::Persistent<Object>));
}
info.GetReturnValue().SetUndefined();
}
/*
* Reads the memory address of the given "buf" pointer Buffer at the specified
* offset, and returns a new SlowBuffer instance from the memory address stored.
*
* info[0] - Buffer - the "buf" Buffer instance to read from
* info[1] - Number - the offset from the "buf" buffer's address to read from
* info[2] - Number - the length in bytes of the returned SlowBuffer instance
*/
NAN_METHOD(ReadPointer) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("readPointer: Buffer instance expected as first argument");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
size_t size = info[2]->Uint32Value();
if (ptr == NULL) {
return Nan::ThrowError("readPointer: Cannot read from NULL pointer");
}
char *val = *reinterpret_cast<char **>(ptr);
info.GetReturnValue().Set(WrapPointer(val, size));
}
/*
* Writes the memory address of the "input" buffer (and optional offset) to the
* specified "buf" buffer and offset. Essentially making "buf" hold a reference
* to the "input" Buffer.
*
* info[0] - Buffer - the "buf" Buffer instance to write to
* info[1] - Number - the offset from the "buf" buffer's address to write to
* info[2] - Buffer - the "input" Buffer whose memory address will be written
*/
NAN_METHOD(WritePointer) {
Local<Value> buf = info[0];
Local<Value> input = info[2];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("writePointer: Buffer instance expected as first argument");
}
if (!(input->IsNull() || Buffer::HasInstance(input))) {
return Nan::ThrowTypeError("writePointer: Buffer instance expected as third argument");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
if (input->IsNull()) {
*reinterpret_cast<char **>(ptr) = NULL;
} else {
char *input_ptr = Buffer::Data(input.As<Object>());
*reinterpret_cast<char **>(ptr) = input_ptr;
}
info.GetReturnValue().SetUndefined();
}
/*
* Reads a machine-endian int64_t from the given Buffer at the given offset.
*
* info[0] - Buffer - the "buf" Buffer instance to read from
* info[1] - Number - the offset from the "buf" buffer's address to read from
*/
NAN_METHOD(ReadInt64) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("readInt64: Buffer instance expected");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
if (ptr == NULL) {
return Nan::ThrowTypeError("readInt64: Cannot read from NULL pointer");
}
int64_t val = *reinterpret_cast<int64_t *>(ptr);
Local<Value> rtn;
if (val < JS_MIN_INT || val > JS_MAX_INT) {
// return a String
char strbuf[128];
snprintf(strbuf, 128, "%" PRId64, val);
rtn = Nan::New<v8::String>(strbuf).ToLocalChecked();
} else {
// return a Number
rtn = Nan::New<v8::Number>(static_cast<double>(val));
}
info.GetReturnValue().Set(rtn);
}
/*
* Writes the input Number/String int64 value as a machine-endian int64_t to
* the given Buffer at the given offset.
*
* info[0] - Buffer - the "buf" Buffer instance to write to
* info[1] - Number - the offset from the "buf" buffer's address to write to
* info[2] - String/Number - the "input" String or Number which will be written
*/
NAN_METHOD(WriteInt64) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("writeInt64: Buffer instance expected");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
Local<Value> in = info[2];
int64_t val;
if (in->IsNumber()) {
val = GetInt64(in);
} else if (in->IsString()) {
char *endptr, *str;
int base = 0;
String::Utf8Value _str(in);
str = *_str;
errno = 0; /* To distinguish success/failure after call */
val = strtoll(str, &endptr, base);
if (endptr == str) {
return Nan::ThrowTypeError("writeInt64: no digits we found in input String");
} else if (errno == ERANGE && (val == LLONG_MAX || val == LLONG_MIN)) {
return Nan::ThrowTypeError("writeInt64: input String numerical value out of range");
} else if (errno != 0 && val == 0) {
char errmsg[200];
snprintf(errmsg, sizeof(errmsg), "writeInt64: %s", strerror(errno));
return Nan::ThrowTypeError(errmsg);
}
} else {
return Nan::ThrowTypeError("writeInt64: Number/String 64-bit value required");
}
*reinterpret_cast<int64_t *>(ptr) = val;
info.GetReturnValue().SetUndefined();
}
/*
* Reads a machine-endian uint64_t from the given Buffer at the given offset.
*
* info[0] - Buffer - the "buf" Buffer instance to read from
* info[1] - Number - the offset from the "buf" buffer's address to read from
*/
NAN_METHOD(ReadUInt64) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("readUInt64: Buffer instance expected");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
if (ptr == NULL) {
return Nan::ThrowTypeError("readUInt64: Cannot read from NULL pointer");
}
uint64_t val = *reinterpret_cast<uint64_t *>(ptr);
Local<Value> rtn;
if (val > JS_MAX_INT) {
// return a String
char strbuf[128];
snprintf(strbuf, 128, "%" PRIu64, val);
rtn = Nan::New<v8::String>(strbuf).ToLocalChecked();
} else {
// return a Number
rtn = Nan::New<v8::Number>(static_cast<double>(val));
}
info.GetReturnValue().Set(rtn);
}
/*
* Writes the input Number/String uint64 value as a machine-endian uint64_t to
* the given Buffer at the given offset.
*
* info[0] - Buffer - the "buf" Buffer instance to write to
* info[1] - Number - the offset from the "buf" buffer's address to write to
* info[2] - String/Number - the "input" String or Number which will be written
*/
NAN_METHOD(WriteUInt64) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("writeUInt64: Buffer instance expected");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
Local<Value> in = info[2];
uint64_t val;
if (in->IsNumber()) {
val = GetInt64(in);
} else if (in->IsString()) {
char *endptr, *str;
int base = 0;
String::Utf8Value _str(in);
str = *_str;
errno = 0; /* To distinguish success/failure after call */
val = strtoull(str, &endptr, base);
if (endptr == str) {
return Nan::ThrowTypeError("writeUInt64: no digits we found in input String");
} else if (errno == ERANGE && val == ULLONG_MAX) {
return Nan::ThrowTypeError("writeUInt64: input String numerical value out of range");
} else if (errno != 0 && val == 0) {
char errmsg[200];
snprintf(errmsg, sizeof(errmsg), "writeUInt64: %s", strerror(errno));
return Nan::ThrowTypeError(errmsg);
}
} else {
return Nan::ThrowTypeError("writeUInt64: Number/String 64-bit value required");
}
*reinterpret_cast<uint64_t *>(ptr) = val;
info.GetReturnValue().SetUndefined();
}
/*
* Reads a Utf8 C String from the given pointer at the given offset (or 0).
* I didn't want to add this function but it ends up being necessary for reading
* past a 0 or 1 length Buffer's boundary in node-ffi :\
*
* info[0] - Buffer - the "buf" Buffer instance to read from
* info[1] - Number - the offset from the "buf" buffer's address to read from
*/
NAN_METHOD(ReadCString) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("readCString: Buffer instance expected");
}
int64_t offset = GetInt64(info[1]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
if (ptr == NULL) {
return Nan::ThrowError("readCString: Cannot read from NULL pointer");
}
Local<Value> rtn = Nan::New<v8::String>(ptr).ToLocalChecked();
info.GetReturnValue().Set(rtn);
}
/*
* Returns a new Buffer instance that has the same memory address
* as the given buffer, but with the specified size.
*
* info[0] - Buffer - the "buf" Buffer instance to read the address from
* info[1] - Number - the size in bytes that the returned Buffer should be
* info[2] - Number - the offset from the "buf" buffer's address to read from
*/
NAN_METHOD(ReinterpretBuffer) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("reinterpret: Buffer instance expected");
}
int64_t offset = GetInt64(info[2]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
if (ptr == NULL) {
return Nan::ThrowError("reinterpret: Cannot reinterpret from NULL pointer");
}
size_t size = info[1]->Uint32Value();
info.GetReturnValue().Set(WrapPointer(ptr, size));
}
/*
* Returns a new Buffer instance that has the same memory address
* as the given buffer, but with a length up to the first aligned set of values of
* 0 in a row for the given length.
*
* info[0] - Buffer - the "buf" Buffer instance to read the address from
* info[1] - Number - the number of sequential 0-byte values that need to be read
* info[2] - Number - the offset from the "buf" buffer's address to read from
*/
NAN_METHOD(ReinterpretBufferUntilZeros) {
Local<Value> buf = info[0];
if (!Buffer::HasInstance(buf)) {
return Nan::ThrowTypeError("reinterpretUntilZeros: Buffer instance expected");
}
int64_t offset = GetInt64(info[2]);
char *ptr = Buffer::Data(buf.As<Object>()) + offset;
if (ptr == NULL) {
return Nan::ThrowError("reinterpretUntilZeros: Cannot reinterpret from NULL pointer");
}
uint32_t numZeros = info[1]->Uint32Value();
uint32_t i = 0;
size_t size = 0;
bool end = false;
while (!end && size < kMaxLength) {
end = true;
for (i = 0; i < numZeros; i++) {
if (ptr[size + i] != 0) {
end = false;
break;
}
}
if (!end) {
size += numZeros;
}
}
info.GetReturnValue().Set(WrapPointer(ptr, size));
}
} // anonymous namespace
NAN_MODULE_INIT(init) {
Nan::HandleScope scope;
// "sizeof" map
Local<Object> smap = Nan::New<v8::Object>();
// fixed sizes
#define SET_SIZEOF(name, type) \
smap->Set(Nan::New<v8::String>( #name ).ToLocalChecked(), Nan::New<v8::Uint32>(static_cast<uint32_t>(sizeof(type))));
SET_SIZEOF(int8, int8_t);
SET_SIZEOF(uint8, uint8_t);
SET_SIZEOF(int16, int16_t);
SET_SIZEOF(uint16, uint16_t);
SET_SIZEOF(int32, int32_t);
SET_SIZEOF(uint32, uint32_t);
SET_SIZEOF(int64, int64_t);
SET_SIZEOF(uint64, uint64_t);
SET_SIZEOF(float, float);
SET_SIZEOF(double, double);
// (potentially) variable sizes
SET_SIZEOF(bool, bool);
SET_SIZEOF(byte, unsigned char);
SET_SIZEOF(char, char);
SET_SIZEOF(uchar, unsigned char);
SET_SIZEOF(short, short);
SET_SIZEOF(ushort, unsigned short);
SET_SIZEOF(int, int);
SET_SIZEOF(uint, unsigned int);
SET_SIZEOF(long, long);
SET_SIZEOF(ulong, unsigned long);
SET_SIZEOF(longlong, long long);
SET_SIZEOF(ulonglong, unsigned long long);
SET_SIZEOF(pointer, char *);
SET_SIZEOF(size_t, size_t);
// size of a Persistent handle to a JS object
SET_SIZEOF(Object, Nan::Persistent<Object>);
// "alignof" map
Local<Object> amap = Nan::New<v8::Object>();
#define SET_ALIGNOF(name, type) \
struct s_##name { type a; }; \
amap->Set(Nan::New<v8::String>( #name ).ToLocalChecked(), Nan::New<v8::Uint32>(static_cast<uint32_t>(__alignof__(struct s_##name))));
SET_ALIGNOF(int8, int8_t);
SET_ALIGNOF(uint8, uint8_t);
SET_ALIGNOF(int16, int16_t);
SET_ALIGNOF(uint16, uint16_t);
SET_ALIGNOF(int32, int32_t);
SET_ALIGNOF(uint32, uint32_t);
SET_ALIGNOF(int64, int64_t);
SET_ALIGNOF(uint64, uint64_t);
SET_ALIGNOF(float, float);
SET_ALIGNOF(double, double);
SET_ALIGNOF(bool, bool);
SET_ALIGNOF(char, char);
SET_ALIGNOF(uchar, unsigned char);
SET_ALIGNOF(short, short);
SET_ALIGNOF(ushort, unsigned short);
SET_ALIGNOF(int, int);
SET_ALIGNOF(uint, unsigned int);
SET_ALIGNOF(long, long);
SET_ALIGNOF(ulong, unsigned long);
SET_ALIGNOF(longlong, long long);
SET_ALIGNOF(ulonglong, unsigned long long);
SET_ALIGNOF(pointer, char *);
SET_ALIGNOF(size_t, size_t);
SET_ALIGNOF(Object, Nan::Persistent<Object>);
// exports
target->Set(Nan::New<v8::String>("sizeof").ToLocalChecked(), smap);
target->Set(Nan::New<v8::String>("alignof").ToLocalChecked(), amap);
Nan::ForceSet(target, Nan::New<v8::String>("endianness").ToLocalChecked(), Nan::New<v8::String>(CheckEndianness()).ToLocalChecked(), static_cast<PropertyAttribute>(ReadOnly|DontDelete));
Nan::ForceSet(target, Nan::New<v8::String>("NULL").ToLocalChecked(), WrapNullPointer(), static_cast<PropertyAttribute>(ReadOnly|DontDelete));
Nan::SetMethod(target, "address", Address);
Nan::SetMethod(target, "hexAddress", HexAddress);
Nan::SetMethod(target, "isNull", IsNull);
Nan::SetMethod(target, "readObject", ReadObject);
Nan::SetMethod(target, "writeObject", WriteObject);
Nan::SetMethod(target, "readPointer", ReadPointer);
Nan::SetMethod(target, "writePointer", WritePointer);
Nan::SetMethod(target, "readInt64", ReadInt64);
Nan::SetMethod(target, "writeInt64", WriteInt64);
Nan::SetMethod(target, "readUInt64", ReadUInt64);
Nan::SetMethod(target, "writeUInt64", WriteUInt64);
Nan::SetMethod(target, "readCString", ReadCString);
Nan::SetMethod(target, "reinterpret", ReinterpretBuffer);
Nan::SetMethod(target, "reinterpretUntilZeros", ReinterpretBufferUntilZeros);
}
NODE_MODULE(binding, init);

52
node_modules/ref/test/address.js generated vendored Normal file
View File

@ -0,0 +1,52 @@
var ref = require('../')
var assert = require('assert')
var inspect = require('util').inspect
describe('address', function () {
var buf = new Buffer('hello')
it('should return 0 for the NULL pointer', function () {
assert.strictEqual(0, ref.address(ref.NULL))
})
it('should give a positive value for any other Buffer', function () {
var address = ref.address(buf)
assert.equal(typeof address, 'number')
assert(isFinite(address))
assert(address > 0)
})
it('should accept an offset value for the 2nd argument', function () {
var address = ref.address(buf)
assert.equal(address + 0, ref.address(buf, 0))
assert.equal(address + 1, ref.address(buf, 1))
assert.equal(address + 2, ref.address(buf, 2))
assert.equal(address + 3, ref.address(buf, 3))
assert.equal(address + 4, ref.address(buf, 4))
assert.equal(address + 5, ref.address(buf, 5))
})
it('should accept a negative offset value for the 2nd argument', function () {
var address = ref.address(buf)
assert.equal(address - 0, ref.address(buf, -0))
assert.equal(address - 1, ref.address(buf, -1))
assert.equal(address - 2, ref.address(buf, -2))
assert.equal(address - 3, ref.address(buf, -3))
assert.equal(address - 4, ref.address(buf, -4))
assert.equal(address - 5, ref.address(buf, -5))
})
it('should have an offset of zero when none is given', function () {
assert.equal(ref.address(buf), ref.address(buf, 0))
})
describe('inspect()', function () {
it('should overwrite the default Buffer#inspect() to print the memory address', function () {
assert(inspect(buf).indexOf(buf.hexAddress()) !== -1)
})
})
})

17
node_modules/ref/test/alloc.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
var assert = require('assert')
var ref = require('../')
describe('alloc()', function () {
it('should return a new Buffer of "bool" size', function () {
var buf = ref.alloc(ref.types.bool)
assert.equal(ref.sizeof.bool, buf.length)
})
it('should coerce string type names', function () {
var buf = ref.alloc('bool')
assert.strictEqual(ref.types.bool, buf.type)
})
})

36
node_modules/ref/test/bool.js generated vendored Normal file
View File

@ -0,0 +1,36 @@
var assert = require('assert')
var ref = require('../')
describe('bool', function () {
var buf = ref.alloc('bool')
it('should return JS "false" for a value of 0', function () {
buf[0] = 0
assert.strictEqual(false, ref.get(buf))
})
it('should return JS "true" for a value of 1', function () {
buf[0] = 1
assert.strictEqual(true, ref.get(buf))
})
it('should write a JS "false" value as 0', function () {
ref.set(buf, 0, false)
assert.strictEqual(0, buf[0])
})
it('should write a JS "true" value as 1', function () {
ref.set(buf, 0, true)
assert.strictEqual(1, buf[0])
})
it('should allow uint8 number values to be written to it', function () {
var val = 255
ref.set(buf, 0, val)
assert.strictEqual(true, ref.get(buf))
assert.strictEqual(val, buf[0])
})
})

17
node_modules/ref/test/char.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
var assert = require('assert')
var ref = require('../')
describe('char', function () {
it('should accept a JS String, and write the first char\'s code', function () {
var val = 'a'
var buf = ref.alloc('char', val)
assert.strictEqual(val.charCodeAt(0), buf.deref())
buf = ref.alloc('uchar', val)
assert.strictEqual(val.charCodeAt(0), buf.deref())
})
})

48
node_modules/ref/test/coerce.js generated vendored Normal file
View File

@ -0,0 +1,48 @@
var assert = require('assert')
var ref = require('../')
describe('coerce', function () {
it('should return `ref.types.void` for "void"', function () {
var type = ref.coerceType('void')
assert.strictEqual(ref.types.void, type)
})
it('should return a ref type when a "*" is present', function () {
var type = ref.coerceType('void *')
assert(type !== ref.types.void)
assert.equal(type.indirection, ref.types.void.indirection + 1)
})
it('should coerce the "type" property of a Buffer', function () {
var buf = new Buffer(ref.sizeof.int)
buf.type = 'int'
var type = ref.getType(buf)
assert.strictEqual(ref.types.int, type)
assert.strictEqual('int', buf.type)
})
it('should coerce "Object" to `ref.types.Object`', function () {
assert.strictEqual(ref.types.Object, ref.coerceType('Object'))
})
it('should coerce the optional type in `ref.get()`', function () {
var b = new Buffer(ref.sizeof.int8)
b[0] = 5
assert.strictEqual(5, ref.get(b, 0, 'int8'))
})
it('should coerce the optional type in `ref.set()`', function () {
var b = new Buffer(ref.sizeof.int8)
ref.set(b, 0, 5, 'int8')
assert.strictEqual(5, b[0])
})
it('should throw a TypeError if a "type" can not be inferred', function () {
assert.throws(function () {
ref.coerceType({ })
}, /could not determine a proper \"type\"/)
})
})

170
node_modules/ref/test/int64.js generated vendored Normal file
View File

@ -0,0 +1,170 @@
var assert = require('assert')
var ref = require('../')
describe('int64', function () {
var JS_MAX_INT = +9007199254740992
var JS_MIN_INT = -9007199254740992
it('should allow simple ints to be written and read', function () {
var buf = new Buffer(ref.sizeof.int64)
var val = 123456789
ref.writeInt64(buf, 0, val)
var rtn = ref.readInt64(buf, 0)
assert.equal(val, rtn)
})
it('should allow INT64_MAX to be written and read', function () {
var buf = new Buffer(ref.sizeof.int64)
var val = '9223372036854775807'
ref.writeInt64(buf, 0, val)
var rtn = ref.readInt64(buf, 0)
assert.equal(val, rtn)
})
it('should allow a hex String to be input (signed)', function () {
var buf = new Buffer(ref.sizeof.int64)
var val = '-0x1234567890'
ref.writeInt64(buf, 0, val)
var rtn = ref.readInt64(buf, 0)
assert.equal(parseInt(val, 16), rtn)
})
it('should allow an octal String to be input (signed)', function () {
var buf = new Buffer(ref.sizeof.int64)
var val = '-0777'
ref.writeInt64(buf, 0, val)
var rtn = ref.readInt64(buf, 0)
assert.equal(parseInt(val, 8), rtn)
})
it('should allow a hex String to be input (unsigned)', function () {
var buf = new Buffer(ref.sizeof.uint64)
var val = '0x1234567890'
ref.writeUInt64(buf, 0, val)
var rtn = ref.readUInt64(buf, 0)
assert.equal(parseInt(val, 16), rtn)
})
it('should allow an octal String to be input (unsigned)', function () {
var buf = new Buffer(ref.sizeof.uint64)
var val = '0777'
ref.writeUInt64(buf, 0, val)
var rtn = ref.readUInt64(buf, 0)
assert.equal(parseInt(val, 8), rtn)
})
it('should return a Number when reading JS_MIN_INT', function () {
var buf = new Buffer(ref.sizeof.int64)
ref.writeInt64(buf, 0, JS_MIN_INT)
var rtn = ref.readInt64(buf, 0)
assert.equal('number', typeof rtn)
assert.equal(JS_MIN_INT, rtn)
})
it('should return a Number when reading JS_MAX_INT', function () {
var buf = new Buffer(ref.sizeof.int64)
ref.writeInt64(buf, 0, JS_MAX_INT)
var rtn = ref.readInt64(buf, 0)
assert.equal('number', typeof rtn)
assert.equal(JS_MAX_INT, rtn)
})
it('should return a String when reading JS_MAX_INT+1', function () {
var buf = new Buffer(ref.sizeof.int64)
var plus_one = '9007199254740993'
ref.writeInt64(buf, 0, plus_one)
var rtn = ref.readInt64(buf, 0)
assert.equal('string', typeof rtn)
assert.equal(plus_one, rtn)
})
it('should return a String when reading JS_MIN_INT-1', function () {
var buf = new Buffer(ref.sizeof.int64)
var minus_one = '-9007199254740993'
ref.writeInt64(buf, 0, minus_one)
var rtn = ref.readInt64(buf, 0)
assert.equal('string', typeof rtn)
assert.equal(minus_one, rtn)
})
it('should return a Number when reading 0, even when written as a String', function () {
var buf = new Buffer(ref.sizeof.int64)
var zero = '0'
ref.writeInt64(buf, 0, zero)
var rtn = ref.readInt64(buf, 0)
assert.equal('number', typeof rtn)
assert.equal(0, rtn)
})
it('should throw a "no digits" Error when writing an invalid String (signed)', function () {
assert.throws(function () {
var buf = new Buffer(ref.sizeof.int64)
ref.writeInt64(buf, 0, 'foo')
}, /no digits we found in input String/)
})
it('should throw a "no digits" Error when writing an invalid String (unsigned)', function () {
assert.throws(function () {
var buf = new Buffer(ref.sizeof.uint64)
ref.writeUInt64(buf, 0, 'foo')
}, /no digits we found in input String/)
})
it('should throw an "out of range" Error when writing an invalid String (signed)', function () {
var e;
try {
var buf = new Buffer(ref.sizeof.int64)
ref.writeInt64(buf, 0, '10000000000000000000000000')
} catch (_e) {
e = _e;
}
assert(/input String numerical value out of range/.test(e.message));
})
it('should throw an "out of range" Error when writing an invalid String (unsigned)', function () {
var e;
try {
var buf = new Buffer(ref.sizeof.uint64)
ref.writeUInt64(buf, 0, '10000000000000000000000000')
} catch (_e) {
e = _e;
}
assert(/input String numerical value out of range/.test(e.message));
})
it('should throw an Error when reading an int64_t from the NULL pointer', function () {
assert.throws(function () {
ref.readInt64(ref.NULL)
})
})
it('should throw an Error when reading an uint64_t from the NULL pointer', function () {
assert.throws(function () {
ref.readUInt64(ref.NULL)
})
})
;['LE', 'BE'].forEach(function (endianness) {
describe(endianness, function () {
it('should read and write a signed ' + endianness + ' 64-bit integer', function () {
var val = -123456789
var buf = new Buffer(ref.sizeof.int64)
ref['writeInt64' + endianness](buf, 0, val)
assert.equal(val, ref['readInt64' + endianness](buf, 0))
})
it('should read and write an unsigned ' + endianness + ' 64-bit integer', function () {
var val = 123456789
var buf = new Buffer(ref.sizeof.uint64)
ref['writeUInt64' + endianness](buf, 0, val)
assert.equal(val, ref['readUInt64' + endianness](buf, 0))
})
})
})
})

24
node_modules/ref/test/iojs3issue.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
var assert = require('assert')
var ref = require('../')
// This will check if the new Buffer implementation behaves like the pre io.js 3.0 one did:
describe('iojs3issue', function () {
it('should not crash', function() {
for (var i = 0; i < 10; i++) {
gc()
var buf = new Buffer(8)
buf.fill(0)
var buf2 = ref.ref(buf)
var buf3 = ref.deref(buf2)
}
})
it('should not crash too', function() {
for (var i = 0; i < 10; i++) {
gc()
var buf = new Buffer(7)
buf.fill(0)
var buf2 = ref.ref(buf)
var buf3 = ref.deref(buf2)
}
})
})

16
node_modules/ref/test/isNull.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
var assert = require('assert')
var ref = require('../')
describe('isNull', function () {
it('should return "true" for the NULL pointer', function () {
assert.strictEqual(true, ref.isNull(ref.NULL))
})
it('should return "false" for a valid Buffer', function () {
var buf = new Buffer('hello')
assert.strictEqual(false, ref.isNull(buf))
})
})

74
node_modules/ref/test/object.js generated vendored Normal file
View File

@ -0,0 +1,74 @@
var assert = require('assert')
var weak = require('weak')
var ref = require('../')
describe('Object', function () {
var obj = {
foo: 'bar'
, test: Math.random()
, now: new Date()
}
beforeEach(gc)
it('should write and read back an Object in a Buffer', function () {
var buf = new Buffer(ref.sizeof.Object)
ref.writeObject(buf, 0, obj)
var out = ref.readObject(buf)
assert.strictEqual(obj, out)
assert.deepEqual(obj, out)
})
it('should retain references to written Objects', function (done) {
var o_gc = false
var buf_gc = false
var o = { foo: 'bar' }
var buf = new Buffer(ref.sizeof.Object)
weak(o, function () { o_gc = true })
weak(buf, function () { buf_gc = true })
ref.writeObject(buf, 0, o)
assert(!o_gc, '"o" has been garbage collected too soon')
assert(!buf_gc, '"buf" has been garbage collected too soon')
// try to GC `o`
o = null
gc()
assert(!o_gc, '"o" has been garbage collected too soon')
assert(!buf_gc, '"buf" has been garbage collected too soon')
// now GC `buf`
buf = null
setImmediate(function () {
gc()
assert(buf_gc, '"buf" has not been garbage collected')
assert(o_gc, '"o" has not been garbage collected')
done()
});
})
it('should throw an Error when reading an Object from the NULL pointer', function () {
assert.throws(function () {
ref.NULL.readObject()
})
})
describe('offset', function () {
it('should read two Objects next to each other in memory', function () {
var buf = new Buffer(ref.sizeof.pointer * 2)
var a = {}
var b = {}
buf.writeObject(a, 0 * ref.sizeof.pointer)
buf.writeObject(b, 1 * ref.sizeof.pointer)
var _a = buf.readObject(0 * ref.sizeof.pointer)
var _b = buf.readObject(1 * ref.sizeof.pointer)
assert.strictEqual(a, _a)
assert.strictEqual(b, _b)
})
})
})

80
node_modules/ref/test/pointer.js generated vendored Normal file
View File

@ -0,0 +1,80 @@
var assert = require('assert')
var weak = require('weak')
var ref = require('../')
describe('pointer', function () {
var test = new Buffer('hello world')
beforeEach(gc)
it('should write and read back a pointer (Buffer) in a Buffer', function () {
var buf = new Buffer(ref.sizeof.pointer)
ref.writePointer(buf, 0, test)
var out = ref.readPointer(buf, 0, test.length)
assert.strictEqual(out.length, test.length)
for (var i = 0, l = out.length; i < l; i++) {
assert.strictEqual(out[i], test[i])
}
assert.strictEqual(ref.address(out), ref.address(test))
})
it('should retain references to a written pointer in a Buffer', function (done) {
var child_gc = false
var parent_gc = false
var child = new Buffer('a pointer holding some data...')
var parent = new Buffer(ref.sizeof.pointer)
weak(child, function () { child_gc = true })
weak(parent, function () { parent_gc = true })
ref.writePointer(parent, 0, child)
assert(!child_gc, '"child" has been garbage collected too soon')
assert(!parent_gc, '"parent" has been garbage collected too soon')
// try to GC `child`
child = null
gc()
assert(!child_gc, '"child" has been garbage collected too soon')
assert(!parent_gc, '"parent" has been garbage collected too soon')
// now GC `parent`
parent = null
setImmediate(function () {
gc()
assert(parent_gc, '"parent" has not been garbage collected')
assert(child_gc, '"child" has not been garbage collected')
done()
});
})
it('should throw an Error when reading from the NULL pointer', function () {
assert.throws(function () {
ref.NULL.readPointer()
})
})
it('should return a 0-length Buffer when reading a NULL pointer', function () {
var buf = new Buffer(ref.sizeof.pointer)
ref.writePointer(buf, 0, ref.NULL)
var out = ref.readPointer(buf, 0, 100)
assert.strictEqual(out.length, 0)
})
describe('offset', function () {
it('should read two pointers next to each other in memory', function () {
var buf = new Buffer(ref.sizeof.pointer * 2)
var a = new Buffer('hello')
var b = new Buffer('world')
buf.writePointer(a, 0 * ref.sizeof.pointer)
buf.writePointer(b, 1 * ref.sizeof.pointer)
var _a = buf.readPointer(0 * ref.sizeof.pointer)
var _b = buf.readPointer(1 * ref.sizeof.pointer)
assert.equal(a.address(), _a.address())
assert.equal(b.address(), _b.address())
})
})
})

61
node_modules/ref/test/ref-deref.js generated vendored Normal file
View File

@ -0,0 +1,61 @@
var assert = require('assert')
var ref = require('../')
describe('ref(), deref()', function () {
beforeEach(gc)
it('should work 1 layer deep', function () {
var test = new Buffer('one layer deep')
var one = ref.ref(test)
var _test = ref.deref(one)
assert.equal(test.length, _test.length)
assert.equal(test.toString(), _test.toString())
})
it('should work 2 layers deep', function () {
var test = new Buffer('two layers deep')
var one = ref.ref(test)
var two = ref.ref(one)
var _one = ref.deref(two)
var _test = ref.deref(_one)
assert.equal(ref.address(one), ref.address(_one))
assert.equal(ref.address(test), ref.address(_test))
assert.equal(one.length, _one.length)
assert.equal(test.length, _test.length)
assert.equal(test.toString(), _test.toString())
})
it('should throw when derefing a Buffer with no "type"', function () {
var test = new Buffer('???')
assert.throws(function () {
ref.deref(test)
}, /unknown "type"/)
})
it('should throw when derefing a Buffer with no "type" 2', function () {
var test = new Buffer('???')
var r = ref.ref(test)
var _test = ref.deref(r)
assert.equal(ref.address(test), ref.address(_test))
assert.throws(function () {
ref.deref(_test)
}, /unknown "type"/)
})
it('should deref() a "char" type properly', function () {
var test = new Buffer(ref.sizeof.char)
test.type = ref.types.char
test[0] = 50
assert.equal(50, ref.deref(test))
test[0] = 127
assert.equal(127, ref.deref(test))
})
it('should not throw when calling ref()/deref() on a `void` type', function () {
var test = ref.alloc(ref.types.void)
assert.strictEqual(null, test.deref())
})
})

57
node_modules/ref/test/reinterpret.js generated vendored Normal file
View File

@ -0,0 +1,57 @@
var assert = require('assert')
var weak = require('weak')
var ref = require('../')
describe('reinterpret()', function () {
beforeEach(gc)
it('should return a new Buffer instance at the same address', function () {
var buf = new Buffer('hello world')
var small = buf.slice(0, 0)
assert.strictEqual(0, small.length)
assert.strictEqual(buf.address(), small.address())
var reinterpreted = small.reinterpret(buf.length)
assert.strictEqual(buf.address(), reinterpreted.address())
assert.strictEqual(buf.length, reinterpreted.length)
assert.strictEqual(buf.toString(), reinterpreted.toString())
})
it('should return a new Buffer instance starting at the offset address', function () {
var buf = new Buffer('hello world')
var offset = 3
var small = buf.slice(offset, buf.length)
assert.strictEqual(buf.length - offset, small.length)
assert.strictEqual(buf.address() + offset, small.address())
var reinterpreted = buf.reinterpret(small.length, offset)
assert.strictEqual(small.address(), reinterpreted.address())
assert.strictEqual(small.length, reinterpreted.length)
assert.strictEqual(small.toString(), reinterpreted.toString())
})
it('should retain a reference to the original Buffer when reinterpreted', function () {
var origGCd = false
var otherGCd = false
var buf = new Buffer(1)
weak(buf, function () { origGCd = true })
var other = buf.reinterpret(0)
weak(other, function () { otherGCd = true })
assert(!origGCd, '"buf" has been garbage collected too soon')
assert(!otherGCd, '"other" has been garbage collected too soon')
// try to GC `buf`
buf = null
gc()
assert(!origGCd, '"buf" has been garbage collected too soon')
assert(!otherGCd, '"other" has been garbage collected too soon')
// now GC `other`
other = null
gc()
assert(otherGCd, '"other" has not been garbage collected')
assert(origGCd, '"buf" has not been garbage collected')
})
})

45
node_modules/ref/test/reinterpretUntilZeros.js generated vendored Normal file
View File

@ -0,0 +1,45 @@
var fs = require('fs')
var assert = require('assert')
var weak = require('weak')
var ref = require('../')
describe('reinterpretUntilZeros()', function () {
beforeEach(gc)
it('should return a new Buffer instance up until the first 0', function () {
var buf = new Buffer('hello\0world')
var buf2 = buf.reinterpretUntilZeros(1)
assert.equal(buf2.length, 'hello'.length)
assert.equal(buf2.toString(), 'hello')
})
it('should return a new Buffer instance up until the first 0 starting from offset', function () {
var buf = new Buffer('hello\0world')
var buf2 = buf.reinterpretUntilZeros(1, 3)
assert.equal(buf2.length, 'lo'.length)
assert.equal(buf2.toString(), 'lo')
})
it('should return a new Buffer instance up until the first 2-byte sequence of 0s', function () {
var str = 'hello world'
var buf = new Buffer(50)
var len = buf.write(str, 'ucs2')
buf.writeInt16LE(0, len) // NULL terminate the string
var buf2 = buf.reinterpretUntilZeros(2)
assert.equal(str.length, buf2.length / 2)
assert.equal(buf2.toString('ucs2'), str)
})
it('should return a large Buffer instance > 10,000 bytes with UTF16-LE char bytes', function () {
var data = fs.readFileSync(__dirname + '/utf16le.bin');
var strBuf = ref.reinterpretUntilZeros(data, 2);
assert(strBuf.length > 10000);
var str = strBuf.toString('ucs2');
// the data in `utf16le.bin` should be a JSON parsable string
assert(JSON.parse(str));
})
})

98
node_modules/ref/test/string.js generated vendored Normal file
View File

@ -0,0 +1,98 @@
var assert = require('assert')
var ref = require('../')
describe('C string', function () {
describe('readCString()', function () {
it('should return "" for a Buffer containing "\\0"', function () {
var buf = new Buffer('\0')
assert.strictEqual('', buf.readCString(0))
})
it('should return "hello" for a Buffer containing "hello\\0world"', function () {
var buf = new Buffer('hello\0world')
assert.strictEqual('hello', buf.readCString(0))
})
it('should throw an Error when reading from the NULL pointer', function () {
assert.throws(function () {
ref.NULL.readCString()
})
})
})
describe('writeCString()', function () {
it('should write a C string (NULL terminated) to a Buffer', function () {
var buf = new Buffer(20)
var str = 'hello world'
buf.writeCString(str)
for (var i = 0; i < str.length; i++) {
assert.equal(str.charCodeAt(i), buf[i])
}
assert.equal(0, buf[str.length])
})
})
describe('allocCString()', function () {
it('should return a new Buffer containing the given string', function () {
var buf = ref.allocCString('hello world')
assert.strictEqual('hello world', buf.readCString())
})
it('should return the NULL pointer for `null` values', function () {
var buf = ref.allocCString(null)
assert(buf.isNull())
assert.strictEqual(0, buf.address())
})
it('should return the NULL pointer for `undefined` values', function () {
var buf = ref.allocCString(undefined)
assert(buf.isNull())
assert.strictEqual(0, buf.address())
})
it('should return the NULL pointer for a NULL pointer Buffer', function () {
var buf = ref.allocCString(ref.NULL)
assert(buf.isNull())
assert.strictEqual(0, buf.address())
})
})
describe('CString', function () {
it('should return JS `null` when given a pointer pointing to NULL', function () {
var buf = ref.alloc(ref.types.CString)
buf.writePointer(ref.NULL)
assert.strictEqual(null, buf.deref())
// another version of the same test
assert.strictEqual(null, ref.get(ref.NULL_POINTER, 0, ref.types.CString))
})
it('should read a utf8 string from a Buffer', function () {
var str = 'hello world'
var buf = ref.alloc(ref.types.CString)
buf.writePointer(new Buffer(str + '\0'))
assert.strictEqual(str, buf.deref())
})
// https://github.com/node-ffi/node-ffi/issues/169
it('should set a Buffer as backing store', function () {
var str = 'hey!'
var store = new Buffer(str + '\0')
var buf = ref.alloc(ref.types.CString)
ref.set(buf, 0, store)
assert.equal(str, ref.get(buf, 0))
})
})
})

86
node_modules/ref/test/types.js generated vendored Normal file
View File

@ -0,0 +1,86 @@
var assert = require('assert')
var ref = require('../')
describe('types', function () {
describe('refType()', function () {
it('should return a new "type" with its `indirection` level increased by 1', function () {
var int = ref.types.int
var intPtr = ref.refType(int)
assert.equal(int.size, intPtr.size)
assert.equal(int.indirection + 1, intPtr.indirection)
})
it('should coerce string types', function () {
var intPtr = ref.refType('int')
assert.equal(2, intPtr.indirection)
assert.equal(intPtr.size, ref.types.int.size)
})
it('should override and update a read-only name property', function () {
// a type similar to ref-struct's StructType
// used for types refType name property test
function StructType() {}
StructType.size = 0
StructType.indirection = 0
// read-only name property
assert.equal(StructType.name, 'StructType')
try {
StructType.name = 'foo'
} catch (err) {
// ignore
}
assert.equal(StructType.name, 'StructType')
// name property should be writable and updated
var newObj = ref.refType(StructType)
var newProp = Object.getOwnPropertyDescriptor(newObj, 'name')
assert.equal(newProp.writable, true)
assert.equal(newObj.name, 'StructType*')
})
})
describe('derefType()', function () {
it('should return a new "type" with its `indirection` level decreased by 1', function () {
var intPtr = Object.create(ref.types.int)
intPtr.indirection++
var int = ref.derefType(intPtr)
assert.equal(intPtr.size, intPtr.size)
assert.equal(intPtr.indirection - 1, int.indirection)
})
it('should throw an Error when given a "type" with its `indirection` level already at 1', function () {
assert.throws(function () {
ref.derefType(ref.types.int)
})
})
})
describe('size', function () {
Object.keys(ref.types).forEach(function (name) {
if (name === 'void') return
it('sizeof(' + name + ') should be >= 1', function () {
var type = ref.types[name]
assert.equal('number', typeof type.size)
assert(type.size >= 1)
})
})
})
describe('alignment', function () {
Object.keys(ref.types).forEach(function (name) {
if (name === 'void') return
it('alignof(' + name + ') should be >= 1', function () {
var type = ref.types[name]
assert.equal('number', typeof type.alignment)
assert(type.alignment >= 1)
})
})
})
})

BIN
node_modules/ref/test/utf16le.bin generated vendored Normal file

Binary file not shown.