@push.rocks/smartmatch 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_bundle/bundle.js +115 -0
- package/dist_bundle/bundle.js.map +7 -0
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/index.d.ts +5 -0
- package/dist_ts/index.js +10 -0
- package/dist_ts/smartmatch.plugins.d.ts +2 -0
- package/dist_ts/smartmatch.plugins.js +4 -0
- package/license +19 -0
- package/npmextra.json +18 -0
- package/package.json +42 -0
- package/readme.md +39 -0
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/index.ts +12 -0
- package/ts/smartmatch.plugins.ts +4 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// node_modules/matcher/index.js
|
|
8
|
+
var matcher_exports = {};
|
|
9
|
+
__export(matcher_exports, {
|
|
10
|
+
isMatch: () => isMatch,
|
|
11
|
+
matcher: () => matcher
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// node_modules/matcher/node_modules/escape-string-regexp/index.js
|
|
15
|
+
function escapeStringRegexp(string) {
|
|
16
|
+
if (typeof string !== "string") {
|
|
17
|
+
throw new TypeError("Expected a string");
|
|
18
|
+
}
|
|
19
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// node_modules/matcher/index.js
|
|
23
|
+
var regexpCache = /* @__PURE__ */ new Map();
|
|
24
|
+
var sanitizeArray = (input, inputName) => {
|
|
25
|
+
if (!Array.isArray(input)) {
|
|
26
|
+
switch (typeof input) {
|
|
27
|
+
case "string":
|
|
28
|
+
input = [input];
|
|
29
|
+
break;
|
|
30
|
+
case "undefined":
|
|
31
|
+
input = [];
|
|
32
|
+
break;
|
|
33
|
+
default:
|
|
34
|
+
throw new TypeError(`Expected '${inputName}' to be a string or an array, but got a type of '${typeof input}'`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return input.filter((string) => {
|
|
38
|
+
if (typeof string !== "string") {
|
|
39
|
+
if (typeof string === "undefined") {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
throw new TypeError(`Expected '${inputName}' to be an array of strings, but found a type of '${typeof string}' in the array`);
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var makeRegexp = (pattern, options) => {
|
|
48
|
+
options = {
|
|
49
|
+
caseSensitive: false,
|
|
50
|
+
...options
|
|
51
|
+
};
|
|
52
|
+
const cacheKey = pattern + JSON.stringify(options);
|
|
53
|
+
if (regexpCache.has(cacheKey)) {
|
|
54
|
+
return regexpCache.get(cacheKey);
|
|
55
|
+
}
|
|
56
|
+
const negated = pattern[0] === "!";
|
|
57
|
+
if (negated) {
|
|
58
|
+
pattern = pattern.slice(1);
|
|
59
|
+
}
|
|
60
|
+
pattern = escapeStringRegexp(pattern).replace(/\\\*/g, "[\\s\\S]*");
|
|
61
|
+
const regexp = new RegExp(`^${pattern}$`, options.caseSensitive ? "" : "i");
|
|
62
|
+
regexp.negated = negated;
|
|
63
|
+
regexpCache.set(cacheKey, regexp);
|
|
64
|
+
return regexp;
|
|
65
|
+
};
|
|
66
|
+
var baseMatcher = (inputs, patterns, options, firstMatchOnly) => {
|
|
67
|
+
inputs = sanitizeArray(inputs, "inputs");
|
|
68
|
+
patterns = sanitizeArray(patterns, "patterns");
|
|
69
|
+
if (patterns.length === 0) {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
patterns = patterns.map((pattern) => makeRegexp(pattern, options));
|
|
73
|
+
const { allPatterns } = options || {};
|
|
74
|
+
const result = [];
|
|
75
|
+
for (const input of inputs) {
|
|
76
|
+
let matches;
|
|
77
|
+
const didFit = [...patterns].fill(false);
|
|
78
|
+
for (const [index, pattern] of patterns.entries()) {
|
|
79
|
+
if (pattern.test(input)) {
|
|
80
|
+
didFit[index] = true;
|
|
81
|
+
matches = !pattern.negated;
|
|
82
|
+
if (!matches) {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (!(matches === false || matches === void 0 && patterns.some((pattern) => !pattern.negated) || allPatterns && didFit.some((yes, index) => !yes && !patterns[index].negated))) {
|
|
88
|
+
result.push(input);
|
|
89
|
+
if (firstMatchOnly) {
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
};
|
|
96
|
+
function matcher(inputs, patterns, options) {
|
|
97
|
+
return baseMatcher(inputs, patterns, options, false);
|
|
98
|
+
}
|
|
99
|
+
function isMatch(inputs, patterns, options) {
|
|
100
|
+
return baseMatcher(inputs, patterns, options, true).length > 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ts/index.ts
|
|
104
|
+
var SmartMatch = class {
|
|
105
|
+
constructor(wildcardArg) {
|
|
106
|
+
this.wildcard = wildcardArg;
|
|
107
|
+
}
|
|
108
|
+
match(matchStringArg) {
|
|
109
|
+
return matcher_exports.isMatch(matchStringArg, this.wildcard);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
export {
|
|
113
|
+
SmartMatch
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=bundle.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../node_modules/matcher/index.js", "../node_modules/matcher/node_modules/escape-string-regexp/index.js", "../ts/index.ts"],
|
|
4
|
+
"sourcesContent": ["import escapeStringRegexp from 'escape-string-regexp';\n\nconst regexpCache = new Map();\n\nconst sanitizeArray = (input, inputName) => {\n\tif (!Array.isArray(input)) {\n\t\tswitch (typeof input) {\n\t\t\tcase 'string':\n\t\t\t\tinput = [input];\n\t\t\t\tbreak;\n\t\t\tcase 'undefined':\n\t\t\t\tinput = [];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new TypeError(`Expected '${inputName}' to be a string or an array, but got a type of '${typeof input}'`);\n\t\t}\n\t}\n\n\treturn input.filter(string => {\n\t\tif (typeof string !== 'string') {\n\t\t\tif (typeof string === 'undefined') {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tthrow new TypeError(`Expected '${inputName}' to be an array of strings, but found a type of '${typeof string}' in the array`);\n\t\t}\n\n\t\treturn true;\n\t});\n};\n\nconst makeRegexp = (pattern, options) => {\n\toptions = {\n\t\tcaseSensitive: false,\n\t\t...options,\n\t};\n\n\tconst cacheKey = pattern + JSON.stringify(options);\n\n\tif (regexpCache.has(cacheKey)) {\n\t\treturn regexpCache.get(cacheKey);\n\t}\n\n\tconst negated = pattern[0] === '!';\n\n\tif (negated) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tpattern = escapeStringRegexp(pattern).replace(/\\\\\\*/g, '[\\\\s\\\\S]*');\n\n\tconst regexp = new RegExp(`^${pattern}$`, options.caseSensitive ? '' : 'i');\n\tregexp.negated = negated;\n\tregexpCache.set(cacheKey, regexp);\n\n\treturn regexp;\n};\n\nconst baseMatcher = (inputs, patterns, options, firstMatchOnly) => {\n\tinputs = sanitizeArray(inputs, 'inputs');\n\tpatterns = sanitizeArray(patterns, 'patterns');\n\n\tif (patterns.length === 0) {\n\t\treturn [];\n\t}\n\n\tpatterns = patterns.map(pattern => makeRegexp(pattern, options));\n\n\tconst {allPatterns} = options || {};\n\tconst result = [];\n\n\tfor (const input of inputs) {\n\t\t// String is included only if it matches at least one non-negated pattern supplied.\n\t\t// Note: the `allPatterns` option requires every non-negated pattern to be matched once.\n\t\t// Matching a negated pattern excludes the string.\n\t\tlet matches;\n\t\tconst didFit = [...patterns].fill(false);\n\n\t\tfor (const [index, pattern] of patterns.entries()) {\n\t\t\tif (pattern.test(input)) {\n\t\t\t\tdidFit[index] = true;\n\t\t\t\tmatches = !pattern.negated;\n\n\t\t\t\tif (!matches) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t!(\n\t\t\t\tmatches === false\n\t\t\t\t|| (matches === undefined && patterns.some(pattern => !pattern.negated))\n\t\t\t\t|| (allPatterns && didFit.some((yes, index) => !yes && !patterns[index].negated))\n\t\t\t)\n\t\t) {\n\t\t\tresult.push(input);\n\n\t\t\tif (firstMatchOnly) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n};\n\nexport function matcher(inputs, patterns, options) {\n\treturn baseMatcher(inputs, patterns, options, false);\n}\n\nexport function isMatch(inputs, patterns, options) {\n\treturn baseMatcher(inputs, patterns, options, true).length > 0;\n}\n", "export default function escapeStringRegexp(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError('Expected a string');\n\t}\n\n\t// Escape characters with special meaning either inside or outside character sets.\n\t// Use a simple backslash escape when it\u2019s always valid, and a `\\xnn` escape when the simpler form would be disallowed by Unicode patterns\u2019 stricter grammar.\n\treturn string\n\t\t.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&')\n\t\t.replace(/-/g, '\\\\x2d');\n}\n", "import * as plugins from './smartmatch.plugins.js';\n\nexport class SmartMatch {\n public wildcard: string;\n constructor(wildcardArg: string) {\n this.wildcard = wildcardArg;\n }\n\n public match(matchStringArg: string): boolean {\n return plugins.matcher.isMatch(matchStringArg, this.wildcard);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAe,SAAR,mBAAoC,QAAQ;AAClD,MAAI,OAAO,WAAW,UAAU;AAC/B,UAAM,IAAI,UAAU,mBAAmB;AAAA,EACxC;AAI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
5
|
+
name: '@pushrocks/smartmatch',
|
|
6
|
+
version: '2.0.0',
|
|
7
|
+
description: 'a minimal matching library using picomatch'
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx1QkFBdUI7SUFDN0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLDRDQUE0QztDQUMxRCxDQUFBIn0=
|
package/dist_ts/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as plugins from './smartmatch.plugins.js';
|
|
2
|
+
export class SmartMatch {
|
|
3
|
+
constructor(wildcardArg) {
|
|
4
|
+
this.wildcard = wildcardArg;
|
|
5
|
+
}
|
|
6
|
+
match(matchStringArg) {
|
|
7
|
+
return plugins.matcher.isMatch(matchStringArg, this.wildcard);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLHlCQUF5QixDQUFDO0FBRW5ELE1BQU0sT0FBTyxVQUFVO0lBRXJCLFlBQVksV0FBbUI7UUFDN0IsSUFBSSxDQUFDLFFBQVEsR0FBRyxXQUFXLENBQUM7SUFDOUIsQ0FBQztJQUVNLEtBQUssQ0FBQyxjQUFzQjtRQUNqQyxPQUFPLE9BQU8sQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUM7SUFDaEUsQ0FBQztDQUNGIn0=
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// third party scope
|
|
2
|
+
import * as matcher from 'matcher';
|
|
3
|
+
export { matcher };
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRtYXRjaC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRtYXRjaC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG9CQUFvQjtBQUNwQixPQUFPLEtBQUssT0FBTyxNQUFNLFNBQVMsQ0FBQztBQUVuQyxPQUFPLEVBQUUsT0FBTyxFQUFFLENBQUMifQ==
|
package/license
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2020 Lossless GmbH (hello@lossless.com)
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/npmextra.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"gitzone": {
|
|
3
|
+
"projectType": "npm",
|
|
4
|
+
"module": {
|
|
5
|
+
"githost": "gitlab.com",
|
|
6
|
+
"gitscope": "pushrocks",
|
|
7
|
+
"gitrepo": "smartmatch",
|
|
8
|
+
"description": "a minimal matching library using picomatch",
|
|
9
|
+
"npmPackagename": "@pushrocks/smartmatch",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"projectDomain": "push.rocks"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"npmci": {
|
|
15
|
+
"npmGlobalTools": [],
|
|
16
|
+
"npmAccessLevel": "public"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@push.rocks/smartmatch",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "a minimal matching library using picomatch",
|
|
6
|
+
"main": "dist_ts/index.js",
|
|
7
|
+
"typings": "dist_ts/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"author": "Lossless GmbH",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "(tstest test/)",
|
|
13
|
+
"build": "(tsbuild && tsbundle npm)",
|
|
14
|
+
"format": "(gitzone format)",
|
|
15
|
+
"buildDocs": "tsdoc"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@gitzone/tsbuild": "^2.1.65",
|
|
19
|
+
"@gitzone/tsbundle": "^2.0.7",
|
|
20
|
+
"@gitzone/tstest": "^1.0.73",
|
|
21
|
+
"@pushrocks/tapbundle": "^5.0.4",
|
|
22
|
+
"@types/node": "^18.6.5"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"matcher": "^5.0.0"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"ts/**/*",
|
|
29
|
+
"ts_web/**/*",
|
|
30
|
+
"dist/**/*",
|
|
31
|
+
"dist_*/**/*",
|
|
32
|
+
"dist_ts/**/*",
|
|
33
|
+
"dist_ts_web/**/*",
|
|
34
|
+
"assets/**/*",
|
|
35
|
+
"cli.js",
|
|
36
|
+
"npmextra.json",
|
|
37
|
+
"readme.md"
|
|
38
|
+
],
|
|
39
|
+
"browserslist": [
|
|
40
|
+
"last 1 chrome versions"
|
|
41
|
+
]
|
|
42
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @pushrocks/smartmatch
|
|
2
|
+
a minimal matching library using picomatch
|
|
3
|
+
|
|
4
|
+
## Availabililty and Links
|
|
5
|
+
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartmatch)
|
|
6
|
+
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartmatch)
|
|
7
|
+
* [github.com (source mirror)](https://github.com/pushrocks/smartmatch)
|
|
8
|
+
* [docs (typedoc)](https://pushrocks.gitlab.io/smartmatch/)
|
|
9
|
+
|
|
10
|
+
## Status for master
|
|
11
|
+
|
|
12
|
+
Status Category | Status Badge
|
|
13
|
+
-- | --
|
|
14
|
+
GitLab Pipelines | [](https://lossless.cloud)
|
|
15
|
+
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
|
16
|
+
npm | [](https://lossless.cloud)
|
|
17
|
+
Snyk | [](https://lossless.cloud)
|
|
18
|
+
TypeScript Support | [](https://lossless.cloud)
|
|
19
|
+
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
|
20
|
+
Code Style | [](https://lossless.cloud)
|
|
21
|
+
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
|
22
|
+
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
|
23
|
+
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
|
24
|
+
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
Use TypeScript for best in class intellisense
|
|
29
|
+
|
|
30
|
+
## Contribution
|
|
31
|
+
|
|
32
|
+
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
|
33
|
+
|
|
34
|
+
For further information read the linked docs at the top of this readme.
|
|
35
|
+
|
|
36
|
+
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
|
37
|
+
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
|
38
|
+
|
|
39
|
+
[](https://maintainedby.lossless.com)
|
package/ts/index.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as plugins from './smartmatch.plugins.js';
|
|
2
|
+
|
|
3
|
+
export class SmartMatch {
|
|
4
|
+
public wildcard: string;
|
|
5
|
+
constructor(wildcardArg: string) {
|
|
6
|
+
this.wildcard = wildcardArg;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
public match(matchStringArg: string): boolean {
|
|
10
|
+
return plugins.matcher.isMatch(matchStringArg, this.wildcard);
|
|
11
|
+
}
|
|
12
|
+
}
|