@nocobase/plugin-backup-restore 1.7.0-beta.9 → 1.7.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.
- package/dist/client/c92981952ddacb98.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +5 -5
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/dist/node_modules/archiver/index.js +2 -2
- package/dist/node_modules/archiver/node_modules/async/all.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/allLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/allSeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/any.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/anyLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/anySeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/apply.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/applyEach.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/applyEachSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/asyncify.js +118 -0
- package/dist/node_modules/archiver/node_modules/async/auto.js +333 -0
- package/dist/node_modules/archiver/node_modules/async/autoInject.js +182 -0
- package/dist/node_modules/archiver/node_modules/async/bower.json +17 -0
- package/dist/node_modules/archiver/node_modules/async/cargo.js +63 -0
- package/dist/node_modules/archiver/node_modules/async/cargoQueue.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/compose.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/concat.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/concatLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/concatSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/constant.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/detect.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/detectLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/detectSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/dir.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.js +6062 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.min.js +1 -0
- package/dist/node_modules/archiver/node_modules/async/doDuring.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/doUntil.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/doWhilst.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/during.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/each.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/eachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/eachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/eachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/ensureAsync.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/every.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/everyLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/everySeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filter.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/filterLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filterSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/find.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/findLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/findSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/flatMap.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/foldl.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/foldr.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/forEach.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/forEachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/forEachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/forever.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/groupBy.js +108 -0
- package/dist/node_modules/archiver/node_modules/async/groupByLimit.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/groupBySeries.js +36 -0
- package/dist/node_modules/archiver/node_modules/async/index.js +588 -0
- package/dist/node_modules/archiver/node_modules/async/inject.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/internal/DoublyLinkedList.js +92 -0
- package/dist/node_modules/archiver/node_modules/async/internal/Heap.js +120 -0
- package/dist/node_modules/archiver/node_modules/async/internal/applyEach.js +29 -0
- package/dist/node_modules/archiver/node_modules/async/internal/asyncEachOfLimit.js +75 -0
- package/dist/node_modules/archiver/node_modules/async/internal/awaitify.js +28 -0
- package/dist/node_modules/archiver/node_modules/async/internal/breakLoop.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/consoleFunc.js +31 -0
- package/dist/node_modules/archiver/node_modules/async/internal/createTester.js +40 -0
- package/dist/node_modules/archiver/node_modules/async/internal/eachOfLimit.js +90 -0
- package/dist/node_modules/archiver/node_modules/async/internal/filter.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/internal/getIterator.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/internal/initialParams.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/isArrayLike.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/iterator.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/internal/map.js +30 -0
- package/dist/node_modules/archiver/node_modules/async/internal/once.js +17 -0
- package/dist/node_modules/archiver/node_modules/async/internal/onlyOnce.js +15 -0
- package/dist/node_modules/archiver/node_modules/async/internal/parallel.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/promiseCallback.js +23 -0
- package/dist/node_modules/archiver/node_modules/async/internal/queue.js +294 -0
- package/dist/node_modules/archiver/node_modules/async/internal/range.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/reject.js +26 -0
- package/dist/node_modules/archiver/node_modules/async/internal/setImmediate.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/withoutIndex.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/wrapAsync.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/log.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/map.js +142 -0
- package/dist/node_modules/archiver/node_modules/async/mapLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/mapSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/mapValues.js +152 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesLimit.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/memoize.js +91 -0
- package/dist/node_modules/archiver/node_modules/async/nextTick.js +52 -0
- package/dist/node_modules/archiver/node_modules/async/package.json +75 -0
- package/dist/node_modules/archiver/node_modules/async/parallel.js +180 -0
- package/dist/node_modules/archiver/node_modules/async/parallelLimit.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/priorityQueue.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/queue.js +24 -0
- package/dist/node_modules/archiver/node_modules/async/race.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/reduce.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/reduceRight.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/reflect.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/reflectAll.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/reject.js +87 -0
- package/dist/node_modules/archiver/node_modules/async/rejectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/rejectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/retry.js +159 -0
- package/dist/node_modules/archiver/node_modules/async/retryable.js +77 -0
- package/dist/node_modules/archiver/node_modules/async/select.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/selectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/selectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/seq.js +79 -0
- package/dist/node_modules/archiver/node_modules/async/series.js +186 -0
- package/dist/node_modules/archiver/node_modules/async/setImmediate.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/some.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/someLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/someSeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/sortBy.js +190 -0
- package/dist/node_modules/archiver/node_modules/async/timeout.js +89 -0
- package/dist/node_modules/archiver/node_modules/async/times.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/timesLimit.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/timesSeries.js +32 -0
- package/dist/node_modules/archiver/node_modules/async/transform.js +173 -0
- package/dist/node_modules/archiver/node_modules/async/tryEach.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/unmemoize.js +25 -0
- package/dist/node_modules/archiver/node_modules/async/until.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/waterfall.js +105 -0
- package/dist/node_modules/archiver/node_modules/async/whilst.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/wrapSync.js +118 -0
- package/dist/node_modules/archiver/package.json +1 -1
- package/dist/node_modules/decompress/index.js +2 -2
- package/dist/node_modules/decompress/package.json +1 -1
- package/dist/node_modules/fs-extra/LICENSE +15 -0
- package/dist/node_modules/fs-extra/lib/copy/copy.js +232 -0
- package/dist/node_modules/fs-extra/lib/copy/index.js +6 -0
- package/dist/node_modules/fs-extra/lib/copy-sync/copy-sync.js +166 -0
- package/dist/node_modules/fs-extra/lib/copy-sync/index.js +5 -0
- package/dist/node_modules/fs-extra/lib/empty/index.js +48 -0
- package/dist/node_modules/fs-extra/lib/ensure/file.js +69 -0
- package/dist/node_modules/fs-extra/lib/ensure/index.js +23 -0
- package/dist/node_modules/fs-extra/lib/ensure/link.js +61 -0
- package/dist/node_modules/fs-extra/lib/ensure/symlink-paths.js +99 -0
- package/dist/node_modules/fs-extra/lib/ensure/symlink-type.js +31 -0
- package/dist/node_modules/fs-extra/lib/ensure/symlink.js +63 -0
- package/dist/node_modules/fs-extra/lib/fs/index.js +130 -0
- package/dist/node_modules/fs-extra/lib/index.js +1 -0
- package/dist/node_modules/fs-extra/lib/json/index.js +16 -0
- package/dist/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
- package/dist/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
- package/dist/node_modules/fs-extra/lib/json/output-json.js +12 -0
- package/dist/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
- package/dist/node_modules/fs-extra/lib/mkdirs/make-dir.js +141 -0
- package/dist/node_modules/fs-extra/lib/move/index.js +6 -0
- package/dist/node_modules/fs-extra/lib/move/move.js +65 -0
- package/dist/node_modules/fs-extra/lib/move-sync/index.js +5 -0
- package/dist/node_modules/fs-extra/lib/move-sync/move-sync.js +47 -0
- package/dist/node_modules/fs-extra/lib/output/index.js +40 -0
- package/dist/node_modules/fs-extra/lib/path-exists/index.js +12 -0
- package/dist/node_modules/fs-extra/lib/remove/index.js +9 -0
- package/dist/node_modules/fs-extra/lib/remove/rimraf.js +302 -0
- package/dist/node_modules/fs-extra/lib/util/stat.js +139 -0
- package/dist/node_modules/fs-extra/lib/util/utimes.js +26 -0
- package/dist/node_modules/fs-extra/package.json +1 -0
- package/dist/node_modules/moment/package.json +1 -1
- package/dist/node_modules/semver/bin/semver.js +7 -15
- package/dist/node_modules/semver/classes/range.js +28 -13
- package/dist/node_modules/semver/classes/semver.js +23 -7
- package/dist/node_modules/semver/functions/diff.js +5 -12
- package/dist/node_modules/semver/index.js +1 -1
- package/dist/node_modules/semver/internal/lrucache.js +40 -0
- package/dist/node_modules/semver/internal/re.js +2 -0
- package/dist/node_modules/semver/package.json +1 -1
- package/dist/server/dumper.js +3 -3
- package/package.json +4 -4
- package/dist/client/64214db61c8e2718.js +0 -10
- package/dist/node_modules/decompress/node_modules/make-dir/index.js +0 -85
- package/dist/node_modules/decompress/node_modules/make-dir/license +0 -9
- package/dist/node_modules/decompress/node_modules/make-dir/node_modules/pify/index.js +0 -84
- package/dist/node_modules/decompress/node_modules/make-dir/node_modules/pify/license +0 -9
- package/dist/node_modules/decompress/node_modules/make-dir/node_modules/pify/package.json +0 -51
- package/dist/node_modules/decompress/node_modules/make-dir/package.json +0 -54
- package/dist/node_modules/mkdirp/LICENSE +0 -21
- package/dist/node_modules/mkdirp/bin/cmd.js +0 -68
- package/dist/node_modules/mkdirp/index.js +0 -1
- package/dist/node_modules/mkdirp/lib/find-made.js +0 -29
- package/dist/node_modules/mkdirp/lib/mkdirp-manual.js +0 -64
- package/dist/node_modules/mkdirp/lib/mkdirp-native.js +0 -39
- package/dist/node_modules/mkdirp/lib/opts-arg.js +0 -23
- package/dist/node_modules/mkdirp/lib/path-arg.js +0 -29
- package/dist/node_modules/mkdirp/lib/use-native.js +0 -10
- package/dist/node_modules/mkdirp/package.json +0 -1
- package/dist/node_modules/mkdirp/readme.markdown +0 -266
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('graceful-fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const assert = require('assert')
|
|
6
|
+
|
|
7
|
+
const isWindows = (process.platform === 'win32')
|
|
8
|
+
|
|
9
|
+
function defaults (options) {
|
|
10
|
+
const methods = [
|
|
11
|
+
'unlink',
|
|
12
|
+
'chmod',
|
|
13
|
+
'stat',
|
|
14
|
+
'lstat',
|
|
15
|
+
'rmdir',
|
|
16
|
+
'readdir'
|
|
17
|
+
]
|
|
18
|
+
methods.forEach(m => {
|
|
19
|
+
options[m] = options[m] || fs[m]
|
|
20
|
+
m = m + 'Sync'
|
|
21
|
+
options[m] = options[m] || fs[m]
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
options.maxBusyTries = options.maxBusyTries || 3
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function rimraf (p, options, cb) {
|
|
28
|
+
let busyTries = 0
|
|
29
|
+
|
|
30
|
+
if (typeof options === 'function') {
|
|
31
|
+
cb = options
|
|
32
|
+
options = {}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
assert(p, 'rimraf: missing path')
|
|
36
|
+
assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
|
|
37
|
+
assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required')
|
|
38
|
+
assert(options, 'rimraf: invalid options argument provided')
|
|
39
|
+
assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
|
|
40
|
+
|
|
41
|
+
defaults(options)
|
|
42
|
+
|
|
43
|
+
rimraf_(p, options, function CB (er) {
|
|
44
|
+
if (er) {
|
|
45
|
+
if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') &&
|
|
46
|
+
busyTries < options.maxBusyTries) {
|
|
47
|
+
busyTries++
|
|
48
|
+
const time = busyTries * 100
|
|
49
|
+
// try again, with the same exact callback as this one.
|
|
50
|
+
return setTimeout(() => rimraf_(p, options, CB), time)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// already gone
|
|
54
|
+
if (er.code === 'ENOENT') er = null
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
cb(er)
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Two possible strategies.
|
|
62
|
+
// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
|
|
63
|
+
// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
|
|
64
|
+
//
|
|
65
|
+
// Both result in an extra syscall when you guess wrong. However, there
|
|
66
|
+
// are likely far more normal files in the world than directories. This
|
|
67
|
+
// is based on the assumption that a the average number of files per
|
|
68
|
+
// directory is >= 1.
|
|
69
|
+
//
|
|
70
|
+
// If anyone ever complains about this, then I guess the strategy could
|
|
71
|
+
// be made configurable somehow. But until then, YAGNI.
|
|
72
|
+
function rimraf_ (p, options, cb) {
|
|
73
|
+
assert(p)
|
|
74
|
+
assert(options)
|
|
75
|
+
assert(typeof cb === 'function')
|
|
76
|
+
|
|
77
|
+
// sunos lets the root user unlink directories, which is... weird.
|
|
78
|
+
// so we have to lstat here and make sure it's not a dir.
|
|
79
|
+
options.lstat(p, (er, st) => {
|
|
80
|
+
if (er && er.code === 'ENOENT') {
|
|
81
|
+
return cb(null)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Windows can EPERM on stat. Life is suffering.
|
|
85
|
+
if (er && er.code === 'EPERM' && isWindows) {
|
|
86
|
+
return fixWinEPERM(p, options, er, cb)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (st && st.isDirectory()) {
|
|
90
|
+
return rmdir(p, options, er, cb)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
options.unlink(p, er => {
|
|
94
|
+
if (er) {
|
|
95
|
+
if (er.code === 'ENOENT') {
|
|
96
|
+
return cb(null)
|
|
97
|
+
}
|
|
98
|
+
if (er.code === 'EPERM') {
|
|
99
|
+
return (isWindows)
|
|
100
|
+
? fixWinEPERM(p, options, er, cb)
|
|
101
|
+
: rmdir(p, options, er, cb)
|
|
102
|
+
}
|
|
103
|
+
if (er.code === 'EISDIR') {
|
|
104
|
+
return rmdir(p, options, er, cb)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return cb(er)
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function fixWinEPERM (p, options, er, cb) {
|
|
113
|
+
assert(p)
|
|
114
|
+
assert(options)
|
|
115
|
+
assert(typeof cb === 'function')
|
|
116
|
+
|
|
117
|
+
options.chmod(p, 0o666, er2 => {
|
|
118
|
+
if (er2) {
|
|
119
|
+
cb(er2.code === 'ENOENT' ? null : er)
|
|
120
|
+
} else {
|
|
121
|
+
options.stat(p, (er3, stats) => {
|
|
122
|
+
if (er3) {
|
|
123
|
+
cb(er3.code === 'ENOENT' ? null : er)
|
|
124
|
+
} else if (stats.isDirectory()) {
|
|
125
|
+
rmdir(p, options, er, cb)
|
|
126
|
+
} else {
|
|
127
|
+
options.unlink(p, cb)
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function fixWinEPERMSync (p, options, er) {
|
|
135
|
+
let stats
|
|
136
|
+
|
|
137
|
+
assert(p)
|
|
138
|
+
assert(options)
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
options.chmodSync(p, 0o666)
|
|
142
|
+
} catch (er2) {
|
|
143
|
+
if (er2.code === 'ENOENT') {
|
|
144
|
+
return
|
|
145
|
+
} else {
|
|
146
|
+
throw er
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
try {
|
|
151
|
+
stats = options.statSync(p)
|
|
152
|
+
} catch (er3) {
|
|
153
|
+
if (er3.code === 'ENOENT') {
|
|
154
|
+
return
|
|
155
|
+
} else {
|
|
156
|
+
throw er
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (stats.isDirectory()) {
|
|
161
|
+
rmdirSync(p, options, er)
|
|
162
|
+
} else {
|
|
163
|
+
options.unlinkSync(p)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function rmdir (p, options, originalEr, cb) {
|
|
168
|
+
assert(p)
|
|
169
|
+
assert(options)
|
|
170
|
+
assert(typeof cb === 'function')
|
|
171
|
+
|
|
172
|
+
// try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
|
|
173
|
+
// if we guessed wrong, and it's not a directory, then
|
|
174
|
+
// raise the original error.
|
|
175
|
+
options.rmdir(p, er => {
|
|
176
|
+
if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) {
|
|
177
|
+
rmkids(p, options, cb)
|
|
178
|
+
} else if (er && er.code === 'ENOTDIR') {
|
|
179
|
+
cb(originalEr)
|
|
180
|
+
} else {
|
|
181
|
+
cb(er)
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function rmkids (p, options, cb) {
|
|
187
|
+
assert(p)
|
|
188
|
+
assert(options)
|
|
189
|
+
assert(typeof cb === 'function')
|
|
190
|
+
|
|
191
|
+
options.readdir(p, (er, files) => {
|
|
192
|
+
if (er) return cb(er)
|
|
193
|
+
|
|
194
|
+
let n = files.length
|
|
195
|
+
let errState
|
|
196
|
+
|
|
197
|
+
if (n === 0) return options.rmdir(p, cb)
|
|
198
|
+
|
|
199
|
+
files.forEach(f => {
|
|
200
|
+
rimraf(path.join(p, f), options, er => {
|
|
201
|
+
if (errState) {
|
|
202
|
+
return
|
|
203
|
+
}
|
|
204
|
+
if (er) return cb(errState = er)
|
|
205
|
+
if (--n === 0) {
|
|
206
|
+
options.rmdir(p, cb)
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// this looks simpler, and is strictly *faster*, but will
|
|
214
|
+
// tie up the JavaScript thread and fail on excessively
|
|
215
|
+
// deep directory trees.
|
|
216
|
+
function rimrafSync (p, options) {
|
|
217
|
+
let st
|
|
218
|
+
|
|
219
|
+
options = options || {}
|
|
220
|
+
defaults(options)
|
|
221
|
+
|
|
222
|
+
assert(p, 'rimraf: missing path')
|
|
223
|
+
assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
|
|
224
|
+
assert(options, 'rimraf: missing options')
|
|
225
|
+
assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
|
|
226
|
+
|
|
227
|
+
try {
|
|
228
|
+
st = options.lstatSync(p)
|
|
229
|
+
} catch (er) {
|
|
230
|
+
if (er.code === 'ENOENT') {
|
|
231
|
+
return
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Windows can EPERM on stat. Life is suffering.
|
|
235
|
+
if (er.code === 'EPERM' && isWindows) {
|
|
236
|
+
fixWinEPERMSync(p, options, er)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
try {
|
|
241
|
+
// sunos lets the root user unlink directories, which is... weird.
|
|
242
|
+
if (st && st.isDirectory()) {
|
|
243
|
+
rmdirSync(p, options, null)
|
|
244
|
+
} else {
|
|
245
|
+
options.unlinkSync(p)
|
|
246
|
+
}
|
|
247
|
+
} catch (er) {
|
|
248
|
+
if (er.code === 'ENOENT') {
|
|
249
|
+
return
|
|
250
|
+
} else if (er.code === 'EPERM') {
|
|
251
|
+
return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
|
|
252
|
+
} else if (er.code !== 'EISDIR') {
|
|
253
|
+
throw er
|
|
254
|
+
}
|
|
255
|
+
rmdirSync(p, options, er)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function rmdirSync (p, options, originalEr) {
|
|
260
|
+
assert(p)
|
|
261
|
+
assert(options)
|
|
262
|
+
|
|
263
|
+
try {
|
|
264
|
+
options.rmdirSync(p)
|
|
265
|
+
} catch (er) {
|
|
266
|
+
if (er.code === 'ENOTDIR') {
|
|
267
|
+
throw originalEr
|
|
268
|
+
} else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') {
|
|
269
|
+
rmkidsSync(p, options)
|
|
270
|
+
} else if (er.code !== 'ENOENT') {
|
|
271
|
+
throw er
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function rmkidsSync (p, options) {
|
|
277
|
+
assert(p)
|
|
278
|
+
assert(options)
|
|
279
|
+
options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
|
|
280
|
+
|
|
281
|
+
if (isWindows) {
|
|
282
|
+
// We only end up here once we got ENOTEMPTY at least once, and
|
|
283
|
+
// at this point, we are guaranteed to have removed all the kids.
|
|
284
|
+
// So, we know that it won't be ENOENT or ENOTDIR or anything else.
|
|
285
|
+
// try really hard to delete stuff on windows, because it has a
|
|
286
|
+
// PROFOUNDLY annoying habit of not closing handles promptly when
|
|
287
|
+
// files are deleted, resulting in spurious ENOTEMPTY errors.
|
|
288
|
+
const startTime = Date.now()
|
|
289
|
+
do {
|
|
290
|
+
try {
|
|
291
|
+
const ret = options.rmdirSync(p, options)
|
|
292
|
+
return ret
|
|
293
|
+
} catch {}
|
|
294
|
+
} while (Date.now() - startTime < 500) // give up after 500ms
|
|
295
|
+
} else {
|
|
296
|
+
const ret = options.rmdirSync(p, options)
|
|
297
|
+
return ret
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
module.exports = rimraf
|
|
302
|
+
rimraf.sync = rimrafSync
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('../fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const util = require('util')
|
|
6
|
+
const atLeastNode = require('at-least-node')
|
|
7
|
+
|
|
8
|
+
const nodeSupportsBigInt = atLeastNode('10.5.0')
|
|
9
|
+
const stat = (file) => nodeSupportsBigInt ? fs.stat(file, { bigint: true }) : fs.stat(file)
|
|
10
|
+
const statSync = (file) => nodeSupportsBigInt ? fs.statSync(file, { bigint: true }) : fs.statSync(file)
|
|
11
|
+
|
|
12
|
+
function getStats (src, dest) {
|
|
13
|
+
return Promise.all([
|
|
14
|
+
stat(src),
|
|
15
|
+
stat(dest).catch(err => {
|
|
16
|
+
if (err.code === 'ENOENT') return null
|
|
17
|
+
throw err
|
|
18
|
+
})
|
|
19
|
+
]).then(([srcStat, destStat]) => ({ srcStat, destStat }))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getStatsSync (src, dest) {
|
|
23
|
+
let destStat
|
|
24
|
+
const srcStat = statSync(src)
|
|
25
|
+
try {
|
|
26
|
+
destStat = statSync(dest)
|
|
27
|
+
} catch (err) {
|
|
28
|
+
if (err.code === 'ENOENT') return { srcStat, destStat: null }
|
|
29
|
+
throw err
|
|
30
|
+
}
|
|
31
|
+
return { srcStat, destStat }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function checkPaths (src, dest, funcName, cb) {
|
|
35
|
+
util.callbackify(getStats)(src, dest, (err, stats) => {
|
|
36
|
+
if (err) return cb(err)
|
|
37
|
+
const { srcStat, destStat } = stats
|
|
38
|
+
if (destStat && areIdentical(srcStat, destStat)) {
|
|
39
|
+
return cb(new Error('Source and destination must not be the same.'))
|
|
40
|
+
}
|
|
41
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
42
|
+
return cb(new Error(errMsg(src, dest, funcName)))
|
|
43
|
+
}
|
|
44
|
+
return cb(null, { srcStat, destStat })
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function checkPathsSync (src, dest, funcName) {
|
|
49
|
+
const { srcStat, destStat } = getStatsSync(src, dest)
|
|
50
|
+
if (destStat && areIdentical(srcStat, destStat)) {
|
|
51
|
+
throw new Error('Source and destination must not be the same.')
|
|
52
|
+
}
|
|
53
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
54
|
+
throw new Error(errMsg(src, dest, funcName))
|
|
55
|
+
}
|
|
56
|
+
return { srcStat, destStat }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// recursively check if dest parent is a subdirectory of src.
|
|
60
|
+
// It works for all file types including symlinks since it
|
|
61
|
+
// checks the src and dest inodes. It starts from the deepest
|
|
62
|
+
// parent and stops once it reaches the src parent or the root path.
|
|
63
|
+
function checkParentPaths (src, srcStat, dest, funcName, cb) {
|
|
64
|
+
const srcParent = path.resolve(path.dirname(src))
|
|
65
|
+
const destParent = path.resolve(path.dirname(dest))
|
|
66
|
+
if (destParent === srcParent || destParent === path.parse(destParent).root) return cb()
|
|
67
|
+
const callback = (err, destStat) => {
|
|
68
|
+
if (err) {
|
|
69
|
+
if (err.code === 'ENOENT') return cb()
|
|
70
|
+
return cb(err)
|
|
71
|
+
}
|
|
72
|
+
if (areIdentical(srcStat, destStat)) {
|
|
73
|
+
return cb(new Error(errMsg(src, dest, funcName)))
|
|
74
|
+
}
|
|
75
|
+
return checkParentPaths(src, srcStat, destParent, funcName, cb)
|
|
76
|
+
}
|
|
77
|
+
if (nodeSupportsBigInt) fs.stat(destParent, { bigint: true }, callback)
|
|
78
|
+
else fs.stat(destParent, callback)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function checkParentPathsSync (src, srcStat, dest, funcName) {
|
|
82
|
+
const srcParent = path.resolve(path.dirname(src))
|
|
83
|
+
const destParent = path.resolve(path.dirname(dest))
|
|
84
|
+
if (destParent === srcParent || destParent === path.parse(destParent).root) return
|
|
85
|
+
let destStat
|
|
86
|
+
try {
|
|
87
|
+
destStat = statSync(destParent)
|
|
88
|
+
} catch (err) {
|
|
89
|
+
if (err.code === 'ENOENT') return
|
|
90
|
+
throw err
|
|
91
|
+
}
|
|
92
|
+
if (areIdentical(srcStat, destStat)) {
|
|
93
|
+
throw new Error(errMsg(src, dest, funcName))
|
|
94
|
+
}
|
|
95
|
+
return checkParentPathsSync(src, srcStat, destParent, funcName)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function areIdentical (srcStat, destStat) {
|
|
99
|
+
if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) {
|
|
100
|
+
if (nodeSupportsBigInt || destStat.ino < Number.MAX_SAFE_INTEGER) {
|
|
101
|
+
// definitive answer
|
|
102
|
+
return true
|
|
103
|
+
}
|
|
104
|
+
// Use additional heuristics if we can't use 'bigint'.
|
|
105
|
+
// Different 'ino' could be represented the same if they are >= Number.MAX_SAFE_INTEGER
|
|
106
|
+
// See issue 657
|
|
107
|
+
if (destStat.size === srcStat.size &&
|
|
108
|
+
destStat.mode === srcStat.mode &&
|
|
109
|
+
destStat.nlink === srcStat.nlink &&
|
|
110
|
+
destStat.atimeMs === srcStat.atimeMs &&
|
|
111
|
+
destStat.mtimeMs === srcStat.mtimeMs &&
|
|
112
|
+
destStat.ctimeMs === srcStat.ctimeMs &&
|
|
113
|
+
destStat.birthtimeMs === srcStat.birthtimeMs) {
|
|
114
|
+
// heuristic answer
|
|
115
|
+
return true
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return false
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// return true if dest is a subdir of src, otherwise false.
|
|
122
|
+
// It only checks the path strings.
|
|
123
|
+
function isSrcSubdir (src, dest) {
|
|
124
|
+
const srcArr = path.resolve(src).split(path.sep).filter(i => i)
|
|
125
|
+
const destArr = path.resolve(dest).split(path.sep).filter(i => i)
|
|
126
|
+
return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function errMsg (src, dest, funcName) {
|
|
130
|
+
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
module.exports = {
|
|
134
|
+
checkPaths,
|
|
135
|
+
checkPathsSync,
|
|
136
|
+
checkParentPaths,
|
|
137
|
+
checkParentPathsSync,
|
|
138
|
+
isSrcSubdir
|
|
139
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('graceful-fs')
|
|
4
|
+
|
|
5
|
+
function utimesMillis (path, atime, mtime, callback) {
|
|
6
|
+
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
|
|
7
|
+
fs.open(path, 'r+', (err, fd) => {
|
|
8
|
+
if (err) return callback(err)
|
|
9
|
+
fs.futimes(fd, atime, mtime, futimesErr => {
|
|
10
|
+
fs.close(fd, closeErr => {
|
|
11
|
+
if (callback) callback(futimesErr || closeErr)
|
|
12
|
+
})
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function utimesMillisSync (path, atime, mtime) {
|
|
18
|
+
const fd = fs.openSync(path, 'r+')
|
|
19
|
+
fs.futimesSync(fd, atime, mtime)
|
|
20
|
+
return fs.closeSync(fd)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = {
|
|
24
|
+
utimesMillis,
|
|
25
|
+
utimesMillisSync
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"fs-extra","version":"9.1.0","description":"fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.","engines":{"node":">=10"},"homepage":"https://github.com/jprichardson/node-fs-extra","repository":{"type":"git","url":"https://github.com/jprichardson/node-fs-extra"},"keywords":["fs","file","file system","copy","directory","extra","mkdirp","mkdir","mkdirs","recursive","json","read","write","extra","delete","remove","touch","create","text","output","move","promise"],"author":"JP Richardson <jprichardson@gmail.com>","license":"MIT","dependencies":{"at-least-node":"^1.0.0","graceful-fs":"^4.2.0","jsonfile":"^6.0.1","universalify":"^2.0.0"},"devDependencies":{"coveralls":"^3.0.0","klaw":"^2.1.1","klaw-sync":"^3.0.2","minimist":"^1.1.1","mocha":"^5.0.5","nyc":"^15.0.0","proxyquire":"^2.0.1","read-dir-files":"^0.1.1","standard":"^14.1.0"},"main":"./lib/index.js","files":["lib/","!lib/**/__tests__/"],"scripts":{"full-ci":"npm run lint && npm run coverage","coverage":"nyc -r lcovonly npm run unit","coveralls":"coveralls < coverage/lcov.info","lint":"standard","test-find":"find ./lib/**/__tests__ -name *.test.js | xargs mocha","test":"npm run lint && npm run unit","unit":"node test.js"},"_lastModified":"2025-06-04T04:17:45.014Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"moment","version":"2.29.4","description":"Parse, validate, manipulate, and display dates","homepage":"https://momentjs.com","author":"Iskren Ivov Chernev <iskren.chernev@gmail.com> (https://github.com/ichernev)","contributors":["Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)","Rocky Meza (http://rockymeza.com)","Matt Johnson <mj1856@hotmail.com> (http://codeofmatt.com)","Isaac Cambron <isaac@isaaccambron.com> (http://isaaccambron.com)","Andre Polykanine <andre@oire.org> (https://github.com/oire)"],"keywords":["moment","date","time","parse","format","validate","i18n","l10n","ender"],"main":"./moment.js","jsnext:main":"./dist/moment.js","typings":"./moment.d.ts","typesVersions":{">=3.1":{"*":["ts3.1-typings/*"]}},"engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/moment/moment.git"},"bugs":{"url":"https://github.com/moment/moment/issues"},"license":"MIT","devDependencies":{"benchmark":"latest","coveralls":"latest","cross-env":"^6.0.3","es6-promise":"latest","eslint":"~6","grunt":"latest","grunt-benchmark":"latest","grunt-cli":"latest","grunt-contrib-clean":"latest","grunt-contrib-concat":"latest","grunt-contrib-copy":"latest","grunt-contrib-uglify":"latest","grunt-contrib-watch":"latest","grunt-env":"latest","grunt-exec":"latest","grunt-karma":"latest","grunt-nuget":"latest","grunt-string-replace":"latest","karma":"latest","karma-chrome-launcher":"latest","karma-firefox-launcher":"latest","karma-qunit":"latest","karma-sauce-launcher":"4.1.4","load-grunt-tasks":"latest","lodash":">=4.17.19","node-qunit":"latest","nyc":"latest","prettier":"latest","qunit":"^2.10.0","rollup":"2.17.1","typescript":"^1.8.10","typescript3":"npm:typescript@^3.1.6","uglify-js":"latest"},"ender":"./ender.js","dojoBuild":"package.js","jspm":{"files":["moment.js","moment.d.ts","locale"],"map":{"moment":"./moment"},"buildConfig":{"uglify":true}},"scripts":{"ts3.1-typescript-test":"cross-env node_modules/typescript3/bin/tsc --project ts3.1-typing-tests","typescript-test":"cross-env node_modules/typescript/bin/tsc --project typing-tests","test":"grunt test","eslint":"eslint Gruntfile.js tasks src","prettier-check":"prettier --check Gruntfile.js tasks src","prettier-fmt":"prettier --write Gruntfile.js tasks src","coverage":"nyc npm test && nyc report","coveralls":"nyc npm test && nyc report --reporter=text-lcov | coveralls"},"spm":{"main":"moment.js","output":["locale/*.js"]},"_lastModified":"2025-
|
|
1
|
+
{"name":"moment","version":"2.29.4","description":"Parse, validate, manipulate, and display dates","homepage":"https://momentjs.com","author":"Iskren Ivov Chernev <iskren.chernev@gmail.com> (https://github.com/ichernev)","contributors":["Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)","Rocky Meza (http://rockymeza.com)","Matt Johnson <mj1856@hotmail.com> (http://codeofmatt.com)","Isaac Cambron <isaac@isaaccambron.com> (http://isaaccambron.com)","Andre Polykanine <andre@oire.org> (https://github.com/oire)"],"keywords":["moment","date","time","parse","format","validate","i18n","l10n","ender"],"main":"./moment.js","jsnext:main":"./dist/moment.js","typings":"./moment.d.ts","typesVersions":{">=3.1":{"*":["ts3.1-typings/*"]}},"engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/moment/moment.git"},"bugs":{"url":"https://github.com/moment/moment/issues"},"license":"MIT","devDependencies":{"benchmark":"latest","coveralls":"latest","cross-env":"^6.0.3","es6-promise":"latest","eslint":"~6","grunt":"latest","grunt-benchmark":"latest","grunt-cli":"latest","grunt-contrib-clean":"latest","grunt-contrib-concat":"latest","grunt-contrib-copy":"latest","grunt-contrib-uglify":"latest","grunt-contrib-watch":"latest","grunt-env":"latest","grunt-exec":"latest","grunt-karma":"latest","grunt-nuget":"latest","grunt-string-replace":"latest","karma":"latest","karma-chrome-launcher":"latest","karma-firefox-launcher":"latest","karma-qunit":"latest","karma-sauce-launcher":"4.1.4","load-grunt-tasks":"latest","lodash":">=4.17.19","node-qunit":"latest","nyc":"latest","prettier":"latest","qunit":"^2.10.0","rollup":"2.17.1","typescript":"^1.8.10","typescript3":"npm:typescript@^3.1.6","uglify-js":"latest"},"ender":"./ender.js","dojoBuild":"package.js","jspm":{"files":["moment.js","moment.d.ts","locale"],"map":{"moment":"./moment"},"buildConfig":{"uglify":true}},"scripts":{"ts3.1-typescript-test":"cross-env node_modules/typescript3/bin/tsc --project ts3.1-typing-tests","typescript-test":"cross-env node_modules/typescript/bin/tsc --project typing-tests","test":"grunt test","eslint":"eslint Gruntfile.js tasks src","prettier-check":"prettier --check Gruntfile.js tasks src","prettier-fmt":"prettier --write Gruntfile.js tasks src","coverage":"nyc npm test && nyc report","coveralls":"nyc npm test && nyc report --reporter=text-lcov | coveralls"},"spm":{"main":"moment.js","output":["locale/*.js"]},"_lastModified":"2025-06-04T04:17:45.516Z"}
|
|
@@ -61,6 +61,7 @@ const main = () => {
|
|
|
61
61
|
switch (argv[0]) {
|
|
62
62
|
case 'major': case 'minor': case 'patch': case 'prerelease':
|
|
63
63
|
case 'premajor': case 'preminor': case 'prepatch':
|
|
64
|
+
case 'release':
|
|
64
65
|
inc = argv.shift()
|
|
65
66
|
break
|
|
66
67
|
default:
|
|
@@ -119,7 +120,11 @@ const main = () => {
|
|
|
119
120
|
return fail()
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
|
-
|
|
123
|
+
versions
|
|
124
|
+
.sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options))
|
|
125
|
+
.map(v => semver.clean(v, options))
|
|
126
|
+
.map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v)
|
|
127
|
+
.forEach(v => console.log(v))
|
|
123
128
|
}
|
|
124
129
|
|
|
125
130
|
const failInc = () => {
|
|
@@ -129,19 +134,6 @@ const failInc = () => {
|
|
|
129
134
|
|
|
130
135
|
const fail = () => process.exit(1)
|
|
131
136
|
|
|
132
|
-
const success = () => {
|
|
133
|
-
const compare = reverse ? 'rcompare' : 'compare'
|
|
134
|
-
versions.sort((a, b) => {
|
|
135
|
-
return semver[compare](a, b, options)
|
|
136
|
-
}).map((v) => {
|
|
137
|
-
return semver.clean(v, options)
|
|
138
|
-
}).map((v) => {
|
|
139
|
-
return inc ? semver.inc(v, inc, options, identifier, identifierBase) : v
|
|
140
|
-
}).forEach((v, i, _) => {
|
|
141
|
-
console.log(v)
|
|
142
|
-
})
|
|
143
|
-
}
|
|
144
|
-
|
|
145
137
|
const help = () => console.log(
|
|
146
138
|
`SemVer ${version}
|
|
147
139
|
|
|
@@ -158,7 +150,7 @@ Options:
|
|
|
158
150
|
-i --increment [<level>]
|
|
159
151
|
Increment a version by the specified level. Level can
|
|
160
152
|
be one of: major, minor, patch, premajor, preminor,
|
|
161
|
-
prepatch, or
|
|
153
|
+
prepatch, prerelease, or release. Default level is 'patch'.
|
|
162
154
|
Only one version may be specified.
|
|
163
155
|
|
|
164
156
|
--preid <identifier>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const SPACE_CHARACTERS = /\s+/g
|
|
2
|
+
|
|
1
3
|
// hoisted class for cyclic dependency
|
|
2
4
|
class Range {
|
|
3
5
|
constructor (range, options) {
|
|
@@ -18,7 +20,7 @@ class Range {
|
|
|
18
20
|
// just put it in the set and return
|
|
19
21
|
this.raw = range.value
|
|
20
22
|
this.set = [[range]]
|
|
21
|
-
this.
|
|
23
|
+
this.formatted = undefined
|
|
22
24
|
return this
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -29,10 +31,7 @@ class Range {
|
|
|
29
31
|
// First reduce all whitespace as much as possible so we do not have to rely
|
|
30
32
|
// on potentially slow regexes like \s*. This is then stored and used for
|
|
31
33
|
// future error messages as well.
|
|
32
|
-
this.raw = range
|
|
33
|
-
.trim()
|
|
34
|
-
.split(/\s+/)
|
|
35
|
-
.join(' ')
|
|
34
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')
|
|
36
35
|
|
|
37
36
|
// First, split on ||
|
|
38
37
|
this.set = this.raw
|
|
@@ -66,14 +65,29 @@ class Range {
|
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
this.
|
|
68
|
+
this.formatted = undefined
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get range () {
|
|
72
|
+
if (this.formatted === undefined) {
|
|
73
|
+
this.formatted = ''
|
|
74
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
75
|
+
if (i > 0) {
|
|
76
|
+
this.formatted += '||'
|
|
77
|
+
}
|
|
78
|
+
const comps = this.set[i]
|
|
79
|
+
for (let k = 0; k < comps.length; k++) {
|
|
80
|
+
if (k > 0) {
|
|
81
|
+
this.formatted += ' '
|
|
82
|
+
}
|
|
83
|
+
this.formatted += comps[k].toString().trim()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return this.formatted
|
|
70
88
|
}
|
|
71
89
|
|
|
72
90
|
format () {
|
|
73
|
-
this.range = this.set
|
|
74
|
-
.map((comps) => comps.join(' ').trim())
|
|
75
|
-
.join('||')
|
|
76
|
-
.trim()
|
|
77
91
|
return this.range
|
|
78
92
|
}
|
|
79
93
|
|
|
@@ -198,8 +212,8 @@ class Range {
|
|
|
198
212
|
|
|
199
213
|
module.exports = Range
|
|
200
214
|
|
|
201
|
-
const LRU = require('
|
|
202
|
-
const cache = new LRU(
|
|
215
|
+
const LRU = require('../internal/lrucache')
|
|
216
|
+
const cache = new LRU()
|
|
203
217
|
|
|
204
218
|
const parseOptions = require('../internal/parse-options')
|
|
205
219
|
const Comparator = require('./comparator')
|
|
@@ -470,9 +484,10 @@ const replaceGTE0 = (comp, options) => {
|
|
|
470
484
|
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
|
471
485
|
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
|
|
472
486
|
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
|
|
487
|
+
// TODO build?
|
|
473
488
|
const hyphenReplace = incPr => ($0,
|
|
474
489
|
from, fM, fm, fp, fpr, fb,
|
|
475
|
-
to, tM, tm, tp, tpr
|
|
490
|
+
to, tM, tm, tp, tpr) => {
|
|
476
491
|
if (isX(fM)) {
|
|
477
492
|
from = ''
|
|
478
493
|
} else if (isX(fm)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const debug = require('../internal/debug')
|
|
2
2
|
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
|
|
3
|
-
const { safeRe: re, t } = require('../internal/re')
|
|
3
|
+
const { safeRe: re, safeSrc: src, t } = require('../internal/re')
|
|
4
4
|
|
|
5
5
|
const parseOptions = require('../internal/parse-options')
|
|
6
6
|
const { compareIdentifiers } = require('../internal/identifiers')
|
|
@@ -10,7 +10,7 @@ class SemVer {
|
|
|
10
10
|
|
|
11
11
|
if (version instanceof SemVer) {
|
|
12
12
|
if (version.loose === !!options.loose &&
|
|
13
|
-
|
|
13
|
+
version.includePrerelease === !!options.includePrerelease) {
|
|
14
14
|
return version
|
|
15
15
|
} else {
|
|
16
16
|
version = version.version
|
|
@@ -158,7 +158,7 @@ class SemVer {
|
|
|
158
158
|
do {
|
|
159
159
|
const a = this.build[i]
|
|
160
160
|
const b = other.build[i]
|
|
161
|
-
debug('
|
|
161
|
+
debug('build compare', i, a, b)
|
|
162
162
|
if (a === undefined && b === undefined) {
|
|
163
163
|
return 0
|
|
164
164
|
} else if (b === undefined) {
|
|
@@ -176,6 +176,20 @@ class SemVer {
|
|
|
176
176
|
// preminor will bump the version up to the next minor release, and immediately
|
|
177
177
|
// down to pre-release. premajor and prepatch work the same way.
|
|
178
178
|
inc (release, identifier, identifierBase) {
|
|
179
|
+
if (release.startsWith('pre')) {
|
|
180
|
+
if (!identifier && identifierBase === false) {
|
|
181
|
+
throw new Error('invalid increment argument: identifier is empty')
|
|
182
|
+
}
|
|
183
|
+
// Avoid an invalid semver results
|
|
184
|
+
if (identifier) {
|
|
185
|
+
const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`)
|
|
186
|
+
const match = `-${identifier}`.match(r)
|
|
187
|
+
if (!match || match[1] !== identifier) {
|
|
188
|
+
throw new Error(`invalid identifier: ${identifier}`)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
179
193
|
switch (release) {
|
|
180
194
|
case 'premajor':
|
|
181
195
|
this.prerelease.length = 0
|
|
@@ -206,6 +220,12 @@ class SemVer {
|
|
|
206
220
|
}
|
|
207
221
|
this.inc('pre', identifier, identifierBase)
|
|
208
222
|
break
|
|
223
|
+
case 'release':
|
|
224
|
+
if (this.prerelease.length === 0) {
|
|
225
|
+
throw new Error(`version ${this.raw} is not a prerelease`)
|
|
226
|
+
}
|
|
227
|
+
this.prerelease.length = 0
|
|
228
|
+
break
|
|
209
229
|
|
|
210
230
|
case 'major':
|
|
211
231
|
// If this is a pre-major version, bump up to the same major version.
|
|
@@ -249,10 +269,6 @@ class SemVer {
|
|
|
249
269
|
case 'pre': {
|
|
250
270
|
const base = Number(identifierBase) ? 1 : 0
|
|
251
271
|
|
|
252
|
-
if (!identifier && identifierBase === false) {
|
|
253
|
-
throw new Error('invalid increment argument: identifier is empty')
|
|
254
|
-
}
|
|
255
|
-
|
|
256
272
|
if (this.prerelease.length === 0) {
|
|
257
273
|
this.prerelease = [base]
|
|
258
274
|
} else {
|