@codingame/monaco-vscode-rollup-vsix-plugin 30.0.0 → 31.0.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/package.json +3 -3
- package/rollup-vsix-plugin.d.ts +1 -0
- package/rollup-vsix-plugin.js +307 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-rollup-vsix-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "31.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@rollup/pluginutils": "^5.3.0",
|
|
22
22
|
"css-url-parser": "^1.1.4",
|
|
23
|
-
"memfs": "^4.57.
|
|
23
|
+
"memfs": "^4.57.2",
|
|
24
24
|
"mime-types": "^3.0.2",
|
|
25
|
-
"thenby": "^1.
|
|
25
|
+
"thenby": "^1.4.1",
|
|
26
26
|
"yauzl": "^3.0.0"
|
|
27
27
|
}
|
|
28
28
|
}
|
package/rollup-vsix-plugin.d.ts
CHANGED
|
@@ -1390,6 +1390,7 @@ interface IChatFileContribution {
|
|
|
1390
1390
|
readonly name?: string;
|
|
1391
1391
|
readonly description?: string;
|
|
1392
1392
|
readonly when?: string;
|
|
1393
|
+
readonly sessionTypes?: readonly string[];
|
|
1393
1394
|
}
|
|
1394
1395
|
interface ILanguageModelChatProvider {
|
|
1395
1396
|
vendor: string;
|
package/rollup-vsix-plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createFilter } from '@rollup/pluginutils';
|
|
2
2
|
import * as yauzl from 'yauzl';
|
|
3
3
|
import { createFsFromVolume, Volume } from 'memfs';
|
|
4
|
-
import
|
|
4
|
+
import { firstBy } from 'thenby';
|
|
5
5
|
import * as nodePath from 'node:path';
|
|
6
6
|
import parseCssUrl from 'css-url-parser';
|
|
7
7
|
import * as mime from 'mime-types';
|
|
@@ -2844,6 +2844,8 @@ function requireConstants$1 () {
|
|
|
2844
2844
|
const WIN_SLASH = '\\\\/';
|
|
2845
2845
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
2846
2846
|
|
|
2847
|
+
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
2848
|
+
|
|
2847
2849
|
/**
|
|
2848
2850
|
* Posix glob regex
|
|
2849
2851
|
*/
|
|
@@ -2907,6 +2909,7 @@ function requireConstants$1 () {
|
|
|
2907
2909
|
*/
|
|
2908
2910
|
|
|
2909
2911
|
const POSIX_REGEX_SOURCE = {
|
|
2912
|
+
__proto__: null,
|
|
2910
2913
|
alnum: 'a-zA-Z0-9',
|
|
2911
2914
|
alpha: 'a-zA-Z',
|
|
2912
2915
|
ascii: '\\x00-\\x7F',
|
|
@@ -2924,6 +2927,7 @@ function requireConstants$1 () {
|
|
|
2924
2927
|
};
|
|
2925
2928
|
|
|
2926
2929
|
constants$1 = {
|
|
2930
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
2927
2931
|
MAX_LENGTH: 1024 * 64,
|
|
2928
2932
|
POSIX_REGEX_SOURCE,
|
|
2929
2933
|
|
|
@@ -2937,6 +2941,7 @@ function requireConstants$1 () {
|
|
|
2937
2941
|
|
|
2938
2942
|
// Replace globs with equivalent patterns to reduce parsing time.
|
|
2939
2943
|
REPLACEMENTS: {
|
|
2944
|
+
__proto__: null,
|
|
2940
2945
|
'***': '*',
|
|
2941
2946
|
'**/**': '**',
|
|
2942
2947
|
'**/**/**': '**'
|
|
@@ -3544,6 +3549,277 @@ function requireParse () {
|
|
|
3544
3549
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
3545
3550
|
};
|
|
3546
3551
|
|
|
3552
|
+
const splitTopLevel = input => {
|
|
3553
|
+
const parts = [];
|
|
3554
|
+
let bracket = 0;
|
|
3555
|
+
let paren = 0;
|
|
3556
|
+
let quote = 0;
|
|
3557
|
+
let value = '';
|
|
3558
|
+
let escaped = false;
|
|
3559
|
+
|
|
3560
|
+
for (const ch of input) {
|
|
3561
|
+
if (escaped === true) {
|
|
3562
|
+
value += ch;
|
|
3563
|
+
escaped = false;
|
|
3564
|
+
continue;
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3567
|
+
if (ch === '\\') {
|
|
3568
|
+
value += ch;
|
|
3569
|
+
escaped = true;
|
|
3570
|
+
continue;
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3573
|
+
if (ch === '"') {
|
|
3574
|
+
quote = quote === 1 ? 0 : 1;
|
|
3575
|
+
value += ch;
|
|
3576
|
+
continue;
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3579
|
+
if (quote === 0) {
|
|
3580
|
+
if (ch === '[') {
|
|
3581
|
+
bracket++;
|
|
3582
|
+
} else if (ch === ']' && bracket > 0) {
|
|
3583
|
+
bracket--;
|
|
3584
|
+
} else if (bracket === 0) {
|
|
3585
|
+
if (ch === '(') {
|
|
3586
|
+
paren++;
|
|
3587
|
+
} else if (ch === ')' && paren > 0) {
|
|
3588
|
+
paren--;
|
|
3589
|
+
} else if (ch === '|' && paren === 0) {
|
|
3590
|
+
parts.push(value);
|
|
3591
|
+
value = '';
|
|
3592
|
+
continue;
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
|
|
3597
|
+
value += ch;
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
parts.push(value);
|
|
3601
|
+
return parts;
|
|
3602
|
+
};
|
|
3603
|
+
|
|
3604
|
+
const isPlainBranch = branch => {
|
|
3605
|
+
let escaped = false;
|
|
3606
|
+
|
|
3607
|
+
for (const ch of branch) {
|
|
3608
|
+
if (escaped === true) {
|
|
3609
|
+
escaped = false;
|
|
3610
|
+
continue;
|
|
3611
|
+
}
|
|
3612
|
+
|
|
3613
|
+
if (ch === '\\') {
|
|
3614
|
+
escaped = true;
|
|
3615
|
+
continue;
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
if (/[?*+@!()[\]{}]/.test(ch)) {
|
|
3619
|
+
return false;
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3623
|
+
return true;
|
|
3624
|
+
};
|
|
3625
|
+
|
|
3626
|
+
const normalizeSimpleBranch = branch => {
|
|
3627
|
+
let value = branch.trim();
|
|
3628
|
+
let changed = true;
|
|
3629
|
+
|
|
3630
|
+
while (changed === true) {
|
|
3631
|
+
changed = false;
|
|
3632
|
+
|
|
3633
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
3634
|
+
value = value.slice(2, -1);
|
|
3635
|
+
changed = true;
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
if (!isPlainBranch(value)) {
|
|
3640
|
+
return;
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
return value.replace(/\\(.)/g, '$1');
|
|
3644
|
+
};
|
|
3645
|
+
|
|
3646
|
+
const hasRepeatedCharPrefixOverlap = branches => {
|
|
3647
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3648
|
+
|
|
3649
|
+
for (let i = 0; i < values.length; i++) {
|
|
3650
|
+
for (let j = i + 1; j < values.length; j++) {
|
|
3651
|
+
const a = values[i];
|
|
3652
|
+
const b = values[j];
|
|
3653
|
+
const char = a[0];
|
|
3654
|
+
|
|
3655
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
|
|
3656
|
+
continue;
|
|
3657
|
+
}
|
|
3658
|
+
|
|
3659
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) {
|
|
3660
|
+
return true;
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
return false;
|
|
3666
|
+
};
|
|
3667
|
+
|
|
3668
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
3669
|
+
if ((pattern[0] !== '+' && pattern[0] !== '*') || pattern[1] !== '(') {
|
|
3670
|
+
return;
|
|
3671
|
+
}
|
|
3672
|
+
|
|
3673
|
+
let bracket = 0;
|
|
3674
|
+
let paren = 0;
|
|
3675
|
+
let quote = 0;
|
|
3676
|
+
let escaped = false;
|
|
3677
|
+
|
|
3678
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
3679
|
+
const ch = pattern[i];
|
|
3680
|
+
|
|
3681
|
+
if (escaped === true) {
|
|
3682
|
+
escaped = false;
|
|
3683
|
+
continue;
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
if (ch === '\\') {
|
|
3687
|
+
escaped = true;
|
|
3688
|
+
continue;
|
|
3689
|
+
}
|
|
3690
|
+
|
|
3691
|
+
if (ch === '"') {
|
|
3692
|
+
quote = quote === 1 ? 0 : 1;
|
|
3693
|
+
continue;
|
|
3694
|
+
}
|
|
3695
|
+
|
|
3696
|
+
if (quote === 1) {
|
|
3697
|
+
continue;
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
if (ch === '[') {
|
|
3701
|
+
bracket++;
|
|
3702
|
+
continue;
|
|
3703
|
+
}
|
|
3704
|
+
|
|
3705
|
+
if (ch === ']' && bracket > 0) {
|
|
3706
|
+
bracket--;
|
|
3707
|
+
continue;
|
|
3708
|
+
}
|
|
3709
|
+
|
|
3710
|
+
if (bracket > 0) {
|
|
3711
|
+
continue;
|
|
3712
|
+
}
|
|
3713
|
+
|
|
3714
|
+
if (ch === '(') {
|
|
3715
|
+
paren++;
|
|
3716
|
+
continue;
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
if (ch === ')') {
|
|
3720
|
+
paren--;
|
|
3721
|
+
|
|
3722
|
+
if (paren === 0) {
|
|
3723
|
+
if (requireEnd === true && i !== pattern.length - 1) {
|
|
3724
|
+
return;
|
|
3725
|
+
}
|
|
3726
|
+
|
|
3727
|
+
return {
|
|
3728
|
+
type: pattern[0],
|
|
3729
|
+
body: pattern.slice(2, i),
|
|
3730
|
+
end: i
|
|
3731
|
+
};
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
};
|
|
3736
|
+
|
|
3737
|
+
const getStarExtglobSequenceOutput = pattern => {
|
|
3738
|
+
let index = 0;
|
|
3739
|
+
const chars = [];
|
|
3740
|
+
|
|
3741
|
+
while (index < pattern.length) {
|
|
3742
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
3743
|
+
|
|
3744
|
+
if (!match || match.type !== '*') {
|
|
3745
|
+
return;
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3748
|
+
const branches = splitTopLevel(match.body).map(branch => branch.trim());
|
|
3749
|
+
if (branches.length !== 1) {
|
|
3750
|
+
return;
|
|
3751
|
+
}
|
|
3752
|
+
|
|
3753
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
3754
|
+
if (!branch || branch.length !== 1) {
|
|
3755
|
+
return;
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
chars.push(branch);
|
|
3759
|
+
index += match.end + 1;
|
|
3760
|
+
}
|
|
3761
|
+
|
|
3762
|
+
if (chars.length < 1) {
|
|
3763
|
+
return;
|
|
3764
|
+
}
|
|
3765
|
+
|
|
3766
|
+
const source = chars.length === 1
|
|
3767
|
+
? utils.escapeRegex(chars[0])
|
|
3768
|
+
: `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;
|
|
3769
|
+
|
|
3770
|
+
return `${source}*`;
|
|
3771
|
+
};
|
|
3772
|
+
|
|
3773
|
+
const repeatedExtglobRecursion = pattern => {
|
|
3774
|
+
let depth = 0;
|
|
3775
|
+
let value = pattern.trim();
|
|
3776
|
+
let match = parseRepeatedExtglob(value);
|
|
3777
|
+
|
|
3778
|
+
while (match) {
|
|
3779
|
+
depth++;
|
|
3780
|
+
value = match.body.trim();
|
|
3781
|
+
match = parseRepeatedExtglob(value);
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3784
|
+
return depth;
|
|
3785
|
+
};
|
|
3786
|
+
|
|
3787
|
+
const analyzeRepeatedExtglob = (body, options) => {
|
|
3788
|
+
if (options.maxExtglobRecursion === false) {
|
|
3789
|
+
return { risky: false };
|
|
3790
|
+
}
|
|
3791
|
+
|
|
3792
|
+
const max =
|
|
3793
|
+
typeof options.maxExtglobRecursion === 'number'
|
|
3794
|
+
? options.maxExtglobRecursion
|
|
3795
|
+
: constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
3796
|
+
|
|
3797
|
+
const branches = splitTopLevel(body).map(branch => branch.trim());
|
|
3798
|
+
|
|
3799
|
+
if (branches.length > 1) {
|
|
3800
|
+
if (
|
|
3801
|
+
branches.some(branch => branch === '') ||
|
|
3802
|
+
branches.some(branch => /^[*?]+$/.test(branch)) ||
|
|
3803
|
+
hasRepeatedCharPrefixOverlap(branches)
|
|
3804
|
+
) {
|
|
3805
|
+
return { risky: true };
|
|
3806
|
+
}
|
|
3807
|
+
}
|
|
3808
|
+
|
|
3809
|
+
for (const branch of branches) {
|
|
3810
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
3811
|
+
if (safeOutput) {
|
|
3812
|
+
return { risky: true, safeOutput };
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3815
|
+
if (repeatedExtglobRecursion(branch) > max) {
|
|
3816
|
+
return { risky: true };
|
|
3817
|
+
}
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3820
|
+
return { risky: false };
|
|
3821
|
+
};
|
|
3822
|
+
|
|
3547
3823
|
/**
|
|
3548
3824
|
* Parse the given input string.
|
|
3549
3825
|
* @param {String} input
|
|
@@ -3725,6 +4001,8 @@ function requireParse () {
|
|
|
3725
4001
|
token.prev = prev;
|
|
3726
4002
|
token.parens = state.parens;
|
|
3727
4003
|
token.output = state.output;
|
|
4004
|
+
token.startIndex = state.index;
|
|
4005
|
+
token.tokensIndex = tokens.length;
|
|
3728
4006
|
const output = (opts.capture ? '(' : '') + token.open;
|
|
3729
4007
|
|
|
3730
4008
|
increment('parens');
|
|
@@ -3734,6 +4012,34 @@ function requireParse () {
|
|
|
3734
4012
|
};
|
|
3735
4013
|
|
|
3736
4014
|
const extglobClose = token => {
|
|
4015
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
4016
|
+
const body = input.slice(token.startIndex + 2, state.index);
|
|
4017
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
4018
|
+
|
|
4019
|
+
if ((token.type === 'plus' || token.type === 'star') && analysis.risky) {
|
|
4020
|
+
const safeOutput = analysis.safeOutput
|
|
4021
|
+
? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput)
|
|
4022
|
+
: undefined;
|
|
4023
|
+
const open = tokens[token.tokensIndex];
|
|
4024
|
+
|
|
4025
|
+
open.type = 'text';
|
|
4026
|
+
open.value = literal;
|
|
4027
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
4028
|
+
|
|
4029
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
4030
|
+
tokens[i].value = '';
|
|
4031
|
+
tokens[i].output = '';
|
|
4032
|
+
delete tokens[i].suffix;
|
|
4033
|
+
}
|
|
4034
|
+
|
|
4035
|
+
state.output = token.output + open.output;
|
|
4036
|
+
state.backtrack = true;
|
|
4037
|
+
|
|
4038
|
+
push({ type: 'paren', extglob: true, value, output: '' });
|
|
4039
|
+
decrement('parens');
|
|
4040
|
+
return;
|
|
4041
|
+
}
|
|
4042
|
+
|
|
3737
4043
|
let output = token.close + (opts.capture ? ')' : '');
|
|
3738
4044
|
let rest;
|
|
3739
4045
|
|
|
@@ -8489,7 +8795,6 @@ function parseJson(path, text) {
|
|
|
8489
8795
|
return result;
|
|
8490
8796
|
}
|
|
8491
8797
|
|
|
8492
|
-
const { firstBy } = thenby;
|
|
8493
8798
|
function read(stream) {
|
|
8494
8799
|
const bufs = [];
|
|
8495
8800
|
return new Promise((resolve) => {
|