typescript-language-server 4.1.3 → 4.3.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/CHANGELOG.md +24 -0
- package/README.md +12 -10
- package/lib/cli.mjs +419 -524
- package/lib/cli.mjs.map +1 -1
- package/package.json +19 -27
package/lib/cli.mjs
CHANGED
|
@@ -11990,7 +11990,7 @@ var legacy = legacyStreams;
|
|
|
11990
11990
|
|
|
11991
11991
|
var clone = clone_1;
|
|
11992
11992
|
|
|
11993
|
-
var util
|
|
11993
|
+
var util = require$$0$2;
|
|
11994
11994
|
|
|
11995
11995
|
var gracefulQueue;
|
|
11996
11996
|
|
|
@@ -12016,8 +12016,8 @@ function publishQueue(context, queue) {
|
|
|
12016
12016
|
|
|
12017
12017
|
var debug$2 = noop;
|
|
12018
12018
|
|
|
12019
|
-
if (util
|
|
12020
|
-
var m = util
|
|
12019
|
+
if (util.debuglog) debug$2 = util.debuglog('gfs4'); else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) debug$2 = function() {
|
|
12020
|
+
var m = util.format.apply(util, arguments);
|
|
12021
12021
|
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ');
|
|
12022
12022
|
console.error(m);
|
|
12023
12023
|
};
|
|
@@ -12435,11 +12435,11 @@ makeDir$1.makeDirSync = (dir, options) => {
|
|
|
12435
12435
|
});
|
|
12436
12436
|
};
|
|
12437
12437
|
|
|
12438
|
-
const u$
|
|
12438
|
+
const u$e = universalify$1.fromPromise;
|
|
12439
12439
|
|
|
12440
12440
|
const {makeDir: _makeDir, makeDirSync: makeDirSync} = makeDir$1;
|
|
12441
12441
|
|
|
12442
|
-
const makeDir = u$
|
|
12442
|
+
const makeDir = u$e(_makeDir);
|
|
12443
12443
|
|
|
12444
12444
|
var mkdirs$2 = {
|
|
12445
12445
|
mkdirs: makeDir,
|
|
@@ -12450,7 +12450,7 @@ var mkdirs$2 = {
|
|
|
12450
12450
|
ensureDirSync: makeDirSync
|
|
12451
12451
|
};
|
|
12452
12452
|
|
|
12453
|
-
const u$
|
|
12453
|
+
const u$d = universalify$1.fromPromise;
|
|
12454
12454
|
|
|
12455
12455
|
const fs$f = fs$i;
|
|
12456
12456
|
|
|
@@ -12459,21 +12459,29 @@ function pathExists$6(path) {
|
|
|
12459
12459
|
}
|
|
12460
12460
|
|
|
12461
12461
|
var pathExists_1 = {
|
|
12462
|
-
pathExists: u$
|
|
12462
|
+
pathExists: u$d(pathExists$6),
|
|
12463
12463
|
pathExistsSync: fs$f.existsSync
|
|
12464
12464
|
};
|
|
12465
12465
|
|
|
12466
|
-
const fs$e =
|
|
12466
|
+
const fs$e = fs$i;
|
|
12467
12467
|
|
|
12468
|
-
|
|
12469
|
-
|
|
12470
|
-
|
|
12471
|
-
|
|
12472
|
-
|
|
12473
|
-
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12468
|
+
const u$c = universalify$1.fromPromise;
|
|
12469
|
+
|
|
12470
|
+
async function utimesMillis$1(path, atime, mtime) {
|
|
12471
|
+
const fd = await fs$e.open(path, 'r+');
|
|
12472
|
+
let closeErr = null;
|
|
12473
|
+
try {
|
|
12474
|
+
await fs$e.futimes(fd, atime, mtime);
|
|
12475
|
+
} finally {
|
|
12476
|
+
try {
|
|
12477
|
+
await fs$e.close(fd);
|
|
12478
|
+
} catch (e) {
|
|
12479
|
+
closeErr = e;
|
|
12480
|
+
}
|
|
12481
|
+
}
|
|
12482
|
+
if (closeErr) {
|
|
12483
|
+
throw closeErr;
|
|
12484
|
+
}
|
|
12477
12485
|
}
|
|
12478
12486
|
|
|
12479
12487
|
function utimesMillisSync$1(path, atime, mtime) {
|
|
@@ -12483,7 +12491,7 @@ function utimesMillisSync$1(path, atime, mtime) {
|
|
|
12483
12491
|
}
|
|
12484
12492
|
|
|
12485
12493
|
var utimes = {
|
|
12486
|
-
utimesMillis: utimesMillis$1,
|
|
12494
|
+
utimesMillis: u$c(utimesMillis$1),
|
|
12487
12495
|
utimesMillisSync: utimesMillisSync$1
|
|
12488
12496
|
};
|
|
12489
12497
|
|
|
@@ -12491,9 +12499,9 @@ const fs$d = fs$i;
|
|
|
12491
12499
|
|
|
12492
12500
|
const path$a = require$$1$1;
|
|
12493
12501
|
|
|
12494
|
-
const
|
|
12502
|
+
const u$b = universalify$1.fromPromise;
|
|
12495
12503
|
|
|
12496
|
-
function getStats$
|
|
12504
|
+
function getStats$1(src, dest, opts) {
|
|
12497
12505
|
const statFunc = opts.dereference ? file => fs$d.stat(file, {
|
|
12498
12506
|
bigint: true
|
|
12499
12507
|
}) : file => fs$d.lstat(file, {
|
|
@@ -12531,38 +12539,35 @@ function getStatsSync(src, dest, opts) {
|
|
|
12531
12539
|
};
|
|
12532
12540
|
}
|
|
12533
12541
|
|
|
12534
|
-
function checkPaths(src, dest, funcName, opts
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
isChangingCase: true
|
|
12547
|
-
});
|
|
12548
|
-
}
|
|
12549
|
-
return cb(new Error('Source and destination must not be the same.'));
|
|
12550
|
-
}
|
|
12551
|
-
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
12552
|
-
return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));
|
|
12553
|
-
}
|
|
12554
|
-
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
12555
|
-
return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`));
|
|
12542
|
+
async function checkPaths(src, dest, funcName, opts) {
|
|
12543
|
+
const {srcStat: srcStat, destStat: destStat} = await getStats$1(src, dest, opts);
|
|
12544
|
+
if (destStat) {
|
|
12545
|
+
if (areIdentical$2(srcStat, destStat)) {
|
|
12546
|
+
const srcBaseName = path$a.basename(src);
|
|
12547
|
+
const destBaseName = path$a.basename(dest);
|
|
12548
|
+
if (funcName === 'move' && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
12549
|
+
return {
|
|
12550
|
+
srcStat: srcStat,
|
|
12551
|
+
destStat: destStat,
|
|
12552
|
+
isChangingCase: true
|
|
12553
|
+
};
|
|
12556
12554
|
}
|
|
12555
|
+
throw new Error('Source and destination must not be the same.');
|
|
12557
12556
|
}
|
|
12558
|
-
if (srcStat.isDirectory() &&
|
|
12559
|
-
|
|
12557
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
12558
|
+
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
12560
12559
|
}
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
|
|
12560
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
12561
|
+
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
12562
|
+
}
|
|
12563
|
+
}
|
|
12564
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
12565
|
+
throw new Error(errMsg(src, dest, funcName));
|
|
12566
|
+
}
|
|
12567
|
+
return {
|
|
12568
|
+
srcStat: srcStat,
|
|
12569
|
+
destStat: destStat
|
|
12570
|
+
};
|
|
12566
12571
|
}
|
|
12567
12572
|
|
|
12568
12573
|
function checkPathsSync(src, dest, funcName, opts) {
|
|
@@ -12596,22 +12601,23 @@ function checkPathsSync(src, dest, funcName, opts) {
|
|
|
12596
12601
|
};
|
|
12597
12602
|
}
|
|
12598
12603
|
|
|
12599
|
-
function checkParentPaths(src, srcStat, dest, funcName
|
|
12604
|
+
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
12600
12605
|
const srcParent = path$a.resolve(path$a.dirname(src));
|
|
12601
12606
|
const destParent = path$a.resolve(path$a.dirname(dest));
|
|
12602
|
-
if (destParent === srcParent || destParent === path$a.parse(destParent).root) return
|
|
12603
|
-
|
|
12604
|
-
|
|
12605
|
-
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
|
|
12611
|
-
|
|
12612
|
-
|
|
12613
|
-
|
|
12614
|
-
}
|
|
12607
|
+
if (destParent === srcParent || destParent === path$a.parse(destParent).root) return;
|
|
12608
|
+
let destStat;
|
|
12609
|
+
try {
|
|
12610
|
+
destStat = await fs$d.stat(destParent, {
|
|
12611
|
+
bigint: true
|
|
12612
|
+
});
|
|
12613
|
+
} catch (err) {
|
|
12614
|
+
if (err.code === 'ENOENT') return;
|
|
12615
|
+
throw err;
|
|
12616
|
+
}
|
|
12617
|
+
if (areIdentical$2(srcStat, destStat)) {
|
|
12618
|
+
throw new Error(errMsg(src, dest, funcName));
|
|
12619
|
+
}
|
|
12620
|
+
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
12615
12621
|
}
|
|
12616
12622
|
|
|
12617
12623
|
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
@@ -12640,7 +12646,7 @@ function areIdentical$2(srcStat, destStat) {
|
|
|
12640
12646
|
function isSrcSubdir(src, dest) {
|
|
12641
12647
|
const srcArr = path$a.resolve(src).split(path$a.sep).filter((i => i));
|
|
12642
12648
|
const destArr = path$a.resolve(dest).split(path$a.sep).filter((i => i));
|
|
12643
|
-
return srcArr.
|
|
12649
|
+
return srcArr.every(((cur, i) => destArr[i] === cur));
|
|
12644
12650
|
}
|
|
12645
12651
|
|
|
12646
12652
|
function errMsg(src, dest, funcName) {
|
|
@@ -12648,221 +12654,140 @@ function errMsg(src, dest, funcName) {
|
|
|
12648
12654
|
}
|
|
12649
12655
|
|
|
12650
12656
|
var stat$4 = {
|
|
12651
|
-
checkPaths: checkPaths,
|
|
12657
|
+
checkPaths: u$b(checkPaths),
|
|
12652
12658
|
checkPathsSync: checkPathsSync,
|
|
12653
|
-
checkParentPaths: checkParentPaths,
|
|
12659
|
+
checkParentPaths: u$b(checkParentPaths),
|
|
12654
12660
|
checkParentPathsSync: checkParentPathsSync,
|
|
12655
12661
|
isSrcSubdir: isSrcSubdir,
|
|
12656
12662
|
areIdentical: areIdentical$2
|
|
12657
12663
|
};
|
|
12658
12664
|
|
|
12659
|
-
const fs$c =
|
|
12665
|
+
const fs$c = fs$i;
|
|
12660
12666
|
|
|
12661
12667
|
const path$9 = require$$1$1;
|
|
12662
12668
|
|
|
12663
|
-
const mkdirs$1 = mkdirs$2
|
|
12669
|
+
const {mkdirs: mkdirs$1} = mkdirs$2;
|
|
12664
12670
|
|
|
12665
|
-
const pathExists$5 = pathExists_1
|
|
12671
|
+
const {pathExists: pathExists$5} = pathExists_1;
|
|
12666
12672
|
|
|
12667
|
-
const utimesMillis = utimes
|
|
12673
|
+
const {utimesMillis: utimesMillis} = utimes;
|
|
12668
12674
|
|
|
12669
12675
|
const stat$3 = stat$4;
|
|
12670
12676
|
|
|
12671
|
-
function copy$2(src, dest, opts
|
|
12672
|
-
if (typeof opts === 'function'
|
|
12673
|
-
cb = opts;
|
|
12674
|
-
opts = {};
|
|
12675
|
-
} else if (typeof opts === 'function') {
|
|
12677
|
+
async function copy$2(src, dest, opts = {}) {
|
|
12678
|
+
if (typeof opts === 'function') {
|
|
12676
12679
|
opts = {
|
|
12677
12680
|
filter: opts
|
|
12678
12681
|
};
|
|
12679
12682
|
}
|
|
12680
|
-
cb = cb || function() {};
|
|
12681
|
-
opts = opts || {};
|
|
12682
12683
|
opts.clobber = 'clobber' in opts ? !!opts.clobber : true;
|
|
12683
12684
|
opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber;
|
|
12684
12685
|
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
|
12685
12686
|
process.emitWarning('Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' + '\tsee https://github.com/jprichardson/node-fs-extra/issues/269', 'Warning', 'fs-extra-WARN0001');
|
|
12686
12687
|
}
|
|
12687
|
-
stat$3.checkPaths(src, dest, 'copy', opts
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
if (err) return cb(err);
|
|
12692
|
-
runFilter(src, dest, opts, ((err, include) => {
|
|
12693
|
-
if (err) return cb(err);
|
|
12694
|
-
if (!include) return cb();
|
|
12695
|
-
checkParentDir(destStat, src, dest, opts, cb);
|
|
12696
|
-
}));
|
|
12697
|
-
}));
|
|
12698
|
-
}));
|
|
12699
|
-
}
|
|
12700
|
-
|
|
12701
|
-
function checkParentDir(destStat, src, dest, opts, cb) {
|
|
12688
|
+
const {srcStat: srcStat, destStat: destStat} = await stat$3.checkPaths(src, dest, 'copy', opts);
|
|
12689
|
+
await stat$3.checkParentPaths(src, srcStat, dest, 'copy');
|
|
12690
|
+
const include = await runFilter(src, dest, opts);
|
|
12691
|
+
if (!include) return;
|
|
12702
12692
|
const destParent = path$9.dirname(dest);
|
|
12703
|
-
pathExists$5(destParent
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
return getStats$1(destStat, src, dest, opts, cb);
|
|
12709
|
-
}));
|
|
12710
|
-
}));
|
|
12693
|
+
const dirExists = await pathExists$5(destParent);
|
|
12694
|
+
if (!dirExists) {
|
|
12695
|
+
await mkdirs$1(destParent);
|
|
12696
|
+
}
|
|
12697
|
+
await getStatsAndPerformCopy(destStat, src, dest, opts);
|
|
12711
12698
|
}
|
|
12712
12699
|
|
|
12713
|
-
function runFilter(src, dest, opts
|
|
12714
|
-
if (!opts.filter) return
|
|
12715
|
-
|
|
12700
|
+
async function runFilter(src, dest, opts) {
|
|
12701
|
+
if (!opts.filter) return true;
|
|
12702
|
+
return opts.filter(src, dest);
|
|
12716
12703
|
}
|
|
12717
12704
|
|
|
12718
|
-
function
|
|
12719
|
-
const
|
|
12720
|
-
|
|
12721
|
-
|
|
12722
|
-
|
|
12723
|
-
|
|
12724
|
-
})
|
|
12725
|
-
}
|
|
12726
|
-
|
|
12727
|
-
function onFile$1(srcStat, destStat, src, dest, opts, cb) {
|
|
12728
|
-
if (!destStat) return copyFile$1(srcStat, src, dest, opts, cb);
|
|
12729
|
-
return mayCopyFile$1(srcStat, src, dest, opts, cb);
|
|
12705
|
+
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
12706
|
+
const statFn = opts.dereference ? fs$c.stat : fs$c.lstat;
|
|
12707
|
+
const srcStat = await statFn(src);
|
|
12708
|
+
if (srcStat.isDirectory()) return onDir$1(srcStat, destStat, src, dest, opts);
|
|
12709
|
+
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile$1(srcStat, destStat, src, dest, opts);
|
|
12710
|
+
if (srcStat.isSymbolicLink()) return onLink$1(destStat, src, dest, opts);
|
|
12711
|
+
if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
|
|
12712
|
+
if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
12713
|
+
throw new Error(`Unknown file: ${src}`);
|
|
12730
12714
|
}
|
|
12731
12715
|
|
|
12732
|
-
function
|
|
12716
|
+
async function onFile$1(srcStat, destStat, src, dest, opts) {
|
|
12717
|
+
if (!destStat) return copyFile$1(srcStat, src, dest, opts);
|
|
12733
12718
|
if (opts.overwrite) {
|
|
12734
|
-
fs$c.unlink(dest
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
12740
|
-
} else return cb();
|
|
12741
|
-
}
|
|
12742
|
-
|
|
12743
|
-
function copyFile$1(srcStat, src, dest, opts, cb) {
|
|
12744
|
-
fs$c.copyFile(src, dest, (err => {
|
|
12745
|
-
if (err) return cb(err);
|
|
12746
|
-
if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb);
|
|
12747
|
-
return setDestMode$1(dest, srcStat.mode, cb);
|
|
12748
|
-
}));
|
|
12719
|
+
await fs$c.unlink(dest);
|
|
12720
|
+
return copyFile$1(srcStat, src, dest, opts);
|
|
12721
|
+
}
|
|
12722
|
+
if (opts.errorOnExist) {
|
|
12723
|
+
throw new Error(`'${dest}' already exists`);
|
|
12724
|
+
}
|
|
12749
12725
|
}
|
|
12750
12726
|
|
|
12751
|
-
function
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
}
|
|
12727
|
+
async function copyFile$1(srcStat, src, dest, opts) {
|
|
12728
|
+
await fs$c.copyFile(src, dest);
|
|
12729
|
+
if (opts.preserveTimestamps) {
|
|
12730
|
+
if (fileIsNotWritable$1(srcStat.mode)) {
|
|
12731
|
+
await makeFileWritable$1(dest, srcStat.mode);
|
|
12732
|
+
}
|
|
12733
|
+
const updatedSrcStat = await fs$c.stat(src);
|
|
12734
|
+
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
12757
12735
|
}
|
|
12758
|
-
return
|
|
12736
|
+
return fs$c.chmod(dest, srcStat.mode);
|
|
12759
12737
|
}
|
|
12760
12738
|
|
|
12761
12739
|
function fileIsNotWritable$1(srcMode) {
|
|
12762
12740
|
return (srcMode & 128) === 0;
|
|
12763
12741
|
}
|
|
12764
12742
|
|
|
12765
|
-
function makeFileWritable$1(dest, srcMode
|
|
12766
|
-
return
|
|
12767
|
-
}
|
|
12768
|
-
|
|
12769
|
-
function setDestTimestampsAndMode(srcMode, src, dest, cb) {
|
|
12770
|
-
setDestTimestamps$1(src, dest, (err => {
|
|
12771
|
-
if (err) return cb(err);
|
|
12772
|
-
return setDestMode$1(dest, srcMode, cb);
|
|
12773
|
-
}));
|
|
12774
|
-
}
|
|
12775
|
-
|
|
12776
|
-
function setDestMode$1(dest, srcMode, cb) {
|
|
12777
|
-
return fs$c.chmod(dest, srcMode, cb);
|
|
12778
|
-
}
|
|
12779
|
-
|
|
12780
|
-
function setDestTimestamps$1(src, dest, cb) {
|
|
12781
|
-
fs$c.stat(src, ((err, updatedSrcStat) => {
|
|
12782
|
-
if (err) return cb(err);
|
|
12783
|
-
return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb);
|
|
12784
|
-
}));
|
|
12785
|
-
}
|
|
12786
|
-
|
|
12787
|
-
function onDir$1(srcStat, destStat, src, dest, opts, cb) {
|
|
12788
|
-
if (!destStat) return mkDirAndCopy$1(srcStat.mode, src, dest, opts, cb);
|
|
12789
|
-
return copyDir$1(src, dest, opts, cb);
|
|
12790
|
-
}
|
|
12791
|
-
|
|
12792
|
-
function mkDirAndCopy$1(srcMode, src, dest, opts, cb) {
|
|
12793
|
-
fs$c.mkdir(dest, (err => {
|
|
12794
|
-
if (err) return cb(err);
|
|
12795
|
-
copyDir$1(src, dest, opts, (err => {
|
|
12796
|
-
if (err) return cb(err);
|
|
12797
|
-
return setDestMode$1(dest, srcMode, cb);
|
|
12798
|
-
}));
|
|
12799
|
-
}));
|
|
12800
|
-
}
|
|
12801
|
-
|
|
12802
|
-
function copyDir$1(src, dest, opts, cb) {
|
|
12803
|
-
fs$c.readdir(src, ((err, items) => {
|
|
12804
|
-
if (err) return cb(err);
|
|
12805
|
-
return copyDirItems(items, src, dest, opts, cb);
|
|
12806
|
-
}));
|
|
12743
|
+
function makeFileWritable$1(dest, srcMode) {
|
|
12744
|
+
return fs$c.chmod(dest, srcMode | 128);
|
|
12807
12745
|
}
|
|
12808
12746
|
|
|
12809
|
-
function
|
|
12810
|
-
|
|
12811
|
-
|
|
12812
|
-
|
|
12813
|
-
|
|
12814
|
-
|
|
12815
|
-
|
|
12816
|
-
|
|
12817
|
-
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
|
|
12825
|
-
if (err) return cb(err);
|
|
12826
|
-
return copyDirItems(items, src, dest, opts, cb);
|
|
12827
|
-
}));
|
|
12828
|
-
}));
|
|
12829
|
-
}));
|
|
12830
|
-
}
|
|
12831
|
-
|
|
12832
|
-
function onLink$1(destStat, src, dest, opts, cb) {
|
|
12833
|
-
fs$c.readlink(src, ((err, resolvedSrc) => {
|
|
12834
|
-
if (err) return cb(err);
|
|
12835
|
-
if (opts.dereference) {
|
|
12836
|
-
resolvedSrc = path$9.resolve(process.cwd(), resolvedSrc);
|
|
12837
|
-
}
|
|
12838
|
-
if (!destStat) {
|
|
12839
|
-
return fs$c.symlink(resolvedSrc, dest, cb);
|
|
12840
|
-
} else {
|
|
12841
|
-
fs$c.readlink(dest, ((err, resolvedDest) => {
|
|
12842
|
-
if (err) {
|
|
12843
|
-
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs$c.symlink(resolvedSrc, dest, cb);
|
|
12844
|
-
return cb(err);
|
|
12845
|
-
}
|
|
12846
|
-
if (opts.dereference) {
|
|
12847
|
-
resolvedDest = path$9.resolve(process.cwd(), resolvedDest);
|
|
12848
|
-
}
|
|
12849
|
-
if (stat$3.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
12850
|
-
return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`));
|
|
12851
|
-
}
|
|
12852
|
-
if (stat$3.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
12853
|
-
return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`));
|
|
12854
|
-
}
|
|
12855
|
-
return copyLink$1(resolvedSrc, dest, cb);
|
|
12856
|
-
}));
|
|
12857
|
-
}
|
|
12858
|
-
}));
|
|
12747
|
+
async function onDir$1(srcStat, destStat, src, dest, opts) {
|
|
12748
|
+
if (!destStat) {
|
|
12749
|
+
await fs$c.mkdir(dest);
|
|
12750
|
+
}
|
|
12751
|
+
const items = await fs$c.readdir(src);
|
|
12752
|
+
await Promise.all(items.map((async item => {
|
|
12753
|
+
const srcItem = path$9.join(src, item);
|
|
12754
|
+
const destItem = path$9.join(dest, item);
|
|
12755
|
+
const include = await runFilter(srcItem, destItem, opts);
|
|
12756
|
+
if (!include) return;
|
|
12757
|
+
const {destStat: destStat} = await stat$3.checkPaths(srcItem, destItem, 'copy', opts);
|
|
12758
|
+
return getStatsAndPerformCopy(destStat, srcItem, destItem, opts);
|
|
12759
|
+
})));
|
|
12760
|
+
if (!destStat) {
|
|
12761
|
+
await fs$c.chmod(dest, srcStat.mode);
|
|
12762
|
+
}
|
|
12859
12763
|
}
|
|
12860
12764
|
|
|
12861
|
-
function
|
|
12862
|
-
fs$c.
|
|
12863
|
-
|
|
12864
|
-
|
|
12865
|
-
}
|
|
12765
|
+
async function onLink$1(destStat, src, dest, opts) {
|
|
12766
|
+
let resolvedSrc = await fs$c.readlink(src);
|
|
12767
|
+
if (opts.dereference) {
|
|
12768
|
+
resolvedSrc = path$9.resolve(process.cwd(), resolvedSrc);
|
|
12769
|
+
}
|
|
12770
|
+
if (!destStat) {
|
|
12771
|
+
return fs$c.symlink(resolvedSrc, dest);
|
|
12772
|
+
}
|
|
12773
|
+
let resolvedDest = null;
|
|
12774
|
+
try {
|
|
12775
|
+
resolvedDest = await fs$c.readlink(dest);
|
|
12776
|
+
} catch (e) {
|
|
12777
|
+
if (e.code === 'EINVAL' || e.code === 'UNKNOWN') return fs$c.symlink(resolvedSrc, dest);
|
|
12778
|
+
throw e;
|
|
12779
|
+
}
|
|
12780
|
+
if (opts.dereference) {
|
|
12781
|
+
resolvedDest = path$9.resolve(process.cwd(), resolvedDest);
|
|
12782
|
+
}
|
|
12783
|
+
if (stat$3.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
12784
|
+
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
12785
|
+
}
|
|
12786
|
+
if (stat$3.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
12787
|
+
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
12788
|
+
}
|
|
12789
|
+
await fs$c.unlink(dest);
|
|
12790
|
+
return fs$c.symlink(resolvedSrc, dest);
|
|
12866
12791
|
}
|
|
12867
12792
|
|
|
12868
12793
|
var copy_1 = copy$2;
|
|
@@ -13004,16 +12929,16 @@ function copyLink(resolvedSrc, dest) {
|
|
|
13004
12929
|
|
|
13005
12930
|
var copySync_1 = copySync$1;
|
|
13006
12931
|
|
|
13007
|
-
const u$
|
|
12932
|
+
const u$a = universalify$1.fromPromise;
|
|
13008
12933
|
|
|
13009
12934
|
var copy$1 = {
|
|
13010
|
-
copy: u$
|
|
12935
|
+
copy: u$a(copy_1),
|
|
13011
12936
|
copySync: copySync_1
|
|
13012
12937
|
};
|
|
13013
12938
|
|
|
13014
12939
|
const fs$a = gracefulFs;
|
|
13015
12940
|
|
|
13016
|
-
const u$
|
|
12941
|
+
const u$9 = universalify$1.fromCallback;
|
|
13017
12942
|
|
|
13018
12943
|
function remove$2(path, callback) {
|
|
13019
12944
|
fs$a.rm(path, {
|
|
@@ -13030,11 +12955,11 @@ function removeSync$1(path) {
|
|
|
13030
12955
|
}
|
|
13031
12956
|
|
|
13032
12957
|
var remove_1 = {
|
|
13033
|
-
remove: u$
|
|
12958
|
+
remove: u$9(remove$2),
|
|
13034
12959
|
removeSync: removeSync$1
|
|
13035
12960
|
};
|
|
13036
12961
|
|
|
13037
|
-
const u$
|
|
12962
|
+
const u$8 = universalify$1.fromPromise;
|
|
13038
12963
|
|
|
13039
12964
|
const fs$9 = fs$i;
|
|
13040
12965
|
|
|
@@ -13044,7 +12969,7 @@ const mkdir$3 = mkdirs$2;
|
|
|
13044
12969
|
|
|
13045
12970
|
const remove$1 = remove_1;
|
|
13046
12971
|
|
|
13047
|
-
const emptyDir = u$
|
|
12972
|
+
const emptyDir = u$8((async function emptyDir(dir) {
|
|
13048
12973
|
let items;
|
|
13049
12974
|
try {
|
|
13050
12975
|
items = await fs$9.readdir(dir);
|
|
@@ -13074,41 +12999,38 @@ var empty = {
|
|
|
13074
12999
|
emptydir: emptyDir
|
|
13075
13000
|
};
|
|
13076
13001
|
|
|
13077
|
-
const u$
|
|
13002
|
+
const u$7 = universalify$1.fromPromise;
|
|
13078
13003
|
|
|
13079
13004
|
const path$6 = require$$1$1;
|
|
13080
13005
|
|
|
13081
|
-
const fs$8 =
|
|
13006
|
+
const fs$8 = fs$i;
|
|
13082
13007
|
|
|
13083
13008
|
const mkdir$2 = mkdirs$2;
|
|
13084
13009
|
|
|
13085
|
-
function createFile$1(file
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
|
|
13010
|
+
async function createFile$1(file) {
|
|
13011
|
+
let stats;
|
|
13012
|
+
try {
|
|
13013
|
+
stats = await fs$8.stat(file);
|
|
13014
|
+
} catch {}
|
|
13015
|
+
if (stats && stats.isFile()) return;
|
|
13016
|
+
const dir = path$6.dirname(file);
|
|
13017
|
+
let dirStats = null;
|
|
13018
|
+
try {
|
|
13019
|
+
dirStats = await fs$8.stat(dir);
|
|
13020
|
+
} catch (err) {
|
|
13021
|
+
if (err.code === 'ENOENT') {
|
|
13022
|
+
await mkdir$2.mkdirs(dir);
|
|
13023
|
+
await fs$8.writeFile(file, '');
|
|
13024
|
+
return;
|
|
13025
|
+
} else {
|
|
13026
|
+
throw err;
|
|
13027
|
+
}
|
|
13028
|
+
}
|
|
13029
|
+
if (dirStats.isDirectory()) {
|
|
13030
|
+
await fs$8.writeFile(file, '');
|
|
13031
|
+
} else {
|
|
13032
|
+
await fs$8.readdir(dir);
|
|
13091
13033
|
}
|
|
13092
|
-
fs$8.stat(file, ((err, stats) => {
|
|
13093
|
-
if (!err && stats.isFile()) return callback();
|
|
13094
|
-
const dir = path$6.dirname(file);
|
|
13095
|
-
fs$8.stat(dir, ((err, stats) => {
|
|
13096
|
-
if (err) {
|
|
13097
|
-
if (err.code === 'ENOENT') {
|
|
13098
|
-
return mkdir$2.mkdirs(dir, (err => {
|
|
13099
|
-
if (err) return callback(err);
|
|
13100
|
-
makeFile();
|
|
13101
|
-
}));
|
|
13102
|
-
}
|
|
13103
|
-
return callback(err);
|
|
13104
|
-
}
|
|
13105
|
-
if (stats.isDirectory()) makeFile(); else {
|
|
13106
|
-
fs$8.readdir(dir, (err => {
|
|
13107
|
-
if (err) return callback(err);
|
|
13108
|
-
}));
|
|
13109
|
-
}
|
|
13110
|
-
}));
|
|
13111
|
-
}));
|
|
13112
13034
|
}
|
|
13113
13035
|
|
|
13114
13036
|
function createFileSync$1(file) {
|
|
@@ -13129,47 +13051,41 @@ function createFileSync$1(file) {
|
|
|
13129
13051
|
}
|
|
13130
13052
|
|
|
13131
13053
|
var file$1 = {
|
|
13132
|
-
createFile: u$
|
|
13054
|
+
createFile: u$7(createFile$1),
|
|
13133
13055
|
createFileSync: createFileSync$1
|
|
13134
13056
|
};
|
|
13135
13057
|
|
|
13136
|
-
const u$
|
|
13058
|
+
const u$6 = universalify$1.fromPromise;
|
|
13137
13059
|
|
|
13138
13060
|
const path$5 = require$$1$1;
|
|
13139
13061
|
|
|
13140
|
-
const fs$7 =
|
|
13062
|
+
const fs$7 = fs$i;
|
|
13141
13063
|
|
|
13142
13064
|
const mkdir$1 = mkdirs$2;
|
|
13143
13065
|
|
|
13144
|
-
const pathExists$4 = pathExists_1
|
|
13066
|
+
const {pathExists: pathExists$4} = pathExists_1;
|
|
13145
13067
|
|
|
13146
13068
|
const {areIdentical: areIdentical$1} = stat$4;
|
|
13147
13069
|
|
|
13148
|
-
function createLink$1(srcpath, dstpath
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13070
|
+
async function createLink$1(srcpath, dstpath) {
|
|
13071
|
+
let dstStat;
|
|
13072
|
+
try {
|
|
13073
|
+
dstStat = await fs$7.lstat(dstpath);
|
|
13074
|
+
} catch {}
|
|
13075
|
+
let srcStat;
|
|
13076
|
+
try {
|
|
13077
|
+
srcStat = await fs$7.lstat(srcpath);
|
|
13078
|
+
} catch (err) {
|
|
13079
|
+
err.message = err.message.replace('lstat', 'ensureLink');
|
|
13080
|
+
throw err;
|
|
13154
13081
|
}
|
|
13155
|
-
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
|
|
13159
|
-
|
|
13160
|
-
|
|
13161
|
-
|
|
13162
|
-
const dir = path$5.dirname(dstpath);
|
|
13163
|
-
pathExists$4(dir, ((err, dirExists) => {
|
|
13164
|
-
if (err) return callback(err);
|
|
13165
|
-
if (dirExists) return makeLink(srcpath, dstpath);
|
|
13166
|
-
mkdir$1.mkdirs(dir, (err => {
|
|
13167
|
-
if (err) return callback(err);
|
|
13168
|
-
makeLink(srcpath, dstpath);
|
|
13169
|
-
}));
|
|
13170
|
-
}));
|
|
13171
|
-
}));
|
|
13172
|
-
}));
|
|
13082
|
+
if (dstStat && areIdentical$1(srcStat, dstStat)) return;
|
|
13083
|
+
const dir = path$5.dirname(dstpath);
|
|
13084
|
+
const dirExists = await pathExists$4(dir);
|
|
13085
|
+
if (!dirExists) {
|
|
13086
|
+
await mkdir$1.mkdirs(dir);
|
|
13087
|
+
}
|
|
13088
|
+
await fs$7.link(srcpath, dstpath);
|
|
13173
13089
|
}
|
|
13174
13090
|
|
|
13175
13091
|
function createLinkSync$1(srcpath, dstpath) {
|
|
@@ -13192,104 +13108,101 @@ function createLinkSync$1(srcpath, dstpath) {
|
|
|
13192
13108
|
}
|
|
13193
13109
|
|
|
13194
13110
|
var link = {
|
|
13195
|
-
createLink: u$
|
|
13111
|
+
createLink: u$6(createLink$1),
|
|
13196
13112
|
createLinkSync: createLinkSync$1
|
|
13197
13113
|
};
|
|
13198
13114
|
|
|
13199
13115
|
const path$4 = require$$1$1;
|
|
13200
13116
|
|
|
13201
|
-
const fs$6 =
|
|
13117
|
+
const fs$6 = fs$i;
|
|
13202
13118
|
|
|
13203
|
-
const pathExists$3 = pathExists_1
|
|
13119
|
+
const {pathExists: pathExists$3} = pathExists_1;
|
|
13204
13120
|
|
|
13205
|
-
|
|
13121
|
+
const u$5 = universalify$1.fromPromise;
|
|
13122
|
+
|
|
13123
|
+
async function symlinkPaths$1(srcpath, dstpath) {
|
|
13206
13124
|
if (path$4.isAbsolute(srcpath)) {
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
}
|
|
13217
|
-
} else {
|
|
13218
|
-
const dstdir = path$4.dirname(dstpath);
|
|
13219
|
-
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
13220
|
-
return pathExists$3(relativeToDst, ((err, exists) => {
|
|
13221
|
-
if (err) return callback(err);
|
|
13222
|
-
if (exists) {
|
|
13223
|
-
return callback(null, {
|
|
13224
|
-
toCwd: relativeToDst,
|
|
13225
|
-
toDst: srcpath
|
|
13226
|
-
});
|
|
13227
|
-
} else {
|
|
13228
|
-
return fs$6.lstat(srcpath, (err => {
|
|
13229
|
-
if (err) {
|
|
13230
|
-
err.message = err.message.replace('lstat', 'ensureSymlink');
|
|
13231
|
-
return callback(err);
|
|
13232
|
-
}
|
|
13233
|
-
return callback(null, {
|
|
13234
|
-
toCwd: srcpath,
|
|
13235
|
-
toDst: path$4.relative(dstdir, srcpath)
|
|
13236
|
-
});
|
|
13237
|
-
}));
|
|
13238
|
-
}
|
|
13239
|
-
}));
|
|
13125
|
+
try {
|
|
13126
|
+
await fs$6.lstat(srcpath);
|
|
13127
|
+
} catch (err) {
|
|
13128
|
+
err.message = err.message.replace('lstat', 'ensureSymlink');
|
|
13129
|
+
throw err;
|
|
13130
|
+
}
|
|
13131
|
+
return {
|
|
13132
|
+
toCwd: srcpath,
|
|
13133
|
+
toDst: srcpath
|
|
13134
|
+
};
|
|
13240
13135
|
}
|
|
13136
|
+
const dstdir = path$4.dirname(dstpath);
|
|
13137
|
+
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
13138
|
+
const exists = await pathExists$3(relativeToDst);
|
|
13139
|
+
if (exists) {
|
|
13140
|
+
return {
|
|
13141
|
+
toCwd: relativeToDst,
|
|
13142
|
+
toDst: srcpath
|
|
13143
|
+
};
|
|
13144
|
+
}
|
|
13145
|
+
try {
|
|
13146
|
+
await fs$6.lstat(srcpath);
|
|
13147
|
+
} catch (err) {
|
|
13148
|
+
err.message = err.message.replace('lstat', 'ensureSymlink');
|
|
13149
|
+
throw err;
|
|
13150
|
+
}
|
|
13151
|
+
return {
|
|
13152
|
+
toCwd: srcpath,
|
|
13153
|
+
toDst: path$4.relative(dstdir, srcpath)
|
|
13154
|
+
};
|
|
13241
13155
|
}
|
|
13242
13156
|
|
|
13243
13157
|
function symlinkPathsSync$1(srcpath, dstpath) {
|
|
13244
|
-
let exists;
|
|
13245
13158
|
if (path$4.isAbsolute(srcpath)) {
|
|
13246
|
-
exists = fs$6.existsSync(srcpath);
|
|
13159
|
+
const exists = fs$6.existsSync(srcpath);
|
|
13247
13160
|
if (!exists) throw new Error('absolute srcpath does not exist');
|
|
13248
13161
|
return {
|
|
13249
13162
|
toCwd: srcpath,
|
|
13250
13163
|
toDst: srcpath
|
|
13251
13164
|
};
|
|
13252
|
-
} else {
|
|
13253
|
-
const dstdir = path$4.dirname(dstpath);
|
|
13254
|
-
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
13255
|
-
exists = fs$6.existsSync(relativeToDst);
|
|
13256
|
-
if (exists) {
|
|
13257
|
-
return {
|
|
13258
|
-
toCwd: relativeToDst,
|
|
13259
|
-
toDst: srcpath
|
|
13260
|
-
};
|
|
13261
|
-
} else {
|
|
13262
|
-
exists = fs$6.existsSync(srcpath);
|
|
13263
|
-
if (!exists) throw new Error('relative srcpath does not exist');
|
|
13264
|
-
return {
|
|
13265
|
-
toCwd: srcpath,
|
|
13266
|
-
toDst: path$4.relative(dstdir, srcpath)
|
|
13267
|
-
};
|
|
13268
|
-
}
|
|
13269
13165
|
}
|
|
13166
|
+
const dstdir = path$4.dirname(dstpath);
|
|
13167
|
+
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
13168
|
+
const exists = fs$6.existsSync(relativeToDst);
|
|
13169
|
+
if (exists) {
|
|
13170
|
+
return {
|
|
13171
|
+
toCwd: relativeToDst,
|
|
13172
|
+
toDst: srcpath
|
|
13173
|
+
};
|
|
13174
|
+
}
|
|
13175
|
+
const srcExists = fs$6.existsSync(srcpath);
|
|
13176
|
+
if (!srcExists) throw new Error('relative srcpath does not exist');
|
|
13177
|
+
return {
|
|
13178
|
+
toCwd: srcpath,
|
|
13179
|
+
toDst: path$4.relative(dstdir, srcpath)
|
|
13180
|
+
};
|
|
13270
13181
|
}
|
|
13271
13182
|
|
|
13272
13183
|
var symlinkPaths_1 = {
|
|
13273
|
-
symlinkPaths: symlinkPaths$1,
|
|
13184
|
+
symlinkPaths: u$5(symlinkPaths$1),
|
|
13274
13185
|
symlinkPathsSync: symlinkPathsSync$1
|
|
13275
13186
|
};
|
|
13276
13187
|
|
|
13277
|
-
const fs$5 =
|
|
13188
|
+
const fs$5 = fs$i;
|
|
13278
13189
|
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
if (type) return
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13190
|
+
const u$4 = universalify$1.fromPromise;
|
|
13191
|
+
|
|
13192
|
+
async function symlinkType$1(srcpath, type) {
|
|
13193
|
+
if (type) return type;
|
|
13194
|
+
let stats;
|
|
13195
|
+
try {
|
|
13196
|
+
stats = await fs$5.lstat(srcpath);
|
|
13197
|
+
} catch {
|
|
13198
|
+
return 'file';
|
|
13199
|
+
}
|
|
13200
|
+
return stats && stats.isDirectory() ? 'dir' : 'file';
|
|
13288
13201
|
}
|
|
13289
13202
|
|
|
13290
13203
|
function symlinkTypeSync$1(srcpath, type) {
|
|
13291
|
-
let stats;
|
|
13292
13204
|
if (type) return type;
|
|
13205
|
+
let stats;
|
|
13293
13206
|
try {
|
|
13294
13207
|
stats = fs$5.lstatSync(srcpath);
|
|
13295
13208
|
} catch {
|
|
@@ -13299,68 +13212,43 @@ function symlinkTypeSync$1(srcpath, type) {
|
|
|
13299
13212
|
}
|
|
13300
13213
|
|
|
13301
13214
|
var symlinkType_1 = {
|
|
13302
|
-
symlinkType: symlinkType$1,
|
|
13215
|
+
symlinkType: u$4(symlinkType$1),
|
|
13303
13216
|
symlinkTypeSync: symlinkTypeSync$1
|
|
13304
13217
|
};
|
|
13305
13218
|
|
|
13306
|
-
const u$3 = universalify$1.
|
|
13219
|
+
const u$3 = universalify$1.fromPromise;
|
|
13307
13220
|
|
|
13308
13221
|
const path$3 = require$$1$1;
|
|
13309
13222
|
|
|
13310
13223
|
const fs$4 = fs$i;
|
|
13311
13224
|
|
|
13312
|
-
const
|
|
13313
|
-
|
|
13314
|
-
const mkdirs = _mkdirs.mkdirs;
|
|
13315
|
-
|
|
13316
|
-
const mkdirsSync = _mkdirs.mkdirsSync;
|
|
13317
|
-
|
|
13318
|
-
const _symlinkPaths = symlinkPaths_1;
|
|
13319
|
-
|
|
13320
|
-
const symlinkPaths = _symlinkPaths.symlinkPaths;
|
|
13225
|
+
const {mkdirs: mkdirs, mkdirsSync: mkdirsSync} = mkdirs$2;
|
|
13321
13226
|
|
|
13322
|
-
const symlinkPathsSync =
|
|
13227
|
+
const {symlinkPaths: symlinkPaths, symlinkPathsSync: symlinkPathsSync} = symlinkPaths_1;
|
|
13323
13228
|
|
|
13324
|
-
const
|
|
13229
|
+
const {symlinkType: symlinkType, symlinkTypeSync: symlinkTypeSync} = symlinkType_1;
|
|
13325
13230
|
|
|
13326
|
-
const
|
|
13327
|
-
|
|
13328
|
-
const symlinkTypeSync = _symlinkType.symlinkTypeSync;
|
|
13329
|
-
|
|
13330
|
-
const pathExists$2 = pathExists_1.pathExists;
|
|
13231
|
+
const {pathExists: pathExists$2} = pathExists_1;
|
|
13331
13232
|
|
|
13332
13233
|
const {areIdentical: areIdentical} = stat$4;
|
|
13333
13234
|
|
|
13334
|
-
function createSymlink$1(srcpath, dstpath, type
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
symlinkType(relative.toCwd, type, ((err, type) => {
|
|
13352
|
-
if (err) return callback(err);
|
|
13353
|
-
const dir = path$3.dirname(dstpath);
|
|
13354
|
-
pathExists$2(dir, ((err, dirExists) => {
|
|
13355
|
-
if (err) return callback(err);
|
|
13356
|
-
if (dirExists) return fs$4.symlink(srcpath, dstpath, type, callback);
|
|
13357
|
-
mkdirs(dir, (err => {
|
|
13358
|
-
if (err) return callback(err);
|
|
13359
|
-
fs$4.symlink(srcpath, dstpath, type, callback);
|
|
13360
|
-
}));
|
|
13361
|
-
}));
|
|
13362
|
-
}));
|
|
13363
|
-
}));
|
|
13235
|
+
async function createSymlink$1(srcpath, dstpath, type) {
|
|
13236
|
+
let stats;
|
|
13237
|
+
try {
|
|
13238
|
+
stats = await fs$4.lstat(dstpath);
|
|
13239
|
+
} catch {}
|
|
13240
|
+
if (stats && stats.isSymbolicLink()) {
|
|
13241
|
+
const [srcStat, dstStat] = await Promise.all([ fs$4.stat(srcpath), fs$4.stat(dstpath) ]);
|
|
13242
|
+
if (areIdentical(srcStat, dstStat)) return;
|
|
13243
|
+
}
|
|
13244
|
+
const relative = await symlinkPaths(srcpath, dstpath);
|
|
13245
|
+
srcpath = relative.toDst;
|
|
13246
|
+
const toType = await symlinkType(relative.toCwd, type);
|
|
13247
|
+
const dir = path$3.dirname(dstpath);
|
|
13248
|
+
if (!await pathExists$2(dir)) {
|
|
13249
|
+
await mkdirs(dir);
|
|
13250
|
+
}
|
|
13251
|
+
return fs$4.symlink(srcpath, dstpath, toType);
|
|
13364
13252
|
}
|
|
13365
13253
|
|
|
13366
13254
|
function createSymlinkSync$1(srcpath, dstpath, type) {
|
|
@@ -13517,9 +13405,9 @@ var jsonfile = {
|
|
|
13517
13405
|
writeJsonSync: jsonFile$1.writeFileSync
|
|
13518
13406
|
};
|
|
13519
13407
|
|
|
13520
|
-
const u$2 = universalify$1.
|
|
13408
|
+
const u$2 = universalify$1.fromPromise;
|
|
13521
13409
|
|
|
13522
|
-
const fs$3 =
|
|
13410
|
+
const fs$3 = fs$i;
|
|
13523
13411
|
|
|
13524
13412
|
const path$2 = require$$1$1;
|
|
13525
13413
|
|
|
@@ -13527,28 +13415,19 @@ const mkdir = mkdirs$2;
|
|
|
13527
13415
|
|
|
13528
13416
|
const pathExists$1 = pathExists_1.pathExists;
|
|
13529
13417
|
|
|
13530
|
-
function outputFile$1(file, data, encoding
|
|
13531
|
-
if (typeof encoding === 'function') {
|
|
13532
|
-
callback = encoding;
|
|
13533
|
-
encoding = 'utf8';
|
|
13534
|
-
}
|
|
13418
|
+
async function outputFile$1(file, data, encoding = 'utf-8') {
|
|
13535
13419
|
const dir = path$2.dirname(file);
|
|
13536
|
-
pathExists$1(dir
|
|
13537
|
-
|
|
13538
|
-
|
|
13539
|
-
|
|
13540
|
-
if (err) return callback(err);
|
|
13541
|
-
fs$3.writeFile(file, data, encoding, callback);
|
|
13542
|
-
}));
|
|
13543
|
-
}));
|
|
13420
|
+
if (!await pathExists$1(dir)) {
|
|
13421
|
+
await mkdir.mkdirs(dir);
|
|
13422
|
+
}
|
|
13423
|
+
return fs$3.writeFile(file, data, encoding);
|
|
13544
13424
|
}
|
|
13545
13425
|
|
|
13546
13426
|
function outputFileSync$1(file, ...args) {
|
|
13547
13427
|
const dir = path$2.dirname(file);
|
|
13548
|
-
if (fs$3.existsSync(dir)) {
|
|
13549
|
-
|
|
13428
|
+
if (!fs$3.existsSync(dir)) {
|
|
13429
|
+
mkdir.mkdirsSync(dir);
|
|
13550
13430
|
}
|
|
13551
|
-
mkdir.mkdirsSync(dir);
|
|
13552
13431
|
fs$3.writeFileSync(file, ...args);
|
|
13553
13432
|
}
|
|
13554
13433
|
|
|
@@ -13601,80 +13480,58 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
13601
13480
|
|
|
13602
13481
|
var json = jsonFile;
|
|
13603
13482
|
|
|
13604
|
-
const fs$2 =
|
|
13483
|
+
const fs$2 = fs$i;
|
|
13605
13484
|
|
|
13606
13485
|
const path$1 = require$$1$1;
|
|
13607
13486
|
|
|
13608
|
-
const copy = copy$1
|
|
13487
|
+
const {copy: copy} = copy$1;
|
|
13609
13488
|
|
|
13610
|
-
const remove = remove_1
|
|
13489
|
+
const {remove: remove} = remove_1;
|
|
13611
13490
|
|
|
13612
|
-
const mkdirp = mkdirs$2
|
|
13491
|
+
const {mkdirp: mkdirp} = mkdirs$2;
|
|
13613
13492
|
|
|
13614
|
-
const pathExists = pathExists_1
|
|
13493
|
+
const {pathExists: pathExists} = pathExists_1;
|
|
13615
13494
|
|
|
13616
13495
|
const stat$1 = stat$4;
|
|
13617
13496
|
|
|
13618
|
-
function move$1(src, dest, opts
|
|
13619
|
-
if (typeof opts === 'function') {
|
|
13620
|
-
cb = opts;
|
|
13621
|
-
opts = {};
|
|
13622
|
-
}
|
|
13623
|
-
opts = opts || {};
|
|
13497
|
+
async function move$1(src, dest, opts = {}) {
|
|
13624
13498
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
13625
|
-
stat$1.checkPaths(src, dest, 'move', opts
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
mkdirp(path$1.dirname(dest), (err => {
|
|
13632
|
-
if (err) return cb(err);
|
|
13633
|
-
return doRename$1(src, dest, overwrite, isChangingCase, cb);
|
|
13634
|
-
}));
|
|
13635
|
-
}));
|
|
13636
|
-
}));
|
|
13637
|
-
}
|
|
13638
|
-
|
|
13639
|
-
function isParentRoot$1(dest) {
|
|
13640
|
-
const parent = path$1.dirname(dest);
|
|
13641
|
-
const parsedPath = path$1.parse(parent);
|
|
13642
|
-
return parsedPath.root === parent;
|
|
13643
|
-
}
|
|
13644
|
-
|
|
13645
|
-
function doRename$1(src, dest, overwrite, isChangingCase, cb) {
|
|
13646
|
-
if (isChangingCase) return rename$1(src, dest, overwrite, cb);
|
|
13647
|
-
if (overwrite) {
|
|
13648
|
-
return remove(dest, (err => {
|
|
13649
|
-
if (err) return cb(err);
|
|
13650
|
-
return rename$1(src, dest, overwrite, cb);
|
|
13651
|
-
}));
|
|
13499
|
+
const {srcStat: srcStat, isChangingCase: isChangingCase = false} = await stat$1.checkPaths(src, dest, 'move', opts);
|
|
13500
|
+
await stat$1.checkParentPaths(src, srcStat, dest, 'move');
|
|
13501
|
+
const destParent = path$1.dirname(dest);
|
|
13502
|
+
const parsedParentPath = path$1.parse(destParent);
|
|
13503
|
+
if (parsedParentPath.root !== destParent) {
|
|
13504
|
+
await mkdirp(destParent);
|
|
13652
13505
|
}
|
|
13653
|
-
|
|
13654
|
-
if (err) return cb(err);
|
|
13655
|
-
if (destExists) return cb(new Error('dest already exists.'));
|
|
13656
|
-
return rename$1(src, dest, overwrite, cb);
|
|
13657
|
-
}));
|
|
13506
|
+
return doRename$1(src, dest, overwrite, isChangingCase);
|
|
13658
13507
|
}
|
|
13659
13508
|
|
|
13660
|
-
function
|
|
13661
|
-
|
|
13662
|
-
if (
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13509
|
+
async function doRename$1(src, dest, overwrite, isChangingCase) {
|
|
13510
|
+
if (!isChangingCase) {
|
|
13511
|
+
if (overwrite) {
|
|
13512
|
+
await remove(dest);
|
|
13513
|
+
} else if (await pathExists(dest)) {
|
|
13514
|
+
throw new Error('dest already exists.');
|
|
13515
|
+
}
|
|
13516
|
+
}
|
|
13517
|
+
try {
|
|
13518
|
+
await fs$2.rename(src, dest);
|
|
13519
|
+
} catch (err) {
|
|
13520
|
+
if (err.code !== 'EXDEV') {
|
|
13521
|
+
throw err;
|
|
13522
|
+
}
|
|
13523
|
+
await moveAcrossDevice$1(src, dest, overwrite);
|
|
13524
|
+
}
|
|
13666
13525
|
}
|
|
13667
13526
|
|
|
13668
|
-
function moveAcrossDevice$1(src, dest, overwrite
|
|
13527
|
+
async function moveAcrossDevice$1(src, dest, overwrite) {
|
|
13669
13528
|
const opts = {
|
|
13670
13529
|
overwrite: overwrite,
|
|
13671
13530
|
errorOnExist: true,
|
|
13672
13531
|
preserveTimestamps: true
|
|
13673
13532
|
};
|
|
13674
|
-
copy(src, dest, opts
|
|
13675
|
-
|
|
13676
|
-
return remove(src, cb);
|
|
13677
|
-
}));
|
|
13533
|
+
await copy(src, dest, opts);
|
|
13534
|
+
return remove(src);
|
|
13678
13535
|
}
|
|
13679
13536
|
|
|
13680
13537
|
var move_1 = move$1;
|
|
@@ -13737,7 +13594,7 @@ function moveAcrossDevice(src, dest, overwrite) {
|
|
|
13737
13594
|
|
|
13738
13595
|
var moveSync_1 = moveSync;
|
|
13739
13596
|
|
|
13740
|
-
const u = universalify$1.
|
|
13597
|
+
const u = universalify$1.fromPromise;
|
|
13741
13598
|
|
|
13742
13599
|
var move = {
|
|
13743
13600
|
move: u(move_1),
|
|
@@ -17562,17 +17419,20 @@ class LspDocuments {
|
|
|
17562
17419
|
constructor(client, lspClient, onCaseInsensitiveFileSystem) {
|
|
17563
17420
|
this._validateJavaScript = true;
|
|
17564
17421
|
this._validateTypeScript = true;
|
|
17422
|
+
this.modeIds = new Set;
|
|
17565
17423
|
this._files = [];
|
|
17566
17424
|
this.documents = new Map;
|
|
17567
17425
|
this.client = client;
|
|
17568
17426
|
this.lspClient = lspClient;
|
|
17569
|
-
this.modeIds = new Set(jsTsLanguageModes);
|
|
17570
17427
|
const pathNormalizer = path => this.client.toTsFilePath(path.toString());
|
|
17571
17428
|
this.pendingDiagnostics = new PendingDiagnostics(pathNormalizer, {
|
|
17572
17429
|
onCaseInsensitiveFileSystem: onCaseInsensitiveFileSystem
|
|
17573
17430
|
});
|
|
17574
17431
|
this.diagnosticDelayer = new Delayer(300);
|
|
17575
17432
|
}
|
|
17433
|
+
initialize(allModeIds) {
|
|
17434
|
+
this.modeIds = new Set(allModeIds);
|
|
17435
|
+
}
|
|
17576
17436
|
get files() {
|
|
17577
17437
|
return this._files;
|
|
17578
17438
|
}
|
|
@@ -17795,6 +17655,35 @@ const vsls = 'vsls';
|
|
|
17795
17655
|
|
|
17796
17656
|
const disabledSchemes = new Set([ git, vsls, github, azurerepos ]);
|
|
17797
17657
|
|
|
17658
|
+
var TypeScriptServerPlugin;
|
|
17659
|
+
|
|
17660
|
+
(function(TypeScriptServerPlugin) {
|
|
17661
|
+
function equals(a, b) {
|
|
17662
|
+
return a.uri.toString() === b.uri.toString() && a.name === b.name && equals$1(a.languages, b.languages);
|
|
17663
|
+
}
|
|
17664
|
+
TypeScriptServerPlugin.equals = equals;
|
|
17665
|
+
})(TypeScriptServerPlugin || (TypeScriptServerPlugin = {}));
|
|
17666
|
+
|
|
17667
|
+
class PluginManager {
|
|
17668
|
+
setPlugins(plugins) {
|
|
17669
|
+
this._plugins = this.readPlugins(plugins);
|
|
17670
|
+
}
|
|
17671
|
+
get plugins() {
|
|
17672
|
+
return Array.from(this._plugins || []);
|
|
17673
|
+
}
|
|
17674
|
+
readPlugins(plugins) {
|
|
17675
|
+
const newPlugins = [];
|
|
17676
|
+
for (const plugin of plugins) {
|
|
17677
|
+
newPlugins.push({
|
|
17678
|
+
name: plugin.name,
|
|
17679
|
+
uri: URI.file(plugin.location),
|
|
17680
|
+
languages: Array.isArray(plugin.languages) ? plugin.languages : []
|
|
17681
|
+
});
|
|
17682
|
+
}
|
|
17683
|
+
return newPlugins;
|
|
17684
|
+
}
|
|
17685
|
+
}
|
|
17686
|
+
|
|
17798
17687
|
class TypeScriptServerError extends Error {
|
|
17799
17688
|
static create(serverId, version, response) {
|
|
17800
17689
|
const parsedResult = TypeScriptServerError.parseErrorText(response);
|
|
@@ -18773,7 +18662,7 @@ class TypeScriptServerSpawner {
|
|
|
18773
18662
|
this._logger = _logger;
|
|
18774
18663
|
this._tracer = _tracer;
|
|
18775
18664
|
}
|
|
18776
|
-
spawn(version, capabilities, configuration, delegate) {
|
|
18665
|
+
spawn(version, capabilities, configuration, pluginManager, delegate) {
|
|
18777
18666
|
let primaryServer;
|
|
18778
18667
|
const serverType = this.getCompositeServerType(version, capabilities, configuration);
|
|
18779
18668
|
switch (serverType) {
|
|
@@ -18782,21 +18671,21 @@ class TypeScriptServerSpawner {
|
|
|
18782
18671
|
{
|
|
18783
18672
|
const enableDynamicRouting = serverType === 2;
|
|
18784
18673
|
primaryServer = new SyntaxRoutingTsServer({
|
|
18785
|
-
syntax: this.spawnTsServer('syntax', version, configuration),
|
|
18786
|
-
semantic: this.spawnTsServer('semantic', version, configuration)
|
|
18674
|
+
syntax: this.spawnTsServer('syntax', version, configuration, pluginManager),
|
|
18675
|
+
semantic: this.spawnTsServer('semantic', version, configuration, pluginManager)
|
|
18787
18676
|
}, delegate, enableDynamicRouting);
|
|
18788
18677
|
break;
|
|
18789
18678
|
}
|
|
18790
18679
|
|
|
18791
18680
|
case 0:
|
|
18792
18681
|
{
|
|
18793
|
-
primaryServer = this.spawnTsServer('main', version, configuration);
|
|
18682
|
+
primaryServer = this.spawnTsServer('main', version, configuration, pluginManager);
|
|
18794
18683
|
break;
|
|
18795
18684
|
}
|
|
18796
18685
|
|
|
18797
18686
|
case 3:
|
|
18798
18687
|
{
|
|
18799
|
-
primaryServer = this.spawnTsServer('syntax', version, configuration);
|
|
18688
|
+
primaryServer = this.spawnTsServer('syntax', version, configuration, pluginManager);
|
|
18800
18689
|
break;
|
|
18801
18690
|
}
|
|
18802
18691
|
}
|
|
@@ -18820,10 +18709,10 @@ class TypeScriptServerSpawner {
|
|
|
18820
18709
|
return 0;
|
|
18821
18710
|
}
|
|
18822
18711
|
}
|
|
18823
|
-
spawnTsServer(kind, version, configuration) {
|
|
18712
|
+
spawnTsServer(kind, version, configuration, pluginManager) {
|
|
18824
18713
|
const processFactory = new NodeTsServerProcessFactory;
|
|
18825
18714
|
const canceller = nodeRequestCancellerFactory.create(kind, this._tracer);
|
|
18826
|
-
const {args: args, tsServerLogFile: tsServerLogFile} = this.getTsServerArgs(kind, configuration, this._apiVersion, canceller.cancellationPipeName);
|
|
18715
|
+
const {args: args, tsServerLogFile: tsServerLogFile} = this.getTsServerArgs(kind, configuration, this._apiVersion, pluginManager, canceller.cancellationPipeName);
|
|
18827
18716
|
if (this.isLoggingEnabled(configuration)) {
|
|
18828
18717
|
if (tsServerLogFile) {
|
|
18829
18718
|
this._logger.logIgnoringVerbosity(LogLevel.Info, `<${kind}> Log file: ${tsServerLogFile}`);
|
|
@@ -18847,7 +18736,7 @@ class TypeScriptServerSpawner {
|
|
|
18847
18736
|
return ServerType.Semantic;
|
|
18848
18737
|
}
|
|
18849
18738
|
}
|
|
18850
|
-
getTsServerArgs(kind, configuration, apiVersion, cancellationPipeName) {
|
|
18739
|
+
getTsServerArgs(kind, configuration, apiVersion, pluginManager, cancellationPipeName) {
|
|
18851
18740
|
const args = [];
|
|
18852
18741
|
let tsServerLogFile;
|
|
18853
18742
|
let tsServerTraceDirectory;
|
|
@@ -18859,7 +18748,7 @@ class TypeScriptServerSpawner {
|
|
|
18859
18748
|
}
|
|
18860
18749
|
}
|
|
18861
18750
|
args.push('--useInferredProjectPerProjectRoot');
|
|
18862
|
-
const {disableAutomaticTypingAcquisition: disableAutomaticTypingAcquisition,
|
|
18751
|
+
const {disableAutomaticTypingAcquisition: disableAutomaticTypingAcquisition, locale: locale, npmLocation: npmLocation} = configuration;
|
|
18863
18752
|
if (disableAutomaticTypingAcquisition || kind === 'syntax' || kind === 'diagnostics') {
|
|
18864
18753
|
args.push('--disableAutomaticTypingAcquisition');
|
|
18865
18754
|
}
|
|
@@ -18874,11 +18763,15 @@ class TypeScriptServerSpawner {
|
|
|
18874
18763
|
args.push('--logFile', tsServerLogFile);
|
|
18875
18764
|
}
|
|
18876
18765
|
}
|
|
18877
|
-
|
|
18878
|
-
|
|
18766
|
+
const pluginPaths = [];
|
|
18767
|
+
if (pluginManager.plugins.length) {
|
|
18768
|
+
args.push('--globalPlugins', pluginManager.plugins.map((x => x.name)).join(','));
|
|
18769
|
+
for (const plugin of pluginManager.plugins) {
|
|
18770
|
+
pluginPaths.push(plugin.uri.fsPath);
|
|
18771
|
+
}
|
|
18879
18772
|
}
|
|
18880
|
-
if (
|
|
18881
|
-
args.push('--pluginProbeLocations',
|
|
18773
|
+
if (pluginPaths.length !== 0) {
|
|
18774
|
+
args.push('--pluginProbeLocations', pluginPaths.join(','));
|
|
18882
18775
|
}
|
|
18883
18776
|
if (npmLocation) {
|
|
18884
18777
|
this._logger.info(`using npm from ${npmLocation}`);
|
|
@@ -19051,6 +18944,7 @@ class TsClient {
|
|
|
19051
18944
|
this.serverState = ServerState.None;
|
|
19052
18945
|
this.workspaceFolders = [];
|
|
19053
18946
|
this.useSyntaxServer = 2;
|
|
18947
|
+
this.pluginManager = new PluginManager;
|
|
19054
18948
|
this.documents = new LspDocuments(this, lspClient, onCaseInsensitiveFileSystem);
|
|
19055
18949
|
this.logger = new PrefixingLogger(logger, '[tsclient]');
|
|
19056
18950
|
this.tsserverLogger = new PrefixingLogger(this.logger, '[tsserver]');
|
|
@@ -19147,6 +19041,14 @@ class TsClient {
|
|
|
19147
19041
|
}
|
|
19148
19042
|
}
|
|
19149
19043
|
}
|
|
19044
|
+
configurePlugin(pluginName, configuration) {
|
|
19045
|
+
if (this.apiVersion.gte(API.v314)) {
|
|
19046
|
+
this.executeWithoutWaitingForResponse(CommandTypes.ConfigurePlugin, {
|
|
19047
|
+
pluginName: pluginName,
|
|
19048
|
+
configuration: configuration
|
|
19049
|
+
});
|
|
19050
|
+
}
|
|
19051
|
+
}
|
|
19150
19052
|
start(workspaceRoot, options) {
|
|
19151
19053
|
this.apiVersion = options.typescriptVersion.version || API.defaultVersion;
|
|
19152
19054
|
this.typescriptVersionSource = options.typescriptVersion.source;
|
|
@@ -19157,8 +19059,11 @@ class TsClient {
|
|
|
19157
19059
|
this.useSyntaxServer = options.useSyntaxServer;
|
|
19158
19060
|
this.onEvent = options.onEvent;
|
|
19159
19061
|
this.onExit = options.onExit;
|
|
19062
|
+
this.pluginManager.setPlugins(options.plugins);
|
|
19063
|
+
const modeIds = [ ...jsTsLanguageModes, ...this.pluginManager.plugins.flatMap((x => x.languages)) ];
|
|
19064
|
+
this.documents.initialize(modeIds);
|
|
19160
19065
|
const tsServerSpawner = new TypeScriptServerSpawner(this.apiVersion, options.logDirectoryProvider, this.logger, this.tracer);
|
|
19161
|
-
const tsServer = tsServerSpawner.spawn(options.typescriptVersion, this.capabilities, options, {
|
|
19066
|
+
const tsServer = tsServerSpawner.spawn(options.typescriptVersion, this.capabilities, options, this.pluginManager, {
|
|
19162
19067
|
onFatalError: (command, err) => this.fatalError(command, err)
|
|
19163
19068
|
});
|
|
19164
19069
|
this.serverState = new ServerState.Running(tsServer, this.apiVersion, undefined, true);
|
|
@@ -19181,9 +19086,6 @@ class TsClient {
|
|
|
19181
19086
|
this.serviceExited();
|
|
19182
19087
|
}));
|
|
19183
19088
|
tsServer.onEvent((event => this.dispatchEvent(event)));
|
|
19184
|
-
if (this.apiVersion.gte(API.v300) && this.capabilities.has(ClientCapability.Semantic)) {
|
|
19185
|
-
this.loadingIndicator.startedLoadingProject('');
|
|
19186
|
-
}
|
|
19187
19089
|
return true;
|
|
19188
19090
|
}
|
|
19189
19091
|
serviceExited() {
|
|
@@ -22438,17 +22340,8 @@ class LspServer {
|
|
|
22438
22340
|
const clientCapabilities = this.initializeParams.capabilities;
|
|
22439
22341
|
this.workspaceRoot = this.initializeParams.rootUri ? URI.parse(this.initializeParams.rootUri).fsPath : this.initializeParams.rootPath || undefined;
|
|
22440
22342
|
const userInitializationOptions = this.initializeParams.initializationOptions || {};
|
|
22441
|
-
const {disableAutomaticTypingAcquisition: disableAutomaticTypingAcquisition, hostInfo: hostInfo, maxTsServerMemory: maxTsServerMemory, npmLocation: npmLocation, locale: locale, tsserver: tsserver} = userInitializationOptions;
|
|
22442
|
-
const
|
|
22443
|
-
plugins: userInitializationOptions.plugins || []
|
|
22444
|
-
};
|
|
22445
|
-
const globalPlugins = [];
|
|
22446
|
-
const pluginProbeLocations = [];
|
|
22447
|
-
for (const plugin of plugins) {
|
|
22448
|
-
globalPlugins.push(plugin.name);
|
|
22449
|
-
pluginProbeLocations.push(plugin.location);
|
|
22450
|
-
}
|
|
22451
|
-
const typescriptVersion = this.findTypescriptVersion(tsserver?.path);
|
|
22343
|
+
const {disableAutomaticTypingAcquisition: disableAutomaticTypingAcquisition, hostInfo: hostInfo, maxTsServerMemory: maxTsServerMemory, npmLocation: npmLocation, locale: locale, plugins: plugins, tsserver: tsserver} = userInitializationOptions;
|
|
22344
|
+
const typescriptVersion = this.findTypescriptVersion(tsserver?.path, tsserver?.fallbackPath);
|
|
22452
22345
|
if (typescriptVersion) {
|
|
22453
22346
|
this.options.lspClient.logMessage({
|
|
22454
22347
|
type: main$3.MessageType.Info,
|
|
@@ -22494,8 +22387,7 @@ class LspServer {
|
|
|
22494
22387
|
maxTsServerMemory: maxTsServerMemory,
|
|
22495
22388
|
npmLocation: npmLocation,
|
|
22496
22389
|
locale: locale,
|
|
22497
|
-
|
|
22498
|
-
pluginProbeLocations: pluginProbeLocations,
|
|
22390
|
+
plugins: plugins || [],
|
|
22499
22391
|
onEvent: this.onTsEvent.bind(this),
|
|
22500
22392
|
onExit: (exitCode, signal) => {
|
|
22501
22393
|
this.shutdown();
|
|
@@ -22607,7 +22499,7 @@ class LspServer {
|
|
|
22607
22499
|
source: typescriptVersionSource
|
|
22608
22500
|
});
|
|
22609
22501
|
}
|
|
22610
|
-
findTypescriptVersion(userTsserverPath) {
|
|
22502
|
+
findTypescriptVersion(userTsserverPath, fallbackTsserverPath) {
|
|
22611
22503
|
const typescriptVersionProvider = new TypeScriptVersionProvider(userTsserverPath, this.logger);
|
|
22612
22504
|
const userSettingVersion = typescriptVersionProvider.getUserSettingVersion();
|
|
22613
22505
|
if (userSettingVersion) {
|
|
@@ -22622,6 +22514,14 @@ class LspServer {
|
|
|
22622
22514
|
return workspaceVersion;
|
|
22623
22515
|
}
|
|
22624
22516
|
}
|
|
22517
|
+
const fallbackVersionProvider = new TypeScriptVersionProvider(fallbackTsserverPath, this.logger);
|
|
22518
|
+
const fallbackSettingVersion = fallbackVersionProvider.getUserSettingVersion();
|
|
22519
|
+
if (fallbackSettingVersion) {
|
|
22520
|
+
if (fallbackSettingVersion.isValid) {
|
|
22521
|
+
return fallbackSettingVersion;
|
|
22522
|
+
}
|
|
22523
|
+
this.logger.logIgnoringVerbosity(LogLevel.Warning, `Typescript specified through fallback setting ignored due to invalid path "${fallbackSettingVersion.path}"`);
|
|
22524
|
+
}
|
|
22625
22525
|
const bundledVersion = typescriptVersionProvider.bundledVersion();
|
|
22626
22526
|
if (bundledVersion?.isValid) {
|
|
22627
22527
|
return bundledVersion;
|
|
@@ -23083,12 +22983,7 @@ class LspServer {
|
|
|
23083
22983
|
}
|
|
23084
22984
|
} else if (params.command === Commands.CONFIGURE_PLUGIN && params.arguments) {
|
|
23085
22985
|
const [pluginName, configuration] = params.arguments;
|
|
23086
|
-
|
|
23087
|
-
this.tsClient.executeWithoutWaitingForResponse(CommandTypes.ConfigurePlugin, {
|
|
23088
|
-
configuration: configuration,
|
|
23089
|
-
pluginName: pluginName
|
|
23090
|
-
});
|
|
23091
|
-
}
|
|
22986
|
+
this.tsClient.configurePlugin(pluginName, configuration);
|
|
23092
22987
|
} else if (params.command === Commands.ORGANIZE_IMPORTS && params.arguments) {
|
|
23093
22988
|
const file = params.arguments[0];
|
|
23094
22989
|
const uri = this.tsClient.toResource(file).toString();
|