feat: docker compose maybe
This commit is contained in:
21
node_modules/globalyzer/license
generated
vendored
Normal file
21
node_modules/globalyzer/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Terkel Gjervig Nielsen
|
||||
|
||||
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.
|
28
node_modules/globalyzer/package.json
generated
vendored
Normal file
28
node_modules/globalyzer/package.json
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "globalyzer",
|
||||
"version": "0.1.0",
|
||||
"description": "Detects and extract the glob part of a string",
|
||||
"main": "src/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/terkelg/globalyzer"
|
||||
},
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"keywords": [
|
||||
"glob",
|
||||
"analyzer",
|
||||
"base",
|
||||
"detect"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "tape test/*.js | tap-spec"
|
||||
},
|
||||
"author": "Terkel Gjervig",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"tap-spec": "^4.1.1",
|
||||
"tape": "^4.9.0"
|
||||
}
|
||||
}
|
57
node_modules/globalyzer/readme.md
generated
vendored
Normal file
57
node_modules/globalyzer/readme.md
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
# globalyzer
|
||||
|
||||
> Detect and extract the glob part of a string
|
||||
|
||||
Utility to detect if a string contains a glob and then split it in a glob and none-glob part.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install globalyzer --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const globalyzer = require('globalyzer');
|
||||
|
||||
globalyzer('foo/bar/.git/');
|
||||
// => { base: 'foo/bar/.git/', glob: '', isGlob: false }
|
||||
|
||||
globalyzer('foo/bar/**/baz');
|
||||
// => { base: 'foo/bar', glob: '**/baz', isGlob: true }
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### globalyzer(glob, options)
|
||||
|
||||
Type: `function`<br>
|
||||
Returns: `{ base, glob, isGlob }`
|
||||
|
||||
Returns an object with the (non-glob) base path and the actual pattern.
|
||||
|
||||
#### options.strict
|
||||
|
||||
Type: `Boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Be strict about what's a glob and what's not
|
||||
|
||||
|
||||
#### glob
|
||||
|
||||
Type: `String`
|
||||
|
||||
Glob string to analyze.
|
||||
|
||||
|
||||
## Credit
|
||||
|
||||
This is a fork of [is-glob](https://github.com/micromatch/is-glob) and [glob-base](https://github.com/micromatch/glob-base)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Terkel Gjervig](https://terkel.com)
|
BIN
node_modules/globalyzer/src/.DS_Store
generated
vendored
Normal file
BIN
node_modules/globalyzer/src/.DS_Store
generated
vendored
Normal file
Binary file not shown.
96
node_modules/globalyzer/src/index.js
generated
vendored
Normal file
96
node_modules/globalyzer/src/index.js
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
'use strict';
|
||||
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const isWin = os.platform() === 'win32';
|
||||
|
||||
const CHARS = { '{': '}', '(': ')', '[': ']'};
|
||||
const STRICT = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\)|(\\).|([@?!+*]\(.*\)))/;
|
||||
const RELAXED = /\\(.)|(^!|[*?{}()[\]]|\(\?)/;
|
||||
|
||||
/**
|
||||
* Detect if a string cointains glob
|
||||
* @param {String} str Input string
|
||||
* @param {Object} [options] Configuration object
|
||||
* @param {Boolean} [options.strict=true] Use relaxed regex if true
|
||||
* @returns {Boolean} true if string contains glob
|
||||
*/
|
||||
function isglob(str, { strict = true } = {}) {
|
||||
if (str === '') return false;
|
||||
let match, rgx = strict ? STRICT : RELAXED;
|
||||
|
||||
while ((match = rgx.exec(str))) {
|
||||
if (match[2]) return true;
|
||||
let idx = match.index + match[0].length;
|
||||
|
||||
// if an open bracket/brace/paren is escaped,
|
||||
// set the index to the next closing character
|
||||
let open = match[1];
|
||||
let close = open ? CHARS[open] : null;
|
||||
if (open && close) {
|
||||
let n = str.indexOf(close, idx);
|
||||
if (n !== -1) idx = n + 1;
|
||||
}
|
||||
|
||||
str = str.slice(idx);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find the static part of a glob-path,
|
||||
* split path and return path part
|
||||
* @param {String} str Path/glob string
|
||||
* @returns {String} static path section of glob
|
||||
*/
|
||||
function parent(str, { strict = false } = {}) {
|
||||
if (isWin && str.includes('/'))
|
||||
str = str.split('\\').join('/');
|
||||
|
||||
// special case for strings ending in enclosure containing path separator
|
||||
if (/[\{\[].*[\/]*.*[\}\]]$/.test(str)) str += '/';
|
||||
|
||||
// preserves full path in case of trailing path separator
|
||||
str += 'a';
|
||||
|
||||
do {str = path.dirname(str)}
|
||||
while (isglob(str, {strict}) || /(^|[^\\])([\{\[]|\([^\)]+$)/.test(str));
|
||||
|
||||
// remove escape chars and return result
|
||||
return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Parse a glob path, and split it by static/glob part
|
||||
* @param {String} pattern String path
|
||||
* @param {Object} [opts] Options
|
||||
* @param {Object} [opts.strict=false] Use strict parsing
|
||||
* @returns {Object} object with parsed path
|
||||
*/
|
||||
function globalyzer(pattern, opts = {}) {
|
||||
let base = parent(pattern, opts);
|
||||
let isGlob = isglob(pattern, opts);
|
||||
let glob;
|
||||
|
||||
if (base != '.') {
|
||||
glob = pattern.substr(base.length);
|
||||
if (glob.startsWith('/')) glob = glob.substr(1);
|
||||
} else {
|
||||
glob = pattern;
|
||||
}
|
||||
|
||||
if (!isGlob) {
|
||||
base = path.dirname(pattern);
|
||||
glob = base !== '.' ? pattern.substr(base.length) : pattern;
|
||||
}
|
||||
|
||||
if (glob.startsWith('./')) glob = glob.substr(2);
|
||||
if (glob.startsWith('/')) glob = glob.substr(1);
|
||||
|
||||
return { base, glob, isGlob };
|
||||
}
|
||||
|
||||
|
||||
module.exports = globalyzer;
|
Reference in New Issue
Block a user