imdone-core 2.4.0 → 2.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.
@@ -22,15 +22,13 @@ export function resolveDefaultFilteredMovePosition({
22
22
  .filter(candidate => !sameTask(candidate, task))
23
23
  if (visibleDestinationCards.length === 0) return destinationCards.length
24
24
 
25
- const anchor = visibleDestinationCards[
26
- Math.min(newPosition, visibleDestinationCards.length - 1)
27
- ]
25
+ const anchor = newPosition === 0
26
+ ? visibleDestinationCards[0]
27
+ : visibleDestinationCards[newPosition - 1]
28
28
  const anchorPosition = destinationCards.findIndex(candidate => sameTask(candidate, anchor))
29
29
  if (anchorPosition < 0) {
30
30
  throw new Error(`Filtered task is missing from ${newList}: ${anchor.id}`)
31
31
  }
32
32
 
33
- return newPosition < visibleDestinationCards.length
34
- ? anchorPosition
35
- : anchorPosition + 1
33
+ return newPosition === 0 ? anchorPosition : anchorPosition + 1
36
34
  }
@@ -23,6 +23,7 @@ export function watchedFileSystemStoreMixin(repo, fs = realFs) {
23
23
 
24
24
  function trackWatcherEvent(listener) {
25
25
  return (...args) => {
26
+ if (watcherPaused) return
26
27
  const event = Promise.resolve().then(() => listener(...args))
27
28
  const trackedEvent = event.catch((err) => {
28
29
  logger.error('Error processing watcher event')
@@ -34,6 +35,12 @@ export function watchedFileSystemStoreMixin(repo, fs = realFs) {
34
35
  }
35
36
  }
36
37
 
38
+ async function waitForWatcherEvents() {
39
+ while (watcherEvents.size > 0) {
40
+ await Promise.allSettled([...watcherEvents])
41
+ }
42
+ }
43
+
37
44
  function ready() {
38
45
  return !initializing && !refreshing
39
46
  }
@@ -49,8 +56,14 @@ export function watchedFileSystemStoreMixin(repo, fs = realFs) {
49
56
  repo.pauseWatcher = async function() {
50
57
  if (repo.watcher && !watcherPaused) {
51
58
  logger.info('Pausing file watcher for:', repo.path)
52
- await repo.watcher.close()
53
59
  watcherPaused = true
60
+ try {
61
+ await repo.watcher.close()
62
+ await waitForWatcherEvents()
63
+ } catch (err) {
64
+ watcherPaused = false
65
+ throw err
66
+ }
54
67
  repo.emit('watcher.paused')
55
68
  return true
56
69
  }
@@ -94,7 +107,7 @@ export function watchedFileSystemStoreMixin(repo, fs = realFs) {
94
107
 
95
108
  repo.destroy = async function () {
96
109
  if (repo.watcher) await repo.watcher.close()
97
- await Promise.allSettled([...watcherEvents])
110
+ await waitForWatcherEvents()
98
111
  await _destroy.apply(repo)
99
112
  }
100
113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "2.4.0",
3
+ "version": "2.5.1",
4
4
  "description": "imdone-core",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "homepage": "https://github.com/imdone/imdone-core",
45
45
  "dependencies": {
46
- "adm-zip": "^0.6.0",
46
+ "adm-zip": "^0.6.1",
47
47
  "async": "^3.2.6",
48
48
  "async-es": "^3.2.6",
49
49
  "chalk": "^5.4.1",
@@ -60,7 +60,7 @@
60
60
  "ignore": "^5.2.0",
61
61
  "imdone-api": "^2.0.4",
62
62
  "isbinaryfile": "^5.0.4",
63
- "js-yaml": "^4.2.0",
63
+ "js-yaml": "^4.3.2",
64
64
  "json-fns": "^1.0.0",
65
65
  "lodash.assign": "^4.2.0",
66
66
  "lodash.debounce": "^4.0.8",
@@ -113,5 +113,10 @@
113
113
  "prettier": "^2.5.1",
114
114
  "typescript": "^5.8.2",
115
115
  "vitest": "^4.1.9"
116
+ },
117
+ "allowScripts": {
118
+ "core-js-pure@3.42.0": true,
119
+ "esbuild@0.28.1": true,
120
+ "fsevents@2.3.3": true
116
121
  }
117
122
  }