webext-patterns 1.5.0 → 1.5.1

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.
Files changed (3) hide show
  1. package/index.js +9 -1
  2. package/package.json +1 -1
  3. package/readme.md +1 -1
package/index.js CHANGED
@@ -107,5 +107,13 @@ export function excludeDuplicatePatterns(matchPatterns) {
107
107
  if (matchPatterns.includes('*://*/*')) {
108
108
  return ['*://*/*'];
109
109
  }
110
- return matchPatterns.filter(possibleSubset => !matchPatterns.some(possibleSuperset => possibleSubset !== possibleSuperset && patternToRegex(possibleSuperset).test(possibleSubset)));
110
+ // Cover identical patterns
111
+ const uniquePatterns = [...new Set(matchPatterns)];
112
+ return uniquePatterns.filter(possibleSubset =>
113
+ // Keep if there are no matches
114
+ !uniquePatterns.some(possibleSuperset =>
115
+ // Don't compare to self
116
+ possibleSubset !== possibleSuperset
117
+ // Drop if it's a subset
118
+ && patternToRegex(possibleSuperset).test(possibleSubset)));
111
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webext-patterns",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Tool to convert the patterns and globs of your WebExtension manifest to regex",
5
5
  "keywords": [
6
6
  "browser",
package/readme.md CHANGED
@@ -146,7 +146,7 @@ isValidPattern('https://google.*/*');
146
146
  - [webext-permissions](https://github.com/fregante/webext-permissions) - Get any optional permissions that users have granted you.
147
147
  - [webext-options-sync](https://github.com/fregante/webext-options-sync) - Helps you manage and autosave your extension's options.
148
148
  - [webext-storage-cache](https://github.com/fregante/webext-storage-cache) - Map-like promised cache storage with expiration.
149
- - [webext-detect-page](https://github.com/fregante/webext-detect-page) - Detects where the current browser extension code is being run.
149
+ - [webext-detect](https://github.com/fregante/webext-detect) - Detects where the current browser extension code is being run.
150
150
  - [Awesome-WebExtensions](https://github.com/fregante/Awesome-WebExtensions) - A curated list of awesome resources for WebExtensions development.
151
151
  - [More…](https://github.com/fregante/webext-fun)
152
152