ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / build / gulpfile.reh.ts 689 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
import { gulp, rename, replace, filter, flatmap, gunzip, jsonEditor } from './lib/gulp/facade.ts' ;
import * as path from 'path' ;
import es from 'event-stream' ;
import * as util from './lib/util.ts' ;
import { getVersion } from './lib/getVersion.ts' ;
import * as task from './lib/gulp/task.ts' ;
import * as optimize from './lib/optimize.ts' ;
import { inlineMeta
product type
getProductionDependencies
readISODate
vfs
packageJson type
untar
File
fs
glob
promisify
rceditCallback
compileBuildWithManglingTask
cleanExtensionsBuildTask compileNonNativeExtensionsBuildTask compileNativeExtensionsBuildTask compileExtensionMediaBuildTask compileCopilotExtensionBuildTask
vscodeWebResourceIncludes createVSCodeWebFileContentMapper
cp
crypto
log
buildfile
fetchUrls
downloadFeedPackage
ensureCopilotPlatformPackage getCopilotExcludeFilter getCopilotRuntimePrebuildFiles getCopilotTgrepExcludeFilter getMxcExcludeFilter getRipgrepExcludeFilter prepareBuiltInCopilotRipgrepShim
readAgentSdkResults
rcedit rceditCallback
path meta dirname
commit
path
path
platform arch
platform arch
platform arch
platform arch
platform arch
platform arch
platform arch
platform arch
serverResourceIncludes
serverResourceExcludes
serverResources
serverResourceIncludes
serverResourceExcludes
serverWithWebResourceIncludes
serverResourceIncludes
vscodeWebResourceIncludes
serverWithWebResourceExcludes
serverResourceExcludes
serverWithWebResources
serverWithWebResourceIncludes
serverWithWebResourceExcludes
serverEntryPoints buildfile codeServer
webEntryPoints
buildfile workerEditor
buildfile workerExtensionHost
buildfile workerNotebook
buildfile workerLanguageDetection
buildfile workerLocalFileSearch
buildfile workerOutputLinks
buildfile workerBackgroundTokenization
buildfile keyboardMaps
buildfile codeWeb
serverWithWebEntryPoints
serverEntryPoints
webEntryPoints
bootstrapEntryPoints
npmrc fs path
nodeVersion npmrc
internalNodeVersion npmrc
nodeVersion internalNodeVersion
expectedName
nodeJsChecksums fs path
line nodeJsChecksums
checksum name line
name expectedName
checksum
nodeVersion platform arch
imageName arch
contents cp maxBuffer encoding
es path contents stat mode fs Stats
NodeJS ReadWriteStream
es file
file contents Buffer file contents
file
buf file contents
buf length
file
buf buf buf buf
file
buf buf
file
e_phoff buf
e_phentsize buf
e_phnum buf
e_phentsize
file
i i e_phnum i
off e_phoff i e_phentsize
off e_phentsize buf length
buf off
buf off
buf off
file
nodeVersion internalNodeVersion
nodejsArtifactFeed product nodejsArtifactFeed
assetName
assetName
feed assetName version checksumSha256 NodeJS ReadWriteStream
result es
filePath feed name assetName version
contents fs promises filePath
checksumSha256
actual crypto contents
actual checksumSha256
result path path filePath contents
result
err
result err
result
platform arch
task task
nodePath path
fs nodePath
util nodePath
platform arch
vfs nodePath
defaultNodeTask task
defaultNodeTask
task task defaultNodeTask
platform arch NodeJS ReadWriteStream
arch
platform
arch
glibcPrefix process env
expectedName
platform
expectedName nodejsArtifactFeed
expectedName
expectedName
expectedName
checksumSha256 expectedName expectedName
checksumSha256
log
platform
nodejsArtifactFeed
expectedName checksumSha256
base checksumSha256
downloaded nodejsArtifactFeed
expectedName checksumSha256
base checksumSha256
stream stream
util
platform arch downloaded downloaded
nodejsArtifactFeed
expectedName checksumSha256
stream stream
util
nodeVersion platform arch
assetName checksumSha256 NodeJS ReadWriteStream
version
nodejsArtifactFeed assetName version checksumSha256
type platform arch sourceFolderName destinationFolderName
destination path destinationFolderName
src gulp sourceFolderName base
path path dirname path dirname sourceFolderName
util
workspaceExtensionPoints
manifest extensionKind main contributes Record
manifest extensionKind
manifest main
manifest contributes Object manifest contributes key workspaceExtensionPoints key
localWorkspaceExtensions glob
extensionPath
type
manifest fs path extensionPath
manifest
extensionPath path path extensionPath
name name name
builtInExtensions name platforms clientOnly fs path builtInExtensions
marketplaceExtensions builtInExtensions
entry entry platforms entry platforms platform
entry entry clientOnly
entry entry name
extensionPaths localWorkspaceExtensions marketplaceExtensions
name
extensions gulp extensionPaths base dot
extensionsCommonDependencies gulp base dot
sources es src extensions extensionsCommonDependencies
dot
version packageJson version
quality product product quality quality
quality quality
version quality
name product nameShort
packageJsonContents
packageJsonStream gulp base
name version dependencies optionalDependencies type
es file
packageJsonContents file contents
file
productJsonContents
productJsonStream gulp base
json Record
json commit commit
json date sourceFolderName
json version version
type
agentSdks
Object agentSdks length
json agentSdks agentSdks
json
es file
productJsonContents file contents
file
license gulp base allowEmpty
jsFilter util data data data path
productionDependencies
dependenciesSrc productionDependencies d path d d
cleanedDeps gulp dependenciesSrc base dot
util path meta dirname
util path meta dirname
platform arch
copilotRuntimePrebuilds gulp platform arch base dot allowEmpty
deps es cleanedDeps copilotRuntimePrebuilds
platform arch
platform arch
platform arch
arch
jsFilter
util
jsFilter restore
nodePath
node gulp base nodePath dot
web NodeJS ReadWriteStream
type
web
resource gulp resource base resource
all es
packageJsonStream
productJsonStream
license
sources
deps
node
web
result all
util
util
platform
result es result
gulp base
version
commit
product applicationName
gulp base
version
commit
product applicationName
gulp base
platform platform platform
result es result
gulp base
version
commit
product applicationName
util
gulp base
version
commit
product applicationName
util
gulp base
util
platform platform
result es result
gulp base
util
result result
targetPaths bootstrapEntryPoints
packageJsonContents
productJsonContents
result vfs destination
filePath
resolve reject
proc cp filePath
proc reject
proc code code
filePath
filePath
resolve reject
proc cp filePath
out
proc stdout chunk out chunk
proc stderr chunk out chunk
proc reject
proc code
code
process stderr out
destinationFolderName
cwd path destinationFolderName
deps
glob cwd
glob cwd
glob cwd
glob cwd
o o
packageJsonContents fs promises path cwd
productContents fs promises path cwd
baseVersion packageJsonContents version
patchPromises deps dep
basename path dep
fullPath path cwd dep
fullPath
fullPath
baseVersion
productContents nameLong
packageJsonContents version
basename
basename
productContents nameLong
packageJsonContents version
patchPromises
platform arch destinationFolderName
outputDir path destinationFolderName
nodeModulesDir path outputDir
builtInCopilotExtensionDir path outputDir
platform arch builtInCopilotExtensionDir nodeModulesDir
product
result product webEndpointUrlTemplate product
result webEndpointUrlTemplate
result
type
bundleTask task task
util
optimize
out
esm
src
entryPoints
type serverEntryPoints serverWithWebEntryPoints
bootstrapEntryPoints
resources type serverResources serverWithWebResources
fileContentMapper type product product
minifyTask task task
bundleTask
util
optimize
task minifyTask
buildTarget
str str
platform buildTarget platform
arch buildTarget arch
minified
sourceFolderName
destinationFolderName
packageTasks task Task
compileNativeExtensionsBuildTask
task task Task
util path destinationFolderName
type platform arch sourceFolderName destinationFolderName
platform arch destinationFolderName
platform
packageTasks destinationFolderName
serverTaskCI task task packageTasks
task serverTaskCI
serverTask task task
compileBuildWithManglingTask
cleanExtensionsBuildTask
compileNonNativeExtensionsBuildTask
compileCopilotExtensionBuildTask
compileExtensionMediaBuildTask
minified minifyTask bundleTask
serverTaskCI
task serverTask
}
from
'./lib/inlineMeta.ts'
;
import
from
'../product.json'
with
{
:
'json'
}
;
import
{
}
from
'./lib/dependencies.ts'
;
import
{
}
from
'./lib/date.ts'
;
import
from
'vinyl-fs'
;
import
from
'../package.json'
with
{
:
'json'
}
;
import
{
}
from
'./lib/util.ts'
;
import
from
'vinyl'
;
import
*
as
from
'fs'
;
import
from
'glob'
;
import
{
}
from
'util'
;
import
from
'rcedit'
;
import
{
}
from
'./gulpfile.compile.ts'
;
import
{
,
,
,
,
}
from
'./gulpfile.extensions.ts'
;
import
{
,
}
from
'./gulpfile.vscode.web.ts'
;
import
*
as
from
'child_process'
;
import
from
'crypto'
;
import
from
'fancy-log'
;
import
from
'./buildfile.ts'
;
import
{
}
from
'./lib/fetch.ts'
;
import
{
}
from
'./lib/azureFeed.ts'
;
import
{
,
,
,
,
,
,
}
from
'./lib/copilot.ts'
;
import
{
}
from
'./agent-sdk/common.ts'
;
const
=
promisify
(
)
;
const
REPO_ROOT
=
.
dirname
(
import
.
.
)
;
const
=
getVersion
(
REPO_ROOT
)
;
const
BUILD_ROOT
=
.
dirname
(
REPO_ROOT
)
;
const
REMOTE_FOLDER
=
.
join
(
REPO_ROOT
,
'remote'
)
;
const
BUILD_TARGETS
=
[
{
:
'win32'
,
:
'x64'
}
,
{
:
'win32'
,
:
'arm64'
}
,
{
:
'darwin'
,
:
'x64'
}
,
{
:
'darwin'
,
:
'arm64'
}
,
{
:
'linux'
,
:
'x64'
}
,
{
:
'linux'
,
:
'arm64'
}
,
{
:
'alpine'
,
:
'arm64'
}
,
{
:
'linux'
,
:
'alpine'
}
,
]
;
const
=
[
'out-build/nls.messages.json'
,
'out-build/nls.keys.json'
,
'out-build/vs/base/node/cpuUsage.sh'
,
'out-build/vs/base/node/ps.sh'
,
'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt'
,
'out-build/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1'
,
'out-build/vs/workbench/contrib/terminal/common/scripts/CodeTabExpansion.psm1'
,
'out-build/vs/workbench/contrib/terminal/common/scripts/GitTabExpansion.psm1'
,
'out-build/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh'
,
'out-build/vs/workbench/contrib/terminal/common/scripts/shellIntegration-env.zsh'
,
'out-build/vs/workbench/contrib/terminal/common/scripts/shellIntegration-profile.zsh'
,
'out-build/vs/workbench/contrib/terminal/common/scripts/shellIntegration-rc.zsh'
,
'out-build/vs/workbench/contrib/terminal/common/scripts/shellIntegration-login.zsh'
,
'out-build/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish'
,
'out-build/vs/workbench/contrib/terminal/common/scripts/psreadline/**'
,
]
;
const
=
[
'!out-build/vs/**/{electron-browser,electron-main,electron-utility}/**'
,
'!out-build/vs/editor/standalone/**'
,
'!out-build/vs/workbench/**/*-tb.png'
,
'!**/test/**'
]
;
const
=
[
...
,
...
]
;
const
=
[
...
,
'out-build/vs/code/browser/workbench/*.html'
,
...
]
;
const
=
[
...
,
'!out-build/vs/code/**/*-dev.html'
]
;
const
=
[
...
,
...
]
;
const
=
.
;
const
=
[
.
,
.
,
.
,
.
,
.
,
.
,
.
,
.
,
.
]
.
flat
(
)
;
const
=
[
...
,
...
,
]
.
flat
(
)
;
const
=
[
'out-build/server-main.js'
,
'out-build/server-cli.js'
,
'out-build/bootstrap-fork.js'
]
;
function
getNodeVersion
(
)
{
const
=
.
readFileSync
(
.
join
(
REPO_ROOT
,
'remote'
,
'.npmrc'
)
,
'utf8'
)
;
const
=
/ ^ target="( . * ) "$ / m
.
exec
(
)
!
[
1
]
;
const
=
/ ^ ms_build_id="( . * ) "$ / m
.
exec
(
)
!
[
1
]
;
return
{
,
}
;
}
function
getNodeChecksum
(
:
string
)
:
string
|
undefined
{
const
=
.
readFileSync
(
.
join
(
REPO_ROOT
,
'build'
,
'checksums'
,
'nodejs.txt'
)
,
'utf8'
)
;
for
(
const
of
.
split
(
'\n'
)
)
{
const
[
,
]
=
.
split
(
/ \s + /
)
;
if
(
===
)
{
return
;
}
}
return
undefined
;
}
function
extractAlpinefromDocker
(
:
string
,
:
string
,
:
string
)
{
const
=
===
'arm64'
?
'arm64v8/node'
:
'node'
;
log
(
` Downloading node.js ${ nodeVersion} ${ platform} ${ arch} from docker image ${ imageName} `
)
;
const
=
.
execSync
(
` docker run --rm ${ imageName} : ${ nodeVersion} -alpine /bin/sh -c 'cat \`which node\`' `
,
{
:
100
*
1024
*
1024
,
:
'buffer'
}
)
;
return
.
readArray
(
[
new
File
(
{
:
'node'
,
,
:
{
:
parseInt
(
'755'
,
8
)
}
as
.
}
)
]
)
;
}
function
patchElfLoadAlign
(
)
:
.
{
return
.
mapSync < File, File>
(
=>
{
if
(
!
.
||
!
.
isBuffer
(
.
)
)
{
return
;
}
const
=
.
;
if
(
.
<
64
)
{
return
;
}
if
(
[
0
]
!==
0x7f
||
[
1
]
!==
0x45
||
[
2
]
!==
0x4c
||
[
3
]
!==
0x46
)
{
return
;
}
if
(
[
4
]
!==
2
||
[
5
]
!==
1
)
{
return
;
}
const
=
Number
(
.
readBigUInt64LE
(
0x20
)
)
;
const
=
.
readUInt16LE
(
0x36
)
;
const
=
.
readUInt16LE
(
0x38
)
;
if
(
!==
56
)
{
return
;
}
const
PT_LOAD
=
1
;
const
MAX_ALIGN
=
0x1000n
;
for
(
let
=
0
;
<
;
++
)
{
const
=
+
*
;
if
(
+
>
.
)
{
break
;
}
if
(
.
readUInt32LE
(
)
!==
PT_LOAD
)
{
continue
;
}
if
(
.
readBigUInt64LE
(
+
48
)
>
MAX_ALIGN
)
{
.
writeBigUInt64LE
(
MAX_ALIGN
,
+
48
)
;
}
}
return
;
}
)
;
}
const
{
,
}
=
getNodeVersion
(
)
;
const
=
.
;
function
internalNodeFeedPackageName
(
:
string
)
:
string
{
return
.
replace
(
/ \. [ ^ .] + $ /
,
''
)
.
toLowerCase
(
)
.
replace
(
/ [ ^ a- z 0- 9 ._-] + / g
,
'-'
)
.
replace
(
/ ^ [ ._-] + /
,
''
)
.
replace
(
/ [ ._-] + $ /
,
''
)
;
}
function
fetchNodejsFromInternalFeed
(
:
string
,
:
string
,
:
string
,
:
string
|
undefined
)
:
.
{
const
=
.
through
(
)
;
(
async
(
)
=>
{
try
{
const
=
await
downloadFeedPackage
(
REPO_ROOT
,
'nodejs-feed'
,
{
,
:
internalNodeFeedPackageName
(
)
,
}
)
;
const
=
await
.
.
readFile
(
)
;
if
(
)
{
const
=
.
createHash
(
'sha256'
)
.
update
(
)
.
digest
(
'hex'
)
;
if
(
!==
)
{
throw
new
Error
(
` Checksum mismatch for ${ assetName} (expected ${ checksumSha256} , actual ${ actual} ) `
)
;
}
}
.
emit
(
'data'
,
new
File
(
{
:
.
basename
(
)
,
}
)
)
;
.
emit
(
'end'
)
;
}
catch
(
)
{
.
emit
(
'error'
,
)
;
}
}
)
(
)
;
return
;
}
BUILD_TARGETS
.
forEach
(
(
{
,
}
)
=>
{
.
task
(
.
define
(
` node- ${ platform} - ${ arch} `
,
(
)
=>
{
const
=
.
join
(
'.build'
,
'node'
,
` v ${ nodeVersion} `
,
` ${ platform} - ${ arch} `
)
;
if
(
!
.
existsSync
(
)
)
{
.
rimraf
(
)
;
return
nodejs
(
,
)
!
.
pipe
(
.
dest
(
)
)
;
}
return
Promise
.
resolve
(
null
)
;
}
)
)
;
}
)
;
const
=
.
task
(
` node- ${ process. platform} - ${ process. arch} `
)
;
if
(
)
{
.
task
(
.
define
(
'node'
,
as
any
)
)
;
}
function
nodejs
(
:
string
,
:
string
)
:
.
|
undefined
{
if
(
===
'alpine'
)
{
=
'alpine'
;
=
'x64'
;
}
log
(
` Downloading node.js ${ nodeVersion} ${ platform} ${ arch} from ${ nodejsArtifactFeed || 'https://nodejs.org' } ... `
)
;
const
=
.
[
'VSCODE_NODE_GLIBC'
]
??
''
;
let
:
string
|
undefined
;
switch
(
)
{
case
'win32'
:
=
?
` win- ${ arch} -node.exe `
:
` win- ${ arch} /node.exe `
;
break
;
case
'darwin'
:
=
` node-v ${ nodeVersion} - ${ platform} - ${ arch} .tar.gz `
;
break
;
case
'linux'
:
=
` node-v ${ nodeVersion} ${ glibcPrefix} - ${ platform} - ${ arch} .tar.gz `
;
break
;
case
'alpine'
:
=
` node-v ${ nodeVersion} -linux- ${ arch} -musl.tar.gz `
;
break
;
}
const
=
?
getNodeChecksum
(
)
:
undefined
;
if
(
)
{
log
(
` Using SHA256 checksum for checking integrity: ${ checksumSha256} `
)
;
}
else
{
.
warn
(
` Unable to verify integrity of downloaded node.js binary because no SHA256 checksum was found! `
)
;
}
switch
(
)
{
case
'win32'
:
return
(
?
fetchNodejs
(
!
,
)
:
fetchUrls
(
` /dist/v ${ nodeVersion} /win- ${ arch} /node.exe `
,
{
:
'https://nodejs.org'
,
}
)
)
.
pipe
(
rename
(
'node.exe'
)
)
;
case
'darwin'
:
case
'linux'
:
{
const
=
(
?
fetchNodejs
(
!
,
)
:
fetchUrls
(
` /dist/v ${ nodeVersion} /node-v ${ nodeVersion} - ${ platform} - ${ arch} .tar.gz `
,
{
:
'https://nodejs.org'
,
}
)
)
.
pipe
(
flatmap
(
=>
.
pipe
(
gunzip
(
)
)
.
pipe
(
untar
(
)
)
)
)
.
pipe
(
filter
(
'**/node'
)
)
.
pipe
(
.
setExecutableBit
(
'**'
)
)
.
pipe
(
rename
(
'node'
)
)
;
return
===
'linux'
&&
===
'x64'
?
.
pipe
(
patchElfLoadAlign
(
)
)
:
;
}
case
'alpine'
:
return
?
fetchNodejs
(
!
,
)
.
pipe
(
flatmap
(
=>
.
pipe
(
gunzip
(
)
)
.
pipe
(
untar
(
)
)
)
)
.
pipe
(
filter
(
'**/node'
)
)
.
pipe
(
.
setExecutableBit
(
'**'
)
)
.
pipe
(
rename
(
'node'
)
)
:
extractAlpinefromDocker
(
,
,
)
;
}
}
function
fetchNodejs
(
:
string
,
:
string
|
undefined
)
:
.
{
const
=
` ${ nodeVersion} - ${ internalNodeVersion} `
;
return
fetchNodejsFromInternalFeed
(
,
,
,
)
;
}
function
packageTask
(
:
string
,
:
string
,
:
string
,
:
string
,
:
string
)
{
const
=
.
join
(
BUILD_ROOT
,
)
;
return
(
)
=>
{
const
=
.
src
(
+
'/**'
,
{
:
'.'
}
)
.
pipe
(
rename
(
function
(
)
{
.
=
.
!
.
replace
(
new
RegExp
(
'^'
+
)
,
'out'
)
;
}
)
)
.
pipe
(
.
setExecutableBit
(
[
'**/*.sh'
]
)
)
.
pipe
(
filter
(
[
'**'
,
'!**/*.{js,css}.map'
]
)
)
;
const
=
[
'debuggers'
,
'jsonValidation'
]
;
const
isUIExtension
=
(
:
{
?
:
string
;
?
:
string
;
?
:
<
string
,
unknown
>
}
)
=>
{
switch
(
.
)
{
case
'ui'
:
return
true
;
case
'workspace'
:
return
false
;
default
:
{
if
(
.
)
{
return
false
;
}
if
(
.
&&
.
keys
(
.
)
.
some
(
=>
.
indexOf
(
)
!==
-
1
)
)
{
return
false
;
}
return
true
;
}
}
}
;
const
=
.
sync
(
'extensions/*/package.json'
)
.
filter
(
(
)
=>
{
if
(
===
'reh-web'
)
{
return
true
;
}
const
=
JSON
.
parse
(
.
readFileSync
(
.
join
(
REPO_ROOT
,
)
)
.
toString
(
)
)
;
return
!
isUIExtension
(
)
;
}
)
.
map
(
(
)
=>
.
basename
(
.
dirname
(
)
)
)
.
filter
(
=>
!==
'vscode-api-tests'
&&
!==
'vscode-test-resolver'
)
;
const
:
Array
<
{
:
string
;
?
:
string
[
]
;
?
:
boolean
}
>
=
JSON
.
parse
(
.
readFileSync
(
.
join
(
REPO_ROOT
,
'product.json'
)
,
'utf8'
)
)
.
;
const
=
.
filter
(
=>
!
.
||
new
Set
(
.
)
.
has
(
)
)
.
filter
(
=>
!
.
)
.
map
(
=>
.
)
;
const
=
[
...
,
...
]
.
map
(
=>
` .build/extensions/ ${ name} /** `
)
;
const
=
.
src
(
,
{
:
'.build'
,
:
true
}
)
;
const
=
.
src
(
'.build/extensions/node_modules/**'
,
{
:
'.build'
,
:
true
}
)
;
const
=
.
merge
(
,
,
)
.
pipe
(
filter
(
[
'**'
,
'!**/*.{js,css}.map'
]
,
{
:
true
}
)
)
;
let
=
.
;
const
=
(
as
typeof
&
{
?
:
string
}
)
.
;
if
(
&&
!==
'stable'
)
{
+=
'-'
+
;
}
const
=
.
;
let
=
''
;
const
=
.
src
(
[
'remote/package.json'
]
,
{
:
'remote'
}
)
.
pipe
(
jsonEditor
(
{
,
,
:
undefined
,
:
undefined
,
:
'module'
}
)
)
.
pipe
(
.
through
(
function
(
)
{
=
.
.
toString
(
)
;
this
.
emit
(
'data'
,
)
;
}
)
)
;
let
=
''
;
const
=
.
src
(
[
'product.json'
]
,
{
:
'.'
}
)
.
pipe
(
jsonEditor
(
(
:
<
string
,
unknown
>
)
=>
{
.
=
;
.
=
readISODate
(
)
;
.
=
;
if
(
===
'reh'
)
{
const
=
readAgentSdkResults
(
)
;
if
(
.
keys
(
)
.
>
0
)
{
.
=
;
}
}
return
;
}
)
)
.
pipe
(
.
through
(
function
(
)
{
=
.
.
toString
(
)
;
this
.
emit
(
'data'
,
)
;
}
)
)
;
const
=
.
src
(
[
'remote/LICENSE'
]
,
{
:
'remote'
,
:
true
}
)
;
const
=
.
filter
(
=>
!
.
isDirectory
(
)
&&
/ \. js$ /
.
test
(
.
)
)
;
const
=
getProductionDependencies
(
REMOTE_FOLDER
)
;
const
=
.
map
(
=>
.
relative
(
REPO_ROOT
,
)
)
.
map
(
=>
[
` ${ d} /** `
,
` ! ${ d} /**/{test,tests}/** `
,
` ! ${ d} /.bin/** `
]
)
.
flat
(
)
;
const
=
.
src
(
,
{
:
'remote'
,
:
true
}
)
.
pipe
(
filter
(
[
'**'
,
'!**/package-lock.json'
,
'!**/*.{js,css}.map'
]
)
)
.
pipe
(
.
cleanNodeModules
(
.
join
(
import
.
.
,
'.moduleignore'
)
)
)
.
pipe
(
.
cleanNodeModules
(
.
join
(
import
.
.
,
` .moduleignore. ${ process. platform} `
)
)
)
;
ensureCopilotPlatformPackage
(
,
,
'remote/node_modules'
)
;
const
=
.
src
(
getCopilotRuntimePrebuildFiles
(
,
,
'remote/node_modules'
)
,
{
:
'remote'
,
:
true
,
:
true
}
)
;
const
=
.
merge
(
,
)
.
pipe
(
filter
(
getCopilotExcludeFilter
(
,
)
)
)
.
pipe
(
filter
(
getCopilotTgrepExcludeFilter
(
,
)
)
)
.
pipe
(
filter
(
getRipgrepExcludeFilter
(
,
)
)
)
.
pipe
(
filter
(
getMxcExcludeFilter
(
)
)
)
.
pipe
(
)
.
pipe
(
.
stripSourceMappingURL
(
)
)
.
pipe
(
.
)
;
const
=
` .build/node/v ${ nodeVersion} / ${ platform} - ${ arch} `
;
const
=
.
src
(
` ${ nodePath} /** `
,
{
:
,
:
true
}
)
;
let
:
.
[
]
=
[
]
;
if
(
===
'reh-web'
)
{
=
[
'resources/server/favicon.ico'
,
'resources/server/code-192.png'
,
'resources/server/code-512.png'
,
'resources/server/manifest.json'
]
.
map
(
=>
.
src
(
,
{
:
'.'
}
)
.
pipe
(
rename
(
)
)
)
;
}
const
=
.
merge
(
,
,
,
,
,
,
...
)
;
let
=
.
pipe
(
.
skipDirectories
(
)
)
.
pipe
(
.
fixWin32DirectoryPermissions
(
)
)
;
if
(
===
'win32'
)
{
=
.
merge
(
,
.
src
(
'resources/server/bin/remote-cli/code.cmd'
,
{
:
'.'
}
)
.
pipe
(
replace
(
'@@VERSION@@'
,
)
)
.
pipe
(
replace
(
'@@COMMIT@@'
,
||
''
)
)
.
pipe
(
replace
(
'@@APPNAME@@'
,
.
)
)
.
pipe
(
rename
(
` bin/remote-cli/ ${ product. applicationName} .cmd `
)
)
,
.
src
(
'resources/server/bin/helpers/browser.cmd'
,
{
:
'.'
}
)
.
pipe
(
replace
(
'@@VERSION@@'
,
)
)
.
pipe
(
replace
(
'@@COMMIT@@'
,
||
''
)
)
.
pipe
(
replace
(
'@@APPNAME@@'
,
.
)
)
.
pipe
(
rename
(
` bin/helpers/browser.cmd `
)
)
,
.
src
(
'resources/server/bin/code-server.cmd'
,
{
:
'.'
}
)
.
pipe
(
rename
(
` bin/ ${ product. serverApplicationName} .cmd `
)
)
,
)
;
}
else
if
(
===
'linux'
||
===
'alpine'
||
===
'darwin'
)
{
=
.
merge
(
,
.
src
(
` resources/server/bin/remote-cli/ ${ platform === 'darwin' ? 'code-darwin.sh' : 'code-linux.sh' } `
,
{
:
'.'
}
)
.
pipe
(
replace
(
'@@VERSION@@'
,
)
)
.
pipe
(
replace
(
'@@COMMIT@@'
,
||
''
)
)
.
pipe
(
replace
(
'@@APPNAME@@'
,
.
)
)
.
pipe
(
rename
(
` bin/remote-cli/ ${ product. applicationName} `
)
)
.
pipe
(
.
setExecutableBit
(
)
)
,
.
src
(
` resources/server/bin/helpers/ ${ platform === 'darwin' ? 'browser-darwin.sh' : 'browser-linux.sh' } `
,
{
:
'.'
}
)
.
pipe
(
replace
(
'@@VERSION@@'
,
)
)
.
pipe
(
replace
(
'@@COMMIT@@'
,
||
''
)
)
.
pipe
(
replace
(
'@@APPNAME@@'
,
.
)
)
.
pipe
(
rename
(
` bin/helpers/browser.sh `
)
)
.
pipe
(
.
setExecutableBit
(
)
)
,
.
src
(
` resources/server/bin/ ${ platform === 'darwin' ? 'code-server-darwin.sh' : 'code-server-linux.sh' } `
,
{
:
'.'
}
)
.
pipe
(
rename
(
` bin/ ${ product. serverApplicationName} `
)
)
.
pipe
(
.
setExecutableBit
(
)
)
)
;
}
if
(
===
'linux'
||
===
'alpine'
)
{
=
.
merge
(
,
.
src
(
` resources/server/bin/helpers/check-requirements-linux.sh `
,
{
:
'.'
}
)
.
pipe
(
rename
(
` bin/helpers/check-requirements.sh `
)
)
.
pipe
(
.
setExecutableBit
(
)
)
)
;
}
=
inlineMeta
(
,
{
:
,
packageJsonFn
:
(
)
=>
,
productJsonFn
:
(
)
=>
}
)
;
return
.
pipe
(
.
dest
(
)
)
;
}
;
}
function
hasAuthenticodeSignature
(
:
string
)
:
Promise
<
boolean
>
{
return
new
Promise
(
(
,
)
=>
{
const
=
.
spawn
(
'signtool.exe'
,
[
'verify'
,
'/pa'
,
]
)
;
.
on
(
'error'
,
)
;
.
on
(
'exit'
,
=>
resolve
(
===
0
)
)
;
}
)
;
}
async
function
stripAuthenticodeSignature
(
:
string
)
:
Promise
<
void
>
{
if
(
!
await
hasAuthenticodeSignature
(
)
)
{
return
;
}
await
new
Promise < void >
(
(
,
)
=>
{
const
=
.
spawn
(
'signtool.exe'
,
[
'remove'
,
'/s'
,
]
)
;
let
=
''
;
.
?.
on
(
'data'
,
=>
+=
.
toString
(
)
)
;
.
?.
on
(
'data'
,
=>
+=
.
toString
(
)
)
;
.
on
(
'error'
,
)
;
.
on
(
'exit'
,
=>
{
if
(
===
0
)
{
resolve
(
)
;
}
else
{
.
.
write
(
)
;
reject
(
new
Error
(
` signtool remove /s failed for ${ filePath} (exit ${ code} ) `
)
)
;
}
}
)
;
}
)
;
}
function
patchWin32DependenciesTask
(
:
string
)
{
const
=
.
join
(
BUILD_ROOT
,
)
;
return
async
(
)
=>
{
const
=
(
await
Promise
.
all
(
[
promisify
(
)
(
'**/*.node'
,
{
}
)
,
promisify
(
)
(
'**/rg.exe'
,
{
}
)
,
promisify
(
)
(
'**/tgrep.exe'
,
{
}
)
,
promisify
(
)
(
'**/OneAuthInterop.dll'
,
{
}
)
,
]
)
)
.
flatMap
(
=>
)
;
const
=
JSON
.
parse
(
await
.
.
readFile
(
.
join
(
,
'package.json'
)
,
'utf8'
)
)
;
const
=
JSON
.
parse
(
await
.
.
readFile
(
.
join
(
,
'product.json'
)
,
'utf8'
)
)
;
const
=
.
.
replace
(
/ -. * $ /
,
''
)
;
const
=
.
map < Promise < unknown >>
(
async
=>
{
const
=
.
basename
(
)
;
const
=
.
join
(
,
)
;
await
stripAuthenticodeSignature
(
)
;
await
rcedit
(
,
{
'file-version'
:
,
'version-string'
:
{
'CompanyName'
:
'Microsoft Corporation'
,
'FileDescription'
:
.
,
'FileVersion'
:
.
,
'InternalName'
:
,
'LegalCopyright'
:
'Copyright (C) 2026 Microsoft. All rights reserved'
,
'OriginalFilename'
:
,
'ProductName'
:
.
,
'ProductVersion'
:
.
,
}
}
)
;
}
)
;
await
Promise
.
all
(
)
;
}
;
}
function
prepareCopilotRipgrepShimTaskREH
(
:
string
,
:
string
,
:
string
)
{
return
async
(
)
=>
{
const
=
.
join
(
BUILD_ROOT
,
)
;
const
=
.
join
(
,
'node_modules'
)
;
const
=
.
join
(
,
'extensions'
,
'copilot'
)
;
prepareBuiltInCopilotRipgrepShim
(
,
,
,
)
;
}
;
}
function
tweakProductForServerWeb
(
:
typeof
import
(
'../product.json'
)
)
{
const
:
typeof
&
{
?
:
string
}
=
{
...
}
;
delete
.
;
return
;
}
[
'reh'
,
'reh-web'
]
.
forEach
(
=>
{
const
=
.
define
(
` bundle-vscode- ${ type } `
,
.
series
(
.
rimraf
(
` out-vscode- ${ type } `
)
,
.
bundleTask
(
{
:
` out-vscode- ${ type } `
,
:
{
:
'out-build'
,
:
[
...
(
===
'reh'
?
:
)
,
...
]
,
:
===
'reh'
?
:
,
:
createVSCodeWebFileContentMapper
(
'.build/extensions'
,
===
'reh-web'
?
tweakProductForServerWeb
(
)
:
)
}
}
)
)
)
;
const
=
.
define
(
` minify-vscode- ${ type } `
,
.
series
(
,
.
rimraf
(
` out-vscode- ${ type } -min `
)
,
.
minifyTask
(
` out-vscode- ${ type } `
,
` https://main.vscode-cdn.net/sourcemaps/ ${ commit} /core `
)
)
)
;
.
task
(
)
;
BUILD_TARGETS
.
forEach
(
=>
{
const
dashed
=
(
:
string
)
=>
(
?
` - ${ str} `
:
` `
)
;
const
=
.
;
const
=
.
;
[
''
,
'min'
]
.
forEach
(
=>
{
const
=
` out-vscode- ${ type } ${ dashed ( minified) } `
;
const
=
` vscode- ${ type } ${ dashed ( platform) } ${ dashed ( arch) } `
;
const
:
.
[
]
=
[
,
.
task
(
` node- ${ platform} - ${ arch} `
)
as
.
,
.
rimraf
(
.
join
(
BUILD_ROOT
,
)
)
,
packageTask
(
,
,
,
,
)
,
prepareCopilotRipgrepShimTaskREH
(
,
,
)
]
;
if
(
===
'win32'
)
{
.
push
(
patchWin32DependenciesTask
(
)
)
;
}
const
=
.
define
(
` vscode- ${ type } ${ dashed ( platform) } ${ dashed ( arch) } ${ dashed ( minified) } -ci `
,
.
series
(
...
)
)
;
.
task
(
)
;
const
=
.
define
(
` vscode- ${ type } ${ dashed ( platform) } ${ dashed ( arch) } ${ dashed ( minified) } `
,
.
series
(
,
,
,
,
,
?
:
,
)
)
;
.
task
(
)
;
}
)
;
}
)
;
}
)
;