mqtt stuff added
This commit is contained in:
143
node_modules/path-dirname/index.js
generated
vendored
Normal file
143
node_modules/path-dirname/index.js
generated
vendored
Normal file
@ -0,0 +1,143 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var inspect = require('util').inspect;
|
||||
|
||||
function assertPath(path) {
|
||||
if (typeof path !== 'string') {
|
||||
throw new TypeError('Path must be a string. Received ' + inspect(path));
|
||||
}
|
||||
}
|
||||
|
||||
function posix(path) {
|
||||
assertPath(path);
|
||||
if (path.length === 0)
|
||||
return '.';
|
||||
var code = path.charCodeAt(0);
|
||||
var hasRoot = (code === 47/*/*/);
|
||||
var end = -1;
|
||||
var matchedSlash = true;
|
||||
for (var i = path.length - 1; i >= 1; --i) {
|
||||
code = path.charCodeAt(i);
|
||||
if (code === 47/*/*/) {
|
||||
if (!matchedSlash) {
|
||||
end = i;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// We saw the first non-path separator
|
||||
matchedSlash = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (end === -1)
|
||||
return hasRoot ? '/' : '.';
|
||||
if (hasRoot && end === 1)
|
||||
return '//';
|
||||
return path.slice(0, end);
|
||||
}
|
||||
|
||||
function win32(path) {
|
||||
assertPath(path);
|
||||
var len = path.length;
|
||||
if (len === 0)
|
||||
return '.';
|
||||
var rootEnd = -1;
|
||||
var end = -1;
|
||||
var matchedSlash = true;
|
||||
var offset = 0;
|
||||
var code = path.charCodeAt(0);
|
||||
|
||||
// Try to match a root
|
||||
if (len > 1) {
|
||||
if (code === 47/*/*/ || code === 92/*\*/) {
|
||||
// Possible UNC root
|
||||
|
||||
rootEnd = offset = 1;
|
||||
|
||||
code = path.charCodeAt(1);
|
||||
if (code === 47/*/*/ || code === 92/*\*/) {
|
||||
// Matched double path separator at beginning
|
||||
var j = 2;
|
||||
var last = j;
|
||||
// Match 1 or more non-path separators
|
||||
for (; j < len; ++j) {
|
||||
code = path.charCodeAt(j);
|
||||
if (code === 47/*/*/ || code === 92/*\*/)
|
||||
break;
|
||||
}
|
||||
if (j < len && j !== last) {
|
||||
// Matched!
|
||||
last = j;
|
||||
// Match 1 or more path separators
|
||||
for (; j < len; ++j) {
|
||||
code = path.charCodeAt(j);
|
||||
if (code !== 47/*/*/ && code !== 92/*\*/)
|
||||
break;
|
||||
}
|
||||
if (j < len && j !== last) {
|
||||
// Matched!
|
||||
last = j;
|
||||
// Match 1 or more non-path separators
|
||||
for (; j < len; ++j) {
|
||||
code = path.charCodeAt(j);
|
||||
if (code === 47/*/*/ || code === 92/*\*/)
|
||||
break;
|
||||
}
|
||||
if (j === len) {
|
||||
// We matched a UNC root only
|
||||
return path;
|
||||
}
|
||||
if (j !== last) {
|
||||
// We matched a UNC root with leftovers
|
||||
|
||||
// Offset by 1 to include the separator after the UNC root to
|
||||
// treat it as a "normal root" on top of a (UNC) root
|
||||
rootEnd = offset = j + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ((code >= 65/*A*/ && code <= 90/*Z*/) ||
|
||||
(code >= 97/*a*/ && code <= 122/*z*/)) {
|
||||
// Possible device root
|
||||
|
||||
code = path.charCodeAt(1);
|
||||
if (path.charCodeAt(1) === 58/*:*/) {
|
||||
rootEnd = offset = 2;
|
||||
if (len > 2) {
|
||||
code = path.charCodeAt(2);
|
||||
if (code === 47/*/*/ || code === 92/*\*/)
|
||||
rootEnd = offset = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (code === 47/*/*/ || code === 92/*\*/) {
|
||||
return path[0];
|
||||
}
|
||||
|
||||
for (var i = len - 1; i >= offset; --i) {
|
||||
code = path.charCodeAt(i);
|
||||
if (code === 47/*/*/ || code === 92/*\*/) {
|
||||
if (!matchedSlash) {
|
||||
end = i;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// We saw the first non-path separator
|
||||
matchedSlash = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (end === -1) {
|
||||
if (rootEnd === -1)
|
||||
return '.';
|
||||
else
|
||||
end = rootEnd;
|
||||
}
|
||||
return path.slice(0, end);
|
||||
}
|
||||
|
||||
module.exports = process.platform === 'win32' ? win32 : posix;
|
||||
module.exports.posix = posix;
|
||||
module.exports.win32 = win32;
|
22
node_modules/path-dirname/license
generated
vendored
Normal file
22
node_modules/path-dirname/license
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Elan Shanker and Node.js contributors. All rights reserved.
|
||||
|
||||
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.
|
63
node_modules/path-dirname/package.json
generated
vendored
Normal file
63
node_modules/path-dirname/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "path-dirname@^1.0.0",
|
||||
"_id": "path-dirname@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=",
|
||||
"_location": "/path-dirname",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "path-dirname@^1.0.0",
|
||||
"name": "path-dirname",
|
||||
"escapedName": "path-dirname",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/glob-parent"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz",
|
||||
"_shasum": "cc33d24d525e099a5388c0336c6e32b9160609e0",
|
||||
"_spec": "path-dirname@^1.0.0",
|
||||
"_where": "/home/wn/workspace-node/PiAlive/node_modules/glob-parent",
|
||||
"author": {
|
||||
"name": "Elan Shanker"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/es128/path-dirname/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Node.js path.dirname() ponyfill",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/es128/path-dirname#readme",
|
||||
"keywords": [
|
||||
"dirname",
|
||||
"dir",
|
||||
"path",
|
||||
"paths",
|
||||
"file",
|
||||
"built-in",
|
||||
"util",
|
||||
"utils",
|
||||
"core",
|
||||
"stdlib",
|
||||
"ponyfill",
|
||||
"polyfill",
|
||||
"shim"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "path-dirname",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/es128/path-dirname.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
53
node_modules/path-dirname/readme.md
generated
vendored
Normal file
53
node_modules/path-dirname/readme.md
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
# path-dirname [](https://travis-ci.org/es128/path-dirname)
|
||||
|
||||
> Node.js [`path.dirname()`](https://nodejs.org/api/path.html#path_path_dirname_path) [ponyfill](https://ponyfill.com)
|
||||
|
||||
This was needed in order to expose `path.posix.dirname()` on Node.js v0.10
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save path-dirname
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pathDirname = require('path-dirname');
|
||||
|
||||
pathDirname('/home/foo');
|
||||
//=> '/home'
|
||||
pathDirname('C:\\Users\\foo');
|
||||
//=> 'C:\\Users'
|
||||
pathDirname('foo');
|
||||
//=> '.'
|
||||
pathDirname('foo/bar');
|
||||
//=> 'foo'
|
||||
|
||||
//Using posix version for consistent output when dealing with glob escape chars
|
||||
pathDirname.win32('C:\\Users\\foo/\\*bar');
|
||||
//=> 'C:\\Users\\foo/'
|
||||
pathDirname.posix('C:\\Users\\foo/\\*bar');
|
||||
//=> 'C:\\Users\\foo'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
See the [`path.dirname()` docs](https://nodejs.org/api/path.html#path_path_dirname_path).
|
||||
|
||||
### pathDirname(path)
|
||||
|
||||
### pathDirname.posix(path)
|
||||
|
||||
POSIX specific version.
|
||||
|
||||
### pathDirname.win32(path)
|
||||
|
||||
Windows specific version.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
Reference in New Issue
Block a user