bare-module-traverse 2.1.0 → 2.1.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.d.ts +2 -2
  2. package/index.js +17 -13
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -70,8 +70,8 @@ declare namespace traverse {
70
70
  >
71
71
 
72
72
  export interface Artifacts {
73
- addons: URL[]
74
- assets: URL[]
73
+ addons: URL[] | Set<string>
74
+ assets: URL[] | Set<string>
75
75
  }
76
76
 
77
77
  export const constants: {
package/index.js CHANGED
@@ -580,24 +580,28 @@ exports.patternMatches = function* patternMatches(pattern, parentURL, matches, o
580
580
  return matches
581
581
  }
582
582
 
583
- function addURL(array, url) {
584
- let lo = 0
585
- let hi = array.length - 1
583
+ function addURL(collection, url) {
584
+ if (Array.isArray(collection)) {
585
+ let lo = 0
586
+ let hi = collection.length - 1
586
587
 
587
- while (lo <= hi) {
588
- const mid = lo + ((hi - lo) >> 1)
589
- const found = array[mid]
588
+ while (lo <= hi) {
589
+ const mid = lo + ((hi - lo) >> 1)
590
+ const found = collection[mid]
590
591
 
591
- if (found.href === url.href) return
592
+ if (found.href === url.href) return
592
593
 
593
- if (found.href < url.href) {
594
- lo = mid + 1
595
- } else {
596
- hi = mid - 1
594
+ if (found.href < url.href) {
595
+ lo = mid + 1
596
+ } else {
597
+ hi = mid - 1
598
+ }
597
599
  }
598
- }
599
600
 
600
- array.splice(lo, 0, url)
601
+ collection.splice(lo, 0, url)
602
+ } else {
603
+ collection.add(url.href)
604
+ }
601
605
  }
602
606
 
603
607
  function removeURL(array, url) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-module-traverse",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Low-level module graph traversal for Bare",
5
5
  "exports": {
6
6
  ".": {