mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-18 02:51:36 -05:00
Compare commits
876 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
201174e293 | ||
|
|
dc2f6235a1 | ||
|
|
0824c779db | ||
|
|
e002ad3b6a | ||
|
|
8a570069f8 | ||
|
|
bfe44c1621 | ||
|
|
b17882a1c1 | ||
|
|
f309979126 | ||
|
|
5a0490e81f | ||
|
|
2c007115f7 | ||
|
|
ac47fb84a8 | ||
|
|
7ba14a3925 | ||
|
|
67514ccc5f | ||
|
|
6ee3886ecf | ||
|
|
76282ed1ef | ||
|
|
bfa9e8c495 | ||
|
|
425eecf692 | ||
|
|
ac1f7542a9 | ||
|
|
225d168fdd | ||
|
|
e073b2cf42 | ||
|
|
1cb366d822 | ||
|
|
c9c8e30ced | ||
|
|
c50941ac7d | ||
|
|
58f950ffbd | ||
|
|
a1341ba503 | ||
|
|
620f4a8bfb | ||
|
|
7f11d44130 | ||
|
|
5c77e752f6 | ||
|
|
1d8132bcaa | ||
|
|
5f1bde5885 | ||
|
|
0adb025573 | ||
|
|
f8e7623f23 | ||
|
|
9243cceb9a | ||
|
|
5a62035ed7 | ||
|
|
c3a81b5bf3 | ||
|
|
34f6811eea | ||
|
|
c800e70ec1 | ||
|
|
7aa2ee08bf | ||
|
|
933aa88dc7 | ||
|
|
4b79ecc3d9 | ||
|
|
0bd179c6ca | ||
|
|
70141bd049 | ||
|
|
65cc585697 | ||
|
|
bd39468b96 | ||
|
|
dad831bc8c | ||
|
|
8a8745701b | ||
|
|
48b899b5d0 | ||
|
|
210447cd37 | ||
|
|
e672fbf6e2 | ||
|
|
004464c699 | ||
|
|
6f39a37656 | ||
|
|
b097b54792 | ||
|
|
0693080630 | ||
|
|
75d27837c2 | ||
|
|
597f29e90a | ||
|
|
a77bb50b9e | ||
|
|
3f84e8e652 | ||
|
|
1df7f25cad | ||
|
|
a0c30517bd | ||
|
|
dc36a9c3e7 | ||
|
|
0e61ad27da | ||
|
|
b3009c3366 | ||
|
|
810073a79b | ||
|
|
79c69d03fa | ||
|
|
22996da737 | ||
|
|
82d0b6c9f0 | ||
|
|
77c997b91e | ||
|
|
bb5d52d72c | ||
|
|
1474bab34a | ||
|
|
05f6f4ea5b | ||
|
|
05feb39501 | ||
|
|
ce92c3329b | ||
|
|
216b6eecc0 | ||
|
|
c0917e9276 | ||
|
|
0bbcbf0d2d | ||
|
|
9b998e3fca | ||
|
|
d7d65cdf21 | ||
|
|
27925289d4 | ||
|
|
03ea265bab | ||
|
|
917f9eead3 | ||
|
|
08f2e72af8 | ||
|
|
a2fb0ec029 | ||
|
|
084042ad13 | ||
|
|
8da3defe24 | ||
|
|
58f9cd32a5 | ||
|
|
f7abf5a2d5 | ||
|
|
c8c6d072f6 | ||
|
|
4d9cc604b9 | ||
|
|
1dc76fa171 | ||
|
|
1d37b9ae9c | ||
|
|
26828602a8 | ||
|
|
e253f3ac89 | ||
|
|
4d59fdea1b | ||
|
|
98a313eb5b | ||
|
|
77e1cd8b32 | ||
|
|
dede5c5ef5 | ||
|
|
d156c0be3d | ||
|
|
dc0bc6e606 | ||
|
|
05040425df | ||
|
|
36f7c283b8 | ||
|
|
9fe4237033 | ||
|
|
b03c0a3e2d | ||
|
|
87946996ed | ||
|
|
cc55023440 | ||
|
|
1f19dfc50d | ||
|
|
950a440350 | ||
|
|
c92b88bfaf | ||
|
|
10875f26dc | ||
|
|
d62e809c18 | ||
|
|
d85bf4f6dd | ||
|
|
801e201cc3 | ||
|
|
e18e0da0c1 | ||
|
|
d046b0a412 | ||
|
|
72084b8fc1 | ||
|
|
2639b2bd2c | ||
|
|
82aa493dfd | ||
|
|
6c3c7c40b5 | ||
|
|
5616751c04 | ||
|
|
7d898ca34d | ||
|
|
e26556b21a | ||
|
|
89e6d363e2 | ||
|
|
c559ac7be9 | ||
|
|
b3fbe47f0a | ||
|
|
c73af4c480 | ||
|
|
8887fe1eac | ||
|
|
ed861a6c96 | ||
|
|
e63bb6a8ec | ||
|
|
8ec09d25ce | ||
|
|
a9a01ae479 | ||
|
|
31a3864789 | ||
|
|
a5c537197c | ||
|
|
4ea13bdbc0 | ||
|
|
b06ddf2dc7 | ||
|
|
2c45ac9df3 | ||
|
|
7735f68502 | ||
|
|
ffb0f5a1c7 | ||
|
|
80c7f9e855 | ||
|
|
709ef4e39f | ||
|
|
4ceb869420 | ||
|
|
432a209184 | ||
|
|
8444271c58 | ||
|
|
2bc97c23d4 | ||
|
|
9ea02bf125 | ||
|
|
2b4de52af4 | ||
|
|
d3492ebf2f | ||
|
|
ff8698f619 | ||
|
|
16bc218ea7 | ||
|
|
72d2920dc3 | ||
|
|
fb8de0d753 | ||
|
|
352afc9827 | ||
|
|
ce699a1c84 | ||
|
|
cde20d338e | ||
|
|
8ab22e9cc8 | ||
|
|
0f2442a7a5 | ||
|
|
ba91140ea5 | ||
|
|
10f05e75ce | ||
|
|
287811f4ab | ||
|
|
a68462c7cb | ||
|
|
005c28dd3a | ||
|
|
197e1c651f | ||
|
|
c01da0f263 | ||
|
|
81ff542d0b | ||
|
|
efee27559b | ||
|
|
dc5408f874 | ||
|
|
7cf9217158 | ||
|
|
401fc8161a | ||
|
|
be2f9a6099 | ||
|
|
21989aa88e | ||
|
|
461d041a50 | ||
|
|
de8662c52f | ||
|
|
0dbbbad370 | ||
|
|
2e05c0a7d9 | ||
|
|
f12f1cb392 | ||
|
|
b6891850a7 | ||
|
|
f147d799e0 | ||
|
|
534bbe9b9a | ||
|
|
b7f4f6af3a | ||
|
|
ac96919caf | ||
|
|
05cf06656d | ||
|
|
1356f0bcf6 | ||
|
|
ce0c955c29 | ||
|
|
0e7f89169e | ||
|
|
81329fa7fa | ||
|
|
3763278366 | ||
|
|
8600dbb04e | ||
|
|
b27f69aace | ||
|
|
8e0c19fc8d | ||
|
|
54ee1c23f0 | ||
|
|
39b33160c2 | ||
|
|
d94f86b44a | ||
|
|
4ae0daa17f | ||
|
|
8d548413bd | ||
|
|
f2e7a99b1e | ||
|
|
a8c31f68b3 | ||
|
|
db49b42e4a | ||
|
|
e77c2fc9bb | ||
|
|
5197ef591a | ||
|
|
898f8ec006 | ||
|
|
37ff96ba95 | ||
|
|
fa961832f3 | ||
|
|
b66ac2781c | ||
|
|
86a0f2d4a7 | ||
|
|
f5e2a67924 | ||
|
|
45cf626230 | ||
|
|
9717b7516d | ||
|
|
b92c23df2b | ||
|
|
df617f19e0 | ||
|
|
fb565c2548 | ||
|
|
2bfc3a6c85 | ||
|
|
4ab5d84b94 | ||
|
|
154213b705 | ||
|
|
4cce29ea9d | ||
|
|
9d5d00aa8f | ||
|
|
70d47c1757 | ||
|
|
befa34790f | ||
|
|
84da9d289b | ||
|
|
7a30d535e8 | ||
|
|
199701d26b | ||
|
|
3ac2cfa528 | ||
|
|
78d68aa1b9 | ||
|
|
8042b78f1e | ||
|
|
000d064276 | ||
|
|
600a78f35f | ||
|
|
6f5e4c30dc | ||
|
|
8e7457911e | ||
|
|
43b3207937 | ||
|
|
22f2151c21 | ||
|
|
7c744f2307 | ||
|
|
08d57fed86 | ||
|
|
6e8a0fe0ef | ||
|
|
6668ec4b5d | ||
|
|
08a8288293 | ||
|
|
3001640eec | ||
|
|
efa3658ced | ||
|
|
92bc253cf7 | ||
|
|
a190190843 | ||
|
|
9c40bd1a23 | ||
|
|
dc2193138d | ||
|
|
033c8cb8b1 | ||
|
|
21c4429c6e | ||
|
|
348a96b033 | ||
|
|
0c930d7c0f | ||
|
|
98aca2b988 | ||
|
|
8d7f497e0c | ||
|
|
1b6328b451 | ||
|
|
d10e08e63e | ||
|
|
a8f21b56f0 | ||
|
|
173842510c | ||
|
|
19c08fe0eb | ||
|
|
db817a7192 | ||
|
|
2c8e93cc96 | ||
|
|
44e9a97f09 | ||
|
|
298ddc4195 | ||
|
|
d9134d6085 | ||
|
|
b17b4ce880 | ||
|
|
2304c32453 | ||
|
|
2b68e4a7df | ||
|
|
8f06e72318 | ||
|
|
5fa740ead4 | ||
|
|
e5096e61e5 | ||
|
|
2a3195636e | ||
|
|
5fb9b8ccd3 | ||
|
|
7089e2299a | ||
|
|
b553cbb68c | ||
|
|
c712411e77 | ||
|
|
48d5cc554c | ||
|
|
39bfd69dc9 | ||
|
|
d690b80493 | ||
|
|
eb48a9f993 | ||
|
|
5a54abaf44 | ||
|
|
47c161f9f1 | ||
|
|
807f8e68f3 | ||
|
|
fba8536c33 | ||
|
|
36fc1bb71a | ||
|
|
ccaa96c81e | ||
|
|
ac2f279c88 | ||
|
|
91cb99b8c8 | ||
|
|
02b1a525e3 | ||
|
|
9bf4a4b18c | ||
|
|
8a01553c49 | ||
|
|
21b913845f | ||
|
|
220e4feb1d | ||
|
|
13884c0457 | ||
|
|
b3bb6ebc6e | ||
|
|
424eb90dd8 | ||
|
|
df804d0729 | ||
|
|
79269cdfd5 | ||
|
|
2a650d4d74 | ||
|
|
017b4ecdb3 | ||
|
|
9c84bf3fd5 | ||
|
|
397b54a8c3 | ||
|
|
cb3604c0a1 | ||
|
|
1a7f0673ea | ||
|
|
0d043207b9 | ||
|
|
f995dea971 | ||
|
|
49e20488bc | ||
|
|
3e47b27192 | ||
|
|
f4fa18ec05 | ||
|
|
c6d1fa2b7d | ||
|
|
c4df7667ff | ||
|
|
6a303cfa25 | ||
|
|
4ffa5cc1da | ||
|
|
172e1cf3bf | ||
|
|
e6a32e52f5 | ||
|
|
d2b6f6844d | ||
|
|
e9ef95ef1f | ||
|
|
10eeb5374f | ||
|
|
332951bc8e | ||
|
|
4daf3280ff | ||
|
|
87bb2c74d9 | ||
|
|
ba011853a0 | ||
|
|
461a158ac3 | ||
|
|
85f59f1103 | ||
|
|
335b9f445f | ||
|
|
7cda45c904 | ||
|
|
4159fdc1a3 | ||
|
|
190da30979 | ||
|
|
ed9c74b900 | ||
|
|
6783766c33 | ||
|
|
b27018b379 | ||
|
|
021d07e04a | ||
|
|
bf0baec392 | ||
|
|
923cbac400 | ||
|
|
ab938f2536 | ||
|
|
a55b1804e9 | ||
|
|
4bfa6b3a5d | ||
|
|
d20f24be18 | ||
|
|
8a17bae7a6 | ||
|
|
d14c73fad5 | ||
|
|
ce878e1def | ||
|
|
a64a0d1db6 | ||
|
|
feab43f16d | ||
|
|
0d60fe775f | ||
|
|
6680be6a73 | ||
|
|
e026ab85a7 | ||
|
|
e53c903205 | ||
|
|
03dbe8565f | ||
|
|
708793cb23 | ||
|
|
43ae4fb0aa | ||
|
|
6b1d552277 | ||
|
|
f24f576b72 | ||
|
|
c23328564f | ||
|
|
cd6dd3dafa | ||
|
|
4081e15bef | ||
|
|
b05e3813d1 | ||
|
|
3048311f40 | ||
|
|
1045392d91 | ||
|
|
7b23ca8ee7 | ||
|
|
4d67eca8bb | ||
|
|
74c4b7311e | ||
|
|
713c74adfd | ||
|
|
408a8a6f19 | ||
|
|
e1485e49d3 | ||
|
|
30b66934cd | ||
|
|
fd49c081c2 | ||
|
|
1327120024 | ||
|
|
d2b5043972 | ||
|
|
a0e55ea3fd | ||
|
|
1f32de29c1 | ||
|
|
12be06d682 | ||
|
|
27ca9b13f8 | ||
|
|
be45905830 | ||
|
|
05d0a89655 | ||
|
|
3ba575dcd0 | ||
|
|
3e200b7f0f | ||
|
|
cbce1f7008 | ||
|
|
e99101447e | ||
|
|
0ddb326e44 | ||
|
|
460446a15c | ||
|
|
4eea24997f | ||
|
|
0b1e9c7c66 | ||
|
|
d51a7a9eb7 | ||
|
|
0f0b959e14 | ||
|
|
b2ceb09e4d | ||
|
|
53953f5cda | ||
|
|
fbd5e819a2 | ||
|
|
bdc391d376 | ||
|
|
6b618fb121 | ||
|
|
1f3e59c9f9 | ||
|
|
1956078c8c | ||
|
|
11230f59fc | ||
|
|
21bad7a01f | ||
|
|
6f9a27ecc7 | ||
|
|
c504113d13 | ||
|
|
c92ff60592 | ||
|
|
e9013d1a2a | ||
|
|
9c4580fe40 | ||
|
|
cb060cb5db | ||
|
|
6c3d85cc45 | ||
|
|
14ae89e87c | ||
|
|
24c48f025d | ||
|
|
f0a556f004 | ||
|
|
fd4d6abb4d | ||
|
|
41cc839380 | ||
|
|
c2a4380b96 | ||
|
|
6f402ac79f | ||
|
|
bf7c1306b1 | ||
|
|
c1509cf09d | ||
|
|
014bca031c | ||
|
|
4f864fd5bd | ||
|
|
2da67567e4 | ||
|
|
5b19d2b1fc | ||
|
|
a6837dcd40 | ||
|
|
af80751a1f | ||
|
|
dd02597c3b | ||
|
|
2926a3cbd8 | ||
|
|
b02bb3bfd4 | ||
|
|
67a4683bb1 | ||
|
|
9baee1c22c | ||
|
|
8cb67b4f9d | ||
|
|
0cd47bc328 | ||
|
|
07fb58d5e1 | ||
|
|
2d80d5e611 | ||
|
|
4bd63b615b | ||
|
|
335f667507 | ||
|
|
1819036d7d | ||
|
|
4f76f116ac | ||
|
|
1eba7c7d2a | ||
|
|
83234dd52c | ||
|
|
bae23b7fce | ||
|
|
3db61eaa82 | ||
|
|
5cf85a0361 | ||
|
|
ffe27f5bde | ||
|
|
78bcd9d54c | ||
|
|
1a9797f0ff | ||
|
|
0de94ff8a4 | ||
|
|
472233d9a7 | ||
|
|
f69e31b0d5 | ||
|
|
60b696cc31 | ||
|
|
549037f744 | ||
|
|
ca5e1e6133 | ||
|
|
3e3ff163db | ||
|
|
ca755365ce | ||
|
|
ea979de19f | ||
|
|
473ddfcdf1 | ||
|
|
a627285a4c | ||
|
|
322847469d | ||
|
|
6c5fac997f | ||
|
|
1871fd383e | ||
|
|
f5b147ca4b | ||
|
|
9d2b206156 | ||
|
|
a372c76e07 | ||
|
|
b1ce07d3ae | ||
|
|
bc09fb30d8 | ||
|
|
c13f219318 | ||
|
|
6b018c5d06 | ||
|
|
e69158d9b2 | ||
|
|
520cfb780a | ||
|
|
e686fed209 | ||
|
|
80ab19ac23 | ||
|
|
25228fa58e | ||
|
|
676d35090f | ||
|
|
e1a36a356c | ||
|
|
3274c0b734 | ||
|
|
9c95e1289f | ||
|
|
ef29871b62 | ||
|
|
a2a87f8d2b | ||
|
|
83c01c6bcb | ||
|
|
c1d850804c | ||
|
|
6590d5f58a | ||
|
|
a225925bc4 | ||
|
|
ab39f1f44f | ||
|
|
8d89364d72 | ||
|
|
af2bc859d1 | ||
|
|
8e72fdaa52 | ||
|
|
e9661f90d0 | ||
|
|
30b111034d | ||
|
|
df18359309 | ||
|
|
03857e0afd | ||
|
|
eaf1e08752 | ||
|
|
d39ceffa94 | ||
|
|
406b171c66 | ||
|
|
6d89b9e203 | ||
|
|
733bb69d25 | ||
|
|
4609694141 | ||
|
|
3be0c5130a | ||
|
|
e50b512580 | ||
|
|
eb62d054de | ||
|
|
e870a309c0 | ||
|
|
3afd3b0ff3 | ||
|
|
e3a2ed95d4 | ||
|
|
20c4f085c8 | ||
|
|
02af7e9299 | ||
|
|
0ae9b36d93 | ||
|
|
2bbb2842e5 | ||
|
|
a5b4eeb932 | ||
|
|
44de602e52 | ||
|
|
63fb4e2827 | ||
|
|
0a839c7321 | ||
|
|
e9747a61ac | ||
|
|
43c3bf4d24 | ||
|
|
0bf642d200 | ||
|
|
b2b69376c4 | ||
|
|
38ad60478c | ||
|
|
cf6a7198f9 | ||
|
|
ac8a926a70 | ||
|
|
aef7244939 | ||
|
|
628e2adc64 | ||
|
|
0c58f09e59 | ||
|
|
e3baf5c443 | ||
|
|
f70bf590cd | ||
|
|
473a414bc3 | ||
|
|
9ad4ec6464 | ||
|
|
a15c315a1c | ||
|
|
58036bb364 | ||
|
|
8a3509e006 | ||
|
|
1d3ead4031 | ||
|
|
498bb47d7f | ||
|
|
f2df9f3917 | ||
|
|
0414ab6e6a | ||
|
|
14a7a5534f | ||
|
|
edc60e0ad1 | ||
|
|
1a97e3de06 | ||
|
|
f5b1bd0bc2 | ||
|
|
05d7e24e66 | ||
|
|
83842ee9e1 | ||
|
|
a13039b14b | ||
|
|
8fce79f385 | ||
|
|
2efea63000 | ||
|
|
c208abf0c5 | ||
|
|
1359354387 | ||
|
|
cd0f9b71c5 | ||
|
|
04ec9caad1 | ||
|
|
259306a8db | ||
|
|
36a8991682 | ||
|
|
1461929f86 | ||
|
|
4bfc549927 | ||
|
|
40db0d6f6f | ||
|
|
6aac0b6056 | ||
|
|
8e234d9b2d | ||
|
|
70819252a9 | ||
|
|
ba264d8311 | ||
|
|
5de002e5c1 | ||
|
|
0b771abad2 | ||
|
|
00041c8ecd | ||
|
|
0225d6d9f9 | ||
|
|
fb4260d71c | ||
|
|
fa253158f4 | ||
|
|
45e3c6ae49 | ||
|
|
d526fe0f7f | ||
|
|
5707b58fda | ||
|
|
1a9f72dfe0 | ||
|
|
078f3a2b54 | ||
|
|
5bcfb9ab32 | ||
|
|
9bd45cf66a | ||
|
|
89c48bbe75 | ||
|
|
6b549696c5 | ||
|
|
3aaf8a24bf | ||
|
|
41ffd6e8ae | ||
|
|
c0a6f3e012 | ||
|
|
eae8de0373 | ||
|
|
23ec6ac567 | ||
|
|
f4cfb4a5ef | ||
|
|
80a9c82813 | ||
|
|
bcd6178d67 | ||
|
|
f10e281ffc | ||
|
|
c2b32fd64a | ||
|
|
80f150dfb4 | ||
|
|
a5c5fcbde1 | ||
|
|
0d76e845d5 | ||
|
|
979d50eb0e | ||
|
|
7099922c35 | ||
|
|
b54b4a4445 | ||
|
|
03989a5af0 | ||
|
|
1847c2e322 | ||
|
|
f7371e9ed5 | ||
|
|
f696274740 | ||
|
|
1c48320ce0 | ||
|
|
96ecf79d32 | ||
|
|
6d243e0ac8 | ||
|
|
8bf60f133f | ||
|
|
3b9a3aba87 | ||
|
|
f0c986858a | ||
|
|
7ee13b4afb | ||
|
|
bca4102542 | ||
|
|
31ac8d6acc | ||
|
|
e82b7615b3 | ||
|
|
6f10f7a21a | ||
|
|
46fb68214f | ||
|
|
c2381424bc | ||
|
|
31328e79be | ||
|
|
96657e300a | ||
|
|
a2e6aa9e64 | ||
|
|
8c2d79e9cf | ||
|
|
cd140b5527 | ||
|
|
a0456bf4f7 | ||
|
|
55e3947cf7 | ||
|
|
db5156e4cd | ||
|
|
eece0677a7 | ||
|
|
24e8c20511 | ||
|
|
886717d330 | ||
|
|
26b27a616a | ||
|
|
0c663e5555 | ||
|
|
0f087915f6 | ||
|
|
a78fa9c0f2 | ||
|
|
b1752ea635 | ||
|
|
ec150917c2 | ||
|
|
7a9a69c439 | ||
|
|
9e9862c6f0 | ||
|
|
7b76d929cd | ||
|
|
1811dfa423 | ||
|
|
3abbc8fd97 | ||
|
|
4b88b67bed | ||
|
|
a2734807ca | ||
|
|
d0d4df313e | ||
|
|
1efd5e6502 | ||
|
|
b12cac0ac3 | ||
|
|
578aa6ccd2 | ||
|
|
3b90530717 | ||
|
|
f199c7a63c | ||
|
|
50a2526d1f | ||
|
|
7fb8a28b59 | ||
|
|
30a825438e | ||
|
|
f63da13210 | ||
|
|
08d73675d4 | ||
|
|
f0f6c00a0e | ||
|
|
965458ca74 | ||
|
|
b30f7ee41c | ||
|
|
a2eb53ce0b | ||
|
|
619c816e7f | ||
|
|
3d6fb7a8fa | ||
|
|
891624c085 | ||
|
|
a7c4686980 | ||
|
|
93aa052856 | ||
|
|
61d05f6782 | ||
|
|
60ccae48f1 | ||
|
|
4b454581fd | ||
|
|
f0aadebd2c | ||
|
|
d3f0ac7954 | ||
|
|
134f76c17f | ||
|
|
b9c877a109 | ||
|
|
aa243a8aae | ||
|
|
e5c1c6f544 | ||
|
|
9e9f85079e | ||
|
|
ae8e2e1f89 | ||
|
|
b2c70e9301 | ||
|
|
e022f4a0d1 | ||
|
|
8bc32e6371 | ||
|
|
f739c47984 | ||
|
|
13fb9fdfd2 | ||
|
|
9a5f51bfbf | ||
|
|
06bab6a38c | ||
|
|
c35a14d8fd | ||
|
|
b914073147 | ||
|
|
04ae18143b | ||
|
|
efe8e81b6e | ||
|
|
c33ddfabf9 | ||
|
|
8ec5451e64 | ||
|
|
20853ddf7e | ||
|
|
091d4cb924 | ||
|
|
cd0210c88a | ||
|
|
ed10f984b6 | ||
|
|
087a6a0810 | ||
|
|
495b4ee7c2 | ||
|
|
7833c28b7a | ||
|
|
bbfb68b082 | ||
|
|
b32e7a777c | ||
|
|
a327889d05 | ||
|
|
5ac89e5a49 | ||
|
|
849653927a | ||
|
|
3545483fc1 | ||
|
|
e5a1896414 | ||
|
|
bec8e72688 | ||
|
|
86748e6d69 | ||
|
|
596f09f754 | ||
|
|
563e25f073 | ||
|
|
1800d0baaf | ||
|
|
2182658301 | ||
|
|
3990719054 | ||
|
|
071b510fba | ||
|
|
d2d2ade9f7 | ||
|
|
d97d2e5c91 | ||
|
|
a6ba44e435 | ||
|
|
4967e630fb | ||
|
|
2508464fde | ||
|
|
782623cba9 | ||
|
|
36045c5381 | ||
|
|
7e49167530 | ||
|
|
a680a2a7dc | ||
|
|
4734451f5f | ||
|
|
dafb780987 | ||
|
|
5fba3e31b4 | ||
|
|
0315020cf0 | ||
|
|
6dca896768 | ||
|
|
90454fbe87 | ||
|
|
f9b2136494 | ||
|
|
3d1c1aefb3 | ||
|
|
e6a65599fd | ||
|
|
32ac907403 | ||
|
|
3af05d62b2 | ||
|
|
b5d8dfa509 | ||
|
|
612987d1e5 | ||
|
|
916598e029 | ||
|
|
c45c634938 | ||
|
|
1bed0d0733 | ||
|
|
e0075b7633 | ||
|
|
0029767561 | ||
|
|
93f9828d04 | ||
|
|
c484af0901 | ||
|
|
b2a96bbe50 | ||
|
|
2414f43757 | ||
|
|
22c54a9917 | ||
|
|
a14c0351ba | ||
|
|
31f75a46c8 | ||
|
|
08d1e9cd73 | ||
|
|
0da83b5d4b | ||
|
|
37d7266751 | ||
|
|
ddfb61b46a | ||
|
|
9a2e8cffed | ||
|
|
e9299d1991 | ||
|
|
08d97cc795 | ||
|
|
0de5d7a96a | ||
|
|
2f8f6064a1 | ||
|
|
d3526f8cf7 | ||
|
|
b045e536c1 | ||
|
|
ab91c88b34 | ||
|
|
f91010c398 | ||
|
|
cd0d0f911b | ||
|
|
bd67006f63 | ||
|
|
5aedd96276 | ||
|
|
751a89d839 | ||
|
|
a226e90c38 | ||
|
|
2eeb2b0d71 | ||
|
|
f2779f2a50 | ||
|
|
357bb1916e | ||
|
|
67a9ff3e16 | ||
|
|
7099b11651 | ||
|
|
27e9e8ec2b | ||
|
|
4d1e3263f4 | ||
|
|
cb1d630cfb | ||
|
|
d7b9e9ab78 | ||
|
|
cb7b8b956f | ||
|
|
a0608a51c1 | ||
|
|
217f5e7ee5 | ||
|
|
50c4fd79b7 | ||
|
|
4cfd9bdbc0 | ||
|
|
f76e8ae2c5 | ||
|
|
089577c5a8 | ||
|
|
c116f933e2 | ||
|
|
fe496ab03b | ||
|
|
3c3d8417e9 | ||
|
|
2b2672e4bd | ||
|
|
1bfc8c1914 | ||
|
|
2f854cce4a | ||
|
|
40550d0840 | ||
|
|
38bedea0bd | ||
|
|
75ab5c1a36 | ||
|
|
3d7c081068 | ||
|
|
c276bd8a37 | ||
|
|
890bece70c | ||
|
|
4a4fe584d5 | ||
|
|
bcd72d21c7 | ||
|
|
722f5e56cd | ||
|
|
f3c7b2416b | ||
|
|
383d74ceb4 | ||
|
|
64f61b2954 | ||
|
|
5c0002404a | ||
|
|
66f39fd3eb | ||
|
|
e79e3bdf1d | ||
|
|
9dd3ec9179 | ||
|
|
c06ab27d08 | ||
|
|
fab4185c1f | ||
|
|
bc4b399f87 | ||
|
|
52544fa953 | ||
|
|
8b2ea4f0a0 | ||
|
|
45b1ae1fb1 | ||
|
|
090ac6eab2 | ||
|
|
b7169f3da9 | ||
|
|
587c3ab436 | ||
|
|
80bbd9dbf3 | ||
|
|
c019175fff | ||
|
|
7f79ab47ac | ||
|
|
ba188189a8 | ||
|
|
8e6359b3a4 | ||
|
|
aac77ed982 | ||
|
|
1d284ea66a | ||
|
|
9f5268101d | ||
|
|
0bba972657 | ||
|
|
bab9fc01ea | ||
|
|
692ed02df8 | ||
|
|
2e67d03b56 | ||
|
|
56ca3406c4 | ||
|
|
94e8ce5185 | ||
|
|
bb54b0280a | ||
|
|
a99c34d817 | ||
|
|
c06f45cf0e | ||
|
|
8114498fb5 | ||
|
|
889b60a71b | ||
|
|
45023b2e71 | ||
|
|
1c08e64651 | ||
|
|
3432dac261 | ||
|
|
5adab4fafb | ||
|
|
d45aebcd19 | ||
|
|
6bf21e4340 | ||
|
|
7ee6dfa21e | ||
|
|
bd7341ddc2 | ||
|
|
f9d8f479b5 | ||
|
|
fdc956e116 | ||
|
|
a44df9adab | ||
|
|
dbc2ce0b3a | ||
|
|
51b8e02455 | ||
|
|
4f9dfe9afa | ||
|
|
db05ed840d | ||
|
|
8570910a43 | ||
|
|
8a9ee40524 | ||
|
|
c166ce112b | ||
|
|
cea52d2314 | ||
|
|
d1cc937f9d | ||
|
|
b61fbc806b | ||
|
|
dfc212369a | ||
|
|
47b855adf8 | ||
|
|
d1bffd0eb0 | ||
|
|
f1b64918ce | ||
|
|
005e3f1476 | ||
|
|
49d19a9ab8 | ||
|
|
f5a866aa42 | ||
|
|
f1ddea986a | ||
|
|
040549d264 | ||
|
|
4b51d9b386 | ||
|
|
73fbd787d8 | ||
|
|
b6f848eff1 | ||
|
|
6f21d6e27e | ||
|
|
af9c3d3872 | ||
|
|
7806a29bed | ||
|
|
0412b643d2 | ||
|
|
d7ee37a946 | ||
|
|
af53a13e6b | ||
|
|
98fa028ce5 | ||
|
|
ed4d4e33b5 | ||
|
|
6c83736626 | ||
|
|
959b4fbab5 | ||
|
|
3b7ff61000 | ||
|
|
cf283a9266 | ||
|
|
e28b86ea87 | ||
|
|
362664c4d8 | ||
|
|
c860a0edb2 | ||
|
|
8e11e460b5 | ||
|
|
ce4e7f4bef | ||
|
|
a8c7c69509 | ||
|
|
579e6bf0cb | ||
|
|
332dc03df0 | ||
|
|
24ea675d7d | ||
|
|
3df522536f | ||
|
|
f5aa49ebb9 | ||
|
|
3076390eb1 | ||
|
|
b7c935c602 | ||
|
|
bbb0f39a94 | ||
|
|
fe04fd72bc | ||
|
|
8a350809fd | ||
|
|
642514fd94 | ||
|
|
234c2f7c9e | ||
|
|
1b2e264c7d | ||
|
|
495c2e62e6 | ||
|
|
03baf3610a | ||
|
|
251ae01c3e | ||
|
|
9a1ac20710 | ||
|
|
f640bda802 | ||
|
|
f9ff1c5910 | ||
|
|
a63800deb1 | ||
|
|
e432884e25 | ||
|
|
0c14c3cc7f | ||
|
|
006eedd3a1 | ||
|
|
cb4fe55bef | ||
|
|
b33ffafdc0 | ||
|
|
e2efe69b73 | ||
|
|
8b85a47cf7 | ||
|
|
5afa287e47 | ||
|
|
0cc7c540a9 | ||
|
|
edd867b6fc | ||
|
|
7808496416 | ||
|
|
ad27f7dbba | ||
|
|
a6cb7cbd65 | ||
|
|
146fd41b50 | ||
|
|
fcb6f7f9ee | ||
|
|
94bd1c4d7d | ||
|
|
e4a0e4e0c1 |
@@ -11,6 +11,6 @@ trim_trailing_whitespace = true
|
|||||||
|
|
||||||
# The indent size used in the `package.json` file cannot be changed
|
# The indent size used in the `package.json` file cannot be changed
|
||||||
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
|
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
|
||||||
[{*.yml,*.yaml,npm-shrinkwrap.json,package.json}]
|
[{*.yml,*.yaml,package.json}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|||||||
@@ -10,5 +10,10 @@
|
|||||||
"no-extra-semi": "warn",
|
"no-extra-semi": "warn",
|
||||||
"semi": "warn"
|
"semi": "warn"
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended"
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"experimentalObjectRestSpread": true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
9
.gitattributes
vendored
9
.gitattributes
vendored
@@ -0,0 +1,9 @@
|
|||||||
|
* text=auto
|
||||||
|
|
||||||
|
LICENSE.txt eol=crlf
|
||||||
|
ThirdPartyNotices.txt eol=crlf
|
||||||
|
|
||||||
|
*.bat eol=crlf
|
||||||
|
*.cmd eol=crlf
|
||||||
|
*.ps1 eol=lf
|
||||||
|
*.sh eol=lf
|
||||||
14
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
14
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Please search existing issues to avoid creating duplicates. -->
|
||||||
|
<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed. -->
|
||||||
|
|
||||||
|
<!-- Use Help > Report Issue to prefill these. -->
|
||||||
|
- Azure Data Studio Version:
|
||||||
|
|
||||||
|
Steps to Reproduce:
|
||||||
|
|
||||||
|
1.
|
||||||
21
.gitignore
vendored
21
.gitignore
vendored
@@ -1,29 +1,20 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
.DS_Store
|
|
||||||
*.dat
|
|
||||||
*.db
|
|
||||||
*.exe
|
|
||||||
*.log
|
|
||||||
*.nupkg
|
|
||||||
*.orig
|
|
||||||
*.vsix
|
|
||||||
*BROWSE.VC*
|
|
||||||
sqltoolsservice
|
|
||||||
coverage
|
|
||||||
test-reports
|
|
||||||
.vscode-test
|
|
||||||
node_modules/
|
node_modules/
|
||||||
.build/
|
.build/
|
||||||
.vs/
|
|
||||||
out/
|
out/
|
||||||
out-build/
|
out-build/
|
||||||
out-editor/
|
out-editor/
|
||||||
|
out-editor-src/
|
||||||
|
out-editor-build/
|
||||||
|
out-editor-esm/
|
||||||
out-editor-min/
|
out-editor-min/
|
||||||
out-monaco-editor-core/
|
out-monaco-editor-core/
|
||||||
out-vscode/
|
out-vscode/
|
||||||
out-vscode-min/
|
out-vscode-min/
|
||||||
build/node_modules
|
build/node_modules
|
||||||
coverage/
|
coverage/
|
||||||
_site
|
test_data/
|
||||||
|
test-results/
|
||||||
|
yarn-error.log
|
||||||
26
.travis.yml
26
.travis.yml
@@ -7,10 +7,13 @@ os:
|
|||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.npm
|
- $HOME/.cache/yarn
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
webhooks:
|
||||||
|
- http://vscode-probot.westus.cloudapp.azure.com:3450/travis/notifications
|
||||||
|
- http://vscode-test-probot.westus.cloudapp.azure.com:3450/travis/notifications
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
@@ -29,25 +32,26 @@ addons:
|
|||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
- git clone --depth 1 https://github.com/creationix/nvm.git ./.nvm
|
- nvm install 8.9.1
|
||||||
- source ./.nvm/nvm.sh
|
- nvm use 8.9.1
|
||||||
- nvm install 7.9.0
|
- npm i -g yarn
|
||||||
- nvm use 7.9.0
|
# - npm config set python `which python`
|
||||||
- npm config set python `which python`
|
|
||||||
- npm install -g gulp
|
|
||||||
- if [ $TRAVIS_OS_NAME == "linux" ]; then
|
- if [ $TRAVIS_OS_NAME == "linux" ]; then
|
||||||
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
|
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
|
||||||
sh -e /etc/init.d/xvfb start;
|
sh -e /etc/init.d/xvfb start;
|
||||||
sleep 3;
|
sleep 3;
|
||||||
fi
|
fi
|
||||||
|
# Make npm logs less verbose
|
||||||
|
# - npm config set depth 0
|
||||||
|
# - npm config set loglevel warn
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- ./scripts/npm.sh install
|
- yarn
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- gulp electron --silent
|
- node_modules/.bin/gulp electron --silent
|
||||||
- gulp compile --silent --max_old_space_size=4096
|
- node_modules/.bin/gulp compile --silent --max_old_space_size=4096
|
||||||
- gulp optimize-vscode --silent --max_old_space_size=4096
|
- node_modules/.bin/gulp optimize-vscode --silent --max_old_space_size=4096
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./scripts/test.sh --coverage --reporter dot; else ./scripts/test.sh --reporter dot; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./scripts/test.sh --coverage --reporter dot; else ./scripts/test.sh --reporter dot; fi
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
|
|||||||
4
.vscode/extensions.json
vendored
4
.vscode/extensions.json
vendored
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
// See https://go.microsoft.com/fwlink/?LinkId=827846
|
||||||
// for the documentation about the extensions.json format
|
// for the documentation about the extensions.json format
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"eg2.tslint",
|
"eg2.tslint",
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"msjsdiag.debugger-for-chrome"
|
"msjsdiag.debugger-for-chrome"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
45
.vscode/launch.json
vendored
45
.vscode/launch.json
vendored
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
@@ -9,7 +8,7 @@
|
|||||||
"program": "${workspaceFolder}/node_modules/gulp/bin/gulp.js",
|
"program": "${workspaceFolder}/node_modules/gulp/bin/gulp.js",
|
||||||
"stopOnEntry": true,
|
"stopOnEntry": true,
|
||||||
"args": [
|
"args": [
|
||||||
"watch-extension:json-client"
|
"hygiene"
|
||||||
],
|
],
|
||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
@@ -67,13 +66,13 @@
|
|||||||
{
|
{
|
||||||
"type": "chrome",
|
"type": "chrome",
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
"name": "Attach to sqlops",
|
"name": "Attach to azuredatastudio",
|
||||||
"port": 9222
|
"port": 9222
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "chrome",
|
"type": "chrome",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Launch sqlops",
|
"name": "Launch azuredatastudio",
|
||||||
"windows": {
|
"windows": {
|
||||||
"runtimeExecutable": "${workspaceFolder}/scripts/sql.bat"
|
"runtimeExecutable": "${workspaceFolder}/scripts/sql.bat"
|
||||||
},
|
},
|
||||||
@@ -87,7 +86,11 @@
|
|||||||
"runtimeArgs": [
|
"runtimeArgs": [
|
||||||
"--inspect=5875"
|
"--inspect=5875"
|
||||||
],
|
],
|
||||||
"webRoot": "${workspaceFolder}"
|
"skipFiles": [
|
||||||
|
"**/winjs*.js"
|
||||||
|
],
|
||||||
|
"webRoot": "${workspaceFolder}",
|
||||||
|
"timeout": 45000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
@@ -95,15 +98,17 @@
|
|||||||
"name": "Unit Tests",
|
"name": "Unit Tests",
|
||||||
"protocol": "inspector",
|
"protocol": "inspector",
|
||||||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
||||||
"runtimeExecutable": "${workspaceFolder}/.build/electron/SQL Operations Studio.app/Contents/MacOS/Electron",
|
"runtimeExecutable": "${workspaceFolder}/.build/electron/Azure Data Studio.app/Contents/MacOS/Electron",
|
||||||
"windows": {
|
"windows": {
|
||||||
"runtimeExecutable": "${workspaceFolder}/.build/electron/sqlops.exe"
|
"runtimeExecutable": "${workspaceFolder}/.build/electron/azuredatastudio.exe"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"runtimeExecutable": "${workspaceFolder}/.build/electron/sqlops"
|
"runtimeExecutable": "${workspaceFolder}/.build/electron/azuredatastudio"
|
||||||
},
|
},
|
||||||
"stopOnEntry": false,
|
"stopOnEntry": false,
|
||||||
|
"outputCapture": "std",
|
||||||
"args": [
|
"args": [
|
||||||
|
"--delay",
|
||||||
"--timeout",
|
"--timeout",
|
||||||
"2000"
|
"2000"
|
||||||
],
|
],
|
||||||
@@ -114,22 +119,38 @@
|
|||||||
"outFiles": [
|
"outFiles": [
|
||||||
"${workspaceFolder}/out/**/*.js"
|
"${workspaceFolder}/out/**/*.js"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Launch Built-in Extension",
|
||||||
|
"type": "extensionHost",
|
||||||
|
"request": "launch",
|
||||||
|
"runtimeExecutable": "${execPath}",
|
||||||
|
"args": [
|
||||||
|
"--extensionDevelopmentPath=${workspaceRoot}/extensions/debug-auto-launch"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"compounds": [
|
"compounds": [
|
||||||
{
|
{
|
||||||
"name": "Debug sqlops Main and Renderer",
|
"name": "Debug azuredatastudio Main and Renderer",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
"Launch sqlops",
|
"Launch azuredatastudio",
|
||||||
"Attach to Main Process"
|
"Attach to Main Process"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Search and Renderer processes",
|
"name": "Search and Renderer processes",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
"Launch sqlops",
|
"Launch azuredatastudio",
|
||||||
"Attach to Search Process"
|
"Attach to Search Process"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Renderer and Extension Host processes",
|
||||||
|
"configurations": [
|
||||||
|
"Launch azuredatastudio",
|
||||||
|
"Attach to Extension Host"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
14
.vscode/settings.json
vendored
14
.vscode/settings.json
vendored
@@ -10,6 +10,9 @@
|
|||||||
"when": "$(basename).ts"
|
"when": "$(basename).ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"files.associations": {
|
||||||
|
"OSSREADME.json": "jsonc"
|
||||||
|
},
|
||||||
"search.exclude": {
|
"search.exclude": {
|
||||||
"**/node_modules": true,
|
"**/node_modules": true,
|
||||||
"**/bower_components": true,
|
"**/bower_components": true,
|
||||||
@@ -34,5 +37,12 @@
|
|||||||
"command": "${workspaceFolder}\\scripts\\test.bat --coverage --run ${file}"
|
"command": "${workspaceFolder}\\scripts\\test.bat --coverage --run ${file}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
}
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
|
"npm.exclude": "**/extensions/**",
|
||||||
|
"git.ignoreLimitWarning": true,
|
||||||
|
"emmet.excludeLanguages": [],
|
||||||
|
"typescript.preferences.importModuleSpecifier": "non-relative",
|
||||||
|
"typescript.preferences.quoteStyle": "single"
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
6
.vscode/tasks.json
vendored
6
.vscode/tasks.json
vendored
@@ -33,11 +33,11 @@
|
|||||||
"task": "tslint",
|
"task": "tslint",
|
||||||
"label": "Run tslint",
|
"label": "Run tslint",
|
||||||
"problemMatcher": [
|
"problemMatcher": [
|
||||||
"$tslint4"
|
"$tslint5"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskName": "Run tests",
|
"label": "Run tests",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "./scripts/test.sh",
|
"command": "./scripts/test.sh",
|
||||||
"windows": {
|
"windows": {
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskName": "Run Dev",
|
"label": "Run Dev",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "./scripts/code.sh",
|
"command": "./scripts/code.sh",
|
||||||
"windows": {
|
"windows": {
|
||||||
|
|||||||
3
.yarnrc
Normal file
3
.yarnrc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
disturl "https://atom.io/download/electron"
|
||||||
|
target "2.0.9"
|
||||||
|
runtime "electron"
|
||||||
184
CHANGELOG.md
184
CHANGELOG.md
@@ -1,6 +1,187 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
## Version 0.25.2
|
## Version 1.1.3
|
||||||
|
* Release date: October 18, 2018
|
||||||
|
* Release status: General Availability
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
* Introducing the Azure Resource Explorer to browse Azure SQL Databases
|
||||||
|
* Improve Object Explorer and Query Editor connectivity robustness
|
||||||
|
* SQL Server 2019 and SQL Agent extension improvements
|
||||||
|
|
||||||
|
## Contributions and "thank you"
|
||||||
|
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
||||||
|
|
||||||
|
* philoushka for `center the icon #2760`
|
||||||
|
* anthonypants for `Typo #2775`
|
||||||
|
* kstolte for `Fix Invalid Configuration in Launch.json #2789`
|
||||||
|
* kstolte for `Fixing a reference to SQL Ops Studio #2788`
|
||||||
|
|
||||||
|
## Version 1.0.0
|
||||||
|
* Release date: September 24, 2018
|
||||||
|
* Release status: General Availability
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
* Announcing the SQL Server 2019 Preview extension.
|
||||||
|
* Support for SQL Server 2019 preview features including big data cluster support.
|
||||||
|
* Azure Data Studio Notebooks
|
||||||
|
* The Azure Resource Explorer viewlets you browse data-related endpoints for your Azure accounts and create connections to them in Object Explorer. In this release Azure SQL Databases and servers are supported.
|
||||||
|
* SQL Server Polybase Create External Table Wizard
|
||||||
|
* Query Results Grid performance and UX improvements for large number of result sets.
|
||||||
|
* Visual Studio Code source code refresh from 1.23 to 1.26.1 with Grid Layout and Improved Settings Editor (preview).
|
||||||
|
* Accessibility improvements for screen reader, keyboard navigation and high-contrast.
|
||||||
|
* Added Connection name option to provide an alternative display name in the Servers viewlet.
|
||||||
|
|
||||||
|
## Contributions and "thank you"
|
||||||
|
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
||||||
|
|
||||||
|
* AlexFsmn `Feature: Ability to add connection name #2332`
|
||||||
|
* AlexFsmn `Disabled connection name input when connecting to a server. #2566`
|
||||||
|
|
||||||
|
## Version 0.33.7
|
||||||
|
* Release date: August 30, 2018
|
||||||
|
* Release status: Public Preview
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
* Announcing the SQL Server Import Extension
|
||||||
|
* SQL Server Profiler Session management
|
||||||
|
* SQL Server Agent improvements
|
||||||
|
* New community extension: First Responder Kit
|
||||||
|
* Quality of Life improvements: Connection strings
|
||||||
|
* Fix many customer reported GitHub issues
|
||||||
|
|
||||||
|
## Contributions and "thank you"
|
||||||
|
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
||||||
|
|
||||||
|
* SebastianPfliegel `Added more saveAsCsv options #2099`
|
||||||
|
* ianychoi `Fixes a typo: Mimunum -> Minimum #1994`
|
||||||
|
* AlexFsmn `Fixed bug where proper file extension wasn't appended to filename. #2151`
|
||||||
|
* AlexFsmn `Added functionality for adding any file to import wizard #2329`
|
||||||
|
* AlexFsmn `Fixed background issue when copying a chart to clipboard #2215`
|
||||||
|
* AlexFsmn `Fixed problem where vertical charts didn't display labels correctly. #2263`
|
||||||
|
* AlexFsmn `Fixed Initial values for charts to match visuals #2266`
|
||||||
|
* AlexFsmn `Renamed chart option labels #2264`
|
||||||
|
* AlexFsmn `Added feature for opening file after exporting to CSV/XLS/JSON & query files #2216`
|
||||||
|
* AlexFsmm `Get Connection String should copy to clipboard #2175`
|
||||||
|
|
||||||
|
## Version 0.31.4
|
||||||
|
* Release date: July 19, 2018
|
||||||
|
* Release status: Public Preview
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
* SQL Server Agent for Azure Data Studio extension improvements
|
||||||
|
* Added view of Alerts, Operators, and Proxies and icons on left pane
|
||||||
|
* Added dialogs for New Job, New Job Step, New Alert, and New Operator
|
||||||
|
* Added Delete Job, Delete Alert, and Delete Operator (right-click)
|
||||||
|
* Added Previous Runs visualization
|
||||||
|
* Added Filters for each column name
|
||||||
|
* SQL Server Profiler for Azure Data Studio extension improvements
|
||||||
|
* Added Hotkeys to quickly launch and start/stop Profiler
|
||||||
|
* Added 5 Default Templates to view Extended Events
|
||||||
|
* Added Server/Database connection name
|
||||||
|
* Added support for Azure SQL Database instances
|
||||||
|
* Added suggestion to exit Profiler when tab is closed when Profiler is still running
|
||||||
|
* Release of Combine Scripts Extension
|
||||||
|
* Wizard and Dialog Extensibility
|
||||||
|
* Fix GitHub Issues
|
||||||
|
|
||||||
|
## Version 0.30.6
|
||||||
|
* Release date: June 20, 2018
|
||||||
|
* Release status: Public Preview
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
* **SQL Server Profiler for Azure Data Studio *Preview*** extension initial release
|
||||||
|
* The new **SQL Data Warehouse** extension includes rich customizable dashboard widgets surfacing insights to your data warehouse. This unlocks key scenarios around managing and tuning your data warehouse to ensure it is optimized for consistent performance.
|
||||||
|
* **Edit Data "Filtering and Sorting"** support
|
||||||
|
* **SQL Server Agent for Azure Data Studio *Preview*** extension enhancements for Jobs and Job History views
|
||||||
|
* Improved **Wizard & Dialog UI Builder Framework** extensibility APIs
|
||||||
|
* Update VS Code Platform source code integrating [March 2018 (1.22)](https://code.visualstudio.com/updates/v1_22) and [April 2018 (1.23)](https://code.visualstudio.com/updates/v1_23) releases
|
||||||
|
* Fix GitHub Issues
|
||||||
|
|
||||||
|
## Version 0.29.3
|
||||||
|
* Release date: May 7, 2018
|
||||||
|
* Release status: Public Preview
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
The May release is focused on stabilization and bug fixes leading up to the Build conference. This build contains the following highlights.
|
||||||
|
|
||||||
|
* Announcing **Redgate SQL Search** extension available in Extension Manager
|
||||||
|
* Community Localization available for 10 languages: **German, Spanish, French, Italian, Japanese, Korean, Portuguese, Russian, Simplified Chinese and Traditional Chinese!**
|
||||||
|
* Reduced telemetry collection, improved [opt-out](https://github.com/Microsoft/azuredatastudio/wiki/How-to-Disable-Telemetry-Reporting) experience and in-product links to [Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement)
|
||||||
|
* Extension Manager has improved Marketplace experience to easily discover community extensions
|
||||||
|
* SQL Agent extension Jobs and Job History view improvement
|
||||||
|
* Updates for **whoisactive** and **Server Reports** extensions
|
||||||
|
* Continue to fix GitHub issues
|
||||||
|
|
||||||
|
## Version 0.28.6
|
||||||
|
* Release date: April 25, 2018
|
||||||
|
* Release status: Public Preview
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
The April Public Preview release contains some of the following highlights.
|
||||||
|
|
||||||
|
* Improvements to SQL Agent *Preview* extension
|
||||||
|
* Accessibility improvements for keyboard navigation, screen reader support and high-contrast mode.
|
||||||
|
* Improved large and protected file support for saving Admin protected and >256M files within SQL Ops Studio
|
||||||
|
* Integrated Terminal splitting to work with multiple open terminals at once
|
||||||
|
* Reduced installation on-disk file count foot print for faster installs and startup times
|
||||||
|
* Improvements to Server Reports extension
|
||||||
|
* Continue to fix GitHub issues
|
||||||
|
|
||||||
|
## Version 0.27.3
|
||||||
|
* Release date: March 28, 2017
|
||||||
|
* Release status: Public Preview
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
The March Public Preview release enables some key aspects of the Azure Data Studio
|
||||||
|
extensibility story. Here are some highlights in this release.
|
||||||
|
|
||||||
|
* Enhance the Manage Dashboard extensibility model to support tabbed Insights and Configuration panes
|
||||||
|
* Dashboard Insights extensions for `sp_whoisactive` from [whoisactive.com](http://whoisactive.com)
|
||||||
|
* Extension Manager enables simple acquisition of 1st-party and 3rd-party extensions
|
||||||
|
* Add additional Extensibility APIs for `connection` and `objectexplorer` management
|
||||||
|
* Community Localization open for 10 languages
|
||||||
|
* Continue to fix important customer impacting GitHub issues
|
||||||
|
|
||||||
|
## Version 0.26.7
|
||||||
|
* Release date: February 16, 2017
|
||||||
|
* Release status: Public Preview Hotfix 1
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
* Bug fix for `#717 Selecting partial query and hitting Cmd or Ctrl+C opens terminal with Error message`
|
||||||
|
|
||||||
|
## Version 0.26.6
|
||||||
|
* Release date: February 15, 2017
|
||||||
|
* Release status: Public Preview
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
The February release fixes several important customer reported issues, as well as various feature improvements. We've also introduced auto-update support in February which will simplify keeping updated with the lastest changes.
|
||||||
|
|
||||||
|
Here's some of the highlights in the February release.
|
||||||
|
|
||||||
|
* Support Auto-Update installation on Windows and macOS
|
||||||
|
* Publish RPM and DEB packages to offical Microsoft repos
|
||||||
|
* Fix `#6 Keep connection and selected database when opening new query tabs`
|
||||||
|
* Fix `#22 'Server Name' and 'Database Name' - Can these be drop downs instead of text` boxes?
|
||||||
|
* Fix #481 Add "Check for updates" option.
|
||||||
|
* SQL Editor colorization and auto-completion fixes
|
||||||
|
* `#584 Keyword "FULL" not highlighted by IntelliSense`
|
||||||
|
* `#345 Colorize SQL functions within the editor`
|
||||||
|
* `#300 [#tempData] latest "]" will display green color`
|
||||||
|
* `#225 Keyword color mismatch`
|
||||||
|
* `#60 invalid sql syntax color highlighting when using temporary table in from clause`
|
||||||
|
* Introduce Connection extensibility API
|
||||||
|
* VS Code Editor 1.19 integration
|
||||||
|
* Update JustinPealing/html-query-plan component to pick-up several Query Plan viewer improvements
|
||||||
|
|
||||||
|
## Contributions and "thank you"
|
||||||
|
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
||||||
|
|
||||||
|
* SebastianPfliegel for `Add cursor snippet (#475)`
|
||||||
|
* mikaoelitiana for fix: `revert README and CONTRIBUTING after last VSCode merge (#574)`
|
||||||
|
* alextercete for `Reinstate menu item to install from VSIX (#682)`
|
||||||
|
|
||||||
|
## Version 0.25.4
|
||||||
* Release date: January 17, 2017
|
* Release date: January 17, 2017
|
||||||
* Release status: Public Preview
|
* Release status: Public Preview
|
||||||
|
|
||||||
@@ -23,6 +204,7 @@ Here's some of the highlights in the January release.
|
|||||||
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
||||||
|
|
||||||
* alextercete for `Fix "No extension gallery service configured" error (#427)`
|
* alextercete for `Fix "No extension gallery service configured" error (#427)`
|
||||||
|
* SebastianPfliegel for `Add cursor snippet (#475)`
|
||||||
|
|
||||||
## Version 0.24.1
|
## Version 0.24.1
|
||||||
* Release date: December 19, 2017
|
* Release date: December 19, 2017
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
## Contributing Issues
|
## Contributing Issues
|
||||||
|
|
||||||
### Before Submitting an Issue
|
### Before Submitting an Issue
|
||||||
First, please do a search in [open issues](https://github.com/Microsoft/sqlopsstudio/issues) to see if the issue or feature request has already been filed. Use this [query](https://github.com/Microsoft/sqlopsstudio/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) to search for the most popular feature requests.
|
First, please do a search in [open issues](https://github.com/Microsoft/azuredatastudio/issues) to see if the issue or feature request has already been filed. Use this [query](https://github.com/Microsoft/azuredatastudio/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc) to search for the most popular feature requests.
|
||||||
|
|
||||||
If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment.
|
If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment.
|
||||||
|
|
||||||
👍 - upvote
|
<EFBFBD> - upvote
|
||||||
|
|
||||||
👎 - downvote
|
<EFBFBD> - downvote
|
||||||
|
|
||||||
If you cannot find an existing issue that describes your bug or feature, submit an issue using the guidelines below.
|
If you cannot find an existing issue that describes your bug or feature, submit an issue using the guidelines below.
|
||||||
|
|
||||||
@@ -18,29 +18,29 @@ File a single issue per problem and feature request.
|
|||||||
* Do not enumerate multiple bugs or feature requests in the same issue.
|
* Do not enumerate multiple bugs or feature requests in the same issue.
|
||||||
* Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar, but have different causes.
|
* Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar, but have different causes.
|
||||||
|
|
||||||
The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
|
The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
|
||||||
|
|
||||||
Please include the following with each issue.
|
Please include the following with each issue.
|
||||||
|
|
||||||
* Version of SQL Ops Studio
|
* Version of Azure Data Studio (formerly SQL Operations Studio).
|
||||||
|
|
||||||
> **Tip:** You can easily create an issue using `Report Issues` from SQL Operations Studio Help menu.
|
> **Tip:** You can easily create an issue using `Report Issues` from Azure Data Studio Help menu.
|
||||||
|
|
||||||
* Reproducible steps (1... 2... 3...) and what you expected versus what you actually saw.
|
* Reproducible steps (1... 2... 3...) and what you expected versus what you actually saw.
|
||||||
* Images, animations, or a link to a video.
|
* Images, animations, or a link to a video.
|
||||||
* A code snippet that demonstrates the issue or a link to a code repository we can easily pull down onto our machine to recreate the issue.
|
* A code snippet that demonstrates the issue or a link to a code repository we can easily pull down onto our machine to recreate the issue.
|
||||||
|
|
||||||
> **Note:** Because we need to copy and paste the code snippet, including a code snippet as a media file (i.e. .gif) is not sufficient.
|
> **Note:** Because we need to copy and paste the code snippet, including a code snippet as a media file (i.e. .gif) is not sufficient.
|
||||||
|
|
||||||
* Errors in the Dev Tools Console (Help | Toggle Developer Tools)
|
* Errors in the Dev Tools Console (Help | Toggle Developer Tools)
|
||||||
|
|
||||||
Please remember to do the following:
|
Please remember to do the following:
|
||||||
|
|
||||||
* Search the issue repository to see if there exists a duplicate.
|
* Search the issue repository to see if there exists a duplicate.
|
||||||
* Simplify your scripts around the issue so we can better isolate the problem.
|
* Simplify your scripts around the issue so we can better isolate the problem.
|
||||||
|
|
||||||
Don't feel bad if we can't reproduce the issue and ask for more information!
|
Don't feel bad if we can't reproduce the issue and ask for more information!
|
||||||
|
|
||||||
## Contributing Fixes
|
## Contributing Fixes
|
||||||
If you are interested in fixing issues and contributing directly to the code base,
|
If you are interested in fixing issues and contributing directly to the code base,
|
||||||
please see the document [How to Contribute](https://github.com/Microsoft/sqlopsstudio/wiki/How-to-Contribute).
|
please see the document [How to Contribute](https://github.com/Microsoft/azuredatastudio/wiki/How-to-Contribute).
|
||||||
|
|||||||
12
LICENSE.txt
12
LICENSE.txt
@@ -1,14 +1,14 @@
|
|||||||
MICROSOFT SOFTWARE LICENSE TERMS
|
MICROSOFT SOFTWARE LICENSE TERMS
|
||||||
|
|
||||||
MICROSOFT SQL OPERATIONS STUDIO
|
MICROSOFT AZURE DATA STUDIO
|
||||||
|
|
||||||
Microsoft Corporation ("Microsoft") grants you a nonexclusive, perpetual,
|
Microsoft Corporation ("Microsoft") grants you a nonexclusive, perpetual,
|
||||||
royalty-free right to use, copy, and modify the software code provided by us
|
royalty-free right to use, copy, and modify the software code provided by us
|
||||||
("Software Code"). You may not sublicense the Software Code or any use of it
|
("Software Code"). You may not sublicense the Software Code or any use of it
|
||||||
(except to your affiliates and to vendors to perform work on your behalf)
|
(except to your affiliates and to vendors to perform work on your behalf)
|
||||||
through distribution, network access, service agreement, lease, rental, or
|
through distribution, network access, service agreement, lease, rental, or
|
||||||
otherwise. Unless applicable law gives you more rights, Microsoft reserves all
|
otherwise. Unless applicable law gives you more rights, Microsoft reserves all
|
||||||
other rights not expressly granted herein, whether by implication, estoppel or
|
other rights not expressly granted herein, whether by implication, estoppel or
|
||||||
otherwise.
|
otherwise.
|
||||||
|
|
||||||
THE SOFTWARE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
THE SOFTWARE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
||||||
|
|||||||
984
OSSREADME.json
984
OSSREADME.json
File diff suppressed because it is too large
Load Diff
89
README.md
89
README.md
@@ -1,21 +1,25 @@
|
|||||||
# SQL Operations Studio
|
# Azure Data Studio
|
||||||
|
|
||||||
SQL Operations Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.
|
[](https://gitter.im/Microsoft/sqlopsstudio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
**Download SQL Operations Studio December Public Preview**
|
Azure Data Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.
|
||||||
|
|
||||||
|
**Download the latest Azure Data Studio release**
|
||||||
|
|
||||||
Platform | Link
|
Platform | Link
|
||||||
-- | --
|
-- | --
|
||||||
Windows Setup Installer | https://go.microsoft.com/fwlink/?linkid=865305
|
Windows Setup Installer | https://go.microsoft.com/fwlink/?linkid=2030731
|
||||||
Windows ZIP | https://go.microsoft.com/fwlink/?linkid=865304
|
Windows ZIP | https://go.microsoft.com/fwlink/?linkid=2030736
|
||||||
macOS ZIP | https://go.microsoft.com/fwlink/?linkid=865306
|
macOS ZIP | https://go.microsoft.com/fwlink/?linkid=2030738
|
||||||
Linux TAR.GZ | https://go.microsoft.com/fwlink/?linkid=865307
|
Linux TAR.GZ | https://go.microsoft.com/fwlink/?linkid=2030741
|
||||||
Linux DEB | https://go.microsoft.com/fwlink/?linkid=865308
|
Linux RPM | https://go.microsoft.com/fwlink/?linkid=2030746
|
||||||
Linux RPM | https://go.microsoft.com/fwlink/?linkid=865309
|
Linux DEB | https://go.microsoft.com/fwlink/?linkid=2030750
|
||||||
|
|
||||||
Go to our [download page](https://aka.ms/sqlopsstudio) for more specific instructions.
|
Go to our [download page](https://aka.ms/azuredatastudio) for more specific instructions.
|
||||||
|
|
||||||
Try out the latest insiders build from `master` at https://github.com/Microsoft/sqlopsstudio/releases.
|
Try out the latest insiders build from `master` at https://github.com/Microsoft/azuredatastudio/releases.
|
||||||
|
|
||||||
|
See the [change log](https://github.com/Microsoft/azuredatastudio/blob/master/CHANGELOG.md) for additional details of what's in this release.
|
||||||
|
|
||||||
**Feature Highlights**
|
**Feature Highlights**
|
||||||
|
|
||||||
@@ -34,21 +38,74 @@ Try out the latest insiders build from `master` at https://github.com/Microsoft/
|
|||||||
|
|
||||||
Here's some of these features in action.
|
Here's some of these features in action.
|
||||||
|
|
||||||
<img src='https://github.com/Microsoft/sqlopsstudio/blob/master/docs/overview_screen.jpg' width='800px'>
|
<img src='https://github.com/Microsoft/azuredatastudio/blob/master/docs/overview_screen.jpg' width='800px'>
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
If you are interested in fixing issues and contributing directly to the code base,
|
If you are interested in fixing issues and contributing directly to the code base,
|
||||||
please see the document [How to Contribute](https://github.com/Microsoft/sqlopsstudio/wiki/How-to-Contribute), which covers the following:
|
please see the document [How to Contribute](https://github.com/Microsoft/azuredatastudio/wiki/How-to-Contribute), which covers the following:
|
||||||
|
|
||||||
* [How to build and run from source](https://github.com/Microsoft/sqlopsstudio/wiki/How-to-Contribute#Build-and-Run-From-Source)
|
* [How to build and run from source](https://github.com/Microsoft/azuredatastudio/wiki/How-to-Contribute#Build-and-Run-From-Source)
|
||||||
* [The development workflow, including debugging and running tests](https://github.com/Microsoft/sqlopsstudio/wiki/How-to-Contribute#development-workflow)
|
* [The development workflow, including debugging and running tests](https://github.com/Microsoft/azuredatastudio/wiki/How-to-Contribute#development-workflow)
|
||||||
* [Submitting pull requests](https://github.com/Microsoft/sqlopsstudio/wiki/How-to-Contribute#pull-requests)
|
* [Submitting pull requests](https://github.com/Microsoft/azuredatastudio/wiki/How-to-Contribute#pull-requests)
|
||||||
|
|
||||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||||
|
|
||||||
|
## Localization
|
||||||
|
Azure Data Studio localization is now open for community contributions. You can contribute to localization for both software and docs. https://aka.ms/SQLOpsStudioLoc
|
||||||
|
|
||||||
|
Localization is now opened for 10 languages: French, Italian, German, Spanish, Simplified Chinese, Traditional Chinese, Japanese, Korean, Russian, and Portuguese (Brazil). Help us make Azure Data Studio available in your language!
|
||||||
|
|
||||||
## Privacy Statement
|
## Privacy Statement
|
||||||
The [Microsoft Enterprise and Developer Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement) describes the privacy statement of this software.
|
The [Microsoft Enterprise and Developer Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement) describes the privacy statement of this software.
|
||||||
|
|
||||||
|
## Contributions and "Thank You"
|
||||||
|
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
||||||
|
|
||||||
|
* philoushka for `center the icon #2760`
|
||||||
|
* anthonypants for `Typo #2775`
|
||||||
|
* kstolte for `Fix Invalid Configuration in Launch.json #2789`
|
||||||
|
* kstolte for `Fixing a reference to SQL Ops Studio #2788`
|
||||||
|
* AlexFsmn `Feature: Ability to add connection name #2332`
|
||||||
|
* AlexFsmn `Disabled connection name input when connecting to a server. #2566`
|
||||||
|
* SebastianPfliegel `Added more saveAsCsv options #2099`
|
||||||
|
* ianychoi `Fixes a typo: Mimunum -> Minimum #1994`
|
||||||
|
* AlexFsmn `Fixed bug where proper file extension wasn't appended to filename. #2151`
|
||||||
|
* AlexFsmn `Added functionality for adding any file to import wizard #2329`
|
||||||
|
* AlexFsmn `Fixed background issue when copying a chart to clipboard #2215`
|
||||||
|
* AlexFsmn `Fixed problem where vertical charts didn't display labels correctly. #2263`
|
||||||
|
* AlexFsmn `Fixed Initial values for charts to match visuals #2266`
|
||||||
|
* AlexFsmn `Renamed chart option labels #2264`
|
||||||
|
* AlexFsmn `Added feature for opening file after exporting to CSV/XLS/JSON & query files #2216`
|
||||||
|
* AlexFsmm `Get Connection String should copy to clipboard #2175`
|
||||||
|
* lanceklinger `Fix for double clicking column handle in results table #1504`
|
||||||
|
* westerncj for `Removed duplicate contribution from README.md (#753)`
|
||||||
|
* ntovas for `Fix for duplicate extensions shown in "Save File" dialog. (#779)`
|
||||||
|
* SebastianPfliegel for `Add cursor snippet (#475)`
|
||||||
|
* mikaoelitiana for fix: `revert README and CONTRIBUTING after last VSCode merge (#574)`
|
||||||
|
* alextercete for `Reinstate menu item to install from VSIX (#682)`
|
||||||
|
* alextercete for `Fix "No extension gallery service configured" error (#427)`
|
||||||
|
* mwiedemeyer for `Fix #58: Default sort order for DB size widget (#111)`
|
||||||
|
* AlexTroshkin for `Show disconnect in context menu only when connectionProfile connected (#150)`
|
||||||
|
* AlexTroshkin for `Fix #138: Invalid syntax color highlighting (identity not highlighting) (#140))`
|
||||||
|
* stebet for `Fix #153: Fixing sql snippets that failed on a DB with case-sensitive collation. (#152)`
|
||||||
|
* SebastianPfliegel `Remove sqlExtensionHelp (#312)`
|
||||||
|
* olljanat for `Implemented npm version check (#314)`
|
||||||
|
* Adam Machanic for helping with the `whoisactive` extension
|
||||||
|
* All community localization contributors:
|
||||||
|
* French: Adrien Clerbois, ANAS BELABBES, Antoine Griffard, Arian Papillon, Eric Macarez, Eric Van Thorre, Jérémy LANDON, Matthias GROSPERRIN, Maxime COQUEREL, Olivier Guinart, thierry DEMAN-BARCELÒ, Thomas Potier
|
||||||
|
* Italian: Aldo Donetti, Alessandro Alpi, Andrea Dottor, Bruni Luca, Gianluca Hotz, Luca Nardi, Luigi Bruno, Marco Dal Pino, Mirco Vanini, Pasquale Ceglie, Riccardo Cappello, Sergio Govoni, Stefano Demiliani
|
||||||
|
* German: Anna Henke-Gunvaldson, Ben Weissman, David Ullmer, J.M. ., Kai Modo, Konstantin Staschill, Kostja Klein, Lennart Trunk, Markus Ehrenmüller-Jensen, Mascha Kroenlein, Matthias Knoll, Mourad Louha, Thomas Hütter, Wolfgang Straßer
|
||||||
|
* Spanish: Alberto Poblacion, Andy Gonzalez, Carlos Mendible, Christian Araujo, Daniel D, Eickhel Mendoza, Ernesto Cardenas, Ivan Toledo Ivanovic, Fran Diaz, JESUS GIL, Jorge Serrano Pérez, José Saturnino Pimentel Juárez, Mauricio Hidalgo, Pablo Iglesias, Rikhardo Estrada Rdez, Thierry DEMAN, YOLANDA CUESTA ALTIERI
|
||||||
|
* Japanese: Fujio Kojima, Kazushi KAMEGAWA, Masayoshi Yamada, Masayuki Ozawa , Seiji Momoto, Takashi Kanai, Takayoshi Tanaka, Yoshihisa Ozaki, 庄垣内治
|
||||||
|
* Chinese (simplified): DAN YE, Joel Yang, Lynne Dong, Ryan(Yu) Zhang, Sheng Jiang, Wei Zhang, Zhiliang Xu
|
||||||
|
* Chinese (Traditional): Bruce Chen, Chiayi Yen, Kevin Yang, Winnie Lin, 保哥 Will, 謝政廷
|
||||||
|
* Korean: Do-Kyun Kim, Evelyn Kim, Helen Jung, Hong Jmee, jeongwoo choi, Jun Hyoung Lee, Jungsun Kim정선, Justin Yoo, Kavrith mucha, Kiwoong Youm, MinGyu Ju, MVP_JUNO BEA, Sejun Kim, SOONMAN KWON, sung man ko, Yeongrak Choi, younggun kim, Youngjae Kim, 소영 이
|
||||||
|
* Russian: Andrey Veselov, Anton Fontanov, Anton Savin, Elena Ostrovskaia, Igor Babichev, Maxim Zelensky, Rodion Fedechkin, Tasha T, Vladimir Zyryanov
|
||||||
|
* Portuguese Brazil: Daniel de Sousa, Diogo Duarte, Douglas Correa, Douglas Eccker, José Emanuel Mendes, Marcelo Fernandes, Marcondes Alexandre, Roberto Fonseca, Rodrigo Crespi
|
||||||
|
|
||||||
|
|
||||||
|
And of course we'd like to thank the authors of all upstream dependencies. Please see a full list in the [ThirdPartyNotices.txt](https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/ThirdPartyNotices.txt)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
MICROSOFT SQL OPERATIONS STUDIO
|
MICROSOFT Azure Data Studio
|
||||||
|
|
||||||
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
|
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
|
||||||
Do Not Translate or Localize
|
Do Not Translate or Localize
|
||||||
@@ -21,6 +21,7 @@ expressly granted herein, whether by implication, estoppel or otherwise.
|
|||||||
error-ex: https://github.com/Qix-/node-error-ex
|
error-ex: https://github.com/Qix-/node-error-ex
|
||||||
escape-string-regexp: https://github.com/sindresorhus/escape-string-regexp
|
escape-string-regexp: https://github.com/sindresorhus/escape-string-regexp
|
||||||
fast-plist: https://github.com/Microsoft/node-fast-plist
|
fast-plist: https://github.com/Microsoft/node-fast-plist
|
||||||
|
find-remove: https://www.npmjs.com/package/find-remove
|
||||||
fs-extra: https://github.com/jprichardson/node-fs-extra
|
fs-extra: https://github.com/jprichardson/node-fs-extra
|
||||||
gc-signals: https://github.com/Microsoft/node-gc-signals
|
gc-signals: https://github.com/Microsoft/node-gc-signals
|
||||||
getmac: https://github.com/bevry/getmac
|
getmac: https://github.com/bevry/getmac
|
||||||
@@ -2039,4 +2040,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
=========================================
|
=========================================
|
||||||
END OF zone.js NOTICES AND INFORMATION
|
END OF zone.js NOTICES AND INFORMATION
|
||||||
|
|||||||
@@ -3,19 +3,17 @@ environment:
|
|||||||
VSCODE_BUILD_VERBOSE: true
|
VSCODE_BUILD_VERBOSE: true
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
- '%APPDATA%\npm-cache'
|
- '%LOCALAPPDATA%\Yarn\cache'
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- ps: Install-Product node 7.9.0 x64
|
- ps: Install-Product node 8.9.1 x64
|
||||||
- npm install -g npm@4 --silent
|
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- .\scripts\npm.bat install
|
- yarn
|
||||||
- .\node_modules\.bin\gulp electron
|
- .\node_modules\.bin\gulp electron
|
||||||
- npm run compile
|
- npm run compile
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- node --version
|
- node --version
|
||||||
- npm --version
|
|
||||||
- .\scripts\test.bat
|
- .\scripts\test.bat
|
||||||
- .\scripts\test-integration.bat
|
- .\scripts\test-integration.bat
|
||||||
|
|||||||
12
build/builtInExtensions.json
Normal file
12
build/builtInExtensions.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "ms-vscode.node-debug",
|
||||||
|
"version": "1.26.7",
|
||||||
|
"repo": "https://github.com/Microsoft/vscode-node-debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ms-vscode.node-debug2",
|
||||||
|
"version": "1.26.8",
|
||||||
|
"repo": "https://github.com/Microsoft/vscode-node-debug2"
|
||||||
|
}
|
||||||
|
]
|
||||||
20
build/builtin/.eslintrc
Normal file
20
build/builtin/.eslintrc
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es6": true,
|
||||||
|
"browser": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": 0,
|
||||||
|
"no-cond-assign": 0,
|
||||||
|
"no-unused-vars": 1,
|
||||||
|
"no-extra-semi": "warn",
|
||||||
|
"semi": "warn"
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"experimentalObjectRestSpread": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
126
build/builtin/browser-main.js
Normal file
126
build/builtin/browser-main.js
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const os = require('os');
|
||||||
|
// @ts-ignore review
|
||||||
|
const { remote } = require('electron');
|
||||||
|
const dialog = remote.dialog;
|
||||||
|
|
||||||
|
const builtInExtensionsPath = path.join(__dirname, '..', 'builtInExtensions.json');
|
||||||
|
const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json');
|
||||||
|
|
||||||
|
function readJson(filePath) {
|
||||||
|
return JSON.parse(fs.readFileSync(filePath, { encoding: 'utf8' }));
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeJson(filePath, obj) {
|
||||||
|
fs.writeFileSync(filePath, JSON.stringify(obj, null, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderOption(form, id, title, value, checked) {
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'radio';
|
||||||
|
input.id = id;
|
||||||
|
input.name = 'choice';
|
||||||
|
input.value = value;
|
||||||
|
input.checked = !!checked;
|
||||||
|
form.appendChild(input);
|
||||||
|
|
||||||
|
const label = document.createElement('label');
|
||||||
|
label.setAttribute('for', id);
|
||||||
|
label.textContent = title;
|
||||||
|
form.appendChild(label);
|
||||||
|
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
function render(el, state) {
|
||||||
|
function setState(state) {
|
||||||
|
try {
|
||||||
|
writeJson(controlFilePath, state.control);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
el.innerHTML = '';
|
||||||
|
render(el, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ul = document.createElement('ul');
|
||||||
|
const { builtin, control } = state;
|
||||||
|
|
||||||
|
for (const ext of builtin) {
|
||||||
|
const controlState = control[ext.name] || 'marketplace';
|
||||||
|
|
||||||
|
const li = document.createElement('li');
|
||||||
|
ul.appendChild(li);
|
||||||
|
|
||||||
|
const name = document.createElement('code');
|
||||||
|
name.textContent = ext.name;
|
||||||
|
li.appendChild(name);
|
||||||
|
|
||||||
|
const form = document.createElement('form');
|
||||||
|
li.appendChild(form);
|
||||||
|
|
||||||
|
const marketplaceInput = renderOption(form, `marketplace-${ext.name}`, 'Marketplace', 'marketplace', controlState === 'marketplace');
|
||||||
|
marketplaceInput.onchange = function () {
|
||||||
|
control[ext.name] = 'marketplace';
|
||||||
|
setState({ builtin, control });
|
||||||
|
};
|
||||||
|
|
||||||
|
const disabledInput = renderOption(form, `disabled-${ext.name}`, 'Disabled', 'disabled', controlState === 'disabled');
|
||||||
|
disabledInput.onchange = function () {
|
||||||
|
control[ext.name] = 'disabled';
|
||||||
|
setState({ builtin, control });
|
||||||
|
};
|
||||||
|
|
||||||
|
let local = undefined;
|
||||||
|
|
||||||
|
if (controlState !== 'marketplace' && controlState !== 'disabled') {
|
||||||
|
local = controlState;
|
||||||
|
}
|
||||||
|
|
||||||
|
const localInput = renderOption(form, `local-${ext.name}`, 'Local', 'local', !!local);
|
||||||
|
localInput.onchange = function () {
|
||||||
|
const result = dialog.showOpenDialog(remote.getCurrentWindow(), {
|
||||||
|
title: 'Choose Folder',
|
||||||
|
properties: ['openDirectory']
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result && result.length >= 1) {
|
||||||
|
control[ext.name] = result[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
setState({ builtin, control });
|
||||||
|
};
|
||||||
|
|
||||||
|
if (local) {
|
||||||
|
const localSpan = document.createElement('code');
|
||||||
|
localSpan.className = 'local';
|
||||||
|
localSpan.textContent = local;
|
||||||
|
form.appendChild(localSpan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
el.appendChild(ul);
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
const el = document.getElementById('extensions');
|
||||||
|
const builtin = readJson(builtInExtensionsPath);
|
||||||
|
let control;
|
||||||
|
|
||||||
|
try {
|
||||||
|
control = readJson(controlFilePath);
|
||||||
|
} catch (err) {
|
||||||
|
control = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
render(el, { builtin, control });
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = main;
|
||||||
46
build/builtin/index.html
Normal file
46
build/builtin/index.html
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<title>Manage Built-in Extensions</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<script src="browser-main.js"></script>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
|
||||||
|
font-size: 10pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: 'Menlo', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
padding-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0.3em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
padding: 0.3em 0 0.3em 0.3em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Built-in Extensions</h1>
|
||||||
|
<div id="extensions"></div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
20
build/builtin/main.js
Normal file
20
build/builtin/main.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
const { app, BrowserWindow } = require('electron');
|
||||||
|
const url = require('url');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
let window = null;
|
||||||
|
|
||||||
|
app.once('ready', () => {
|
||||||
|
window = new BrowserWindow({ width: 800, height: 600 });
|
||||||
|
window.setMenuBarVisibility(false);
|
||||||
|
window.loadURL(url.format({ pathname: path.join(__dirname, 'index.html'), protocol: 'file:', slashes: true }));
|
||||||
|
// window.webContents.openDevTools();
|
||||||
|
window.once('closed', () => window = null);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('window-all-closed', () => app.quit());
|
||||||
5
build/builtin/package.json
Normal file
5
build/builtin/package.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "builtin",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"main": "main.js"
|
||||||
|
}
|
||||||
74
build/dependencies.js
Normal file
74
build/dependencies.js
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const parseSemver = require('parse-semver');
|
||||||
|
const cp = require('child_process');
|
||||||
|
const _ = require('underscore');
|
||||||
|
|
||||||
|
function asYarnDependency(prefix, tree) {
|
||||||
|
let parseResult;
|
||||||
|
|
||||||
|
try {
|
||||||
|
parseResult = parseSemver(tree.name);
|
||||||
|
} catch (err) {
|
||||||
|
err.message += `: ${tree.name}`;
|
||||||
|
console.warn(`Could not parse semver: ${tree.name}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// not an actual dependency in disk
|
||||||
|
if (parseResult.version !== parseResult.range) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const name = parseResult.name;
|
||||||
|
const version = parseResult.version;
|
||||||
|
const dependencyPath = path.join(prefix, name);
|
||||||
|
const children = [];
|
||||||
|
|
||||||
|
for (const child of (tree.children || [])) {
|
||||||
|
const dep = asYarnDependency(path.join(prefix, name, 'node_modules'), child);
|
||||||
|
|
||||||
|
if (dep) {
|
||||||
|
children.push(dep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { name, version, path: dependencyPath, children };
|
||||||
|
}
|
||||||
|
|
||||||
|
function getYarnProductionDependencies(cwd) {
|
||||||
|
const raw = cp.execSync('yarn list --json', { cwd, encoding: 'utf8', env: { ...process.env, NODE_ENV: 'production' }, stdio: [null, null, 'ignore'] });
|
||||||
|
const match = /^{"type":"tree".*$/m.exec(raw);
|
||||||
|
|
||||||
|
if (!match || match.length !== 1) {
|
||||||
|
throw new Error('Could not parse result of `yarn list --json`');
|
||||||
|
}
|
||||||
|
|
||||||
|
const trees = JSON.parse(match[0]).data.trees;
|
||||||
|
|
||||||
|
return trees
|
||||||
|
.map(tree => asYarnDependency(path.join(cwd, 'node_modules'), tree))
|
||||||
|
.filter(dep => !!dep);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProductionDependencies(cwd) {
|
||||||
|
const result = [];
|
||||||
|
const deps = getYarnProductionDependencies(cwd);
|
||||||
|
const flatten = dep => { result.push({ name: dep.name, version: dep.version, path: dep.path }); dep.children.forEach(flatten); };
|
||||||
|
deps.forEach(flatten);
|
||||||
|
|
||||||
|
return _.uniq(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.getProductionDependencies = getProductionDependencies;
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
const root = path.dirname(__dirname);
|
||||||
|
console.log(JSON.stringify(getProductionDependencies(root), null, ' '));
|
||||||
|
}
|
||||||
@@ -3,12 +3,18 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
var gulp = require('gulp');
|
const gulp = require('gulp');
|
||||||
var path = require('path');
|
const path = require('path');
|
||||||
var util = require('./lib/util');
|
const util = require('./lib/util');
|
||||||
var common = require('./lib/optimize');
|
const common = require('./lib/optimize');
|
||||||
var es = require('event-stream');
|
const es = require('event-stream');
|
||||||
var File = require('vinyl');
|
const File = require('vinyl');
|
||||||
|
const i18n = require('./lib/i18n');
|
||||||
|
const standalone = require('./lib/standalone');
|
||||||
|
const cp = require('child_process');
|
||||||
|
const compilation = require('./lib/compilation');
|
||||||
|
const monacoapi = require('./monaco/api');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
var root = path.dirname(__dirname);
|
var root = path.dirname(__dirname);
|
||||||
var sha1 = util.getVersion(root);
|
var sha1 = util.getVersion(root);
|
||||||
@@ -21,14 +27,14 @@ var editorEntryPoints = [
|
|||||||
{
|
{
|
||||||
name: 'vs/editor/editor.main',
|
name: 'vs/editor/editor.main',
|
||||||
include: [],
|
include: [],
|
||||||
exclude: [ 'vs/css', 'vs/nls' ],
|
exclude: ['vs/css', 'vs/nls'],
|
||||||
prepend: [ 'out-build/vs/css.js', 'out-build/vs/nls.js' ],
|
prepend: ['out-build/vs/css.js', 'out-build/vs/nls.js'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'vs/base/common/worker/simpleWorker',
|
name: 'vs/base/common/worker/simpleWorker',
|
||||||
include: [ 'vs/editor/common/services/editorSimpleWorker' ],
|
include: ['vs/editor/common/services/editorSimpleWorker'],
|
||||||
prepend: [ 'vs/loader.js' ],
|
prepend: ['vs/loader.js'],
|
||||||
append: [ 'vs/base/worker/workerMain' ],
|
append: ['vs/base/worker/workerMain'],
|
||||||
dest: 'vs/base/worker/workerMain.js'
|
dest: 'vs/base/worker/workerMain.js'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@@ -55,38 +61,125 @@ var BUNDLED_FILE_HEADER = [
|
|||||||
''
|
''
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
function editorLoaderConfig() {
|
const languages = i18n.defaultLanguages.concat([]); // i18n.defaultLanguages.concat(process.env.VSCODE_QUALITY !== 'stable' ? i18n.extraLanguages : []);
|
||||||
var result = common.loaderConfig();
|
|
||||||
|
|
||||||
// never ship octicons in editor
|
gulp.task('clean-editor-src', util.rimraf('out-editor-src'));
|
||||||
result.paths['vs/base/browser/ui/octiconLabel/octiconLabel'] = 'out-build/vs/base/browser/ui/octiconLabel/octiconLabel.mock';
|
gulp.task('extract-editor-src', ['clean-editor-src'], function () {
|
||||||
|
console.log(`If the build fails, consider tweaking shakeLevel below to a lower value.`);
|
||||||
|
const apiusages = monacoapi.execute().usageContent;
|
||||||
|
const extrausages = fs.readFileSync(path.join(root, 'build', 'monaco', 'monaco.usage.recipe')).toString();
|
||||||
|
standalone.extractEditor({
|
||||||
|
sourcesRoot: path.join(root, 'src'),
|
||||||
|
entryPoints: [
|
||||||
|
'vs/editor/editor.main',
|
||||||
|
'vs/editor/editor.worker',
|
||||||
|
'vs/base/worker/workerMain',
|
||||||
|
],
|
||||||
|
inlineEntryPoints: [
|
||||||
|
apiusages,
|
||||||
|
extrausages
|
||||||
|
],
|
||||||
|
libs: [
|
||||||
|
`lib.d.ts`,
|
||||||
|
`lib.es2015.collection.d.ts`
|
||||||
|
],
|
||||||
|
redirects: {
|
||||||
|
'vs/base/browser/ui/octiconLabel/octiconLabel': 'vs/base/browser/ui/octiconLabel/octiconLabel.mock',
|
||||||
|
},
|
||||||
|
compilerOptions: {
|
||||||
|
module: 2, // ModuleKind.AMD
|
||||||
|
},
|
||||||
|
shakeLevel: 2, // 0-Files, 1-InnerFile, 2-ClassMembers
|
||||||
|
importIgnorePattern: /^vs\/css!/,
|
||||||
|
destRoot: path.join(root, 'out-editor-src')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// force css inlining to use base64 -- see https://github.com/Microsoft/monaco-editor/issues/148
|
// Full compile, including nls and inline sources in sourcemaps, for build
|
||||||
result['vs/css'] = {
|
gulp.task('clean-editor-build', util.rimraf('out-editor-build'));
|
||||||
inlineResources: 'base64',
|
gulp.task('compile-editor-build', ['clean-editor-build', 'extract-editor-src'], compilation.compileTask('out-editor-src', 'out-editor-build', true));
|
||||||
inlineResourcesLimit: 3000 // see https://github.com/Microsoft/monaco-editor/issues/336
|
|
||||||
};
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task('clean-optimized-editor', util.rimraf('out-editor'));
|
gulp.task('clean-optimized-editor', util.rimraf('out-editor'));
|
||||||
gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-client-build'], common.optimizeTask({
|
gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-editor-build'], common.optimizeTask({
|
||||||
|
src: 'out-editor-build',
|
||||||
entryPoints: editorEntryPoints,
|
entryPoints: editorEntryPoints,
|
||||||
otherSources: editorOtherSources,
|
otherSources: editorOtherSources,
|
||||||
resources: editorResources,
|
resources: editorResources,
|
||||||
loaderConfig: editorLoaderConfig(),
|
loaderConfig: {
|
||||||
|
paths: {
|
||||||
|
'vs': 'out-editor-build/vs',
|
||||||
|
'vscode': 'empty:'
|
||||||
|
}
|
||||||
|
},
|
||||||
bundleLoader: false,
|
bundleLoader: false,
|
||||||
header: BUNDLED_FILE_HEADER,
|
header: BUNDLED_FILE_HEADER,
|
||||||
bundleInfo: true,
|
bundleInfo: true,
|
||||||
out: 'out-editor'
|
out: 'out-editor',
|
||||||
|
languages: languages
|
||||||
}));
|
}));
|
||||||
|
|
||||||
gulp.task('clean-minified-editor', util.rimraf('out-editor-min'));
|
gulp.task('clean-minified-editor', util.rimraf('out-editor-min'));
|
||||||
gulp.task('minify-editor', ['clean-minified-editor', 'optimize-editor'], common.minifyTask('out-editor'));
|
gulp.task('minify-editor', ['clean-minified-editor', 'optimize-editor'], common.minifyTask('out-editor'));
|
||||||
|
|
||||||
|
gulp.task('clean-editor-esm', util.rimraf('out-editor-esm'));
|
||||||
|
gulp.task('extract-editor-esm', ['clean-editor-esm', 'clean-editor-distro'], function () {
|
||||||
|
standalone.createESMSourcesAndResources({
|
||||||
|
entryPoints: [
|
||||||
|
'vs/editor/editor.main',
|
||||||
|
'vs/editor/editor.worker'
|
||||||
|
],
|
||||||
|
outFolder: './out-editor-esm/src',
|
||||||
|
outResourcesFolder: './out-monaco-editor-core/esm',
|
||||||
|
redirects: {
|
||||||
|
'vs/base/browser/ui/octiconLabel/octiconLabel': 'vs/base/browser/ui/octiconLabel/octiconLabel.mock',
|
||||||
|
'vs/nls': 'vs/nls.mock',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
gulp.task('compile-editor-esm', ['extract-editor-esm', 'clean-editor-distro'], function () {
|
||||||
|
const result = cp.spawnSync(`node`, [`../node_modules/.bin/tsc`], {
|
||||||
|
cwd: path.join(__dirname, '../out-editor-esm')
|
||||||
|
});
|
||||||
|
console.log(result.stdout.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
function toExternalDTS(contents) {
|
||||||
|
let lines = contents.split('\n');
|
||||||
|
let killNextCloseCurlyBrace = false;
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
let line = lines[i];
|
||||||
|
|
||||||
|
if (killNextCloseCurlyBrace) {
|
||||||
|
if ('}' === line) {
|
||||||
|
lines[i] = '';
|
||||||
|
killNextCloseCurlyBrace = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.indexOf(' ') === 0) {
|
||||||
|
lines[i] = line.substr(4);
|
||||||
|
} else if (line.charAt(0) === '\t') {
|
||||||
|
lines[i] = line.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('declare namespace monaco {' === line) {
|
||||||
|
lines[i] = '';
|
||||||
|
killNextCloseCurlyBrace = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.indexOf('declare namespace monaco.') === 0) {
|
||||||
|
lines[i] = line.replace('declare namespace monaco.', 'export namespace ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
gulp.task('clean-editor-distro', util.rimraf('out-monaco-editor-core'));
|
gulp.task('clean-editor-distro', util.rimraf('out-monaco-editor-core'));
|
||||||
gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-editor'], function() {
|
gulp.task('editor-distro', ['clean-editor-distro', 'compile-editor-esm', 'minify-editor', 'optimize-editor'], function () {
|
||||||
return es.merge(
|
return es.merge(
|
||||||
// other assets
|
// other assets
|
||||||
es.merge(
|
es.merge(
|
||||||
@@ -95,19 +188,30 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed
|
|||||||
gulp.src('src/vs/monaco.d.ts')
|
gulp.src('src/vs/monaco.d.ts')
|
||||||
).pipe(gulp.dest('out-monaco-editor-core')),
|
).pipe(gulp.dest('out-monaco-editor-core')),
|
||||||
|
|
||||||
|
// place the .d.ts in the esm folder
|
||||||
|
gulp.src('src/vs/monaco.d.ts')
|
||||||
|
.pipe(es.through(function (data) {
|
||||||
|
this.emit('data', new File({
|
||||||
|
path: data.path.replace(/monaco\.d\.ts/, 'editor.api.d.ts'),
|
||||||
|
base: data.base,
|
||||||
|
contents: new Buffer(toExternalDTS(data.contents.toString()))
|
||||||
|
}));
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest('out-monaco-editor-core/esm/vs/editor')),
|
||||||
|
|
||||||
// package.json
|
// package.json
|
||||||
gulp.src('build/monaco/package.json')
|
gulp.src('build/monaco/package.json')
|
||||||
.pipe(es.through(function(data) {
|
.pipe(es.through(function (data) {
|
||||||
var json = JSON.parse(data.contents.toString());
|
var json = JSON.parse(data.contents.toString());
|
||||||
json.private = false;
|
json.private = false;
|
||||||
data.contents = new Buffer(JSON.stringify(json, null, ' '));
|
data.contents = Buffer.from(JSON.stringify(json, null, ' '));
|
||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
}))
|
}))
|
||||||
.pipe(gulp.dest('out-monaco-editor-core')),
|
.pipe(gulp.dest('out-monaco-editor-core')),
|
||||||
|
|
||||||
// README.md
|
// README.md
|
||||||
gulp.src('build/monaco/README-npm.md')
|
gulp.src('build/monaco/README-npm.md')
|
||||||
.pipe(es.through(function(data) {
|
.pipe(es.through(function (data) {
|
||||||
this.emit('data', new File({
|
this.emit('data', new File({
|
||||||
path: data.path.replace(/README-npm\.md/, 'README.md'),
|
path: data.path.replace(/README-npm\.md/, 'README.md'),
|
||||||
base: data.base,
|
base: data.base,
|
||||||
@@ -124,10 +228,10 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed
|
|||||||
// min folder
|
// min folder
|
||||||
es.merge(
|
es.merge(
|
||||||
gulp.src('out-editor-min/**/*')
|
gulp.src('out-editor-min/**/*')
|
||||||
).pipe(filterStream(function(path) {
|
).pipe(filterStream(function (path) {
|
||||||
// no map files
|
// no map files
|
||||||
return !/(\.js\.map$)|(nls\.metadata\.json$)|(bundleInfo\.json$)/.test(path);
|
return !/(\.js\.map$)|(nls\.metadata\.json$)|(bundleInfo\.json$)/.test(path);
|
||||||
})).pipe(es.through(function(data) {
|
})).pipe(es.through(function (data) {
|
||||||
// tweak the sourceMappingURL
|
// tweak the sourceMappingURL
|
||||||
if (!/\.js$/.test(data.path)) {
|
if (!/\.js$/.test(data.path)) {
|
||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
@@ -140,49 +244,50 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed
|
|||||||
var newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
|
var newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
|
||||||
strContents = strContents.replace(/\/\/\# sourceMappingURL=[^ ]+$/, newStr);
|
strContents = strContents.replace(/\/\/\# sourceMappingURL=[^ ]+$/, newStr);
|
||||||
|
|
||||||
data.contents = new Buffer(strContents);
|
data.contents = Buffer.from(strContents);
|
||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
})).pipe(gulp.dest('out-monaco-editor-core/min')),
|
})).pipe(gulp.dest('out-monaco-editor-core/min')),
|
||||||
|
|
||||||
// min-maps folder
|
// min-maps folder
|
||||||
es.merge(
|
es.merge(
|
||||||
gulp.src('out-editor-min/**/*')
|
gulp.src('out-editor-min/**/*')
|
||||||
).pipe(filterStream(function(path) {
|
).pipe(filterStream(function (path) {
|
||||||
// no map files
|
// no map files
|
||||||
return /\.js\.map$/.test(path);
|
return /\.js\.map$/.test(path);
|
||||||
})).pipe(gulp.dest('out-monaco-editor-core/min-maps'))
|
})).pipe(gulp.dest('out-monaco-editor-core/min-maps'))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('analyze-editor-distro', function() {
|
gulp.task('analyze-editor-distro', function () {
|
||||||
|
// @ts-ignore
|
||||||
var bundleInfo = require('../out-editor/bundleInfo.json');
|
var bundleInfo = require('../out-editor/bundleInfo.json');
|
||||||
var graph = bundleInfo.graph;
|
var graph = bundleInfo.graph;
|
||||||
var bundles = bundleInfo.bundles;
|
var bundles = bundleInfo.bundles;
|
||||||
|
|
||||||
var inverseGraph = {};
|
var inverseGraph = {};
|
||||||
Object.keys(graph).forEach(function(module) {
|
Object.keys(graph).forEach(function (module) {
|
||||||
var dependencies = graph[module];
|
var dependencies = graph[module];
|
||||||
dependencies.forEach(function(dep) {
|
dependencies.forEach(function (dep) {
|
||||||
inverseGraph[dep] = inverseGraph[dep] || [];
|
inverseGraph[dep] = inverseGraph[dep] || [];
|
||||||
inverseGraph[dep].push(module);
|
inverseGraph[dep].push(module);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var detailed = {};
|
var detailed = {};
|
||||||
Object.keys(bundles).forEach(function(entryPoint) {
|
Object.keys(bundles).forEach(function (entryPoint) {
|
||||||
var included = bundles[entryPoint];
|
var included = bundles[entryPoint];
|
||||||
var includedMap = {};
|
var includedMap = {};
|
||||||
included.forEach(function(included) {
|
included.forEach(function (included) {
|
||||||
includedMap[included] = true;
|
includedMap[included] = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
var explanation = [];
|
var explanation = [];
|
||||||
included.map(function(included) {
|
included.map(function (included) {
|
||||||
if (included.indexOf('!') >= 0) {
|
if (included.indexOf('!') >= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var reason = (inverseGraph[included]||[]).filter(function(mod) {
|
var reason = (inverseGraph[included] || []).filter(function (mod) {
|
||||||
return !!includedMap[mod];
|
return !!includedMap[mod];
|
||||||
});
|
});
|
||||||
explanation.push({
|
explanation.push({
|
||||||
@@ -198,10 +303,67 @@ gulp.task('analyze-editor-distro', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function filterStream(testFunc) {
|
function filterStream(testFunc) {
|
||||||
return es.through(function(data) {
|
return es.through(function (data) {
|
||||||
if (!testFunc(data.relative)) {
|
if (!testFunc(data.relative)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//#region monaco type checking
|
||||||
|
|
||||||
|
function createTscCompileTask(watch) {
|
||||||
|
return () => {
|
||||||
|
const createReporter = require('./lib/reporter').createReporter;
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const args = ['./node_modules/.bin/tsc', '-p', './src/tsconfig.monaco.json', '--noEmit'];
|
||||||
|
if (watch) {
|
||||||
|
args.push('-w');
|
||||||
|
}
|
||||||
|
const child = cp.spawn(`node`, args, {
|
||||||
|
cwd: path.join(__dirname, '..'),
|
||||||
|
// stdio: [null, 'pipe', 'inherit']
|
||||||
|
});
|
||||||
|
let errors = [];
|
||||||
|
let reporter = createReporter();
|
||||||
|
let report;
|
||||||
|
let magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings
|
||||||
|
|
||||||
|
child.stdout.on('data', data => {
|
||||||
|
let str = String(data);
|
||||||
|
str = str.replace(magic, '').trim();
|
||||||
|
if (str.indexOf('Starting compilation') >= 0 || str.indexOf('File change detected') >= 0) {
|
||||||
|
errors.length = 0;
|
||||||
|
report = reporter.end(false);
|
||||||
|
|
||||||
|
} else if (str.indexOf('Compilation complete') >= 0) {
|
||||||
|
report.end();
|
||||||
|
|
||||||
|
} else if (str) {
|
||||||
|
let match = /(.*\(\d+,\d+\): )(.*: )(.*)/.exec(str);
|
||||||
|
if (match) {
|
||||||
|
// trying to massage the message so that it matches the gulp-tsb error messages
|
||||||
|
// e.g. src/vs/base/common/strings.ts(663,5): error TS2322: Type '1234' is not assignable to type 'string'.
|
||||||
|
let fullpath = path.join(root, match[1]);
|
||||||
|
let message = match[3];
|
||||||
|
// @ts-ignore
|
||||||
|
reporter(fullpath + message);
|
||||||
|
} else {
|
||||||
|
// @ts-ignore
|
||||||
|
reporter(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
child.on('exit', resolve);
|
||||||
|
child.on('error', reject);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
gulp.task('monaco-typecheck-watch', createTscCompileTask(true));
|
||||||
|
gulp.task('monaco-typecheck', createTscCompileTask(false));
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const sourcemaps = require('gulp-sourcemaps');
|
|||||||
const nlsDev = require('vscode-nls-dev');
|
const nlsDev = require('vscode-nls-dev');
|
||||||
const root = path.dirname(__dirname);
|
const root = path.dirname(__dirname);
|
||||||
const commit = util.getVersion(root);
|
const commit = util.getVersion(root);
|
||||||
|
const plumber = require('gulp-plumber');
|
||||||
|
|
||||||
const extensionsPath = path.join(path.dirname(__dirname), 'extensions');
|
const extensionsPath = path.join(path.dirname(__dirname), 'extensions');
|
||||||
|
|
||||||
@@ -29,7 +30,6 @@ const compilations = glob.sync('**/tsconfig.json', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const getBaseUrl = out => `https://ticino.blob.core.windows.net/sourcemaps/${commit}/${out}`;
|
const getBaseUrl = out => `https://ticino.blob.core.windows.net/sourcemaps/${commit}/${out}`;
|
||||||
const languages = ['chs', 'cht', 'jpn', 'kor', 'deu', 'fra', 'esn', 'rus', 'ita'];
|
|
||||||
|
|
||||||
const tasks = compilations.map(function (tsconfigFile) {
|
const tasks = compilations.map(function (tsconfigFile) {
|
||||||
const absolutePath = path.join(extensionsPath, tsconfigFile);
|
const absolutePath = path.join(extensionsPath, tsconfigFile);
|
||||||
@@ -55,19 +55,37 @@ const tasks = compilations.map(function (tsconfigFile) {
|
|||||||
const srcBase = path.join(root, 'src');
|
const srcBase = path.join(root, 'src');
|
||||||
const src = path.join(srcBase, '**');
|
const src = path.join(srcBase, '**');
|
||||||
const out = path.join(root, 'out');
|
const out = path.join(root, 'out');
|
||||||
const i18n = path.join(__dirname, '..', 'i18n');
|
|
||||||
const baseUrl = getBaseUrl(out);
|
const baseUrl = getBaseUrl(out);
|
||||||
|
|
||||||
|
let headerId, headerOut;
|
||||||
|
let index = relativeDirname.indexOf('/');
|
||||||
|
if (index < 0) {
|
||||||
|
headerId = 'vscode.' + relativeDirname;
|
||||||
|
headerOut = 'out';
|
||||||
|
} else {
|
||||||
|
headerId = 'vscode.' + relativeDirname.substr(0, index);
|
||||||
|
headerOut = relativeDirname.substr(index + 1) + '/out';
|
||||||
|
}
|
||||||
|
|
||||||
function createPipeline(build, emitError) {
|
function createPipeline(build, emitError) {
|
||||||
const reporter = createReporter();
|
const reporter = createReporter();
|
||||||
|
|
||||||
tsOptions.inlineSources = !!build;
|
tsOptions.inlineSources = !!build;
|
||||||
|
tsOptions.base = path.dirname(absolutePath);
|
||||||
|
|
||||||
const compilation = tsb.create(tsOptions, null, null, err => reporter(err.toString()));
|
const compilation = tsb.create(tsOptions, null, null, err => reporter(err.toString()));
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
const input = es.through();
|
const input = es.through();
|
||||||
const tsFilter = filter(['**/*.ts', '!**/lib/lib*.d.ts', '!**/node_modules/**'], { restore: true });
|
const tsFilter = filter(['**/*.ts', '!**/lib/lib*.d.ts', '!**/node_modules/**'], { restore: true });
|
||||||
const output = input
|
const output = input
|
||||||
|
.pipe(plumber({
|
||||||
|
errorHandler: function (err) {
|
||||||
|
if (err && !err.__reporter__) {
|
||||||
|
reporter(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))
|
||||||
.pipe(tsFilter)
|
.pipe(tsFilter)
|
||||||
.pipe(util.loadSourcemaps())
|
.pipe(util.loadSourcemaps())
|
||||||
.pipe(compilation())
|
.pipe(compilation())
|
||||||
@@ -80,7 +98,9 @@ const tasks = compilations.map(function (tsconfigFile) {
|
|||||||
sourceRoot: '../src'
|
sourceRoot: '../src'
|
||||||
}))
|
}))
|
||||||
.pipe(tsFilter.restore)
|
.pipe(tsFilter.restore)
|
||||||
.pipe(build ? nlsDev.createAdditionalLanguageFiles(languages, i18n, out) : es.through())
|
.pipe(build ? nlsDev.bundleMetaDataFiles(headerId, headerOut) : es.through())
|
||||||
|
// Filter out *.nls.json file. We needed them only to bundle meta data file.
|
||||||
|
.pipe(filter(['**', '!**/*.nls.json']))
|
||||||
.pipe(reporter.end(emitError));
|
.pipe(reporter.end(emitError));
|
||||||
|
|
||||||
return es.duplex(input, output);
|
return es.duplex(input, output);
|
||||||
@@ -127,7 +147,7 @@ const tasks = compilations.map(function (tsconfigFile) {
|
|||||||
const watchInput = watcher(src, srcOpts);
|
const watchInput = watcher(src, srcOpts);
|
||||||
|
|
||||||
return watchInput
|
return watchInput
|
||||||
.pipe(util.incremental(() => pipeline(true), input))
|
.pipe(util.incremental(() => pipeline(), input))
|
||||||
.pipe(gulp.dest(out));
|
.pipe(gulp.dest(out));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ const gulptslint = require('gulp-tslint');
|
|||||||
const gulpeslint = require('gulp-eslint');
|
const gulpeslint = require('gulp-eslint');
|
||||||
const tsfmt = require('typescript-formatter');
|
const tsfmt = require('typescript-formatter');
|
||||||
const tslint = require('tslint');
|
const tslint = require('tslint');
|
||||||
|
const VinylFile = require('vinyl');
|
||||||
const vfs = require('vinyl-fs');
|
const vfs = require('vinyl-fs');
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
const pall = require('p-all');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hygiene works by creating cascading subsets of all our files and
|
* Hygiene works by creating cascading subsets of all our files and
|
||||||
@@ -29,53 +33,58 @@ const all = [
|
|||||||
'extensions/**/*',
|
'extensions/**/*',
|
||||||
'scripts/**/*',
|
'scripts/**/*',
|
||||||
'src/**/*',
|
'src/**/*',
|
||||||
'test/**/*'
|
'test/**/*',
|
||||||
];
|
'!**/node_modules/**'
|
||||||
|
|
||||||
const eolFilter = [
|
|
||||||
'**',
|
|
||||||
'!ThirdPartyNotices.txt',
|
|
||||||
'!LICENSE.txt',
|
|
||||||
'!extensions/**/out/**',
|
|
||||||
'!**/node_modules/**',
|
|
||||||
'!**/fixtures/**',
|
|
||||||
'!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot}',
|
|
||||||
'!build/{lib,tslintRules}/**/*.js',
|
|
||||||
'!build/monaco/**',
|
|
||||||
'!build/win32/**',
|
|
||||||
'!build/**/*.sh',
|
|
||||||
'!build/tfs/**/*.js',
|
|
||||||
'!**/Dockerfile'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const indentationFilter = [
|
const indentationFilter = [
|
||||||
'**',
|
'**',
|
||||||
|
|
||||||
|
// except specific files
|
||||||
'!ThirdPartyNotices.txt',
|
'!ThirdPartyNotices.txt',
|
||||||
'!**/*.md',
|
'!LICENSE.txt',
|
||||||
'!**/*.ps1',
|
'!src/vs/nls.js',
|
||||||
'!**/*.template',
|
'!src/vs/css.js',
|
||||||
'!**/*.yaml',
|
'!src/vs/loader.js',
|
||||||
'!**/*.yml',
|
'!src/vs/base/common/marked/marked.js',
|
||||||
'!**/lib/**',
|
'!src/vs/base/common/winjs.base.js',
|
||||||
'!extensions/**/*.d.ts',
|
'!src/vs/base/node/terminateProcess.sh',
|
||||||
'!src/typings/**/*.d.ts',
|
'!src/vs/base/node/cpuUsage.sh',
|
||||||
'!src/vs/*/**/*.d.ts',
|
|
||||||
'!**/*.d.ts.recipe',
|
|
||||||
'!test/assert.js',
|
'!test/assert.js',
|
||||||
|
|
||||||
|
// except specific folders
|
||||||
|
'!test/smoke/out/**',
|
||||||
|
'!extensions/vscode-api-tests/testWorkspace/**',
|
||||||
|
'!extensions/vscode-api-tests/testWorkspace2/**',
|
||||||
|
'!build/monaco/**',
|
||||||
|
'!build/win32/**',
|
||||||
|
|
||||||
|
// except multiple specific files
|
||||||
'!**/package.json',
|
'!**/package.json',
|
||||||
'!**/npm-shrinkwrap.json',
|
'!**/yarn.lock',
|
||||||
|
'!**/yarn-error.log',
|
||||||
|
|
||||||
|
// except multiple specific folders
|
||||||
'!**/octicons/**',
|
'!**/octicons/**',
|
||||||
'!**/vs/base/common/marked/raw.marked.js',
|
'!**/fixtures/**',
|
||||||
'!**/vs/base/common/winjs.base.raw.js',
|
'!**/lib/**',
|
||||||
'!**/vs/base/node/terminateProcess.sh',
|
'!extensions/**/out/**',
|
||||||
'!**/vs/nls.js',
|
|
||||||
'!**/vs/css.js',
|
|
||||||
'!**/vs/loader.js',
|
|
||||||
'!extensions/**/snippets/**',
|
'!extensions/**/snippets/**',
|
||||||
'!extensions/**/syntaxes/**',
|
'!extensions/**/syntaxes/**',
|
||||||
'!extensions/**/themes/**',
|
'!extensions/**/themes/**',
|
||||||
'!extensions/**/colorize-fixtures/**',
|
'!extensions/**/colorize-fixtures/**',
|
||||||
'!extensions/vscode-api-tests/testWorkspace/**'
|
|
||||||
|
// except specific file types
|
||||||
|
'!src/vs/*/**/*.d.ts',
|
||||||
|
'!src/typings/**/*.d.ts',
|
||||||
|
'!extensions/**/*.d.ts',
|
||||||
|
'!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot,md,ps1,template,yaml,yml,d.ts.recipe}',
|
||||||
|
'!build/{lib,tslintRules}/**/*.js',
|
||||||
|
'!build/**/*.sh',
|
||||||
|
'!build/tfs/**/*.js',
|
||||||
|
'!build/tfs/**/*.config',
|
||||||
|
'!**/Dockerfile',
|
||||||
|
'!extensions/markdown-language-features/media/*.js'
|
||||||
];
|
];
|
||||||
|
|
||||||
const copyrightFilter = [
|
const copyrightFilter = [
|
||||||
@@ -93,11 +102,14 @@ const copyrightFilter = [
|
|||||||
'!**/*.xpm',
|
'!**/*.xpm',
|
||||||
'!**/*.opts',
|
'!**/*.opts',
|
||||||
'!**/*.disabled',
|
'!**/*.disabled',
|
||||||
|
'!**/*.code-workspace',
|
||||||
'!build/**/*.init',
|
'!build/**/*.init',
|
||||||
'!resources/linux/snap/snapcraft.yaml',
|
'!resources/linux/snap/snapcraft.yaml',
|
||||||
|
'!resources/linux/snap/electron-launch',
|
||||||
'!resources/win32/bin/code.js',
|
'!resources/win32/bin/code.js',
|
||||||
'!extensions/markdown/media/tomorrow.css',
|
'!extensions/markdown-language-features/media/highlight.css',
|
||||||
'!extensions/html/server/src/modes/typescript/*'
|
'!extensions/html-language-features/server/src/modes/typescript/*',
|
||||||
|
'!extensions/*/server/bin/*'
|
||||||
];
|
];
|
||||||
|
|
||||||
const eslintFilter = [
|
const eslintFilter = [
|
||||||
@@ -108,8 +120,8 @@ const eslintFilter = [
|
|||||||
'!src/vs/nls.js',
|
'!src/vs/nls.js',
|
||||||
'!src/vs/css.build.js',
|
'!src/vs/css.build.js',
|
||||||
'!src/vs/nls.build.js',
|
'!src/vs/nls.build.js',
|
||||||
'!src/**/winjs.base.raw.js',
|
'!src/**/winjs.base.js',
|
||||||
'!src/**/raw.marked.js',
|
'!src/**/marked.js',
|
||||||
'!**/test/**'
|
'!**/test/**'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -122,26 +134,18 @@ const tslintFilter = [
|
|||||||
'!**/node_modules/**',
|
'!**/node_modules/**',
|
||||||
'!extensions/typescript/test/colorize-fixtures/**',
|
'!extensions/typescript/test/colorize-fixtures/**',
|
||||||
'!extensions/vscode-api-tests/testWorkspace/**',
|
'!extensions/vscode-api-tests/testWorkspace/**',
|
||||||
'!extensions/**/*.test.ts'
|
'!extensions/vscode-api-tests/testWorkspace2/**',
|
||||||
|
'!extensions/**/*.test.ts',
|
||||||
|
'!extensions/html-language-features/server/lib/jquery.d.ts'
|
||||||
];
|
];
|
||||||
|
|
||||||
const copyrightHeader = [
|
// {{SQL CARBON EDIT}}
|
||||||
|
const copyrightHeaderLines = [
|
||||||
'/*---------------------------------------------------------------------------------------------',
|
'/*---------------------------------------------------------------------------------------------',
|
||||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||||
' * Licensed under the Source EULA. See License.txt in the project root for license information.',
|
' * Licensed under the Source EULA. See License.txt in the project root for license information.',
|
||||||
' *--------------------------------------------------------------------------------------------*/'
|
' *--------------------------------------------------------------------------------------------*/'
|
||||||
].join('\n');
|
];
|
||||||
|
|
||||||
function reportFailures(failures) {
|
|
||||||
failures.forEach(failure => {
|
|
||||||
const name = failure.name || failure.fileName;
|
|
||||||
const position = failure.startPosition;
|
|
||||||
const line = position.lineAndCharacter ? position.lineAndCharacter.line : position.line;
|
|
||||||
const character = position.lineAndCharacter ? position.lineAndCharacter.character : position.character;
|
|
||||||
|
|
||||||
console.error(`${name}:${line + 1}:${character + 1}:${failure.failure}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task('eslint', () => {
|
gulp.task('eslint', () => {
|
||||||
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
||||||
@@ -152,31 +156,23 @@ gulp.task('eslint', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('tslint', () => {
|
gulp.task('tslint', () => {
|
||||||
const options = { summarizeFailureOutput: true };
|
// {{SQL CARBON EDIT}}
|
||||||
|
const options = { emitError: false };
|
||||||
|
|
||||||
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
||||||
.pipe(filter(tslintFilter))
|
.pipe(filter(tslintFilter))
|
||||||
.pipe(gulptslint({ rulesDirectory: 'build/lib/tslint' }))
|
.pipe(gulptslint.default({ rulesDirectory: 'build/lib/tslint' }))
|
||||||
.pipe(gulptslint.report(reportFailures, options));
|
.pipe(gulptslint.default.report(options));
|
||||||
});
|
});
|
||||||
|
|
||||||
const hygiene = exports.hygiene = (some, options) => {
|
function hygiene(some) {
|
||||||
options = options || {};
|
|
||||||
let errorCount = 0;
|
let errorCount = 0;
|
||||||
|
|
||||||
const eol = es.through(function (file) {
|
|
||||||
if (/\r\n?/g.test(file.contents.toString('utf8'))) {
|
|
||||||
console.error(file.relative + ': Bad EOL found');
|
|
||||||
errorCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.emit('data', file);
|
|
||||||
});
|
|
||||||
|
|
||||||
const indentation = es.through(function (file) {
|
const indentation = es.through(function (file) {
|
||||||
file.contents
|
const lines = file.contents.toString('utf8').split(/\r\n|\r|\n/);
|
||||||
.toString('utf8')
|
file.__lines = lines;
|
||||||
.split(/\r\n|\r|\n/)
|
|
||||||
|
lines
|
||||||
.forEach((line, i) => {
|
.forEach((line, i) => {
|
||||||
if (/^\s*$/.test(line)) {
|
if (/^\s*$/.test(line)) {
|
||||||
// empty or whitespace lines are OK
|
// empty or whitespace lines are OK
|
||||||
@@ -194,9 +190,14 @@ const hygiene = exports.hygiene = (some, options) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const copyrights = es.through(function (file) {
|
const copyrights = es.through(function (file) {
|
||||||
if (file.contents.toString('utf8').indexOf(copyrightHeader) !== 0) {
|
const lines = file.__lines;
|
||||||
console.error(file.relative + ': Missing or bad copyright statement');
|
|
||||||
errorCount++;
|
for (let i = 0; i < copyrightHeaderLines.length; i++) {
|
||||||
|
if (lines[i] !== copyrightHeaderLines[i]) {
|
||||||
|
console.error(file.relative + ': Missing or bad copyright statement');
|
||||||
|
errorCount++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.emit('data', file);
|
this.emit('data', file);
|
||||||
@@ -204,12 +205,25 @@ const hygiene = exports.hygiene = (some, options) => {
|
|||||||
|
|
||||||
const formatting = es.map(function (file, cb) {
|
const formatting = es.map(function (file, cb) {
|
||||||
tsfmt.processString(file.path, file.contents.toString('utf8'), {
|
tsfmt.processString(file.path, file.contents.toString('utf8'), {
|
||||||
verify: true,
|
verify: false,
|
||||||
tsfmt: true,
|
tsfmt: true,
|
||||||
// verbose: true
|
// verbose: true,
|
||||||
|
// keep checkJS happy
|
||||||
|
editorconfig: undefined,
|
||||||
|
replace: undefined,
|
||||||
|
tsconfig: undefined,
|
||||||
|
tsconfigFile: undefined,
|
||||||
|
tslint: undefined,
|
||||||
|
tslintFile: undefined,
|
||||||
|
tsfmtFile: undefined,
|
||||||
|
vscode: undefined,
|
||||||
|
vscodeFile: undefined
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
if (result.error) {
|
let original = result.src.replace(/\r\n/gm, '\n');
|
||||||
console.error(result.message);
|
let formatted = result.dest.replace(/\r\n/gm, '\n');
|
||||||
|
|
||||||
|
if (original !== formatted) {
|
||||||
|
console.error('File not formatted:', file.relative);
|
||||||
errorCount++;
|
errorCount++;
|
||||||
}
|
}
|
||||||
cb(null, file);
|
cb(null, file);
|
||||||
@@ -219,32 +233,31 @@ const hygiene = exports.hygiene = (some, options) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const tslintConfiguration = tslint.Configuration.findConfiguration('tslint.json', '.');
|
||||||
|
const tslintOptions = { fix: false, formatter: 'json' };
|
||||||
|
const tsLinter = new tslint.Linter(tslintOptions);
|
||||||
|
|
||||||
const tsl = es.through(function (file) {
|
const tsl = es.through(function (file) {
|
||||||
const configuration = tslint.Configuration.findConfiguration(null, '.');
|
|
||||||
const options = { formatter: 'json', rulesDirectory: 'build/lib/tslint' };
|
|
||||||
const contents = file.contents.toString('utf8');
|
const contents = file.contents.toString('utf8');
|
||||||
const linter = new tslint.Linter(options);
|
tsLinter.lint(file.relative, contents, tslintConfiguration.results);
|
||||||
linter.lint(file.relative, contents, configuration.results);
|
|
||||||
const result = linter.getResult();
|
|
||||||
|
|
||||||
if (result.failureCount > 0) {
|
|
||||||
reportFailures(result.failures);
|
|
||||||
errorCount += result.failureCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.emit('data', file);
|
this.emit('data', file);
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = vfs.src(some || all, { base: '.', follow: true, allowEmpty: true })
|
let input;
|
||||||
|
|
||||||
|
if (Array.isArray(some) || typeof some === 'string' || !some) {
|
||||||
|
input = vfs.src(some || all, { base: '.', follow: true, allowEmpty: true });
|
||||||
|
} else {
|
||||||
|
input = some;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = input
|
||||||
.pipe(filter(f => !f.stat.isDirectory()))
|
.pipe(filter(f => !f.stat.isDirectory()))
|
||||||
.pipe(filter(eolFilter))
|
|
||||||
// {{SQL CARBON EDIT}}
|
|
||||||
//.pipe(options.skipEOL ? es.through() : eol)
|
|
||||||
.pipe(filter(indentationFilter))
|
.pipe(filter(indentationFilter))
|
||||||
.pipe(indentation)
|
.pipe(indentation)
|
||||||
.pipe(filter(copyrightFilter))
|
.pipe(filter(copyrightFilter));
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
//.pipe(copyrights);
|
// .pipe(copyrights);
|
||||||
|
|
||||||
const typescript = result
|
const typescript = result
|
||||||
.pipe(filter(tslintFilter))
|
.pipe(filter(tslintFilter))
|
||||||
@@ -255,22 +268,51 @@ const hygiene = exports.hygiene = (some, options) => {
|
|||||||
.pipe(filter(eslintFilter))
|
.pipe(filter(eslintFilter))
|
||||||
.pipe(gulpeslint('src/.eslintrc'))
|
.pipe(gulpeslint('src/.eslintrc'))
|
||||||
.pipe(gulpeslint.formatEach('compact'));
|
.pipe(gulpeslint.formatEach('compact'));
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
// .pipe(gulpeslint.failAfterError());
|
// .pipe(gulpeslint.failAfterError());
|
||||||
|
|
||||||
|
let count = 0;
|
||||||
return es.merge(typescript, javascript)
|
return es.merge(typescript, javascript)
|
||||||
.pipe(es.through(null, function () {
|
.pipe(es.through(function (data) {
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
// if (errorCount > 0) {
|
this.emit('end');
|
||||||
// this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.');
|
|
||||||
// } else {
|
|
||||||
// this.emit('end');
|
|
||||||
// }
|
|
||||||
this.emit('end');
|
|
||||||
}));
|
}));
|
||||||
};
|
}
|
||||||
|
|
||||||
gulp.task('hygiene', () => hygiene(''));
|
function createGitIndexVinyls(paths) {
|
||||||
|
const cp = require('child_process');
|
||||||
|
const repositoryPath = process.cwd();
|
||||||
|
|
||||||
|
const fns = paths.map(relativePath => () => new Promise((c, e) => {
|
||||||
|
const fullPath = path.join(repositoryPath, relativePath);
|
||||||
|
|
||||||
|
fs.stat(fullPath, (err, stat) => {
|
||||||
|
if (err && err.code === 'ENOENT') { // ignore deletions
|
||||||
|
return c(null);
|
||||||
|
} else if (err) {
|
||||||
|
return e(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
cp.exec(`git show :${relativePath}`, { maxBuffer: 2000 * 1024, encoding: 'buffer' }, (err, out) => {
|
||||||
|
if (err) {
|
||||||
|
return e(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
c(new VinylFile({
|
||||||
|
path: fullPath,
|
||||||
|
base: repositoryPath,
|
||||||
|
contents: out,
|
||||||
|
stat
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
|
return pall(fns, { concurrency: 4 })
|
||||||
|
.then(r => r.filter(p => !!p));
|
||||||
|
}
|
||||||
|
|
||||||
|
gulp.task('hygiene', () => hygiene());
|
||||||
|
|
||||||
// this allows us to run hygiene as a git pre-commit hook
|
// this allows us to run hygiene as a git pre-commit hook
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
@@ -281,33 +323,38 @@ if (require.main === module) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
cp.exec('git config core.autocrlf', (err, out) => {
|
if (process.argv.length > 2) {
|
||||||
const skipEOL = out.trim() === 'true';
|
hygiene(process.argv.slice(2)).on('error', err => {
|
||||||
|
console.error();
|
||||||
if (process.argv.length > 2) {
|
console.error(err);
|
||||||
return hygiene(process.argv.slice(2), { skipEOL: skipEOL }).on('error', err => {
|
process.exit(1);
|
||||||
console.error();
|
});
|
||||||
console.error(err);
|
} else {
|
||||||
process.exit(1);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
cp.exec('git diff --cached --name-only', { maxBuffer: 2000 * 1024 }, (err, out) => {
|
cp.exec('git diff --cached --name-only', { maxBuffer: 2000 * 1024 }, (err, out) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error();
|
console.error();
|
||||||
console.error(err);
|
console.error(err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const some = out
|
const some = out
|
||||||
.split(/\r?\n/)
|
.split(/\r?\n/)
|
||||||
.filter(l => !!l);
|
.filter(l => !!l);
|
||||||
|
|
||||||
hygiene(some, { skipEOL: skipEOL }).on('error', err => {
|
if (some.length > 0) {
|
||||||
console.error();
|
console.log('Reading git index versions...');
|
||||||
console.error(err);
|
|
||||||
process.exit(1);
|
createGitIndexVinyls(some)
|
||||||
});
|
.then(vinyls => new Promise((c, e) => hygiene(es.readArray(vinyls))
|
||||||
|
.on('end', () => c())
|
||||||
|
.on('error', e)))
|
||||||
|
.catch(err => {
|
||||||
|
console.error();
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,13 +14,17 @@ const util = require('./lib/util');
|
|||||||
const remote = require('gulp-remote-src');
|
const remote = require('gulp-remote-src');
|
||||||
const zip = require('gulp-vinyl-zip');
|
const zip = require('gulp-vinyl-zip');
|
||||||
const assign = require('object-assign');
|
const assign = require('object-assign');
|
||||||
|
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
const jeditor = require('gulp-json-editor');
|
||||||
|
|
||||||
const pkg = require('../package.json');
|
const pkg = require('../package.json');
|
||||||
|
|
||||||
gulp.task('mixin', function () {
|
gulp.task('mixin', function () {
|
||||||
const repo = process.env['VSCODE_MIXIN_REPO'];
|
// {{SQL CARBON EDIT}}
|
||||||
|
const updateUrl = process.env['SQLOPS_UPDATEURL'];
|
||||||
if (!repo) {
|
if (!updateUrl) {
|
||||||
console.log('Missing VSCODE_MIXIN_REPO, skipping mixin');
|
console.log('Missing SQLOPS_UPDATEURL, skipping mixin');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,39 +35,20 @@ gulp.task('mixin', function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `https://github.com/${repo}/archive/${pkg.distro}.zip`;
|
// {{SQL CARBON EDIT}}
|
||||||
const opts = { base: url };
|
let serviceUrl = 'https://sqlopsextensions.blob.core.windows.net/marketplace/v1/extensionsGallery.json';
|
||||||
const username = process.env['VSCODE_MIXIN_USERNAME'];
|
if (quality === 'insider') {
|
||||||
const password = process.env['VSCODE_MIXIN_PASSWORD'];
|
serviceUrl = `https://sqlopsextensions.blob.core.windows.net/marketplace/v1/extensionsGallery-${quality}.json`;
|
||||||
|
|
||||||
if (username || password) {
|
|
||||||
opts.auth = { user: username || '', pass: password || '' };
|
|
||||||
}
|
}
|
||||||
|
let newValues = {
|
||||||
|
"updateUrl": updateUrl,
|
||||||
|
"quality": quality,
|
||||||
|
"extensionsGallery": {
|
||||||
|
"serviceUrl": serviceUrl
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
console.log('Mixing in sources from \'' + url + '\':');
|
return gulp.src('./product.json')
|
||||||
|
.pipe(jeditor(newValues))
|
||||||
let all = remote('', opts)
|
|
||||||
.pipe(zip.src())
|
|
||||||
.pipe(filter(function (f) { return !f.isDirectory(); }))
|
|
||||||
.pipe(util.rebase(1));
|
|
||||||
|
|
||||||
if (quality) {
|
|
||||||
const productJsonFilter = filter('product.json', { restore: true });
|
|
||||||
const mixin = all
|
|
||||||
.pipe(filter(['quality/' + quality + '/**']))
|
|
||||||
.pipe(util.rebase(2))
|
|
||||||
.pipe(productJsonFilter)
|
|
||||||
.pipe(buffer())
|
|
||||||
.pipe(json(o => assign({}, require('../product.json'), o)))
|
|
||||||
.pipe(productJsonFilter.restore);
|
|
||||||
|
|
||||||
all = es.merge(mixin);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all
|
|
||||||
.pipe(es.mapSync(function (f) {
|
|
||||||
console.log(f.relative);
|
|
||||||
return f;
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest('.'));
|
.pipe(gulp.dest('.'));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,18 +13,6 @@ const filter = require('gulp-filter');
|
|||||||
|
|
||||||
gulp.task('clean-mssql-extension', util.rimraf('extensions/mssql/node_modules'));
|
gulp.task('clean-mssql-extension', util.rimraf('extensions/mssql/node_modules'));
|
||||||
gulp.task('clean-credentials-extension', util.rimraf('extensions/credentials/node_modules'));
|
gulp.task('clean-credentials-extension', util.rimraf('extensions/credentials/node_modules'));
|
||||||
gulp.task('clean-client', util.rimraf('dataprotocol-node/client/node_modules'));
|
|
||||||
gulp.task('clean-jsonrpc', util.rimraf('dataprotocol-node/jsonrpc/node_modules'));
|
|
||||||
gulp.task('clean-server', util.rimraf('dataprotocol-node/server/node_modules'));
|
|
||||||
gulp.task('clean-types', util.rimraf('dataprotocol-node/types/node_modules'));
|
|
||||||
gulp.task('clean-extensions-modules', util.rimraf('extensions-modules/node_modules'));
|
|
||||||
gulp.task('clean-protocol', ['clean-extensions-modules', 'clean-mssql-extension', 'clean-credentials-extension', 'clean-client', 'clean-jsonrpc', 'clean-server', 'clean-types']);
|
|
||||||
|
|
||||||
// Tasks to clean extensions modules
|
|
||||||
gulp.task('clean-mssql-ext-mod', util.rimraf('extensions/mssql/node_modules/extensions-modules'));
|
|
||||||
gulp.task('clean-credentials-ext-mod', util.rimraf('extensions/credentials/node_modules/extensions-modules'));
|
|
||||||
gulp.task('clean-build-ext-mod', util.rimraf('build/node_modules/extensions-modules'));
|
|
||||||
gulp.task('clean-ext-mod', ['clean-mssql-ext-mod', 'clean-credentials-ext-mod', 'clean-build-ext-mod', 'clean-extensions-modules']);
|
|
||||||
|
|
||||||
gulp.task('fmt', () => formatStagedFiles());
|
gulp.task('fmt', () => formatStagedFiles());
|
||||||
const formatFiles = (some) => {
|
const formatFiles = (some) => {
|
||||||
|
|||||||
@@ -17,30 +17,32 @@ const vfs = require('vinyl-fs');
|
|||||||
const rename = require('gulp-rename');
|
const rename = require('gulp-rename');
|
||||||
const replace = require('gulp-replace');
|
const replace = require('gulp-replace');
|
||||||
const filter = require('gulp-filter');
|
const filter = require('gulp-filter');
|
||||||
const buffer = require('gulp-buffer');
|
|
||||||
const json = require('gulp-json-editor');
|
const json = require('gulp-json-editor');
|
||||||
const _ = require('underscore');
|
const _ = require('underscore');
|
||||||
const util = require('./lib/util');
|
const util = require('./lib/util');
|
||||||
const ext = require('./lib/extensions');
|
const ext = require('./lib/extensions');
|
||||||
const buildfile = require('../src/buildfile');
|
const buildfile = require('../src/buildfile');
|
||||||
const common = require('./lib/optimize');
|
const common = require('./lib/optimize');
|
||||||
const nlsDev = require('vscode-nls-dev');
|
|
||||||
const root = path.dirname(__dirname);
|
const root = path.dirname(__dirname);
|
||||||
const commit = util.getVersion(root);
|
const commit = util.getVersion(root);
|
||||||
const packageJson = require('../package.json');
|
const packageJson = require('../package.json');
|
||||||
const product = require('../product.json');
|
const product = require('../product.json');
|
||||||
const shrinkwrap = require('../npm-shrinkwrap.json');
|
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const i18n = require('./lib/i18n');
|
const i18n = require('./lib/i18n');
|
||||||
var del = require('del');
|
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const serviceInstaller = require('extensions-modules/lib/languageservice/serviceInstallerUtil');
|
const serviceDownloader = require('service-downloader').ServiceDownloadProvider;
|
||||||
|
const platformInfo = require('service-downloader/out/platform').PlatformInformation;
|
||||||
const glob = require('glob');
|
const glob = require('glob');
|
||||||
|
const deps = require('./dependencies');
|
||||||
|
const getElectronVersion = require('./lib/electron').getElectronVersion;
|
||||||
|
const createAsar = require('./lib/asar').createAsar;
|
||||||
|
|
||||||
const productDependencies = Object.keys(product.dependencies || {});
|
const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname));
|
||||||
const dependencies = Object.keys(shrinkwrap.dependencies)
|
// @ts-ignore
|
||||||
.concat(productDependencies); // additional dependencies from our product configuration
|
// {{SQL CARBON EDIT}}
|
||||||
|
var del = require('del');
|
||||||
|
const extensionsRoot = path.join(root, 'extensions');
|
||||||
|
const extensionsProductionDependencies = deps.getProductionDependencies(extensionsRoot);
|
||||||
const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n));
|
const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n));
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const nodeModules = [
|
const nodeModules = [
|
||||||
@@ -50,21 +52,32 @@ const nodeModules = [
|
|||||||
'rxjs/Subject',
|
'rxjs/Subject',
|
||||||
'rxjs/Observer',
|
'rxjs/Observer',
|
||||||
'ng2-charts/ng2-charts']
|
'ng2-charts/ng2-charts']
|
||||||
.concat(dependencies)
|
.concat(Object.keys(product.dependencies || {}))
|
||||||
|
.concat(_.uniq(productionDependencies.map(d => d.name)))
|
||||||
.concat(baseModules);
|
.concat(baseModules);
|
||||||
|
|
||||||
// Build
|
|
||||||
|
|
||||||
const builtInExtensions = [
|
// Build
|
||||||
{ name: 'ms-vscode.node-debug', version: '1.18.3' },
|
const builtInExtensions = require('./builtInExtensions.json');
|
||||||
{ name: 'ms-vscode.node-debug2', version: '1.18.5' }
|
|
||||||
];
|
|
||||||
|
|
||||||
const excludedExtensions = [
|
const excludedExtensions = [
|
||||||
'vscode-api-tests',
|
'vscode-api-tests',
|
||||||
'vscode-colorize-tests'
|
'vscode-colorize-tests',
|
||||||
|
'ms-vscode.node-debug',
|
||||||
|
'ms-vscode.node-debug2',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
const vsce = require('vsce');
|
||||||
|
const sqlBuiltInExtensions = [
|
||||||
|
// Add SQL built-in extensions here.
|
||||||
|
// the extension will be excluded from SQLOps package and will have separate vsix packages
|
||||||
|
'agent',
|
||||||
|
'import',
|
||||||
|
'profiler'
|
||||||
|
];
|
||||||
|
var azureExtensions = [ 'azurecore'];
|
||||||
|
|
||||||
const vscodeEntryPoints = _.flatten([
|
const vscodeEntryPoints = _.flatten([
|
||||||
buildfile.entrypoint('vs/workbench/workbench.main'),
|
buildfile.entrypoint('vs/workbench/workbench.main'),
|
||||||
buildfile.base,
|
buildfile.base,
|
||||||
@@ -75,26 +88,28 @@ const vscodeEntryPoints = _.flatten([
|
|||||||
const vscodeResources = [
|
const vscodeResources = [
|
||||||
'out-build/main.js',
|
'out-build/main.js',
|
||||||
'out-build/cli.js',
|
'out-build/cli.js',
|
||||||
|
'out-build/driver.js',
|
||||||
'out-build/bootstrap.js',
|
'out-build/bootstrap.js',
|
||||||
'out-build/bootstrap-amd.js',
|
'out-build/bootstrap-amd.js',
|
||||||
'out-build/paths.js',
|
'out-build/paths.js',
|
||||||
'out-build/vs/**/*.{svg,png,cur,html}',
|
'out-build/vs/**/*.{svg,png,cur,html}',
|
||||||
'out-build/vs/base/node/startupTimers.js',
|
'out-build/vs/base/common/performance.js',
|
||||||
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh}',
|
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh,cpuUsage.sh}',
|
||||||
'out-build/vs/base/browser/ui/octiconLabel/octicons/**',
|
'out-build/vs/base/browser/ui/octiconLabel/octicons/**',
|
||||||
'out-build/vs/workbench/browser/media/*-theme.css',
|
'out-build/vs/workbench/browser/media/*-theme.css',
|
||||||
'out-build/vs/workbench/electron-browser/bootstrap/**',
|
'out-build/vs/workbench/electron-browser/bootstrap/**',
|
||||||
'out-build/vs/workbench/parts/debug/**/*.json',
|
'out-build/vs/workbench/parts/debug/**/*.json',
|
||||||
'out-build/vs/workbench/parts/execution/**/*.scpt',
|
'out-build/vs/workbench/parts/execution/**/*.scpt',
|
||||||
'out-build/vs/workbench/parts/html/browser/webview-pre.js',
|
'out-build/vs/workbench/parts/webview/electron-browser/webview-pre.js',
|
||||||
'out-build/vs/**/markdown.css',
|
'out-build/vs/**/markdown.css',
|
||||||
'out-build/vs/workbench/parts/tasks/**/*.json',
|
'out-build/vs/workbench/parts/tasks/**/*.json',
|
||||||
'out-build/vs/workbench/parts/terminal/electron-browser/terminalProcess.js',
|
|
||||||
'out-build/vs/workbench/parts/welcome/walkThrough/**/*.md',
|
'out-build/vs/workbench/parts/welcome/walkThrough/**/*.md',
|
||||||
'out-build/vs/workbench/services/files/**/*.exe',
|
'out-build/vs/workbench/services/files/**/*.exe',
|
||||||
'out-build/vs/workbench/services/files/**/*.md',
|
'out-build/vs/workbench/services/files/**/*.md',
|
||||||
'out-build/vs/code/electron-browser/sharedProcess.js',
|
'out-build/vs/code/electron-browser/sharedProcess/sharedProcess.js',
|
||||||
// {{SQL CARBON EDIT}}
|
'out-build/vs/code/electron-browser/issue/issueReporter.js',
|
||||||
|
'out-build/vs/code/electron-browser/processExplorer/processExplorer.js',
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
'out-build/sql/workbench/electron-browser/splashscreen/*',
|
'out-build/sql/workbench/electron-browser/splashscreen/*',
|
||||||
'out-build/sql/**/*.{svg,png,cur,html}',
|
'out-build/sql/**/*.{svg,png,cur,html}',
|
||||||
'out-build/sql/base/browser/ui/table/media/*.{gif,png,svg}',
|
'out-build/sql/base/browser/ui/table/media/*.{gif,png,svg}',
|
||||||
@@ -111,6 +126,7 @@ const vscodeResources = [
|
|||||||
'out-build/sql/parts/grid/views/**/*.html',
|
'out-build/sql/parts/grid/views/**/*.html',
|
||||||
'out-build/sql/parts/tasks/**/*.html',
|
'out-build/sql/parts/tasks/**/*.html',
|
||||||
'out-build/sql/parts/taskHistory/viewlet/media/**',
|
'out-build/sql/parts/taskHistory/viewlet/media/**',
|
||||||
|
'out-build/sql/parts/jobManagement/common/media/*.svg',
|
||||||
'out-build/sql/media/objectTypes/*.svg',
|
'out-build/sql/media/objectTypes/*.svg',
|
||||||
'out-build/sql/media/icons/*.svg',
|
'out-build/sql/media/icons/*.svg',
|
||||||
'!**/test/**'
|
'!**/test/**'
|
||||||
@@ -122,20 +138,16 @@ const BUNDLED_FILE_HEADER = [
|
|||||||
' *--------------------------------------------------------*/'
|
' *--------------------------------------------------------*/'
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
var languages = ['chs', 'cht', 'jpn', 'kor', 'deu', 'fra', 'esn', 'rus', 'ita'];
|
|
||||||
if (process.env.VSCODE_QUALITY !== 'stable') {
|
|
||||||
languages = languages.concat(['ptb', 'hun', 'trk']); // Add languages requested by the community to non-stable builds
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task('clean-optimized-vscode', util.rimraf('out-vscode'));
|
gulp.task('clean-optimized-vscode', util.rimraf('out-vscode'));
|
||||||
gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compile-extensions-build'], common.optimizeTask({
|
gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compile-extensions-build'], common.optimizeTask({
|
||||||
|
src: 'out-build',
|
||||||
entryPoints: vscodeEntryPoints,
|
entryPoints: vscodeEntryPoints,
|
||||||
otherSources: [],
|
otherSources: [],
|
||||||
resources: vscodeResources,
|
resources: vscodeResources,
|
||||||
loaderConfig: common.loaderConfig(nodeModules),
|
loaderConfig: common.loaderConfig(nodeModules),
|
||||||
header: BUNDLED_FILE_HEADER,
|
header: BUNDLED_FILE_HEADER,
|
||||||
out: 'out-vscode',
|
out: 'out-vscode',
|
||||||
languages: languages
|
bundleInfo: undefined
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
@@ -151,10 +163,12 @@ gulp.task('clean-minified-vscode', util.rimraf('out-vscode-min'));
|
|||||||
gulp.task('minify-vscode', ['clean-minified-vscode', 'optimize-index-js'], common.minifyTask('out-vscode', baseUrl));
|
gulp.task('minify-vscode', ['clean-minified-vscode', 'optimize-index-js'], common.minifyTask('out-vscode', baseUrl));
|
||||||
|
|
||||||
// Package
|
// Package
|
||||||
|
|
||||||
|
// @ts-ignore JSON checking: darwinCredits is optional
|
||||||
const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
|
const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
version: packageJson.electronVersion,
|
version: getElectronVersion(),
|
||||||
productAppName: product.nameLong,
|
productAppName: product.nameLong,
|
||||||
companyName: 'Microsoft Corporation',
|
companyName: 'Microsoft Corporation',
|
||||||
copyright: 'Copyright (C) 2018 Microsoft. All rights reserved',
|
copyright: 'Copyright (C) 2018 Microsoft. All rights reserved',
|
||||||
@@ -176,10 +190,12 @@ const config = {
|
|||||||
name: product.nameLong,
|
name: product.nameLong,
|
||||||
urlSchemes: [product.urlProtocol]
|
urlSchemes: [product.urlProtocol]
|
||||||
}],
|
}],
|
||||||
darwinCredits: darwinCreditsTemplate ? new Buffer(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : void 0,
|
darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : void 0,
|
||||||
linuxExecutableName: product.applicationName,
|
linuxExecutableName: product.applicationName,
|
||||||
winIcon: 'resources/win32/code.ico',
|
winIcon: 'resources/win32/code.ico',
|
||||||
token: process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || void 0,
|
token: process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || void 0,
|
||||||
|
|
||||||
|
// @ts-ignore JSON checking: electronRepository is optional
|
||||||
repo: product.electronRepository || void 0
|
repo: product.electronRepository || void 0
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -193,7 +209,7 @@ function getElectron(arch) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return gulp.src('package.json')
|
return gulp.src('package.json')
|
||||||
.pipe(json({ name: product.nameShort }))
|
.pipe(json({ name: product.nameShort }))
|
||||||
.pipe(electron(electronOpts))
|
.pipe(electron(electronOpts))
|
||||||
.pipe(filter(['**', '!**/app/package.json']))
|
.pipe(filter(['**', '!**/app/package.json']))
|
||||||
.pipe(vfs.dest('.build/electron'));
|
.pipe(vfs.dest('.build/electron'));
|
||||||
@@ -240,11 +256,66 @@ function computeChecksum(filename) {
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function packageBuiltInExtensions() {
|
||||||
|
const sqlBuiltInLocalExtensionDescriptions = glob.sync('extensions/*/package.json')
|
||||||
|
.map(manifestPath => {
|
||||||
|
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||||
|
const extensionName = path.basename(extensionPath);
|
||||||
|
return { name: extensionName, path: extensionPath };
|
||||||
|
})
|
||||||
|
.filter(({ name }) => excludedExtensions.indexOf(name) === -1)
|
||||||
|
.filter(({ name }) => builtInExtensions.every(b => b.name !== name))
|
||||||
|
.filter(({ name }) => sqlBuiltInExtensions.indexOf(name) >= 0);
|
||||||
|
sqlBuiltInLocalExtensionDescriptions.forEach(element => {
|
||||||
|
const packagePath = path.join(path.dirname(root), element.name + '.vsix');
|
||||||
|
console.info('Creating vsix for ' + element.path + ' result:' + packagePath);
|
||||||
|
vsce.createVSIX({
|
||||||
|
cwd: element.path,
|
||||||
|
packagePath: packagePath,
|
||||||
|
useYarn: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
function packageAzureCoreTask(platform, arch) {
|
||||||
|
var destination = path.join(path.dirname(root), 'azuredatastudio') + (platform ? '-' + platform : '') + (arch ? '-' + arch : '');
|
||||||
|
if (platform === 'darwin') {
|
||||||
|
destination = path.join(destination, 'Azure Data Studio.app', 'Contents', 'Resources', 'app', 'extensions', 'azurecore');
|
||||||
|
} else {
|
||||||
|
destination = path.join(destination, 'resources', 'app', 'extensions', 'azurecore');
|
||||||
|
}
|
||||||
|
|
||||||
|
platform = platform || process.platform;
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
const root = path.resolve(path.join(__dirname, '..'));
|
||||||
|
const localExtensionDescriptions = glob.sync('extensions/*/package.json')
|
||||||
|
.map(manifestPath => {
|
||||||
|
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||||
|
const extensionName = path.basename(extensionPath);
|
||||||
|
return { name: extensionName, path: extensionPath };
|
||||||
|
})
|
||||||
|
.filter(({ name }) => azureExtensions.indexOf(name) > -1);
|
||||||
|
|
||||||
|
const localExtensions = es.merge(...localExtensionDescriptions.map(extension => {
|
||||||
|
return ext.fromLocal(extension.path);
|
||||||
|
}));
|
||||||
|
|
||||||
|
let result = localExtensions
|
||||||
|
.pipe(util.skipDirectories())
|
||||||
|
.pipe(util.fixWin32DirectoryPermissions())
|
||||||
|
.pipe(filter(['**', '!LICENSE', '!LICENSES.chromium.html', '!version']));
|
||||||
|
|
||||||
|
return result.pipe(vfs.dest(destination));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function packageTask(platform, arch, opts) {
|
function packageTask(platform, arch, opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const destination = path.join(path.dirname(root), 'sqlops') + (platform ? '-' + platform : '') + (arch ? '-' + arch : '');
|
const destination = path.join(path.dirname(root), 'azuredatastudio') + (platform ? '-' + platform : '') + (arch ? '-' + arch : '');
|
||||||
platform = platform || process.platform;
|
platform = platform || process.platform;
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
@@ -269,45 +340,54 @@ function packageTask(platform, arch, opts) {
|
|||||||
return { name: extensionName, path: extensionPath };
|
return { name: extensionName, path: extensionPath };
|
||||||
})
|
})
|
||||||
.filter(({ name }) => excludedExtensions.indexOf(name) === -1)
|
.filter(({ name }) => excludedExtensions.indexOf(name) === -1)
|
||||||
.filter(({ name }) => builtInExtensions.every(b => b.name !== name));
|
.filter(({ name }) => builtInExtensions.every(b => b.name !== name))
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
.filter(({ name }) => sqlBuiltInExtensions.indexOf(name) === -1)
|
||||||
|
.filter(({ name }) => azureExtensions.indexOf(name) === -1);
|
||||||
|
|
||||||
|
packageBuiltInExtensions();
|
||||||
|
|
||||||
const localExtensions = es.merge(...localExtensionDescriptions.map(extension => {
|
const localExtensions = es.merge(...localExtensionDescriptions.map(extension => {
|
||||||
const nlsFilter = filter('**/*.nls.json', { restore: true });
|
|
||||||
|
|
||||||
return ext.fromLocal(extension.path)
|
return ext.fromLocal(extension.path)
|
||||||
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`))
|
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
|
||||||
// // TODO@Dirk: this filter / buffer is here to make sure the nls.json files are buffered
|
|
||||||
.pipe(nlsFilter)
|
|
||||||
.pipe(buffer())
|
|
||||||
.pipe(nlsDev.createAdditionalLanguageFiles(languages, path.join(__dirname, '..', 'i18n')))
|
|
||||||
.pipe(nlsFilter.restore);
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const localExtensionDependencies = gulp.src('extensions/node_modules/**', { base: '.' });
|
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
|
const extensionDepsSrc = [
|
||||||
|
..._.flatten(extensionsProductionDependencies.map(d => path.relative(root, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`])),
|
||||||
|
];
|
||||||
|
|
||||||
|
const localExtensionDependencies = gulp.src(extensionDepsSrc, { base: '.', dot: true })
|
||||||
|
.pipe(filter(['**', '!**/package-lock.json']))
|
||||||
|
.pipe(util.cleanNodeModule('account-provider-azure', ['node_modules/date-utils/doc/**', 'node_modules/adal_node/node_modules/**'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('typescript', ['**/**'], undefined));
|
||||||
|
|
||||||
const sources = es.merge(src, localExtensions, localExtensionDependencies)
|
const sources = es.merge(src, localExtensions, localExtensionDependencies)
|
||||||
.pipe(util.setExecutableBit(['**/*.sh']))
|
.pipe(util.setExecutableBit(['**/*.sh']))
|
||||||
.pipe(filter(['**',
|
.pipe(filter(['**', '!**/*.js.map']));
|
||||||
'!**/*.js.map',
|
|
||||||
'!extensions/**/node_modules/**/{test, tests}/**',
|
|
||||||
'!extensions/**/node_modules/**/test.js']));
|
|
||||||
|
|
||||||
let version = packageJson.version;
|
let version = packageJson.version;
|
||||||
|
// @ts-ignore JSON checking: quality is optional
|
||||||
const quality = product.quality;
|
const quality = product.quality;
|
||||||
|
|
||||||
if (quality && quality !== 'stable') {
|
if (quality && quality !== 'stable') {
|
||||||
version += '-' + quality;
|
version += '-' + quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = product.nameShort;
|
// {{SQL CARBON EDIT}}
|
||||||
|
const name = (platform === 'darwin') ? 'Azure Data Studio' : product.nameShort;
|
||||||
const packageJsonStream = gulp.src(['package.json'], { base: '.' })
|
const packageJsonStream = gulp.src(['package.json'], { base: '.' })
|
||||||
.pipe(json({ name, version }));
|
.pipe(json({ name, version }));
|
||||||
|
|
||||||
const settingsSearchBuildId = getBuildNumber();
|
|
||||||
const date = new Date().toISOString();
|
const date = new Date().toISOString();
|
||||||
|
const productJsonUpdate = { commit, date, checksums };
|
||||||
|
|
||||||
|
if (shouldSetupSettingsSearch()) {
|
||||||
|
productJsonUpdate.settingsSearchBuildId = getSettingsSearchBuildId(packageJson);
|
||||||
|
}
|
||||||
|
|
||||||
const productJsonStream = gulp.src(['product.json'], { base: '.' })
|
const productJsonStream = gulp.src(['product.json'], { base: '.' })
|
||||||
.pipe(json({ commit, date, checksums, settingsSearchBuildId }));
|
.pipe(json(productJsonUpdate));
|
||||||
|
|
||||||
const license = gulp.src(['LICENSES.chromium.html', 'LICENSE.txt', 'ThirdPartyNotices.txt', 'licenses/**'], { base: '.' });
|
const license = gulp.src(['LICENSES.chromium.html', 'LICENSE.txt', 'ThirdPartyNotices.txt', 'licenses/**'], { base: '.' });
|
||||||
|
|
||||||
@@ -315,11 +395,14 @@ function packageTask(platform, arch, opts) {
|
|||||||
|
|
||||||
// TODO the API should be copied to `out` during compile, not here
|
// TODO the API should be copied to `out` during compile, not here
|
||||||
const api = gulp.src('src/vs/vscode.d.ts').pipe(rename('out/vs/vscode.d.ts'));
|
const api = gulp.src('src/vs/vscode.d.ts').pipe(rename('out/vs/vscode.d.ts'));
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const dataApi = gulp.src('src/vs/data.d.ts').pipe(rename('out/sql/data.d.ts'));
|
const dataApi = gulp.src('src/vs/data.d.ts').pipe(rename('out/sql/data.d.ts'));
|
||||||
|
|
||||||
const depsSrc = _.flatten(dependencies
|
const depsSrc = [
|
||||||
.map(function (d) { return ['node_modules/' + d + '/**', '!node_modules/' + d + '/**/{test,tests}/**']; }));
|
..._.flatten(productionDependencies.map(d => path.relative(root, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`])),
|
||||||
|
// @ts-ignore JSON checking: dependencies is optional
|
||||||
|
..._.flatten(Object.keys(product.dependencies || {}).map(d => [`node_modules/${d}/**`, `!node_modules/${d}/**/{test,tests}/**`]))
|
||||||
|
];
|
||||||
|
|
||||||
const deps = gulp.src(depsSrc, { base: '.', dot: true })
|
const deps = gulp.src(depsSrc, { base: '.', dot: true })
|
||||||
.pipe(filter(['**', '!**/package-lock.json']))
|
.pipe(filter(['**', '!**/package-lock.json']))
|
||||||
@@ -327,16 +410,36 @@ function packageTask(platform, arch, opts) {
|
|||||||
.pipe(util.cleanNodeModule('oniguruma', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/*.js']))
|
.pipe(util.cleanNodeModule('oniguruma', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/*.js']))
|
||||||
.pipe(util.cleanNodeModule('windows-mutex', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('windows-mutex', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('native-keymap', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('native-keymap', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node']))
|
||||||
|
.pipe(util.cleanNodeModule('native-is-elevated', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('native-watchdog', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('native-watchdog', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||||
|
.pipe(util.cleanNodeModule('spdlog', ['binding.gyp', 'build/**', 'deps/**', 'src/**', 'test/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('jschardet', ['dist/**']))
|
.pipe(util.cleanNodeModule('jschardet', ['dist/**']))
|
||||||
.pipe(util.cleanNodeModule('windows-foreground-love', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('windows-foreground-love', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('windows-process-tree', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('windows-process-tree', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('gc-signals', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/index.js']))
|
.pipe(util.cleanNodeModule('gc-signals', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/index.js']))
|
||||||
.pipe(util.cleanNodeModule('v8-profiler', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/index.js']))
|
|
||||||
.pipe(util.cleanNodeModule('keytar', ['binding.gyp', 'build/**', 'src/**', 'script/**', 'node_modules/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('keytar', ['binding.gyp', 'build/**', 'src/**', 'script/**', 'node_modules/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('node-pty', ['binding.gyp', 'build/**', 'src/**', 'tools/**'], ['build/Release/**']))
|
.pipe(util.cleanNodeModule('node-pty', ['binding.gyp', 'build/**', 'src/**', 'tools/**'], ['build/Release/*.exe', 'build/Release/*.dll', 'build/Release/*.node']))
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
.pipe(util.cleanNodeModule('chart.js', ['node_modules/**'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('emmet', ['node_modules/**'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('pty.js', ['build/**'], ['build/Release/**']))
|
||||||
|
.pipe(util.cleanNodeModule('jquery-ui', ['external/**', 'demos/**'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('core-js', ['**/**'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('slickgrid', ['node_modules/**', 'examples/**'], undefined))
|
||||||
.pipe(util.cleanNodeModule('nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a']))
|
.pipe(util.cleanNodeModule('nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a']))
|
||||||
.pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node']));
|
.pipe(util.cleanNodeModule('vscode-nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a']))
|
||||||
|
.pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node']))
|
||||||
|
.pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*'], 'app/node_modules.asar'));
|
||||||
|
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
let copiedModules = gulp.src([
|
||||||
|
'node_modules/jquery/**/*.*',
|
||||||
|
'node_modules/reflect-metadata/**/*.*',
|
||||||
|
'node_modules/slickgrid/**/*.*',
|
||||||
|
'node_modules/underscore/**/*.*',
|
||||||
|
'node_modules/zone.js/**/*.*',
|
||||||
|
'node_modules/chart.js/**/*.*'
|
||||||
|
], { base: '.', dot: true });
|
||||||
|
|
||||||
let all = es.merge(
|
let all = es.merge(
|
||||||
packageJsonStream,
|
packageJsonStream,
|
||||||
@@ -344,7 +447,8 @@ function packageTask(platform, arch, opts) {
|
|||||||
license,
|
license,
|
||||||
watermark,
|
watermark,
|
||||||
api,
|
api,
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
|
copiedModules,
|
||||||
dataApi,
|
dataApi,
|
||||||
sources,
|
sources,
|
||||||
deps
|
deps
|
||||||
@@ -393,18 +497,22 @@ function packageTask(platform, arch, opts) {
|
|||||||
const buildRoot = path.dirname(root);
|
const buildRoot = path.dirname(root);
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
gulp.task('clean-vscode-win32-ia32', util.rimraf(path.join(buildRoot, 'sqlops-win32-ia32')));
|
gulp.task('vscode-win32-x64-azurecore', ['optimize-vscode'], packageAzureCoreTask('win32', 'x64'));
|
||||||
gulp.task('clean-vscode-win32-x64', util.rimraf(path.join(buildRoot, 'sqlops-win32-x64')));
|
gulp.task('vscode-darwin-azurecore', ['optimize-vscode'], packageAzureCoreTask('darwin'));
|
||||||
gulp.task('clean-vscode-darwin', util.rimraf(path.join(buildRoot, 'sqlops-darwin')));
|
gulp.task('vscode-linux-x64-azurecore', ['optimize-vscode'], packageAzureCoreTask('linux', 'x64'));
|
||||||
gulp.task('clean-vscode-linux-ia32', util.rimraf(path.join(buildRoot, 'sqlops-linux-ia32')));
|
|
||||||
gulp.task('clean-vscode-linux-x64', util.rimraf(path.join(buildRoot, 'sqlops-linux-x64')));
|
gulp.task('clean-vscode-win32-ia32', util.rimraf(path.join(buildRoot, 'azuredatastudio-win32-ia32')));
|
||||||
gulp.task('clean-vscode-linux-arm', util.rimraf(path.join(buildRoot, 'sqlops-linux-arm')));
|
gulp.task('clean-vscode-win32-x64', util.rimraf(path.join(buildRoot, 'azuredatastudio-win32-x64')));
|
||||||
|
gulp.task('clean-vscode-darwin', util.rimraf(path.join(buildRoot, 'azuredatastudio-darwin')));
|
||||||
|
gulp.task('clean-vscode-linux-ia32', util.rimraf(path.join(buildRoot, 'azuredatastudio-linux-ia32')));
|
||||||
|
gulp.task('clean-vscode-linux-x64', util.rimraf(path.join(buildRoot, 'azuredatastudio-linux-x64')));
|
||||||
|
gulp.task('clean-vscode-linux-arm', util.rimraf(path.join(buildRoot, 'azuredatastudio-linux-arm')));
|
||||||
|
|
||||||
gulp.task('vscode-win32-ia32', ['optimize-vscode', 'clean-vscode-win32-ia32'], packageTask('win32', 'ia32'));
|
gulp.task('vscode-win32-ia32', ['optimize-vscode', 'clean-vscode-win32-ia32'], packageTask('win32', 'ia32'));
|
||||||
gulp.task('vscode-win32-x64', ['optimize-vscode', 'clean-vscode-win32-x64'], packageTask('win32', 'x64'));
|
gulp.task('vscode-win32-x64', ['vscode-win32-x64-azurecore', 'optimize-vscode', 'clean-vscode-win32-x64'], packageTask('win32', 'x64'));
|
||||||
gulp.task('vscode-darwin', ['optimize-vscode', 'clean-vscode-darwin'], packageTask('darwin'));
|
gulp.task('vscode-darwin', ['vscode-darwin-azurecore', 'optimize-vscode', 'clean-vscode-darwin'], packageTask('darwin'));
|
||||||
gulp.task('vscode-linux-ia32', ['optimize-vscode', 'clean-vscode-linux-ia32'], packageTask('linux', 'ia32'));
|
gulp.task('vscode-linux-ia32', ['optimize-vscode', 'clean-vscode-linux-ia32'], packageTask('linux', 'ia32'));
|
||||||
gulp.task('vscode-linux-x64', ['optimize-vscode', 'clean-vscode-linux-x64'], packageTask('linux', 'x64'));
|
gulp.task('vscode-linux-x64', ['vscode-linux-x64-azurecore', 'optimize-vscode', 'clean-vscode-linux-x64'], packageTask('linux', 'x64'));
|
||||||
gulp.task('vscode-linux-arm', ['optimize-vscode', 'clean-vscode-linux-arm'], packageTask('linux', 'arm'));
|
gulp.task('vscode-linux-arm', ['optimize-vscode', 'clean-vscode-linux-arm'], packageTask('linux', 'arm'));
|
||||||
|
|
||||||
gulp.task('vscode-win32-ia32-min', ['minify-vscode', 'clean-vscode-win32-ia32'], packageTask('win32', 'ia32', { minified: true }));
|
gulp.task('vscode-win32-ia32-min', ['minify-vscode', 'clean-vscode-win32-ia32'], packageTask('win32', 'ia32', { minified: true }));
|
||||||
@@ -415,25 +523,21 @@ gulp.task('vscode-linux-x64-min', ['minify-vscode', 'clean-vscode-linux-x64'], p
|
|||||||
gulp.task('vscode-linux-arm-min', ['minify-vscode', 'clean-vscode-linux-arm'], packageTask('linux', 'arm', { minified: true }));
|
gulp.task('vscode-linux-arm-min', ['minify-vscode', 'clean-vscode-linux-arm'], packageTask('linux', 'arm', { minified: true }));
|
||||||
|
|
||||||
// Transifex Localizations
|
// Transifex Localizations
|
||||||
const vscodeLanguages = [
|
|
||||||
'zh-hans',
|
const innoSetupConfig = {
|
||||||
'zh-hant',
|
'zh-cn': { codePage: 'CP936', defaultInfo: { name: 'Simplified Chinese', id: '$0804', } },
|
||||||
'ja',
|
'zh-tw': { codePage: 'CP950', defaultInfo: { name: 'Traditional Chinese', id: '$0404' } },
|
||||||
'ko',
|
'ko': { codePage: 'CP949', defaultInfo: { name: 'Korean', id: '$0412' } },
|
||||||
'de',
|
'ja': { codePage: 'CP932' },
|
||||||
'fr',
|
'de': { codePage: 'CP1252' },
|
||||||
'es',
|
'fr': { codePage: 'CP1252' },
|
||||||
'ru',
|
'es': { codePage: 'CP1252' },
|
||||||
'it',
|
'ru': { codePage: 'CP1251' },
|
||||||
'pt-br',
|
'it': { codePage: 'CP1252' },
|
||||||
'hu',
|
'pt-br': { codePage: 'CP1252' },
|
||||||
'tr'
|
'hu': { codePage: 'CP1250' },
|
||||||
];
|
'tr': { codePage: 'CP1254' }
|
||||||
const setupDefaultLanguages = [
|
};
|
||||||
'zh-hans',
|
|
||||||
'zh-hant',
|
|
||||||
'ko'
|
|
||||||
];
|
|
||||||
|
|
||||||
const apiHostname = process.env.TRANSIFEX_API_URL;
|
const apiHostname = process.env.TRANSIFEX_API_URL;
|
||||||
const apiName = process.env.TRANSIFEX_API_NAME;
|
const apiName = process.env.TRANSIFEX_API_NAME;
|
||||||
@@ -441,27 +545,52 @@ const apiToken = process.env.TRANSIFEX_API_TOKEN;
|
|||||||
|
|
||||||
gulp.task('vscode-translations-push', ['optimize-vscode'], function () {
|
gulp.task('vscode-translations-push', ['optimize-vscode'], function () {
|
||||||
const pathToMetadata = './out-vscode/nls.metadata.json';
|
const pathToMetadata = './out-vscode/nls.metadata.json';
|
||||||
const pathToExtensions = './extensions/**/*.nls.json';
|
const pathToExtensions = './extensions/*';
|
||||||
const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}';
|
const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}';
|
||||||
|
|
||||||
return es.merge(
|
return es.merge(
|
||||||
gulp.src(pathToMetadata).pipe(i18n.prepareXlfFiles()),
|
gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()),
|
||||||
gulp.src(pathToSetup).pipe(i18n.prepareXlfFiles()),
|
gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),
|
||||||
gulp.src(pathToExtensions).pipe(i18n.prepareXlfFiles('vscode-extensions'))
|
gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())
|
||||||
|
).pipe(i18n.findObsoleteResources(apiHostname, apiName, apiToken)
|
||||||
).pipe(i18n.pushXlfFiles(apiHostname, apiName, apiToken));
|
).pipe(i18n.pushXlfFiles(apiHostname, apiName, apiToken));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('vscode-translations-pull', function () {
|
gulp.task('vscode-translations-push-test', ['optimize-vscode'], function () {
|
||||||
|
const pathToMetadata = './out-vscode/nls.metadata.json';
|
||||||
|
const pathToExtensions = './extensions/*';
|
||||||
|
const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}';
|
||||||
|
|
||||||
return es.merge(
|
return es.merge(
|
||||||
i18n.pullXlfFiles('vscode-editor', apiHostname, apiName, apiToken, vscodeLanguages),
|
gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()),
|
||||||
i18n.pullXlfFiles('vscode-workbench', apiHostname, apiName, apiToken, vscodeLanguages),
|
gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),
|
||||||
i18n.pullXlfFiles('vscode-extensions', apiHostname, apiName, apiToken, vscodeLanguages),
|
gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())
|
||||||
i18n.pullXlfFiles('vscode-setup', apiHostname, apiName, apiToken, setupDefaultLanguages)
|
// {{SQL CARBON EDIT}}
|
||||||
).pipe(vfs.dest('../vscode-localization'));
|
// disable since function makes calls to VS Code Transifex API
|
||||||
|
// ).pipe(i18n.findObsoleteResources(apiHostname, apiName, apiToken)
|
||||||
|
).pipe(vfs.dest('../vscode-transifex-input'));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('vscode-translations-pull', function () {
|
||||||
|
[...i18n.defaultLanguages, ...i18n.extraLanguages].forEach(language => {
|
||||||
|
i18n.pullCoreAndExtensionsXlfFiles(apiHostname, apiName, apiToken, language).pipe(vfs.dest(`../vscode-localization/${language.id}/build`));
|
||||||
|
|
||||||
|
let includeDefault = !!innoSetupConfig[language.id].defaultInfo;
|
||||||
|
i18n.pullSetupXlfFiles(apiHostname, apiName, apiToken, language, includeDefault).pipe(vfs.dest(`../vscode-localization/${language.id}/setup`));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('vscode-translations-import', function () {
|
gulp.task('vscode-translations-import', function () {
|
||||||
return gulp.src('../vscode-localization/**/*.xlf').pipe(i18n.prepareJsonFiles()).pipe(vfs.dest('./i18n'));
|
[...i18n.defaultLanguages, ...i18n.extraLanguages].forEach(language => {
|
||||||
|
gulp.src(`../vscode-localization/${language.id}/build/*/*.xlf`)
|
||||||
|
.pipe(i18n.prepareI18nFiles())
|
||||||
|
.pipe(vfs.dest(`./i18n/${language.folderName}`));
|
||||||
|
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
// gulp.src(`../vscode-localization/${language.id}/setup/*/*.xlf`)
|
||||||
|
// .pipe(i18n.prepareIslFiles(language, innoSetupConfig[language.id]))
|
||||||
|
// .pipe(vfs.dest(`./build/win32/i18n`));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sourcemaps
|
// Sourcemaps
|
||||||
@@ -486,21 +615,19 @@ gulp.task('upload-vscode-sourcemaps', ['minify-vscode'], () => {
|
|||||||
|
|
||||||
const allConfigDetailsPath = path.join(os.tmpdir(), 'configuration.json');
|
const allConfigDetailsPath = path.join(os.tmpdir(), 'configuration.json');
|
||||||
gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () => {
|
gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () => {
|
||||||
const branch = process.env.BUILD_SOURCEBRANCH;
|
if (!shouldSetupSettingsSearch()) {
|
||||||
if (!branch.endsWith('/master') && !branch.indexOf('/release/') >= 0) {
|
const branch = process.env.BUILD_SOURCEBRANCH;
|
||||||
console.log(`Only runs on master and release branches, not ${branch}`);
|
console.log(`Only runs on master and release branches, not ${branch}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fs.existsSync(allConfigDetailsPath)) {
|
if (!fs.existsSync(allConfigDetailsPath)) {
|
||||||
console.error(`configuration file at ${allConfigDetailsPath} does not exist`);
|
throw new Error(`configuration file at ${allConfigDetailsPath} does not exist`);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const settingsSearchBuildId = getBuildNumber();
|
const settingsSearchBuildId = getSettingsSearchBuildId(packageJson);
|
||||||
if (!settingsSearchBuildId) {
|
if (!settingsSearchBuildId) {
|
||||||
console.error('Failed to compute build number');
|
throw new Error('Failed to compute build number');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return gulp.src(allConfigDetailsPath)
|
return gulp.src(allConfigDetailsPath)
|
||||||
@@ -512,76 +639,30 @@ gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () =
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
function getBuildNumber() {
|
function shouldSetupSettingsSearch() {
|
||||||
const previous = getPreviousVersion(packageJson.version);
|
const branch = process.env.BUILD_SOURCEBRANCH;
|
||||||
if (!previous) {
|
return branch && (/\/master$/.test(branch) || branch.indexOf('/release/') >= 0);
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
function getSettingsSearchBuildId(packageJson) {
|
||||||
try {
|
try {
|
||||||
const out = cp.execSync(`git rev-list ${previous}..HEAD --count`);
|
const branch = process.env.BUILD_SOURCEBRANCH;
|
||||||
|
const branchId = branch.indexOf('/release/') >= 0 ? 0 :
|
||||||
|
/\/master$/.test(branch) ? 1 :
|
||||||
|
2; // Some unexpected branch
|
||||||
|
|
||||||
|
const out = cp.execSync(`git rev-list HEAD --count`);
|
||||||
const count = parseInt(out.toString());
|
const count = parseInt(out.toString());
|
||||||
return versionStringToNumber(packageJson.version) * 1e4 + count;
|
|
||||||
|
// <version number><commit count><branchId (avoid unlikely conflicts)>
|
||||||
|
// 1.25.1, 1,234,567 commits, master = 1250112345671
|
||||||
|
return util.versionStringToNumber(packageJson.version) * 1e8 + count * 10 + branchId;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Could not determine build number: ' + e.toString());
|
throw new Error('Could not determine build number: ' + e.toString());
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// This task is only run for the MacOS build
|
||||||
* Given 1.17.2, return 1.17.1
|
|
||||||
* 1.18.0 => 1.17.2.
|
|
||||||
* 2.0.0 => 1.18.0 (or the highest 1.x)
|
|
||||||
*/
|
|
||||||
function getPreviousVersion(versionStr) {
|
|
||||||
function tagExists(tagName) {
|
|
||||||
try {
|
|
||||||
cp.execSync(`git rev-parse ${tagName}`, { stdio: 'ignore' });
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLastTagFromBase(semverArr, componentToTest) {
|
|
||||||
const baseVersion = semverArr.join('.');
|
|
||||||
if (!tagExists(baseVersion)) {
|
|
||||||
console.error('Failed to find tag for base version, ' + baseVersion);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let goodTag;
|
|
||||||
do {
|
|
||||||
goodTag = semverArr.join('.');
|
|
||||||
semverArr[componentToTest]++;
|
|
||||||
} while (tagExists(semverArr.join('.')));
|
|
||||||
|
|
||||||
return goodTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
const semverArr = versionStr.split('.');
|
|
||||||
if (semverArr[2] > 0) {
|
|
||||||
semverArr[2]--;
|
|
||||||
return semverArr.join('.');
|
|
||||||
} else if (semverArr[1] > 0) {
|
|
||||||
semverArr[1]--;
|
|
||||||
return getLastTagFromBase(semverArr, 2);
|
|
||||||
} else {
|
|
||||||
semverArr[0]--;
|
|
||||||
return getLastTagFromBase(semverArr, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function versionStringToNumber(versionStr) {
|
|
||||||
const semverRegex = /(\d+)\.(\d+)\.(\d+)/;
|
|
||||||
const match = versionStr.match(semverRegex);
|
|
||||||
if (!match) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parseInt(match[1], 10) * 1e4 + parseInt(match[2], 10) * 1e2 + parseInt(match[3], 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task('generate-vscode-configuration', () => {
|
gulp.task('generate-vscode-configuration', () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const buildDir = process.env['AGENT_BUILDDIRECTORY'];
|
const buildDir = process.env['AGENT_BUILDDIRECTORY'];
|
||||||
@@ -589,9 +670,14 @@ gulp.task('generate-vscode-configuration', () => {
|
|||||||
return reject(new Error('$AGENT_BUILDDIRECTORY not set'));
|
return reject(new Error('$AGENT_BUILDDIRECTORY not set'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.env.VSCODE_QUALITY !== 'insider' && process.env.VSCODE_QUALITY !== 'stable') {
|
||||||
|
return resolve();
|
||||||
|
}
|
||||||
|
|
||||||
const userDataDir = path.join(os.tmpdir(), 'tmpuserdata');
|
const userDataDir = path.join(os.tmpdir(), 'tmpuserdata');
|
||||||
const extensionsDir = path.join(os.tmpdir(), 'tmpextdir');
|
const extensionsDir = path.join(os.tmpdir(), 'tmpextdir');
|
||||||
const appPath = path.join(buildDir, 'VSCode-darwin/Visual\\ Studio\\ Code\\ -\\ Insiders.app/Contents/Resources/app/bin/code');
|
const appName = process.env.VSCODE_QUALITY === 'insider' ? 'Visual\\ Studio\\ Code\\ -\\ Insiders.app' : 'Visual\\ Studio\\ Code.app';
|
||||||
|
const appPath = path.join(buildDir, `VSCode-darwin/${appName}/Contents/Resources/app/bin/code`);
|
||||||
const codeProc = cp.exec(`${appPath} --export-default-configuration='${allConfigDetailsPath}' --wait --user-data-dir='${userDataDir}' --extensions-dir='${extensionsDir}'`);
|
const codeProc = cp.exec(`${appPath} --export-default-configuration='${allConfigDetailsPath}' --wait --user-data-dir='${userDataDir}' --extensions-dir='${extensionsDir}'`);
|
||||||
|
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
@@ -611,36 +697,31 @@ gulp.task('generate-vscode-configuration', () => {
|
|||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
}).catch(e => {
|
|
||||||
// Don't fail the build
|
|
||||||
console.error(e.toString());
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
// Install service locally before building carbon
|
// Install service locally before building carbon
|
||||||
|
|
||||||
function installService(extObj, path) {
|
function installService() {
|
||||||
var installer = new serviceInstaller.ServiceInstaller(extObj, path);
|
let config = require('../extensions/mssql/src/config.json');
|
||||||
installer.getServiceInstallDirectoryRoot().then(serviceInstallFolder => {
|
return platformInfo.getCurrent().then(p => {
|
||||||
console.log('Cleaning up the install folder: ' + serviceInstallFolder);
|
let runtime = p.runtimeId;
|
||||||
del(serviceInstallFolder + '/*').then(() => {
|
// fix path since it won't be correct
|
||||||
console.log('Installing the service. Install folder: ' + serviceInstallFolder);
|
config.installDirectory = path.join(__dirname, '../extensions/mssql/src', config.installDirectory);
|
||||||
installer.installService();
|
var installer = new serviceDownloader(config);
|
||||||
}, delError => {
|
let serviceInstallFolder = installer.getInstallDirectory(runtime);
|
||||||
console.log('failed to delete the install folder error: ' + delError);
|
console.log('Cleaning up the install folder: ' + serviceInstallFolder);
|
||||||
});
|
return del(serviceInstallFolder + '/*').then(() => {
|
||||||
}, getFolderPathError => {
|
console.log('Installing the service. Install folder: ' + serviceInstallFolder);
|
||||||
console.log('failed to call getServiceInstallDirectoryRoot error: ' + getFolderPathError);
|
return installer.installService(runtime);
|
||||||
|
}, delError => {
|
||||||
|
console.log('failed to delete the install folder error: ' + delError);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('install-sqltoolsservice', () => {
|
gulp.task('install-sqltoolsservice', () => {
|
||||||
var mssqlExt = require('../extensions/mssql/client/out/models/constants');
|
return installService();
|
||||||
var extObj = new mssqlExt.Constants();
|
|
||||||
var path = '../extensions/mssql/client/out/config.json';
|
|
||||||
return installService(extObj, path);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,40 +14,17 @@ const vfs = require('vinyl-fs');
|
|||||||
const util = require('./lib/util');
|
const util = require('./lib/util');
|
||||||
const packageJson = require('../package.json');
|
const packageJson = require('../package.json');
|
||||||
const product = require('../product.json');
|
const product = require('../product.json');
|
||||||
const rpmDependencies = require('../resources/linux/rpm/dependencies');
|
const rpmDependencies = require('../resources/linux/rpm/dependencies.json');
|
||||||
|
|
||||||
const linuxPackageRevision = Math.floor(new Date().getTime() / 1000);
|
const linuxPackageRevision = Math.floor(new Date().getTime() / 1000);
|
||||||
|
|
||||||
const flatpakManifest = {
|
|
||||||
appId: product.darwinBundleIdentifier, // We need a reverse-url style identifier.
|
|
||||||
sdk: 'org.freedesktop.Sdk',
|
|
||||||
runtime: 'org.freedesktop.Sdk',
|
|
||||||
runtimeVersion: '1.4',
|
|
||||||
base: 'io.atom.electron.BaseApp',
|
|
||||||
baseFlatpakref: 'https://s3-us-west-2.amazonaws.com/electron-flatpak.endlessm.com/electron-base-app-master.flatpakref',
|
|
||||||
command: product.applicationName,
|
|
||||||
symlinks: [
|
|
||||||
['/share/' + product.applicationName + '/bin/' + product.applicationName, '/bin/' + product.applicationName],
|
|
||||||
],
|
|
||||||
finishArgs: [
|
|
||||||
'--share=ipc', '--socket=x11', // Allow showing X11 windows.
|
|
||||||
'--share=network', // Network access (e.g. for installing extension).
|
|
||||||
'--filesystem=host', // Allow access to the whole file system.
|
|
||||||
'--device=dri', // Allow OpenGL rendering.
|
|
||||||
'--filesystem=/tmp', // Needed for Chromium's single instance check.
|
|
||||||
'--socket=pulseaudio', // Some extensions may want to play sounds...
|
|
||||||
'--talk-name=org.freedesktop.Notifications', // ...or pop up notifications.
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function getDebPackageArch(arch) {
|
function getDebPackageArch(arch) {
|
||||||
return { x64: 'amd64', ia32: 'i386', arm: 'armhf' }[arch];
|
return { x64: 'amd64', ia32: 'i386', arm: 'armhf' }[arch];
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareDebPackage(arch) {
|
function prepareDebPackage(arch) {
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const binaryDir = '../sqlops-linux-' + arch;
|
const binaryDir = '../azuredatastudio-linux-' + arch;
|
||||||
const debArch = getDebPackageArch(arch);
|
const debArch = getDebPackageArch(arch);
|
||||||
const destination = '.build/linux/deb/' + debArch + '/' + product.applicationName + '-' + debArch;
|
const destination = '.build/linux/deb/' + debArch + '/' + product.applicationName + '-' + debArch;
|
||||||
|
|
||||||
@@ -96,7 +73,9 @@ function prepareDebPackage(arch) {
|
|||||||
const postinst = gulp.src('resources/linux/debian/postinst.template', { base: '.' })
|
const postinst = gulp.src('resources/linux/debian/postinst.template', { base: '.' })
|
||||||
.pipe(replace('@@NAME@@', product.applicationName))
|
.pipe(replace('@@NAME@@', product.applicationName))
|
||||||
.pipe(replace('@@ARCHITECTURE@@', debArch))
|
.pipe(replace('@@ARCHITECTURE@@', debArch))
|
||||||
|
// @ts-ignore JSON checking: quality is optional
|
||||||
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
|
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
|
||||||
|
// @ts-ignore JSON checking: updateUrl is optional
|
||||||
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
|
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
|
||||||
.pipe(rename('DEBIAN/postinst'));
|
.pipe(rename('DEBIAN/postinst'));
|
||||||
|
|
||||||
@@ -111,8 +90,7 @@ function buildDebPackage(arch) {
|
|||||||
return shell.task([
|
return shell.task([
|
||||||
'chmod 755 ' + product.applicationName + '-' + debArch + '/DEBIAN/postinst ' + product.applicationName + '-' + debArch + '/DEBIAN/prerm ' + product.applicationName + '-' + debArch + '/DEBIAN/postrm',
|
'chmod 755 ' + product.applicationName + '-' + debArch + '/DEBIAN/postinst ' + product.applicationName + '-' + debArch + '/DEBIAN/prerm ' + product.applicationName + '-' + debArch + '/DEBIAN/postrm',
|
||||||
'mkdir -p deb',
|
'mkdir -p deb',
|
||||||
'fakeroot dpkg-deb -b ' + product.applicationName + '-' + debArch + ' deb',
|
'fakeroot dpkg-deb -b ' + product.applicationName + '-' + debArch + ' deb'
|
||||||
'dpkg-scanpackages deb /dev/null > Packages'
|
|
||||||
], { cwd: '.build/linux/deb/' + debArch });
|
], { cwd: '.build/linux/deb/' + debArch });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +104,7 @@ function getRpmPackageArch(arch) {
|
|||||||
|
|
||||||
function prepareRpmPackage(arch) {
|
function prepareRpmPackage(arch) {
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const binaryDir = '../sqlops-linux-' + arch;
|
const binaryDir = '../azuredatastudio-linux-' + arch;
|
||||||
const rpmArch = getRpmPackageArch(arch);
|
const rpmArch = getRpmPackageArch(arch);
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
@@ -156,7 +134,9 @@ function prepareRpmPackage(arch) {
|
|||||||
.pipe(replace('@@RELEASE@@', linuxPackageRevision))
|
.pipe(replace('@@RELEASE@@', linuxPackageRevision))
|
||||||
.pipe(replace('@@ARCHITECTURE@@', rpmArch))
|
.pipe(replace('@@ARCHITECTURE@@', rpmArch))
|
||||||
.pipe(replace('@@LICENSE@@', product.licenseName))
|
.pipe(replace('@@LICENSE@@', product.licenseName))
|
||||||
|
// @ts-ignore JSON checking: quality is optional
|
||||||
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
|
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
|
||||||
|
// @ts-ignore JSON checking: updateUrl is optional
|
||||||
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
|
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
|
||||||
.pipe(replace('@@DEPENDENCIES@@', rpmDependencies[rpmArch].join(', ')))
|
.pipe(replace('@@DEPENDENCIES@@', rpmDependencies[rpmArch].join(', ')))
|
||||||
.pipe(rename('SPECS/' + product.applicationName + '.spec'));
|
.pipe(rename('SPECS/' + product.applicationName + '.spec'));
|
||||||
@@ -220,10 +200,10 @@ function prepareSnapPackage(arch) {
|
|||||||
|
|
||||||
function buildSnapPackage(arch) {
|
function buildSnapPackage(arch) {
|
||||||
const snapBuildPath = getSnapBuildPath(arch);
|
const snapBuildPath = getSnapBuildPath(arch);
|
||||||
|
const snapFilename = `${product.applicationName}-${packageJson.version}-${linuxPackageRevision}-${arch}.snap`;
|
||||||
return shell.task([
|
return shell.task([
|
||||||
`chmod +x ${snapBuildPath}/electron-launch`,
|
`chmod +x ${snapBuildPath}/electron-launch`,
|
||||||
`cd ${snapBuildPath} && snapcraft snap`
|
`cd ${snapBuildPath} && snapcraft snap --output ../${snapFilename}`
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +213,7 @@ function getFlatpakArch(arch) {
|
|||||||
|
|
||||||
function prepareFlatpak(arch) {
|
function prepareFlatpak(arch) {
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const binaryDir = '../sqlops-linux-' + arch;
|
const binaryDir = '../azuredatastudio-linux-' + arch;
|
||||||
const flatpakArch = getFlatpakArch(arch);
|
const flatpakArch = getFlatpakArch(arch);
|
||||||
const destination = '.build/linux/flatpak/' + flatpakArch;
|
const destination = '.build/linux/flatpak/' + flatpakArch;
|
||||||
|
|
||||||
@@ -334,10 +314,3 @@ gulp.task('vscode-linux-arm-prepare-snap', ['clean-vscode-linux-arm-snap'], prep
|
|||||||
gulp.task('vscode-linux-ia32-build-snap', ['vscode-linux-ia32-prepare-snap'], buildSnapPackage('ia32'));
|
gulp.task('vscode-linux-ia32-build-snap', ['vscode-linux-ia32-prepare-snap'], buildSnapPackage('ia32'));
|
||||||
gulp.task('vscode-linux-x64-build-snap', ['vscode-linux-x64-prepare-snap'], buildSnapPackage('x64'));
|
gulp.task('vscode-linux-x64-build-snap', ['vscode-linux-x64-prepare-snap'], buildSnapPackage('x64'));
|
||||||
gulp.task('vscode-linux-arm-build-snap', ['vscode-linux-arm-prepare-snap'], buildSnapPackage('arm'));
|
gulp.task('vscode-linux-arm-build-snap', ['vscode-linux-arm-prepare-snap'], buildSnapPackage('arm'));
|
||||||
|
|
||||||
gulp.task('vscode-linux-ia32-prepare-flatpak', ['clean-vscode-linux-ia32-flatpak'], prepareFlatpak('ia32'));
|
|
||||||
gulp.task('vscode-linux-x64-prepare-flatpak', ['clean-vscode-linux-x64-flatpak'], prepareFlatpak('x64'));
|
|
||||||
gulp.task('vscode-linux-arm-prepare-flatpak', ['clean-vscode-linux-arm-flatpak'], prepareFlatpak('arm'));
|
|
||||||
gulp.task('vscode-linux-ia32-flatpak', ['vscode-linux-ia32-prepare-flatpak'], buildFlatpak('ia32'));
|
|
||||||
gulp.task('vscode-linux-x64-flatpak', ['vscode-linux-x64-prepare-flatpak'], buildFlatpak('x64'));
|
|
||||||
gulp.task('vscode-linux-arm-flatpak', ['vscode-linux-arm-prepare-flatpak'], buildFlatpak('arm'));
|
|
||||||
|
|||||||
@@ -7,42 +7,71 @@
|
|||||||
|
|
||||||
const gulp = require('gulp');
|
const gulp = require('gulp');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const _7z = require('7zip')['7z'];
|
const _7z = require('7zip')['7z'];
|
||||||
const util = require('./lib/util');
|
const util = require('./lib/util');
|
||||||
const pkg = require('../package.json');
|
const pkg = require('../package.json');
|
||||||
const product = require('../product.json');
|
const product = require('../product.json');
|
||||||
|
const vfs = require('vinyl-fs');
|
||||||
|
const mkdirp = require('mkdirp');
|
||||||
|
|
||||||
const repoPath = path.dirname(__dirname);
|
const repoPath = path.dirname(__dirname);
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const buildPath = arch => path.join(path.dirname(repoPath), `sqlops-win32-${arch}`);
|
const buildPath = arch => path.join(path.dirname(repoPath), `azuredatastudio-win32-${arch}`);
|
||||||
const zipDir = arch => path.join(repoPath, '.build', `win32-${arch}`, 'archive');
|
const zipDir = arch => path.join(repoPath, '.build', `win32-${arch}`, 'archive');
|
||||||
const zipPath = arch => path.join(zipDir(arch), `VSCode-win32-${arch}.zip`);
|
const zipPath = arch => path.join(zipDir(arch), `VSCode-win32-${arch}.zip`);
|
||||||
const setupDir = arch => path.join(repoPath, '.build', `win32-${arch}`, 'setup');
|
const setupDir = (arch, target) => path.join(repoPath, '.build', `win32-${arch}`, `${target}-setup`);
|
||||||
const issPath = path.join(__dirname, 'win32', 'code.iss');
|
const issPath = path.join(__dirname, 'win32', 'code.iss');
|
||||||
const innoSetupPath = path.join(path.dirname(path.dirname(require.resolve('innosetup-compiler'))), 'bin', 'ISCC.exe');
|
const innoSetupPath = path.join(path.dirname(path.dirname(require.resolve('innosetup-compiler'))), 'bin', 'ISCC.exe');
|
||||||
|
const signPS1 = path.join(repoPath, 'build', 'tfs', 'win32', 'sign.ps1');
|
||||||
|
|
||||||
function packageInnoSetup(iss, options, cb) {
|
function packageInnoSetup(iss, options, cb) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
const definitions = options.definitions || {};
|
const definitions = options.definitions || {};
|
||||||
|
const debug = process.argv.some(arg => arg === '--debug-inno');
|
||||||
|
|
||||||
|
if (debug) {
|
||||||
|
definitions['Debug'] = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
const keys = Object.keys(definitions);
|
const keys = Object.keys(definitions);
|
||||||
|
|
||||||
keys.forEach(key => assert(typeof definitions[key] === 'string', `Missing value for '${key}' in Inno Setup package step`));
|
keys.forEach(key => assert(typeof definitions[key] === 'string', `Missing value for '${key}' in Inno Setup package step`));
|
||||||
|
|
||||||
const defs = keys.map(key => `/d${key}=${definitions[key]}`);
|
const defs = keys.map(key => `/d${key}=${definitions[key]}`);
|
||||||
const args = [iss].concat(defs);
|
const args = [
|
||||||
|
iss,
|
||||||
|
...defs
|
||||||
|
//,
|
||||||
|
//`/sesrp=powershell.exe -ExecutionPolicy bypass ${signPS1} $f`
|
||||||
|
];
|
||||||
|
|
||||||
cp.spawn(innoSetupPath, args, { stdio: 'inherit' })
|
cp.spawn(innoSetupPath, args, { stdio: ['ignore', 'inherit', 'inherit'] })
|
||||||
.on('error', cb)
|
.on('error', cb)
|
||||||
.on('exit', () => cb(null));
|
.on('exit', () => cb(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildWin32Setup(arch) {
|
function buildWin32Setup(arch, target) {
|
||||||
|
if (target !== 'system' && target !== 'user') {
|
||||||
|
throw new Error('Invalid setup target');
|
||||||
|
}
|
||||||
|
|
||||||
return cb => {
|
return cb => {
|
||||||
const ia32AppId = product.win32AppId;
|
const ia32AppId = target === 'system' ? product.win32AppId : product.win32UserAppId;
|
||||||
const x64AppId = product.win32x64AppId;
|
const x64AppId = target === 'system' ? product.win32x64AppId : product.win32x64UserAppId;
|
||||||
|
|
||||||
|
const sourcePath = buildPath(arch);
|
||||||
|
const outputPath = setupDir(arch, target);
|
||||||
|
mkdirp.sync(outputPath);
|
||||||
|
|
||||||
|
const originalProductJsonPath = path.join(sourcePath, 'resources/app/product.json');
|
||||||
|
const productJsonPath = path.join(outputPath, 'product.json');
|
||||||
|
const productJson = JSON.parse(fs.readFileSync(originalProductJsonPath, 'utf8'));
|
||||||
|
productJson['target'] = target;
|
||||||
|
fs.writeFileSync(productJsonPath, JSON.stringify(productJson, undefined, '\t'));
|
||||||
|
|
||||||
const definitions = {
|
const definitions = {
|
||||||
NameLong: product.nameLong,
|
NameLong: product.nameLong,
|
||||||
@@ -50,35 +79,42 @@ function buildWin32Setup(arch) {
|
|||||||
DirName: product.win32DirName,
|
DirName: product.win32DirName,
|
||||||
Version: pkg.version,
|
Version: pkg.version,
|
||||||
RawVersion: pkg.version.replace(/-\w+$/, ''),
|
RawVersion: pkg.version.replace(/-\w+$/, ''),
|
||||||
NameVersion: product.win32NameVersion,
|
NameVersion: product.win32NameVersion + (target === 'user' ? ' (User)' : ''),
|
||||||
ExeBasename: product.nameShort,
|
ExeBasename: product.nameShort,
|
||||||
RegValueName: product.win32RegValueName,
|
RegValueName: product.win32RegValueName,
|
||||||
ShellNameShort: product.win32ShellNameShort,
|
ShellNameShort: product.win32ShellNameShort,
|
||||||
AppMutex: product.win32MutexName,
|
AppMutex: product.win32MutexName,
|
||||||
Arch: arch,
|
Arch: arch,
|
||||||
AppId: arch === 'ia32' ? ia32AppId : x64AppId,
|
AppId: arch === 'ia32' ? ia32AppId : x64AppId,
|
||||||
IncompatibleAppId: arch === 'ia32' ? x64AppId : ia32AppId,
|
IncompatibleTargetAppId: arch === 'ia32' ? product.win32AppId : product.win32x64AppId,
|
||||||
|
IncompatibleArchAppId: arch === 'ia32' ? x64AppId : ia32AppId,
|
||||||
AppUserId: product.win32AppUserModelId,
|
AppUserId: product.win32AppUserModelId,
|
||||||
ArchitecturesAllowed: arch === 'ia32' ? '' : 'x64',
|
ArchitecturesAllowed: arch === 'ia32' ? '' : 'x64',
|
||||||
ArchitecturesInstallIn64BitMode: arch === 'ia32' ? '' : 'x64',
|
ArchitecturesInstallIn64BitMode: arch === 'ia32' ? '' : 'x64',
|
||||||
SourceDir: buildPath(arch),
|
SourceDir: sourcePath,
|
||||||
RepoDir: repoPath,
|
RepoDir: repoPath,
|
||||||
OutputDir: setupDir(arch)
|
OutputDir: outputPath,
|
||||||
|
InstallTarget: target,
|
||||||
|
ProductJsonPath: productJsonPath
|
||||||
};
|
};
|
||||||
|
|
||||||
packageInnoSetup(issPath, { definitions }, cb);
|
packageInnoSetup(issPath, { definitions }, cb);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('clean-vscode-win32-ia32-setup', util.rimraf(setupDir('ia32')));
|
function defineWin32SetupTasks(arch, target) {
|
||||||
gulp.task('vscode-win32-ia32-setup', ['clean-vscode-win32-ia32-setup'], buildWin32Setup('ia32'));
|
gulp.task(`clean-vscode-win32-${arch}-${target}-setup`, util.rimraf(setupDir(arch, target)));
|
||||||
|
gulp.task(`vscode-win32-${arch}-${target}-setup`, [`clean-vscode-win32-${arch}-${target}-setup`], buildWin32Setup(arch, target));
|
||||||
|
}
|
||||||
|
|
||||||
gulp.task('clean-vscode-win32-x64-setup', util.rimraf(setupDir('x64')));
|
defineWin32SetupTasks('ia32', 'system');
|
||||||
gulp.task('vscode-win32-x64-setup', ['clean-vscode-win32-x64-setup'], buildWin32Setup('x64'));
|
defineWin32SetupTasks('x64', 'system');
|
||||||
|
defineWin32SetupTasks('ia32', 'user');
|
||||||
|
defineWin32SetupTasks('x64', 'user');
|
||||||
|
|
||||||
function archiveWin32Setup(arch) {
|
function archiveWin32Setup(arch) {
|
||||||
return cb => {
|
return cb => {
|
||||||
const args = ['a', '-tzip', zipPath(arch), '.', '-r'];
|
const args = ['a', '-tzip', zipPath(arch), '-x!CodeSignSummary*.md', '.', '-r'];
|
||||||
|
|
||||||
cp.spawn(_7z, args, { stdio: 'inherit', cwd: buildPath(arch) })
|
cp.spawn(_7z, args, { stdio: 'inherit', cwd: buildPath(arch) })
|
||||||
.on('error', cb)
|
.on('error', cb)
|
||||||
@@ -91,3 +127,13 @@ gulp.task('vscode-win32-ia32-archive', ['clean-vscode-win32-ia32-archive'], arch
|
|||||||
|
|
||||||
gulp.task('clean-vscode-win32-x64-archive', util.rimraf(zipDir('x64')));
|
gulp.task('clean-vscode-win32-x64-archive', util.rimraf(zipDir('x64')));
|
||||||
gulp.task('vscode-win32-x64-archive', ['clean-vscode-win32-x64-archive'], archiveWin32Setup('x64'));
|
gulp.task('vscode-win32-x64-archive', ['clean-vscode-win32-x64-archive'], archiveWin32Setup('x64'));
|
||||||
|
|
||||||
|
function copyInnoUpdater(arch) {
|
||||||
|
return () => {
|
||||||
|
return gulp.src('build/win32/{inno_updater.exe,vcruntime140.dll}', { base: 'build/win32' })
|
||||||
|
.pipe(vfs.dest(path.join(buildPath(arch), 'tools')));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
gulp.task('vscode-win32-ia32-copy-inno-updater', copyInnoUpdater('ia32'));
|
||||||
|
gulp.task('vscode-win32-x64-copy-inno-updater', copyInnoUpdater('x64'));
|
||||||
118
build/lib/asar.js
Normal file
118
build/lib/asar.js
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var path = require("path");
|
||||||
|
var es = require("event-stream");
|
||||||
|
var pickle = require("chromium-pickle-js");
|
||||||
|
var Filesystem = require("asar/lib/filesystem");
|
||||||
|
var VinylFile = require("vinyl");
|
||||||
|
var minimatch = require("minimatch");
|
||||||
|
function createAsar(folderPath, unpackGlobs, destFilename) {
|
||||||
|
var shouldUnpackFile = function (file) {
|
||||||
|
for (var i = 0; i < unpackGlobs.length; i++) {
|
||||||
|
if (minimatch(file.relative, unpackGlobs[i])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
var filesystem = new Filesystem(folderPath);
|
||||||
|
var out = [];
|
||||||
|
// Keep track of pending inserts
|
||||||
|
var pendingInserts = 0;
|
||||||
|
var onFileInserted = function () { pendingInserts--; };
|
||||||
|
// Do not insert twice the same directory
|
||||||
|
var seenDir = {};
|
||||||
|
var insertDirectoryRecursive = function (dir) {
|
||||||
|
if (seenDir[dir]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var lastSlash = dir.lastIndexOf('/');
|
||||||
|
if (lastSlash === -1) {
|
||||||
|
lastSlash = dir.lastIndexOf('\\');
|
||||||
|
}
|
||||||
|
if (lastSlash !== -1) {
|
||||||
|
insertDirectoryRecursive(dir.substring(0, lastSlash));
|
||||||
|
}
|
||||||
|
seenDir[dir] = true;
|
||||||
|
filesystem.insertDirectory(dir);
|
||||||
|
};
|
||||||
|
var insertDirectoryForFile = function (file) {
|
||||||
|
var lastSlash = file.lastIndexOf('/');
|
||||||
|
if (lastSlash === -1) {
|
||||||
|
lastSlash = file.lastIndexOf('\\');
|
||||||
|
}
|
||||||
|
if (lastSlash !== -1) {
|
||||||
|
insertDirectoryRecursive(file.substring(0, lastSlash));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var insertFile = function (relativePath, stat, shouldUnpack) {
|
||||||
|
insertDirectoryForFile(relativePath);
|
||||||
|
pendingInserts++;
|
||||||
|
filesystem.insertFile(relativePath, shouldUnpack, { stat: stat }, {}, onFileInserted);
|
||||||
|
};
|
||||||
|
return es.through(function (file) {
|
||||||
|
if (file.stat.isDirectory()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!file.stat.isFile()) {
|
||||||
|
throw new Error("unknown item in stream!");
|
||||||
|
}
|
||||||
|
var shouldUnpack = shouldUnpackFile(file);
|
||||||
|
insertFile(file.relative, { size: file.contents.length, mode: file.stat.mode }, shouldUnpack);
|
||||||
|
if (shouldUnpack) {
|
||||||
|
// The file goes outside of xx.asar, in a folder xx.asar.unpacked
|
||||||
|
var relative = path.relative(folderPath, file.path);
|
||||||
|
this.queue(new VinylFile({
|
||||||
|
cwd: folderPath,
|
||||||
|
base: folderPath,
|
||||||
|
path: path.join(destFilename + '.unpacked', relative),
|
||||||
|
stat: file.stat,
|
||||||
|
contents: file.contents
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// The file goes inside of xx.asar
|
||||||
|
out.push(file.contents);
|
||||||
|
}
|
||||||
|
}, function () {
|
||||||
|
var _this = this;
|
||||||
|
var finish = function () {
|
||||||
|
{
|
||||||
|
var headerPickle = pickle.createEmpty();
|
||||||
|
headerPickle.writeString(JSON.stringify(filesystem.header));
|
||||||
|
var headerBuf = headerPickle.toBuffer();
|
||||||
|
var sizePickle = pickle.createEmpty();
|
||||||
|
sizePickle.writeUInt32(headerBuf.length);
|
||||||
|
var sizeBuf = sizePickle.toBuffer();
|
||||||
|
out.unshift(headerBuf);
|
||||||
|
out.unshift(sizeBuf);
|
||||||
|
}
|
||||||
|
var contents = Buffer.concat(out);
|
||||||
|
out.length = 0;
|
||||||
|
_this.queue(new VinylFile({
|
||||||
|
cwd: folderPath,
|
||||||
|
base: folderPath,
|
||||||
|
path: destFilename,
|
||||||
|
contents: contents
|
||||||
|
}));
|
||||||
|
_this.queue(null);
|
||||||
|
};
|
||||||
|
// Call finish() only when all file inserts have finished...
|
||||||
|
if (pendingInserts === 0) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
onFileInserted = function () {
|
||||||
|
pendingInserts--;
|
||||||
|
if (pendingInserts === 0) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.createAsar = createAsar;
|
||||||
131
build/lib/asar.ts
Normal file
131
build/lib/asar.ts
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as es from 'event-stream';
|
||||||
|
import * as pickle from 'chromium-pickle-js';
|
||||||
|
import * as Filesystem from 'asar/lib/filesystem';
|
||||||
|
import * as VinylFile from 'vinyl';
|
||||||
|
import * as minimatch from 'minimatch';
|
||||||
|
|
||||||
|
export function createAsar(folderPath: string, unpackGlobs: string[], destFilename: string): NodeJS.ReadWriteStream {
|
||||||
|
|
||||||
|
const shouldUnpackFile = (file: VinylFile): boolean => {
|
||||||
|
for (let i = 0; i < unpackGlobs.length; i++) {
|
||||||
|
if (minimatch(file.relative, unpackGlobs[i])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const filesystem = new Filesystem(folderPath);
|
||||||
|
const out: Buffer[] = [];
|
||||||
|
|
||||||
|
// Keep track of pending inserts
|
||||||
|
let pendingInserts = 0;
|
||||||
|
let onFileInserted = () => { pendingInserts--; };
|
||||||
|
|
||||||
|
// Do not insert twice the same directory
|
||||||
|
const seenDir: { [key: string]: boolean; } = {};
|
||||||
|
const insertDirectoryRecursive = (dir: string) => {
|
||||||
|
if (seenDir[dir]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let lastSlash = dir.lastIndexOf('/');
|
||||||
|
if (lastSlash === -1) {
|
||||||
|
lastSlash = dir.lastIndexOf('\\');
|
||||||
|
}
|
||||||
|
if (lastSlash !== -1) {
|
||||||
|
insertDirectoryRecursive(dir.substring(0, lastSlash));
|
||||||
|
}
|
||||||
|
seenDir[dir] = true;
|
||||||
|
filesystem.insertDirectory(dir);
|
||||||
|
};
|
||||||
|
|
||||||
|
const insertDirectoryForFile = (file: string) => {
|
||||||
|
let lastSlash = file.lastIndexOf('/');
|
||||||
|
if (lastSlash === -1) {
|
||||||
|
lastSlash = file.lastIndexOf('\\');
|
||||||
|
}
|
||||||
|
if (lastSlash !== -1) {
|
||||||
|
insertDirectoryRecursive(file.substring(0, lastSlash));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const insertFile = (relativePath: string, stat: { size: number; mode: number; }, shouldUnpack: boolean) => {
|
||||||
|
insertDirectoryForFile(relativePath);
|
||||||
|
pendingInserts++;
|
||||||
|
filesystem.insertFile(relativePath, shouldUnpack, { stat: stat }, {}, onFileInserted);
|
||||||
|
};
|
||||||
|
|
||||||
|
return es.through(function (file) {
|
||||||
|
if (file.stat.isDirectory()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!file.stat.isFile()) {
|
||||||
|
throw new Error(`unknown item in stream!`);
|
||||||
|
}
|
||||||
|
const shouldUnpack = shouldUnpackFile(file);
|
||||||
|
insertFile(file.relative, { size: file.contents.length, mode: file.stat.mode }, shouldUnpack);
|
||||||
|
|
||||||
|
if (shouldUnpack) {
|
||||||
|
// The file goes outside of xx.asar, in a folder xx.asar.unpacked
|
||||||
|
const relative = path.relative(folderPath, file.path);
|
||||||
|
this.queue(new VinylFile({
|
||||||
|
cwd: folderPath,
|
||||||
|
base: folderPath,
|
||||||
|
path: path.join(destFilename + '.unpacked', relative),
|
||||||
|
stat: file.stat,
|
||||||
|
contents: file.contents
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
// The file goes inside of xx.asar
|
||||||
|
out.push(file.contents);
|
||||||
|
}
|
||||||
|
}, function () {
|
||||||
|
|
||||||
|
let finish = () => {
|
||||||
|
{
|
||||||
|
const headerPickle = pickle.createEmpty();
|
||||||
|
headerPickle.writeString(JSON.stringify(filesystem.header));
|
||||||
|
const headerBuf = headerPickle.toBuffer();
|
||||||
|
|
||||||
|
const sizePickle = pickle.createEmpty();
|
||||||
|
sizePickle.writeUInt32(headerBuf.length);
|
||||||
|
const sizeBuf = sizePickle.toBuffer();
|
||||||
|
|
||||||
|
out.unshift(headerBuf);
|
||||||
|
out.unshift(sizeBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
const contents = Buffer.concat(out);
|
||||||
|
out.length = 0;
|
||||||
|
|
||||||
|
this.queue(new VinylFile({
|
||||||
|
cwd: folderPath,
|
||||||
|
base: folderPath,
|
||||||
|
path: destFilename,
|
||||||
|
contents: contents
|
||||||
|
}));
|
||||||
|
this.queue(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Call finish() only when all file inserts have finished...
|
||||||
|
if (pendingInserts === 0) {
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
onFileInserted = () => {
|
||||||
|
pendingInserts--;
|
||||||
|
if (pendingInserts === 0) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
121
build/lib/builtInExtensions.js
Normal file
121
build/lib/builtInExtensions.js
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const os = require('os');
|
||||||
|
const mkdirp = require('mkdirp');
|
||||||
|
const rimraf = require('rimraf');
|
||||||
|
const es = require('event-stream');
|
||||||
|
const rename = require('gulp-rename');
|
||||||
|
const vfs = require('vinyl-fs');
|
||||||
|
const ext = require('./extensions');
|
||||||
|
const util = require('gulp-util');
|
||||||
|
|
||||||
|
const root = path.dirname(path.dirname(__dirname));
|
||||||
|
const builtInExtensions = require('../builtInExtensions.json');
|
||||||
|
const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json');
|
||||||
|
|
||||||
|
function getExtensionPath(extension) {
|
||||||
|
return path.join(root, '.build', 'builtInExtensions', extension.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isUpToDate(extension) {
|
||||||
|
const packagePath = path.join(getExtensionPath(extension), 'package.json');
|
||||||
|
|
||||||
|
if (!fs.existsSync(packagePath)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const packageContents = fs.readFileSync(packagePath, { encoding: 'utf8' });
|
||||||
|
|
||||||
|
try {
|
||||||
|
const diskVersion = JSON.parse(packageContents).version;
|
||||||
|
return (diskVersion === extension.version);
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncMarketplaceExtension(extension) {
|
||||||
|
if (isUpToDate(extension)) {
|
||||||
|
util.log(util.colors.blue('[marketplace]'), `${extension.name}@${extension.version}`, util.colors.green('✔︎'));
|
||||||
|
return es.readArray([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
rimraf.sync(getExtensionPath(extension));
|
||||||
|
|
||||||
|
return ext.fromMarketplace(extension.name, extension.version)
|
||||||
|
.pipe(rename(p => p.dirname = `${extension.name}/${p.dirname}`))
|
||||||
|
.pipe(vfs.dest('.build/builtInExtensions'))
|
||||||
|
.on('end', () => util.log(util.colors.blue('[marketplace]'), extension.name, util.colors.green('✔︎')));
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncExtension(extension, controlState) {
|
||||||
|
switch (controlState) {
|
||||||
|
case 'disabled':
|
||||||
|
util.log(util.colors.blue('[disabled]'), util.colors.gray(extension.name));
|
||||||
|
return es.readArray([]);
|
||||||
|
|
||||||
|
case 'marketplace':
|
||||||
|
return syncMarketplaceExtension(extension);
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (!fs.existsSync(controlState)) {
|
||||||
|
util.log(util.colors.red(`Error: Built-in extension '${extension.name}' is configured to run from '${controlState}' but that path does not exist.`));
|
||||||
|
return es.readArray([]);
|
||||||
|
|
||||||
|
} else if (!fs.existsSync(path.join(controlState, 'package.json'))) {
|
||||||
|
util.log(util.colors.red(`Error: Built-in extension '${extension.name}' is configured to run from '${controlState}' but there is no 'package.json' file in that directory.`));
|
||||||
|
return es.readArray([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
util.log(util.colors.blue('[local]'), `${extension.name}: ${util.colors.cyan(controlState)}`, util.colors.green('✔︎'));
|
||||||
|
return es.readArray([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function readControlFile() {
|
||||||
|
try {
|
||||||
|
return JSON.parse(fs.readFileSync(controlFilePath, 'utf8'));
|
||||||
|
} catch (err) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeControlFile(control) {
|
||||||
|
mkdirp.sync(path.dirname(controlFilePath));
|
||||||
|
fs.writeFileSync(controlFilePath, JSON.stringify(control, null, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
util.log('Syncronizing built-in extensions...');
|
||||||
|
util.log(`You can manage built-in extensions with the ${util.colors.cyan('--builtin')} flag`);
|
||||||
|
|
||||||
|
const control = readControlFile();
|
||||||
|
const streams = [];
|
||||||
|
|
||||||
|
for (const extension of builtInExtensions) {
|
||||||
|
let controlState = control[extension.name] || 'marketplace';
|
||||||
|
control[extension.name] = controlState;
|
||||||
|
|
||||||
|
streams.push(syncExtension(extension, controlState));
|
||||||
|
}
|
||||||
|
|
||||||
|
writeControlFile(control);
|
||||||
|
|
||||||
|
es.merge(streams)
|
||||||
|
.on('error', err => {
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
})
|
||||||
|
.on('end', () => {
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
@@ -217,6 +217,7 @@ function removeDuplicateTSBoilerplate(destFiles) {
|
|||||||
{ start: /^var __metadata/, end: /^};$/ },
|
{ start: /^var __metadata/, end: /^};$/ },
|
||||||
{ start: /^var __param/, end: /^};$/ },
|
{ start: /^var __param/, end: /^};$/ },
|
||||||
{ start: /^var __awaiter/, end: /^};$/ },
|
{ start: /^var __awaiter/, end: /^};$/ },
|
||||||
|
{ start: /^var __generator/, end: /^};$/ },
|
||||||
];
|
];
|
||||||
destFiles.forEach(function (destFile) {
|
destFiles.forEach(function (destFile) {
|
||||||
var SEEN_BOILERPLATE = [];
|
var SEEN_BOILERPLATE = [];
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ interface ILoaderPluginReqFunc {
|
|||||||
|
|
||||||
export interface IEntryPoint {
|
export interface IEntryPoint {
|
||||||
name: string;
|
name: string;
|
||||||
include: string[];
|
include?: string[];
|
||||||
exclude: string[];
|
exclude?: string[];
|
||||||
prepend: string[];
|
prepend: string[];
|
||||||
append: string[];
|
append?: string[];
|
||||||
dest: string;
|
dest?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IEntryPointMap {
|
interface IEntryPointMap {
|
||||||
@@ -339,6 +339,7 @@ function removeDuplicateTSBoilerplate(destFiles: IConcatFile[]): IConcatFile[] {
|
|||||||
{ start: /^var __metadata/, end: /^};$/ },
|
{ start: /^var __metadata/, end: /^};$/ },
|
||||||
{ start: /^var __param/, end: /^};$/ },
|
{ start: /^var __param/, end: /^};$/ },
|
||||||
{ start: /^var __awaiter/, end: /^};$/ },
|
{ start: /^var __awaiter/, end: /^};$/ },
|
||||||
|
{ start: /^var __generator/, end: /^};$/ },
|
||||||
];
|
];
|
||||||
|
|
||||||
destFiles.forEach((destFile) => {
|
destFiles.forEach((destFile) => {
|
||||||
|
|||||||
@@ -18,14 +18,21 @@ var _ = require("underscore");
|
|||||||
var monacodts = require("../monaco/api");
|
var monacodts = require("../monaco/api");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var reporter = reporter_1.createReporter();
|
var reporter = reporter_1.createReporter();
|
||||||
var rootDir = path.join(__dirname, '../../src');
|
function getTypeScriptCompilerOptions(src) {
|
||||||
var options = require('../../src/tsconfig.json').compilerOptions;
|
var rootDir = path.join(__dirname, "../../" + src);
|
||||||
options.verbose = false;
|
var options = require("../../" + src + "/tsconfig.json").compilerOptions;
|
||||||
options.sourceMap = true;
|
options.verbose = false;
|
||||||
options.rootDir = rootDir;
|
options.sourceMap = true;
|
||||||
options.sourceRoot = util.toFileUri(rootDir);
|
if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry
|
||||||
function createCompile(build, emitError) {
|
options.sourceMap = false;
|
||||||
var opts = _.clone(options);
|
}
|
||||||
|
options.rootDir = rootDir;
|
||||||
|
options.sourceRoot = util.toFileUri(rootDir);
|
||||||
|
options.newLine = /\r\n/.test(fs.readFileSync(__filename, 'utf8')) ? 'CRLF' : 'LF';
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
function createCompile(src, build, emitError) {
|
||||||
|
var opts = _.clone(getTypeScriptCompilerOptions(src));
|
||||||
opts.inlineSources = !!build;
|
opts.inlineSources = !!build;
|
||||||
opts.noFilesystemLookup = true;
|
opts.noFilesystemLookup = true;
|
||||||
var ts = tsb.create(opts, null, null, function (err) { return reporter(err.toString()); });
|
var ts = tsb.create(opts, null, null, function (err) { return reporter(err.toString()); });
|
||||||
@@ -47,77 +54,46 @@ function createCompile(build, emitError) {
|
|||||||
.pipe(sourcemaps.write('.', {
|
.pipe(sourcemaps.write('.', {
|
||||||
addComment: false,
|
addComment: false,
|
||||||
includeContent: !!build,
|
includeContent: !!build,
|
||||||
sourceRoot: options.sourceRoot
|
sourceRoot: opts.sourceRoot
|
||||||
}))
|
}))
|
||||||
.pipe(tsFilter.restore)
|
.pipe(tsFilter.restore)
|
||||||
.pipe(reporter.end(emitError));
|
.pipe(reporter.end(emitError));
|
||||||
return es.duplex(input, output);
|
return es.duplex(input, output);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function compileTask(out, build) {
|
function compileTask(src, out, build) {
|
||||||
return function () {
|
return function () {
|
||||||
var compile = createCompile(build, true);
|
var compile = createCompile(src, build, true);
|
||||||
var src = es.merge(gulp.src('src/**', { base: 'src' }), gulp.src('node_modules/typescript/lib/lib.d.ts'));
|
var srcPipe = es.merge(gulp.src(src + "/**", { base: "" + src }), gulp.src('node_modules/typescript/lib/lib.d.ts'));
|
||||||
return src
|
// Do not write .d.ts files to disk, as they are not needed there.
|
||||||
|
var dtsFilter = util.filter(function (data) { return !/\.d\.ts$/.test(data.path); });
|
||||||
|
return srcPipe
|
||||||
.pipe(compile())
|
.pipe(compile())
|
||||||
|
.pipe(dtsFilter)
|
||||||
.pipe(gulp.dest(out))
|
.pipe(gulp.dest(out))
|
||||||
.pipe(monacodtsTask(out, false));
|
.pipe(dtsFilter.restore)
|
||||||
|
.pipe(src !== 'src' ? es.through() : monacodtsTask(out, false));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.compileTask = compileTask;
|
exports.compileTask = compileTask;
|
||||||
function watchTask(out, build) {
|
function watchTask(out, build) {
|
||||||
return function () {
|
return function () {
|
||||||
var compile = createCompile(build);
|
var compile = createCompile('src', build);
|
||||||
var src = es.merge(gulp.src('src/**', { base: 'src' }), gulp.src('node_modules/typescript/lib/lib.d.ts'));
|
var src = es.merge(gulp.src('src/**', { base: 'src' }), gulp.src('node_modules/typescript/lib/lib.d.ts'));
|
||||||
var watchSrc = watch('src/**', { base: 'src' });
|
var watchSrc = watch('src/**', { base: 'src' });
|
||||||
|
// Do not write .d.ts files to disk, as they are not needed there.
|
||||||
|
var dtsFilter = util.filter(function (data) { return !/\.d\.ts$/.test(data.path); });
|
||||||
return watchSrc
|
return watchSrc
|
||||||
.pipe(util.incremental(compile, src, true))
|
.pipe(util.incremental(compile, src, true))
|
||||||
|
.pipe(dtsFilter)
|
||||||
.pipe(gulp.dest(out))
|
.pipe(gulp.dest(out))
|
||||||
|
.pipe(dtsFilter.restore)
|
||||||
.pipe(monacodtsTask(out, true));
|
.pipe(monacodtsTask(out, true));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.watchTask = watchTask;
|
exports.watchTask = watchTask;
|
||||||
function reloadTypeScriptNodeModule() {
|
|
||||||
var util = require('gulp-util');
|
|
||||||
function log(message) {
|
|
||||||
var rest = [];
|
|
||||||
for (var _i = 1; _i < arguments.length; _i++) {
|
|
||||||
rest[_i - 1] = arguments[_i];
|
|
||||||
}
|
|
||||||
util.log.apply(util, [util.colors.cyan('[memory watch dog]'), message].concat(rest));
|
|
||||||
}
|
|
||||||
function heapUsed() {
|
|
||||||
return (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2) + ' MB';
|
|
||||||
}
|
|
||||||
return es.through(function (data) {
|
|
||||||
this.emit('data', data);
|
|
||||||
}, function () {
|
|
||||||
log('memory usage after compilation finished: ' + heapUsed());
|
|
||||||
// It appears we are running into some variant of
|
|
||||||
// https://bugs.chromium.org/p/v8/issues/detail?id=2073
|
|
||||||
//
|
|
||||||
// Even though all references are dropped, some
|
|
||||||
// optimized methods in the TS compiler end up holding references
|
|
||||||
// to the entire TypeScript language host (>600MB)
|
|
||||||
//
|
|
||||||
// The idea is to force v8 to drop references to these
|
|
||||||
// optimized methods, by "reloading" the typescript node module
|
|
||||||
log('Reloading typescript node module...');
|
|
||||||
var resolvedName = require.resolve('typescript');
|
|
||||||
var originalModule = require.cache[resolvedName];
|
|
||||||
delete require.cache[resolvedName];
|
|
||||||
var newExports = require('typescript');
|
|
||||||
require.cache[resolvedName] = originalModule;
|
|
||||||
for (var prop in newExports) {
|
|
||||||
if (newExports.hasOwnProperty(prop)) {
|
|
||||||
originalModule.exports[prop] = newExports[prop];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log('typescript node module reloaded.');
|
|
||||||
this.emit('end');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function monacodtsTask(out, isWatch) {
|
function monacodtsTask(out, isWatch) {
|
||||||
|
var basePath = path.resolve(process.cwd(), out);
|
||||||
var neededFiles = {};
|
var neededFiles = {};
|
||||||
monacodts.getFilesToWatch(out).forEach(function (filePath) {
|
monacodts.getFilesToWatch(out).forEach(function (filePath) {
|
||||||
filePath = path.normalize(filePath);
|
filePath = path.normalize(filePath);
|
||||||
@@ -149,6 +125,7 @@ function monacodtsTask(out, isWatch) {
|
|||||||
fs.writeFileSync(result.filePath, result.content);
|
fs.writeFileSync(result.filePath, result.content);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
fs.writeFileSync(result.filePath, result.content);
|
||||||
resultStream.emit('error', 'monaco.d.ts is no longer up to date. Please run gulp watch and commit the new file.');
|
resultStream.emit('error', 'monaco.d.ts is no longer up to date. Please run gulp watch and commit the new file.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,7 +137,7 @@ function monacodtsTask(out, isWatch) {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
resultStream = es.through(function (data) {
|
resultStream = es.through(function (data) {
|
||||||
var filePath = path.normalize(data.path);
|
var filePath = path.normalize(path.resolve(basePath, data.relative));
|
||||||
if (neededFiles[filePath]) {
|
if (neededFiles[filePath]) {
|
||||||
setInputFile(filePath, data.contents.toString());
|
setInputFile(filePath, data.contents.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,15 +21,22 @@ import * as fs from 'fs';
|
|||||||
|
|
||||||
const reporter = createReporter();
|
const reporter = createReporter();
|
||||||
|
|
||||||
const rootDir = path.join(__dirname, '../../src');
|
function getTypeScriptCompilerOptions(src: string) {
|
||||||
const options = require('../../src/tsconfig.json').compilerOptions;
|
const rootDir = path.join(__dirname, `../../${src}`);
|
||||||
options.verbose = false;
|
const options = require(`../../${src}/tsconfig.json`).compilerOptions;
|
||||||
options.sourceMap = true;
|
options.verbose = false;
|
||||||
options.rootDir = rootDir;
|
options.sourceMap = true;
|
||||||
options.sourceRoot = util.toFileUri(rootDir);
|
if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry
|
||||||
|
options.sourceMap = false;
|
||||||
|
}
|
||||||
|
options.rootDir = rootDir;
|
||||||
|
options.sourceRoot = util.toFileUri(rootDir);
|
||||||
|
options.newLine = /\r\n/.test(fs.readFileSync(__filename, 'utf8')) ? 'CRLF' : 'LF';
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
function createCompile(build: boolean, emitError?: boolean): (token?: util.ICancellationToken) => NodeJS.ReadWriteStream {
|
function createCompile(src: string, build: boolean, emitError?: boolean): (token?: util.ICancellationToken) => NodeJS.ReadWriteStream {
|
||||||
const opts = _.clone(options);
|
const opts = _.clone(getTypeScriptCompilerOptions(src));
|
||||||
opts.inlineSources = !!build;
|
opts.inlineSources = !!build;
|
||||||
opts.noFilesystemLookup = true;
|
opts.noFilesystemLookup = true;
|
||||||
|
|
||||||
@@ -49,14 +56,13 @@ function createCompile(build: boolean, emitError?: boolean): (token?: util.ICanc
|
|||||||
.pipe(tsFilter)
|
.pipe(tsFilter)
|
||||||
.pipe(util.loadSourcemaps())
|
.pipe(util.loadSourcemaps())
|
||||||
.pipe(ts(token))
|
.pipe(ts(token))
|
||||||
// .pipe(build ? reloadTypeScriptNodeModule() : es.through())
|
|
||||||
.pipe(noDeclarationsFilter)
|
.pipe(noDeclarationsFilter)
|
||||||
.pipe(build ? nls() : es.through())
|
.pipe(build ? nls() : es.through())
|
||||||
.pipe(noDeclarationsFilter.restore)
|
.pipe(noDeclarationsFilter.restore)
|
||||||
.pipe(sourcemaps.write('.', {
|
.pipe(sourcemaps.write('.', {
|
||||||
addComment: false,
|
addComment: false,
|
||||||
includeContent: !!build,
|
includeContent: !!build,
|
||||||
sourceRoot: options.sourceRoot
|
sourceRoot: opts.sourceRoot
|
||||||
}))
|
}))
|
||||||
.pipe(tsFilter.restore)
|
.pipe(tsFilter.restore)
|
||||||
.pipe(reporter.end(emitError));
|
.pipe(reporter.end(emitError));
|
||||||
@@ -65,27 +71,32 @@ function createCompile(build: boolean, emitError?: boolean): (token?: util.ICanc
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function compileTask(out: string, build: boolean): () => NodeJS.ReadWriteStream {
|
export function compileTask(src: string, out: string, build: boolean): () => NodeJS.ReadWriteStream {
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
const compile = createCompile(build, true);
|
const compile = createCompile(src, build, true);
|
||||||
|
|
||||||
const src = es.merge(
|
const srcPipe = es.merge(
|
||||||
gulp.src('src/**', { base: 'src' }),
|
gulp.src(`${src}/**`, { base: `${src}` }),
|
||||||
gulp.src('node_modules/typescript/lib/lib.d.ts'),
|
gulp.src('node_modules/typescript/lib/lib.d.ts'),
|
||||||
);
|
);
|
||||||
|
|
||||||
return src
|
// Do not write .d.ts files to disk, as they are not needed there.
|
||||||
|
const dtsFilter = util.filter(data => !/\.d\.ts$/.test(data.path));
|
||||||
|
|
||||||
|
return srcPipe
|
||||||
.pipe(compile())
|
.pipe(compile())
|
||||||
|
.pipe(dtsFilter)
|
||||||
.pipe(gulp.dest(out))
|
.pipe(gulp.dest(out))
|
||||||
.pipe(monacodtsTask(out, false));
|
.pipe(dtsFilter.restore)
|
||||||
|
.pipe(src !== 'src' ? es.through() : monacodtsTask(out, false));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteStream {
|
export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteStream {
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
const compile = createCompile(build);
|
const compile = createCompile('src', build);
|
||||||
|
|
||||||
const src = es.merge(
|
const src = es.merge(
|
||||||
gulp.src('src/**', { base: 'src' }),
|
gulp.src('src/**', { base: 'src' }),
|
||||||
@@ -93,62 +104,22 @@ export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteSt
|
|||||||
);
|
);
|
||||||
const watchSrc = watch('src/**', { base: 'src' });
|
const watchSrc = watch('src/**', { base: 'src' });
|
||||||
|
|
||||||
|
// Do not write .d.ts files to disk, as they are not needed there.
|
||||||
|
const dtsFilter = util.filter(data => !/\.d\.ts$/.test(data.path));
|
||||||
|
|
||||||
return watchSrc
|
return watchSrc
|
||||||
.pipe(util.incremental(compile, src, true))
|
.pipe(util.incremental(compile, src, true))
|
||||||
|
.pipe(dtsFilter)
|
||||||
.pipe(gulp.dest(out))
|
.pipe(gulp.dest(out))
|
||||||
|
.pipe(dtsFilter.restore)
|
||||||
.pipe(monacodtsTask(out, true));
|
.pipe(monacodtsTask(out, true));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadTypeScriptNodeModule(): NodeJS.ReadWriteStream {
|
|
||||||
var util = require('gulp-util');
|
|
||||||
function log(message: any, ...rest: any[]): void {
|
|
||||||
util.log(util.colors.cyan('[memory watch dog]'), message, ...rest);
|
|
||||||
}
|
|
||||||
|
|
||||||
function heapUsed(): string {
|
|
||||||
return (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2) + ' MB';
|
|
||||||
}
|
|
||||||
|
|
||||||
return es.through(function (data) {
|
|
||||||
this.emit('data', data);
|
|
||||||
}, function () {
|
|
||||||
|
|
||||||
log('memory usage after compilation finished: ' + heapUsed());
|
|
||||||
|
|
||||||
// It appears we are running into some variant of
|
|
||||||
// https://bugs.chromium.org/p/v8/issues/detail?id=2073
|
|
||||||
//
|
|
||||||
// Even though all references are dropped, some
|
|
||||||
// optimized methods in the TS compiler end up holding references
|
|
||||||
// to the entire TypeScript language host (>600MB)
|
|
||||||
//
|
|
||||||
// The idea is to force v8 to drop references to these
|
|
||||||
// optimized methods, by "reloading" the typescript node module
|
|
||||||
|
|
||||||
log('Reloading typescript node module...');
|
|
||||||
|
|
||||||
var resolvedName = require.resolve('typescript');
|
|
||||||
|
|
||||||
var originalModule = require.cache[resolvedName];
|
|
||||||
delete require.cache[resolvedName];
|
|
||||||
var newExports = require('typescript');
|
|
||||||
require.cache[resolvedName] = originalModule;
|
|
||||||
|
|
||||||
for (var prop in newExports) {
|
|
||||||
if (newExports.hasOwnProperty(prop)) {
|
|
||||||
originalModule.exports[prop] = newExports[prop];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log('typescript node module reloaded.');
|
|
||||||
|
|
||||||
this.emit('end');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function monacodtsTask(out: string, isWatch: boolean): NodeJS.ReadWriteStream {
|
function monacodtsTask(out: string, isWatch: boolean): NodeJS.ReadWriteStream {
|
||||||
|
|
||||||
|
const basePath = path.resolve(process.cwd(), out);
|
||||||
|
|
||||||
const neededFiles: { [file: string]: boolean; } = {};
|
const neededFiles: { [file: string]: boolean; } = {};
|
||||||
monacodts.getFilesToWatch(out).forEach(function (filePath) {
|
monacodts.getFilesToWatch(out).forEach(function (filePath) {
|
||||||
filePath = path.normalize(filePath);
|
filePath = path.normalize(filePath);
|
||||||
@@ -182,6 +153,7 @@ function monacodtsTask(out: string, isWatch: boolean): NodeJS.ReadWriteStream {
|
|||||||
if (isWatch) {
|
if (isWatch) {
|
||||||
fs.writeFileSync(result.filePath, result.content);
|
fs.writeFileSync(result.filePath, result.content);
|
||||||
} else {
|
} else {
|
||||||
|
fs.writeFileSync(result.filePath, result.content);
|
||||||
resultStream.emit('error', 'monaco.d.ts is no longer up to date. Please run gulp watch and commit the new file.');
|
resultStream.emit('error', 'monaco.d.ts is no longer up to date. Please run gulp watch and commit the new file.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +168,7 @@ function monacodtsTask(out: string, isWatch: boolean): NodeJS.ReadWriteStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resultStream = es.through(function (data) {
|
resultStream = es.through(function (data) {
|
||||||
const filePath = path.normalize(data.path);
|
const filePath = path.normalize(path.resolve(basePath, data.relative));
|
||||||
if (neededFiles[filePath]) {
|
if (neededFiles[filePath]) {
|
||||||
setInputFile(filePath, data.contents.toString());
|
setInputFile(filePath, data.contents.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
28
build/lib/electron.js
Normal file
28
build/lib/electron.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const root = path.dirname(path.dirname(__dirname));
|
||||||
|
|
||||||
|
function getElectronVersion() {
|
||||||
|
const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
|
||||||
|
const target = /^target "(.*)"$/m.exec(yarnrc)[1];
|
||||||
|
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.getElectronVersion = getElectronVersion;
|
||||||
|
|
||||||
|
// returns 0 if the right version of electron is in .build/electron
|
||||||
|
if (require.main === module) {
|
||||||
|
const version = getElectronVersion();
|
||||||
|
const versionFile = path.join(root, '.build', 'electron', 'version');
|
||||||
|
const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `v${version}`;
|
||||||
|
|
||||||
|
process.exit(isUpToDate ? 0 : 1);
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@ var vsce = require("vsce");
|
|||||||
var File = require("vinyl");
|
var File = require("vinyl");
|
||||||
function fromLocal(extensionPath) {
|
function fromLocal(extensionPath) {
|
||||||
var result = es.through();
|
var result = es.through();
|
||||||
vsce.listFiles({ cwd: extensionPath })
|
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn })
|
||||||
.then(function (fileNames) {
|
.then(function (fileNames) {
|
||||||
var files = fileNames
|
var files = fileNames
|
||||||
.map(function (fileName) { return path.join(extensionPath, fileName); })
|
.map(function (fileName) { return path.join(extensionPath, fileName); })
|
||||||
@@ -44,6 +44,7 @@ function error(err) {
|
|||||||
var baseHeaders = {
|
var baseHeaders = {
|
||||||
'X-Market-Client-Id': 'VSCode Build',
|
'X-Market-Client-Id': 'VSCode Build',
|
||||||
'User-Agent': 'VSCode Build',
|
'User-Agent': 'VSCode Build',
|
||||||
|
'X-Market-User-Id': '291C1CD0-051A-4123-9B4B-30D60EF52EE2',
|
||||||
};
|
};
|
||||||
function fromMarketplace(extensionName, version) {
|
function fromMarketplace(extensionName, version) {
|
||||||
var filterType = 7;
|
var filterType = 7;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import * as File from 'vinyl';
|
|||||||
export function fromLocal(extensionPath: string): Stream {
|
export function fromLocal(extensionPath: string): Stream {
|
||||||
const result = es.through();
|
const result = es.through();
|
||||||
|
|
||||||
vsce.listFiles({ cwd: extensionPath })
|
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn })
|
||||||
.then(fileNames => {
|
.then(fileNames => {
|
||||||
const files = fileNames
|
const files = fileNames
|
||||||
.map(fileName => path.join(extensionPath, fileName))
|
.map(fileName => path.join(extensionPath, fileName))
|
||||||
@@ -49,6 +49,7 @@ function error(err: any): Stream {
|
|||||||
const baseHeaders = {
|
const baseHeaders = {
|
||||||
'X-Market-Client-Id': 'VSCode Build',
|
'X-Market-Client-Id': 'VSCode Build',
|
||||||
'User-Agent': 'VSCode Build',
|
'User-Agent': 'VSCode Build',
|
||||||
|
'X-Market-User-Id': '291C1CD0-051A-4123-9B4B-30D60EF52EE2',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function fromMarketplace(extensionName: string, version: string): Stream {
|
export function fromMarketplace(extensionName: string, version: string): Stream {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,10 @@
|
|||||||
"name": "vs/workbench/parts/codeEditor",
|
"name": "vs/workbench/parts/codeEditor",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/parts/comments",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/parts/debug",
|
"name": "vs/workbench/parts/debug",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
@@ -46,10 +50,6 @@
|
|||||||
"name": "vs/workbench/parts/execution",
|
"name": "vs/workbench/parts/execution",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "vs/workbench/parts/explorers",
|
|
||||||
"project": "vscode-workbench"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/parts/extensions",
|
"name": "vs/workbench/parts/extensions",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
@@ -71,7 +71,15 @@
|
|||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/parts/nps",
|
"name": "vs/workbench/parts/localizations",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/parts/logs",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/parts/navigation",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -130,22 +138,50 @@
|
|||||||
"name": "vs/workbench/parts/update",
|
"name": "vs/workbench/parts/update",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/parts/url",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/parts/watermark",
|
"name": "vs/workbench/parts/watermark",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/parts/webview",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/parts/welcome",
|
"name": "vs/workbench/parts/welcome",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/parts/outline",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/services/actions",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/services/bulkEdit",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/services/configuration",
|
"name": "vs/workbench/services/configuration",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/services/configurationResolver",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/services/crashReporter",
|
"name": "vs/workbench/services/crashReporter",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/services/dialogs",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/services/editor",
|
"name": "vs/workbench/services/editor",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
@@ -154,6 +190,10 @@
|
|||||||
"name": "vs/workbench/services/extensions",
|
"name": "vs/workbench/services/extensions",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/services/jsonschemas",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/services/files",
|
"name": "vs/workbench/services/files",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
@@ -162,10 +202,6 @@
|
|||||||
"name": "vs/workbench/services/keybinding",
|
"name": "vs/workbench/services/keybinding",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "vs/workbench/services/message",
|
|
||||||
"project": "vscode-workbench"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/services/mode",
|
"name": "vs/workbench/services/mode",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
@@ -195,8 +231,8 @@
|
|||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "setup_messages",
|
"name": "vs/workbench/services/preferences",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-preferences"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
1043
build/lib/i18n.ts
1043
build/lib/i18n.ts
File diff suppressed because it is too large
Load Diff
@@ -79,7 +79,7 @@ function isImportNode(node) {
|
|||||||
function fileFrom(file, contents, path) {
|
function fileFrom(file, contents, path) {
|
||||||
if (path === void 0) { path = file.path; }
|
if (path === void 0) { path = file.path; }
|
||||||
return new File({
|
return new File({
|
||||||
contents: new Buffer(contents),
|
contents: Buffer.from(contents),
|
||||||
base: file.base,
|
base: file.base,
|
||||||
cwd: file.cwd,
|
cwd: file.cwd,
|
||||||
path: path
|
path: path
|
||||||
@@ -150,13 +150,16 @@ function isImportNode(node) {
|
|||||||
.filter(function (d) { return d.importClause.namedBindings.kind === ts.SyntaxKind.NamespaceImport; })
|
.filter(function (d) { return d.importClause.namedBindings.kind === ts.SyntaxKind.NamespaceImport; })
|
||||||
.map(function (d) { return d.importClause.namedBindings.name; })
|
.map(function (d) { return d.importClause.namedBindings.name; })
|
||||||
.concat(importEqualsDeclarations.map(function (d) { return d.name; }))
|
.concat(importEqualsDeclarations.map(function (d) { return d.name; }))
|
||||||
|
// find read-only references to `nls`
|
||||||
.map(function (n) { return service.getReferencesAtPosition(filename, n.pos + 1); })
|
.map(function (n) { return service.getReferencesAtPosition(filename, n.pos + 1); })
|
||||||
.flatten()
|
.flatten()
|
||||||
.filter(function (r) { return !r.isWriteAccess; })
|
.filter(function (r) { return !r.isWriteAccess; })
|
||||||
|
// find the deepest call expressions AST nodes that contain those references
|
||||||
.map(function (r) { return collect(sourceFile, function (n) { return isCallExpressionWithinTextSpanCollectStep(r.textSpan, n); }); })
|
.map(function (r) { return collect(sourceFile, function (n) { return isCallExpressionWithinTextSpanCollectStep(r.textSpan, n); }); })
|
||||||
.map(function (a) { return lazy(a).last(); })
|
.map(function (a) { return lazy(a).last(); })
|
||||||
.filter(function (n) { return !!n; })
|
.filter(function (n) { return !!n; })
|
||||||
.map(function (n) { return n; })
|
.map(function (n) { return n; })
|
||||||
|
// only `localize` calls
|
||||||
.filter(function (n) { return n.expression.kind === ts.SyntaxKind.PropertyAccessExpression && n.expression.name.getText() === 'localize'; });
|
.filter(function (n) { return n.expression.kind === ts.SyntaxKind.PropertyAccessExpression && n.expression.name.getText() === 'localize'; });
|
||||||
// `localize` named imports
|
// `localize` named imports
|
||||||
var allLocalizeImportDeclarations = importDeclarations
|
var allLocalizeImportDeclarations = importDeclarations
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ module nls {
|
|||||||
|
|
||||||
export function fileFrom(file: File, contents: string, path: string = file.path) {
|
export function fileFrom(file: File, contents: string, path: string = file.path) {
|
||||||
return new File({
|
return new File({
|
||||||
contents: new Buffer(contents),
|
contents: Buffer.from(contents),
|
||||||
base: file.base,
|
base: file.base,
|
||||||
cwd: file.cwd,
|
cwd: file.cwd,
|
||||||
path: path
|
path: path
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ var concat = require("gulp-concat");
|
|||||||
var VinylFile = require("vinyl");
|
var VinylFile = require("vinyl");
|
||||||
var bundle = require("./bundle");
|
var bundle = require("./bundle");
|
||||||
var util = require("./util");
|
var util = require("./util");
|
||||||
var i18n = require("./i18n");
|
|
||||||
var gulpUtil = require("gulp-util");
|
var gulpUtil = require("gulp-util");
|
||||||
var flatmap = require("gulp-flatmap");
|
var flatmap = require("gulp-flatmap");
|
||||||
var pump = require("pump");
|
var pump = require("pump");
|
||||||
@@ -40,26 +39,26 @@ function loaderConfig(emptyPaths) {
|
|||||||
}
|
}
|
||||||
exports.loaderConfig = loaderConfig;
|
exports.loaderConfig = loaderConfig;
|
||||||
var IS_OUR_COPYRIGHT_REGEXP = /Copyright \(C\) Microsoft Corporation/i;
|
var IS_OUR_COPYRIGHT_REGEXP = /Copyright \(C\) Microsoft Corporation/i;
|
||||||
function loader(bundledFileHeader, bundleLoader) {
|
function loader(src, bundledFileHeader, bundleLoader) {
|
||||||
var sources = [
|
var sources = [
|
||||||
'out-build/vs/loader.js'
|
src + "/vs/loader.js"
|
||||||
];
|
];
|
||||||
if (bundleLoader) {
|
if (bundleLoader) {
|
||||||
sources = sources.concat([
|
sources = sources.concat([
|
||||||
'out-build/vs/css.js',
|
src + "/vs/css.js",
|
||||||
'out-build/vs/nls.js'
|
src + "/vs/nls.js"
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
var isFirst = true;
|
var isFirst = true;
|
||||||
return (gulp
|
return (gulp
|
||||||
.src(sources, { base: 'out-build' })
|
.src(sources, { base: "" + src })
|
||||||
.pipe(es.through(function (data) {
|
.pipe(es.through(function (data) {
|
||||||
if (isFirst) {
|
if (isFirst) {
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
this.emit('data', new VinylFile({
|
this.emit('data', new VinylFile({
|
||||||
path: 'fake',
|
path: 'fake',
|
||||||
base: '',
|
base: '',
|
||||||
contents: new Buffer(bundledFileHeader)
|
contents: Buffer.from(bundledFileHeader)
|
||||||
}));
|
}));
|
||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
}
|
}
|
||||||
@@ -74,7 +73,7 @@ function loader(bundledFileHeader, bundleLoader) {
|
|||||||
return f;
|
return f;
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
function toConcatStream(bundledFileHeader, sources, dest) {
|
function toConcatStream(src, bundledFileHeader, sources, dest) {
|
||||||
var useSourcemaps = /\.js$/.test(dest) && !/\.nls\.js$/.test(dest);
|
var useSourcemaps = /\.js$/.test(dest) && !/\.nls\.js$/.test(dest);
|
||||||
// If a bundle ends up including in any of the sources our copyright, then
|
// If a bundle ends up including in any of the sources our copyright, then
|
||||||
// insert a fake source at the beginning of each bundle with our copyright
|
// insert a fake source at the beginning of each bundle with our copyright
|
||||||
@@ -94,23 +93,24 @@ function toConcatStream(bundledFileHeader, sources, dest) {
|
|||||||
}
|
}
|
||||||
var treatedSources = sources.map(function (source) {
|
var treatedSources = sources.map(function (source) {
|
||||||
var root = source.path ? REPO_ROOT_PATH.replace(/\\/g, '/') : '';
|
var root = source.path ? REPO_ROOT_PATH.replace(/\\/g, '/') : '';
|
||||||
var base = source.path ? root + '/out-build' : '';
|
var base = source.path ? root + ("/" + src) : '';
|
||||||
return new VinylFile({
|
return new VinylFile({
|
||||||
path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake',
|
path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake',
|
||||||
base: base,
|
base: base,
|
||||||
contents: new Buffer(source.contents)
|
contents: Buffer.from(source.contents)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return es.readArray(treatedSources)
|
return es.readArray(treatedSources)
|
||||||
.pipe(useSourcemaps ? util.loadSourcemaps() : es.through())
|
.pipe(useSourcemaps ? util.loadSourcemaps() : es.through())
|
||||||
.pipe(concat(dest));
|
.pipe(concat(dest));
|
||||||
}
|
}
|
||||||
function toBundleStream(bundledFileHeader, bundles) {
|
function toBundleStream(src, bundledFileHeader, bundles) {
|
||||||
return es.merge(bundles.map(function (bundle) {
|
return es.merge(bundles.map(function (bundle) {
|
||||||
return toConcatStream(bundledFileHeader, bundle.sources, bundle.dest);
|
return toConcatStream(src, bundledFileHeader, bundle.sources, bundle.dest);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
function optimizeTask(opts) {
|
function optimizeTask(opts) {
|
||||||
|
var src = opts.src;
|
||||||
var entryPoints = opts.entryPoints;
|
var entryPoints = opts.entryPoints;
|
||||||
var otherSources = opts.otherSources;
|
var otherSources = opts.otherSources;
|
||||||
var resources = opts.resources;
|
var resources = opts.resources;
|
||||||
@@ -126,7 +126,7 @@ function optimizeTask(opts) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return bundlesStream.emit('error', JSON.stringify(err));
|
return bundlesStream.emit('error', JSON.stringify(err));
|
||||||
}
|
}
|
||||||
toBundleStream(bundledFileHeader, result.files).pipe(bundlesStream);
|
toBundleStream(src, bundledFileHeader, result.files).pipe(bundlesStream);
|
||||||
// Remove css inlined resources
|
// Remove css inlined resources
|
||||||
var filteredResources = resources.slice();
|
var filteredResources = resources.slice();
|
||||||
result.cssInlinedResources.forEach(function (resource) {
|
result.cssInlinedResources.forEach(function (resource) {
|
||||||
@@ -135,22 +135,22 @@ function optimizeTask(opts) {
|
|||||||
}
|
}
|
||||||
filteredResources.push('!' + resource);
|
filteredResources.push('!' + resource);
|
||||||
});
|
});
|
||||||
gulp.src(filteredResources, { base: 'out-build' }).pipe(resourcesStream);
|
gulp.src(filteredResources, { base: "" + src }).pipe(resourcesStream);
|
||||||
var bundleInfoArray = [];
|
var bundleInfoArray = [];
|
||||||
if (opts.bundleInfo) {
|
if (opts.bundleInfo) {
|
||||||
bundleInfoArray.push(new VinylFile({
|
bundleInfoArray.push(new VinylFile({
|
||||||
path: 'bundleInfo.json',
|
path: 'bundleInfo.json',
|
||||||
base: '.',
|
base: '.',
|
||||||
contents: new Buffer(JSON.stringify(result.bundleData, null, '\t'))
|
contents: Buffer.from(JSON.stringify(result.bundleData, null, '\t'))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
es.readArray(bundleInfoArray).pipe(bundleInfoStream);
|
es.readArray(bundleInfoArray).pipe(bundleInfoStream);
|
||||||
});
|
});
|
||||||
var otherSourcesStream = es.through();
|
var otherSourcesStream = es.through();
|
||||||
var otherSourcesStreamArr = [];
|
var otherSourcesStreamArr = [];
|
||||||
gulp.src(otherSources, { base: 'out-build' })
|
gulp.src(otherSources, { base: "" + src })
|
||||||
.pipe(es.through(function (data) {
|
.pipe(es.through(function (data) {
|
||||||
otherSourcesStreamArr.push(toConcatStream(bundledFileHeader, [data], data.relative));
|
otherSourcesStreamArr.push(toConcatStream(src, bundledFileHeader, [data], data.relative));
|
||||||
}, function () {
|
}, function () {
|
||||||
if (!otherSourcesStreamArr.length) {
|
if (!otherSourcesStreamArr.length) {
|
||||||
setTimeout(function () { otherSourcesStream.emit('end'); }, 0);
|
setTimeout(function () { otherSourcesStream.emit('end'); }, 0);
|
||||||
@@ -159,22 +159,17 @@ function optimizeTask(opts) {
|
|||||||
es.merge(otherSourcesStreamArr).pipe(otherSourcesStream);
|
es.merge(otherSourcesStreamArr).pipe(otherSourcesStream);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
var result = es.merge(loader(bundledFileHeader, bundleLoader), bundlesStream, otherSourcesStream, resourcesStream, bundleInfoStream);
|
var result = es.merge(loader(src, bundledFileHeader, bundleLoader), bundlesStream, otherSourcesStream, resourcesStream, bundleInfoStream);
|
||||||
return result
|
return result
|
||||||
.pipe(sourcemaps.write('./', {
|
.pipe(sourcemaps.write('./', {
|
||||||
sourceRoot: null,
|
sourceRoot: null,
|
||||||
addComment: true,
|
addComment: true,
|
||||||
includeContent: true
|
includeContent: true
|
||||||
}))
|
|
||||||
.pipe(i18n.processNlsFiles({
|
|
||||||
fileHeader: bundledFileHeader,
|
|
||||||
languages: opts.languages
|
|
||||||
}))
|
}))
|
||||||
.pipe(gulp.dest(out));
|
.pipe(gulp.dest(out));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.optimizeTask = optimizeTask;
|
exports.optimizeTask = optimizeTask;
|
||||||
;
|
|
||||||
/**
|
/**
|
||||||
* Wrap around uglify and allow the preserveComments function
|
* Wrap around uglify and allow the preserveComments function
|
||||||
* to have a file "context" to include our copyright only once per file.
|
* to have a file "context" to include our copyright only once per file.
|
||||||
@@ -212,8 +207,7 @@ function uglifyWithCopyrights() {
|
|||||||
return stream.pipe(minify({
|
return stream.pipe(minify({
|
||||||
output: {
|
output: {
|
||||||
comments: preserveComments(f),
|
comments: preserveComments(f),
|
||||||
// linux tfs build agent is crashing, does this help?§
|
max_line_len: 1024
|
||||||
max_line_len: 3200000
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
@@ -238,4 +232,3 @@ function minifyTask(src, sourceMapBaseUrl) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.minifyTask = minifyTask;
|
exports.minifyTask = minifyTask;
|
||||||
;
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import * as concat from 'gulp-concat';
|
|||||||
import * as VinylFile from 'vinyl';
|
import * as VinylFile from 'vinyl';
|
||||||
import * as bundle from './bundle';
|
import * as bundle from './bundle';
|
||||||
import * as util from './util';
|
import * as util from './util';
|
||||||
import * as i18n from './i18n';
|
|
||||||
import * as gulpUtil from 'gulp-util';
|
import * as gulpUtil from 'gulp-util';
|
||||||
import * as flatmap from 'gulp-flatmap';
|
import * as flatmap from 'gulp-flatmap';
|
||||||
import * as pump from 'pump';
|
import * as pump from 'pump';
|
||||||
import * as sm from 'source-map';
|
import * as sm from 'source-map';
|
||||||
|
import { Language } from './i18n';
|
||||||
|
|
||||||
const REPO_ROOT_PATH = path.join(__dirname, '../..');
|
const REPO_ROOT_PATH = path.join(__dirname, '../..');
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ function log(prefix: string, message: string): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
export function loaderConfig(emptyPaths: string[]) {
|
export function loaderConfig(emptyPaths?: string[]) {
|
||||||
const result = {
|
const result = {
|
||||||
paths: {
|
paths: {
|
||||||
'vs': 'out-build/vs',
|
'vs': 'out-build/vs',
|
||||||
@@ -52,28 +52,28 @@ declare class FileSourceMap extends VinylFile {
|
|||||||
public sourceMap: sm.RawSourceMap;
|
public sourceMap: sm.RawSourceMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loader(bundledFileHeader: string, bundleLoader: boolean): NodeJS.ReadWriteStream {
|
function loader(src: string, bundledFileHeader: string, bundleLoader: boolean): NodeJS.ReadWriteStream {
|
||||||
let sources = [
|
let sources = [
|
||||||
'out-build/vs/loader.js'
|
`${src}/vs/loader.js`
|
||||||
];
|
];
|
||||||
if (bundleLoader) {
|
if (bundleLoader) {
|
||||||
sources = sources.concat([
|
sources = sources.concat([
|
||||||
'out-build/vs/css.js',
|
`${src}/vs/css.js`,
|
||||||
'out-build/vs/nls.js'
|
`${src}/vs/nls.js`
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let isFirst = true;
|
let isFirst = true;
|
||||||
return (
|
return (
|
||||||
gulp
|
gulp
|
||||||
.src(sources, { base: 'out-build' })
|
.src(sources, { base: `${src}` })
|
||||||
.pipe(es.through(function (data) {
|
.pipe(es.through(function (data) {
|
||||||
if (isFirst) {
|
if (isFirst) {
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
this.emit('data', new VinylFile({
|
this.emit('data', new VinylFile({
|
||||||
path: 'fake',
|
path: 'fake',
|
||||||
base: '',
|
base: '',
|
||||||
contents: new Buffer(bundledFileHeader)
|
contents: Buffer.from(bundledFileHeader)
|
||||||
}));
|
}));
|
||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
} else {
|
} else {
|
||||||
@@ -89,7 +89,7 @@ function loader(bundledFileHeader: string, bundleLoader: boolean): NodeJS.ReadWr
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toConcatStream(bundledFileHeader: string, sources: bundle.IFile[], dest: string): NodeJS.ReadWriteStream {
|
function toConcatStream(src: string, bundledFileHeader: string, sources: bundle.IFile[], dest: string): NodeJS.ReadWriteStream {
|
||||||
const useSourcemaps = /\.js$/.test(dest) && !/\.nls\.js$/.test(dest);
|
const useSourcemaps = /\.js$/.test(dest) && !/\.nls\.js$/.test(dest);
|
||||||
|
|
||||||
// If a bundle ends up including in any of the sources our copyright, then
|
// If a bundle ends up including in any of the sources our copyright, then
|
||||||
@@ -112,12 +112,12 @@ function toConcatStream(bundledFileHeader: string, sources: bundle.IFile[], dest
|
|||||||
|
|
||||||
const treatedSources = sources.map(function (source) {
|
const treatedSources = sources.map(function (source) {
|
||||||
const root = source.path ? REPO_ROOT_PATH.replace(/\\/g, '/') : '';
|
const root = source.path ? REPO_ROOT_PATH.replace(/\\/g, '/') : '';
|
||||||
const base = source.path ? root + '/out-build' : '';
|
const base = source.path ? root + `/${src}` : '';
|
||||||
|
|
||||||
return new VinylFile({
|
return new VinylFile({
|
||||||
path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake',
|
path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake',
|
||||||
base: base,
|
base: base,
|
||||||
contents: new Buffer(source.contents)
|
contents: Buffer.from(source.contents)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -126,13 +126,17 @@ function toConcatStream(bundledFileHeader: string, sources: bundle.IFile[], dest
|
|||||||
.pipe(concat(dest));
|
.pipe(concat(dest));
|
||||||
}
|
}
|
||||||
|
|
||||||
function toBundleStream(bundledFileHeader: string, bundles: bundle.IConcatFile[]): NodeJS.ReadWriteStream {
|
function toBundleStream(src:string, bundledFileHeader: string, bundles: bundle.IConcatFile[]): NodeJS.ReadWriteStream {
|
||||||
return es.merge(bundles.map(function (bundle) {
|
return es.merge(bundles.map(function (bundle) {
|
||||||
return toConcatStream(bundledFileHeader, bundle.sources, bundle.dest);
|
return toConcatStream(src, bundledFileHeader, bundle.sources, bundle.dest);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IOptimizeTaskOpts {
|
export interface IOptimizeTaskOpts {
|
||||||
|
/**
|
||||||
|
* The folder to read files from.
|
||||||
|
*/
|
||||||
|
src: string;
|
||||||
/**
|
/**
|
||||||
* (for AMD files, will get bundled and get Copyright treatment)
|
* (for AMD files, will get bundled and get Copyright treatment)
|
||||||
*/
|
*/
|
||||||
@@ -163,11 +167,13 @@ export interface IOptimizeTaskOpts {
|
|||||||
*/
|
*/
|
||||||
out: string;
|
out: string;
|
||||||
/**
|
/**
|
||||||
* (languages to process)
|
* (out folder name)
|
||||||
*/
|
*/
|
||||||
languages: string[];
|
languages?: Language[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStream {
|
export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStream {
|
||||||
|
const src = opts.src;
|
||||||
const entryPoints = opts.entryPoints;
|
const entryPoints = opts.entryPoints;
|
||||||
const otherSources = opts.otherSources;
|
const otherSources = opts.otherSources;
|
||||||
const resources = opts.resources;
|
const resources = opts.resources;
|
||||||
@@ -184,7 +190,7 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
|||||||
bundle.bundle(entryPoints, loaderConfig, function (err, result) {
|
bundle.bundle(entryPoints, loaderConfig, function (err, result) {
|
||||||
if (err) { return bundlesStream.emit('error', JSON.stringify(err)); }
|
if (err) { return bundlesStream.emit('error', JSON.stringify(err)); }
|
||||||
|
|
||||||
toBundleStream(bundledFileHeader, result.files).pipe(bundlesStream);
|
toBundleStream(src, bundledFileHeader, result.files).pipe(bundlesStream);
|
||||||
|
|
||||||
// Remove css inlined resources
|
// Remove css inlined resources
|
||||||
const filteredResources = resources.slice();
|
const filteredResources = resources.slice();
|
||||||
@@ -194,14 +200,14 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
|||||||
}
|
}
|
||||||
filteredResources.push('!' + resource);
|
filteredResources.push('!' + resource);
|
||||||
});
|
});
|
||||||
gulp.src(filteredResources, { base: 'out-build' }).pipe(resourcesStream);
|
gulp.src(filteredResources, { base: `${src}` }).pipe(resourcesStream);
|
||||||
|
|
||||||
const bundleInfoArray: VinylFile[] = [];
|
const bundleInfoArray: VinylFile[] = [];
|
||||||
if (opts.bundleInfo) {
|
if (opts.bundleInfo) {
|
||||||
bundleInfoArray.push(new VinylFile({
|
bundleInfoArray.push(new VinylFile({
|
||||||
path: 'bundleInfo.json',
|
path: 'bundleInfo.json',
|
||||||
base: '.',
|
base: '.',
|
||||||
contents: new Buffer(JSON.stringify(result.bundleData, null, '\t'))
|
contents: Buffer.from(JSON.stringify(result.bundleData, null, '\t'))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
es.readArray(bundleInfoArray).pipe(bundleInfoStream);
|
es.readArray(bundleInfoArray).pipe(bundleInfoStream);
|
||||||
@@ -210,9 +216,9 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
|||||||
const otherSourcesStream = es.through();
|
const otherSourcesStream = es.through();
|
||||||
const otherSourcesStreamArr: NodeJS.ReadWriteStream[] = [];
|
const otherSourcesStreamArr: NodeJS.ReadWriteStream[] = [];
|
||||||
|
|
||||||
gulp.src(otherSources, { base: 'out-build' })
|
gulp.src(otherSources, { base: `${src}` })
|
||||||
.pipe(es.through(function (data) {
|
.pipe(es.through(function (data) {
|
||||||
otherSourcesStreamArr.push(toConcatStream(bundledFileHeader, [data], data.relative));
|
otherSourcesStreamArr.push(toConcatStream(src, bundledFileHeader, [data], data.relative));
|
||||||
}, function () {
|
}, function () {
|
||||||
if (!otherSourcesStreamArr.length) {
|
if (!otherSourcesStreamArr.length) {
|
||||||
setTimeout(function () { otherSourcesStream.emit('end'); }, 0);
|
setTimeout(function () { otherSourcesStream.emit('end'); }, 0);
|
||||||
@@ -222,7 +228,7 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const result = es.merge(
|
const result = es.merge(
|
||||||
loader(bundledFileHeader, bundleLoader),
|
loader(src, bundledFileHeader, bundleLoader),
|
||||||
bundlesStream,
|
bundlesStream,
|
||||||
otherSourcesStream,
|
otherSourcesStream,
|
||||||
resourcesStream,
|
resourcesStream,
|
||||||
@@ -235,13 +241,9 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
|||||||
addComment: true,
|
addComment: true,
|
||||||
includeContent: true
|
includeContent: true
|
||||||
}))
|
}))
|
||||||
.pipe(i18n.processNlsFiles({
|
|
||||||
fileHeader: bundledFileHeader,
|
|
||||||
languages: opts.languages
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest(out));
|
.pipe(gulp.dest(out));
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
declare class FileWithCopyright extends VinylFile {
|
declare class FileWithCopyright extends VinylFile {
|
||||||
public __hasOurCopyright: boolean;
|
public __hasOurCopyright: boolean;
|
||||||
@@ -287,8 +289,7 @@ function uglifyWithCopyrights(): NodeJS.ReadWriteStream {
|
|||||||
return stream.pipe(minify({
|
return stream.pipe(minify({
|
||||||
output: {
|
output: {
|
||||||
comments: preserveComments(<FileWithCopyright>f),
|
comments: preserveComments(<FileWithCopyright>f),
|
||||||
// linux tfs build agent is crashing, does this help?§
|
max_line_len: 1024
|
||||||
max_line_len: 3200000
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
@@ -296,7 +297,7 @@ function uglifyWithCopyrights(): NodeJS.ReadWriteStream {
|
|||||||
return es.duplex(input, output);
|
return es.duplex(input, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function minifyTask(src: string, sourceMapBaseUrl: string): (cb: any) => void {
|
export function minifyTask(src: string, sourceMapBaseUrl?: string): (cb: any) => void {
|
||||||
const sourceMappingURL = sourceMapBaseUrl && (f => `${sourceMapBaseUrl}/${f.relative}.map`);
|
const sourceMappingURL = sourceMapBaseUrl && (f => `${sourceMapBaseUrl}/${f.relative}.map`);
|
||||||
|
|
||||||
return cb => {
|
return cb => {
|
||||||
@@ -327,4 +328,4 @@ export function minifyTask(src: string, sourceMapBaseUrl: string): (cb: any) =>
|
|||||||
cb(err);
|
cb(err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -34,7 +34,13 @@ catch (err) {
|
|||||||
}
|
}
|
||||||
function log() {
|
function log() {
|
||||||
var errors = _.flatten(allErrors);
|
var errors = _.flatten(allErrors);
|
||||||
errors.map(function (err) { return util.log(util.colors.red('Error') + ": " + err); });
|
var seen = new Set();
|
||||||
|
errors.map(function (err) {
|
||||||
|
if (!seen.has(err)) {
|
||||||
|
seen.add(err);
|
||||||
|
util.log(util.colors.red('Error') + ": " + err);
|
||||||
|
}
|
||||||
|
});
|
||||||
var regex = /^([^(]+)\((\d+),(\d+)\): (.*)$/;
|
var regex = /^([^(]+)\((\d+),(\d+)\): (.*)$/;
|
||||||
var messages = errors
|
var messages = errors
|
||||||
.map(function (err) { return regex.exec(err); })
|
.map(function (err) { return regex.exec(err); })
|
||||||
@@ -67,8 +73,13 @@ function createReporter() {
|
|||||||
return es.through(null, function () {
|
return es.through(null, function () {
|
||||||
onEnd();
|
onEnd();
|
||||||
if (emitError && errors.length > 0) {
|
if (emitError && errors.length > 0) {
|
||||||
log();
|
errors.__logged__ = true;
|
||||||
this.emit('error');
|
if (!errors.__logged__) {
|
||||||
|
log();
|
||||||
|
}
|
||||||
|
var err = new Error("Found " + errors.length + " errors");
|
||||||
|
err.__reporter__ = true;
|
||||||
|
this.emit('error', err);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.emit('end');
|
this.emit('end');
|
||||||
@@ -80,4 +91,3 @@ function createReporter() {
|
|||||||
return ReportFunc;
|
return ReportFunc;
|
||||||
}
|
}
|
||||||
exports.createReporter = createReporter;
|
exports.createReporter = createReporter;
|
||||||
;
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import * as util from 'gulp-util';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
const allErrors: Error[][] = [];
|
const allErrors: string[][] = [];
|
||||||
let startTime: number = null;
|
let startTime: number = null;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
@@ -42,7 +42,14 @@ try {
|
|||||||
|
|
||||||
function log(): void {
|
function log(): void {
|
||||||
const errors = _.flatten(allErrors);
|
const errors = _.flatten(allErrors);
|
||||||
errors.map(err => util.log(`${util.colors.red('Error')}: ${err}`));
|
const seen = new Set<string>();
|
||||||
|
|
||||||
|
errors.map(err => {
|
||||||
|
if (!seen.has(err)) {
|
||||||
|
seen.add(err);
|
||||||
|
util.log(`${util.colors.red('Error')}: ${err}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const regex = /^([^(]+)\((\d+),(\d+)\): (.*)$/;
|
const regex = /^([^(]+)\((\d+),(\d+)\): (.*)$/;
|
||||||
const messages = errors
|
const messages = errors
|
||||||
@@ -61,17 +68,17 @@ function log(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IReporter {
|
export interface IReporter {
|
||||||
(err: Error): void;
|
(err: string): void;
|
||||||
hasErrors(): boolean;
|
hasErrors(): boolean;
|
||||||
end(emitError: boolean): NodeJS.ReadWriteStream;
|
end(emitError: boolean): NodeJS.ReadWriteStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createReporter(): IReporter {
|
export function createReporter(): IReporter {
|
||||||
const errors: Error[] = [];
|
const errors: string[] = [];
|
||||||
allErrors.push(errors);
|
allErrors.push(errors);
|
||||||
|
|
||||||
class ReportFunc {
|
class ReportFunc {
|
||||||
constructor(err: Error) {
|
constructor(err: string) {
|
||||||
errors.push(err);
|
errors.push(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,8 +94,15 @@ export function createReporter(): IReporter {
|
|||||||
onEnd();
|
onEnd();
|
||||||
|
|
||||||
if (emitError && errors.length > 0) {
|
if (emitError && errors.length > 0) {
|
||||||
log();
|
(errors as any).__logged__ = true;
|
||||||
this.emit('error');
|
|
||||||
|
if (!(errors as any).__logged__) {
|
||||||
|
log();
|
||||||
|
}
|
||||||
|
|
||||||
|
const err = new Error(`Found ${errors.length} errors`);
|
||||||
|
(err as any).__reporter__ = true;
|
||||||
|
this.emit('error', err);
|
||||||
} else {
|
} else {
|
||||||
this.emit('end');
|
this.emit('end');
|
||||||
}
|
}
|
||||||
@@ -97,4 +111,4 @@ export function createReporter(): IReporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return <IReporter><any>ReportFunc;
|
return <IReporter><any>ReportFunc;
|
||||||
};
|
}
|
||||||
|
|||||||
349
build/lib/standalone.js
Normal file
349
build/lib/standalone.js
Normal file
@@ -0,0 +1,349 @@
|
|||||||
|
"use strict";
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var ts = require("typescript");
|
||||||
|
var fs = require("fs");
|
||||||
|
var path = require("path");
|
||||||
|
var tss = require("./treeshaking");
|
||||||
|
var REPO_ROOT = path.join(__dirname, '../../');
|
||||||
|
var SRC_DIR = path.join(REPO_ROOT, 'src');
|
||||||
|
var OUT_EDITOR = path.join(REPO_ROOT, 'out-editor');
|
||||||
|
var dirCache = {};
|
||||||
|
function writeFile(filePath, contents) {
|
||||||
|
function ensureDirs(dirPath) {
|
||||||
|
if (dirCache[dirPath]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dirCache[dirPath] = true;
|
||||||
|
ensureDirs(path.dirname(dirPath));
|
||||||
|
if (fs.existsSync(dirPath)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.mkdirSync(dirPath);
|
||||||
|
}
|
||||||
|
ensureDirs(path.dirname(filePath));
|
||||||
|
fs.writeFileSync(filePath, contents);
|
||||||
|
}
|
||||||
|
function extractEditor(options) {
|
||||||
|
var result = tss.shake(options);
|
||||||
|
for (var fileName in result) {
|
||||||
|
if (result.hasOwnProperty(fileName)) {
|
||||||
|
writeFile(path.join(options.destRoot, fileName), result[fileName]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var copied = {};
|
||||||
|
var copyFile = function (fileName) {
|
||||||
|
if (copied[fileName]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
copied[fileName] = true;
|
||||||
|
var srcPath = path.join(options.sourcesRoot, fileName);
|
||||||
|
var dstPath = path.join(options.destRoot, fileName);
|
||||||
|
writeFile(dstPath, fs.readFileSync(srcPath));
|
||||||
|
};
|
||||||
|
var writeOutputFile = function (fileName, contents) {
|
||||||
|
writeFile(path.join(options.destRoot, fileName), contents);
|
||||||
|
};
|
||||||
|
for (var fileName in result) {
|
||||||
|
if (result.hasOwnProperty(fileName)) {
|
||||||
|
var fileContents = result[fileName];
|
||||||
|
var info = ts.preProcessFile(fileContents);
|
||||||
|
for (var i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||||
|
var importedFileName = info.importedFiles[i].fileName;
|
||||||
|
var importedFilePath = void 0;
|
||||||
|
if (/^vs\/css!/.test(importedFileName)) {
|
||||||
|
importedFilePath = importedFileName.substr('vs/css!'.length) + '.css';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
importedFilePath = importedFileName;
|
||||||
|
}
|
||||||
|
if (/(^\.\/)|(^\.\.\/)/.test(importedFilePath)) {
|
||||||
|
importedFilePath = path.join(path.dirname(fileName), importedFilePath);
|
||||||
|
}
|
||||||
|
if (/\.css$/.test(importedFilePath)) {
|
||||||
|
transportCSS(importedFilePath, copyFile, writeOutputFile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (fs.existsSync(path.join(options.sourcesRoot, importedFilePath + '.js'))) {
|
||||||
|
copyFile(importedFilePath + '.js');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var tsConfig = JSON.parse(fs.readFileSync(path.join(options.sourcesRoot, 'tsconfig.json')).toString());
|
||||||
|
tsConfig.compilerOptions.noUnusedLocals = false;
|
||||||
|
writeOutputFile('tsconfig.json', JSON.stringify(tsConfig, null, '\t'));
|
||||||
|
[
|
||||||
|
'vs/css.build.js',
|
||||||
|
'vs/css.d.ts',
|
||||||
|
'vs/css.js',
|
||||||
|
'vs/loader.js',
|
||||||
|
'vs/monaco.d.ts',
|
||||||
|
'vs/nls.build.js',
|
||||||
|
'vs/nls.d.ts',
|
||||||
|
'vs/nls.js',
|
||||||
|
'vs/nls.mock.ts',
|
||||||
|
'typings/lib.ie11_safe_es6.d.ts',
|
||||||
|
'typings/thenable.d.ts',
|
||||||
|
'typings/es6-promise.d.ts',
|
||||||
|
'typings/require.d.ts',
|
||||||
|
].forEach(copyFile);
|
||||||
|
}
|
||||||
|
exports.extractEditor = extractEditor;
|
||||||
|
function createESMSourcesAndResources(options) {
|
||||||
|
var OUT_FOLDER = path.join(REPO_ROOT, options.outFolder);
|
||||||
|
var OUT_RESOURCES_FOLDER = path.join(REPO_ROOT, options.outResourcesFolder);
|
||||||
|
var in_queue = Object.create(null);
|
||||||
|
var queue = [];
|
||||||
|
var enqueue = function (module) {
|
||||||
|
if (in_queue[module]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
in_queue[module] = true;
|
||||||
|
queue.push(module);
|
||||||
|
};
|
||||||
|
var seenDir = {};
|
||||||
|
var createDirectoryRecursive = function (dir) {
|
||||||
|
if (seenDir[dir]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var lastSlash = dir.lastIndexOf('/');
|
||||||
|
if (lastSlash === -1) {
|
||||||
|
lastSlash = dir.lastIndexOf('\\');
|
||||||
|
}
|
||||||
|
if (lastSlash !== -1) {
|
||||||
|
createDirectoryRecursive(dir.substring(0, lastSlash));
|
||||||
|
}
|
||||||
|
seenDir[dir] = true;
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(dir);
|
||||||
|
}
|
||||||
|
catch (err) { }
|
||||||
|
};
|
||||||
|
seenDir[REPO_ROOT] = true;
|
||||||
|
var toggleComments = function (fileContents) {
|
||||||
|
var lines = fileContents.split(/\r\n|\r|\n/);
|
||||||
|
var mode = 0;
|
||||||
|
for (var i = 0; i < lines.length; i++) {
|
||||||
|
var line = lines[i];
|
||||||
|
if (mode === 0) {
|
||||||
|
if (/\/\/ ESM-comment-begin/.test(line)) {
|
||||||
|
mode = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (/\/\/ ESM-uncomment-begin/.test(line)) {
|
||||||
|
mode = 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (mode === 1) {
|
||||||
|
if (/\/\/ ESM-comment-end/.test(line)) {
|
||||||
|
mode = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines[i] = '// ' + line;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (mode === 2) {
|
||||||
|
if (/\/\/ ESM-uncomment-end/.test(line)) {
|
||||||
|
mode = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines[i] = line.replace(/^(\s*)\/\/ ?/, function (_, indent) {
|
||||||
|
return indent;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
};
|
||||||
|
var write = function (filePath, contents) {
|
||||||
|
var absoluteFilePath;
|
||||||
|
if (/\.ts$/.test(filePath)) {
|
||||||
|
absoluteFilePath = path.join(OUT_FOLDER, filePath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
absoluteFilePath = path.join(OUT_RESOURCES_FOLDER, filePath);
|
||||||
|
}
|
||||||
|
createDirectoryRecursive(path.dirname(absoluteFilePath));
|
||||||
|
if (/(\.ts$)|(\.js$)/.test(filePath)) {
|
||||||
|
contents = toggleComments(contents.toString());
|
||||||
|
}
|
||||||
|
fs.writeFileSync(absoluteFilePath, contents);
|
||||||
|
};
|
||||||
|
options.entryPoints.forEach(function (entryPoint) { return enqueue(entryPoint); });
|
||||||
|
while (queue.length > 0) {
|
||||||
|
var module_1 = queue.shift();
|
||||||
|
if (transportCSS(module_1, enqueue, write)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (transportResource(options, module_1, enqueue, write)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (transportDTS(options, module_1, enqueue, write)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var filename = void 0;
|
||||||
|
if (options.redirects[module_1]) {
|
||||||
|
filename = path.join(SRC_DIR, options.redirects[module_1] + '.ts');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
filename = path.join(SRC_DIR, module_1 + '.ts');
|
||||||
|
}
|
||||||
|
var fileContents = fs.readFileSync(filename).toString();
|
||||||
|
var info = ts.preProcessFile(fileContents);
|
||||||
|
for (var i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||||
|
var importedFilename = info.importedFiles[i].fileName;
|
||||||
|
var pos = info.importedFiles[i].pos;
|
||||||
|
var end = info.importedFiles[i].end;
|
||||||
|
var importedFilepath = void 0;
|
||||||
|
if (/^vs\/css!/.test(importedFilename)) {
|
||||||
|
importedFilepath = importedFilename.substr('vs/css!'.length) + '.css';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
importedFilepath = importedFilename;
|
||||||
|
}
|
||||||
|
if (/(^\.\/)|(^\.\.\/)/.test(importedFilepath)) {
|
||||||
|
importedFilepath = path.join(path.dirname(module_1), importedFilepath);
|
||||||
|
}
|
||||||
|
enqueue(importedFilepath);
|
||||||
|
var relativePath = void 0;
|
||||||
|
if (importedFilepath === path.dirname(module_1)) {
|
||||||
|
relativePath = '../' + path.basename(path.dirname(module_1));
|
||||||
|
}
|
||||||
|
else if (importedFilepath === path.dirname(path.dirname(module_1))) {
|
||||||
|
relativePath = '../../' + path.basename(path.dirname(path.dirname(module_1)));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
relativePath = path.relative(path.dirname(module_1), importedFilepath);
|
||||||
|
}
|
||||||
|
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
|
||||||
|
relativePath = './' + relativePath;
|
||||||
|
}
|
||||||
|
fileContents = (fileContents.substring(0, pos + 1)
|
||||||
|
+ relativePath
|
||||||
|
+ fileContents.substring(end + 1));
|
||||||
|
}
|
||||||
|
fileContents = fileContents.replace(/import ([a-zA-z0-9]+) = require\(('[^']+')\);/g, function (_, m1, m2) {
|
||||||
|
return "import * as " + m1 + " from " + m2 + ";";
|
||||||
|
});
|
||||||
|
fileContents = fileContents.replace(/Thenable/g, 'PromiseLike');
|
||||||
|
write(module_1 + '.ts', fileContents);
|
||||||
|
}
|
||||||
|
var esm_opts = {
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": path.relative(path.dirname(OUT_FOLDER), OUT_RESOURCES_FOLDER),
|
||||||
|
"rootDir": "src",
|
||||||
|
"module": "es6",
|
||||||
|
"target": "es5",
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"es5",
|
||||||
|
"es2015.collection",
|
||||||
|
"es2015.promise"
|
||||||
|
],
|
||||||
|
"types": []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fs.writeFileSync(path.join(path.dirname(OUT_FOLDER), 'tsconfig.json'), JSON.stringify(esm_opts, null, '\t'));
|
||||||
|
var monacodts = fs.readFileSync(path.join(SRC_DIR, 'vs/monaco.d.ts')).toString();
|
||||||
|
fs.writeFileSync(path.join(OUT_FOLDER, 'vs/monaco.d.ts'), monacodts);
|
||||||
|
}
|
||||||
|
exports.createESMSourcesAndResources = createESMSourcesAndResources;
|
||||||
|
function transportCSS(module, enqueue, write) {
|
||||||
|
if (!/\.css/.test(module)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var filename = path.join(SRC_DIR, module);
|
||||||
|
var fileContents = fs.readFileSync(filename).toString();
|
||||||
|
var inlineResources = 'base64'; // see https://github.com/Microsoft/monaco-editor/issues/148
|
||||||
|
var inlineResourcesLimit = 300000; //3000; // see https://github.com/Microsoft/monaco-editor/issues/336
|
||||||
|
var newContents = _rewriteOrInlineUrls(fileContents, inlineResources === 'base64', inlineResourcesLimit);
|
||||||
|
write(module, newContents);
|
||||||
|
return true;
|
||||||
|
function _rewriteOrInlineUrls(contents, forceBase64, inlineByteLimit) {
|
||||||
|
return _replaceURL(contents, function (url) {
|
||||||
|
var imagePath = path.join(path.dirname(module), url);
|
||||||
|
var fileContents = fs.readFileSync(path.join(SRC_DIR, imagePath));
|
||||||
|
if (fileContents.length < inlineByteLimit) {
|
||||||
|
var MIME = /\.svg$/.test(url) ? 'image/svg+xml' : 'image/png';
|
||||||
|
var DATA = ';base64,' + fileContents.toString('base64');
|
||||||
|
if (!forceBase64 && /\.svg$/.test(url)) {
|
||||||
|
// .svg => url encode as explained at https://codepen.io/tigt/post/optimizing-svgs-in-data-uris
|
||||||
|
var newText = fileContents.toString()
|
||||||
|
.replace(/"/g, '\'')
|
||||||
|
.replace(/</g, '%3C')
|
||||||
|
.replace(/>/g, '%3E')
|
||||||
|
.replace(/&/g, '%26')
|
||||||
|
.replace(/#/g, '%23')
|
||||||
|
.replace(/\s+/g, ' ');
|
||||||
|
var encodedData = ',' + newText;
|
||||||
|
if (encodedData.length < DATA.length) {
|
||||||
|
DATA = encodedData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '"data:' + MIME + DATA + '"';
|
||||||
|
}
|
||||||
|
enqueue(imagePath);
|
||||||
|
return url;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function _replaceURL(contents, replacer) {
|
||||||
|
// Use ")" as the terminator as quotes are oftentimes not used at all
|
||||||
|
return contents.replace(/url\(\s*([^\)]+)\s*\)?/g, function (_) {
|
||||||
|
var matches = [];
|
||||||
|
for (var _i = 1; _i < arguments.length; _i++) {
|
||||||
|
matches[_i - 1] = arguments[_i];
|
||||||
|
}
|
||||||
|
var url = matches[0];
|
||||||
|
// Eliminate starting quotes (the initial whitespace is not captured)
|
||||||
|
if (url.charAt(0) === '"' || url.charAt(0) === '\'') {
|
||||||
|
url = url.substring(1);
|
||||||
|
}
|
||||||
|
// The ending whitespace is captured
|
||||||
|
while (url.length > 0 && (url.charAt(url.length - 1) === ' ' || url.charAt(url.length - 1) === '\t')) {
|
||||||
|
url = url.substring(0, url.length - 1);
|
||||||
|
}
|
||||||
|
// Eliminate ending quotes
|
||||||
|
if (url.charAt(url.length - 1) === '"' || url.charAt(url.length - 1) === '\'') {
|
||||||
|
url = url.substring(0, url.length - 1);
|
||||||
|
}
|
||||||
|
if (!_startsWith(url, 'data:') && !_startsWith(url, 'http://') && !_startsWith(url, 'https://')) {
|
||||||
|
url = replacer(url);
|
||||||
|
}
|
||||||
|
return 'url(' + url + ')';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function _startsWith(haystack, needle) {
|
||||||
|
return haystack.length >= needle.length && haystack.substr(0, needle.length) === needle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function transportResource(options, module, enqueue, write) {
|
||||||
|
if (!/\.svg/.test(module)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
write(module, fs.readFileSync(path.join(SRC_DIR, module)));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function transportDTS(options, module, enqueue, write) {
|
||||||
|
if (options.redirects[module] && fs.existsSync(path.join(SRC_DIR, options.redirects[module] + '.ts'))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(path.join(SRC_DIR, module + '.d.ts'))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
write(module + '.d.ts', fs.readFileSync(path.join(SRC_DIR, module + '.d.ts')));
|
||||||
|
var filename;
|
||||||
|
if (options.redirects[module]) {
|
||||||
|
write(module + '.js', fs.readFileSync(path.join(SRC_DIR, options.redirects[module] + '.js')));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
write(module + '.js', fs.readFileSync(path.join(SRC_DIR, module + '.js')));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
395
build/lib/standalone.ts
Normal file
395
build/lib/standalone.ts
Normal file
@@ -0,0 +1,395 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as ts from 'typescript';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as tss from './treeshaking';
|
||||||
|
|
||||||
|
const REPO_ROOT = path.join(__dirname, '../../');
|
||||||
|
const SRC_DIR = path.join(REPO_ROOT, 'src');
|
||||||
|
const OUT_EDITOR = path.join(REPO_ROOT, 'out-editor');
|
||||||
|
|
||||||
|
let dirCache: { [dir: string]: boolean; } = {};
|
||||||
|
|
||||||
|
function writeFile(filePath: string, contents: Buffer | string): void {
|
||||||
|
function ensureDirs(dirPath: string): void {
|
||||||
|
if (dirCache[dirPath]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dirCache[dirPath] = true;
|
||||||
|
|
||||||
|
ensureDirs(path.dirname(dirPath));
|
||||||
|
if (fs.existsSync(dirPath)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.mkdirSync(dirPath);
|
||||||
|
}
|
||||||
|
ensureDirs(path.dirname(filePath));
|
||||||
|
fs.writeFileSync(filePath, contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: string }): void {
|
||||||
|
let result = tss.shake(options);
|
||||||
|
for (let fileName in result) {
|
||||||
|
if (result.hasOwnProperty(fileName)) {
|
||||||
|
writeFile(path.join(options.destRoot, fileName), result[fileName]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let copied: { [fileName:string]: boolean; } = {};
|
||||||
|
const copyFile = (fileName: string) => {
|
||||||
|
if (copied[fileName]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
copied[fileName] = true;
|
||||||
|
const srcPath = path.join(options.sourcesRoot, fileName);
|
||||||
|
const dstPath = path.join(options.destRoot, fileName);
|
||||||
|
writeFile(dstPath, fs.readFileSync(srcPath));
|
||||||
|
};
|
||||||
|
const writeOutputFile = (fileName: string, contents: string) => {
|
||||||
|
writeFile(path.join(options.destRoot, fileName), contents);
|
||||||
|
};
|
||||||
|
for (let fileName in result) {
|
||||||
|
if (result.hasOwnProperty(fileName)) {
|
||||||
|
const fileContents = result[fileName];
|
||||||
|
const info = ts.preProcessFile(fileContents);
|
||||||
|
|
||||||
|
for (let i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||||
|
const importedFileName = info.importedFiles[i].fileName;
|
||||||
|
|
||||||
|
let importedFilePath: string;
|
||||||
|
if (/^vs\/css!/.test(importedFileName)) {
|
||||||
|
importedFilePath = importedFileName.substr('vs/css!'.length) + '.css';
|
||||||
|
} else {
|
||||||
|
importedFilePath = importedFileName;
|
||||||
|
}
|
||||||
|
if (/(^\.\/)|(^\.\.\/)/.test(importedFilePath)) {
|
||||||
|
importedFilePath = path.join(path.dirname(fileName), importedFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/\.css$/.test(importedFilePath)) {
|
||||||
|
transportCSS(importedFilePath, copyFile, writeOutputFile);
|
||||||
|
} else {
|
||||||
|
if (fs.existsSync(path.join(options.sourcesRoot, importedFilePath + '.js'))) {
|
||||||
|
copyFile(importedFilePath + '.js');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const tsConfig = JSON.parse(fs.readFileSync(path.join(options.sourcesRoot, 'tsconfig.json')).toString());
|
||||||
|
tsConfig.compilerOptions.noUnusedLocals = false;
|
||||||
|
writeOutputFile('tsconfig.json', JSON.stringify(tsConfig, null, '\t'));
|
||||||
|
|
||||||
|
[
|
||||||
|
'vs/css.build.js',
|
||||||
|
'vs/css.d.ts',
|
||||||
|
'vs/css.js',
|
||||||
|
'vs/loader.js',
|
||||||
|
'vs/monaco.d.ts',
|
||||||
|
'vs/nls.build.js',
|
||||||
|
'vs/nls.d.ts',
|
||||||
|
'vs/nls.js',
|
||||||
|
'vs/nls.mock.ts',
|
||||||
|
'typings/lib.ie11_safe_es6.d.ts',
|
||||||
|
'typings/thenable.d.ts',
|
||||||
|
'typings/es6-promise.d.ts',
|
||||||
|
'typings/require.d.ts',
|
||||||
|
].forEach(copyFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IOptions {
|
||||||
|
entryPoints: string[];
|
||||||
|
outFolder: string;
|
||||||
|
outResourcesFolder: string;
|
||||||
|
redirects: { [module: string]: string; };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createESMSourcesAndResources(options: IOptions): void {
|
||||||
|
const OUT_FOLDER = path.join(REPO_ROOT, options.outFolder);
|
||||||
|
const OUT_RESOURCES_FOLDER = path.join(REPO_ROOT, options.outResourcesFolder);
|
||||||
|
|
||||||
|
let in_queue: { [module: string]: boolean; } = Object.create(null);
|
||||||
|
let queue: string[] = [];
|
||||||
|
|
||||||
|
const enqueue = (module: string) => {
|
||||||
|
if (in_queue[module]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
in_queue[module] = true;
|
||||||
|
queue.push(module);
|
||||||
|
};
|
||||||
|
|
||||||
|
const seenDir: { [key: string]: boolean; } = {};
|
||||||
|
const createDirectoryRecursive = (dir: string) => {
|
||||||
|
if (seenDir[dir]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let lastSlash = dir.lastIndexOf('/');
|
||||||
|
if (lastSlash === -1) {
|
||||||
|
lastSlash = dir.lastIndexOf('\\');
|
||||||
|
}
|
||||||
|
if (lastSlash !== -1) {
|
||||||
|
createDirectoryRecursive(dir.substring(0, lastSlash));
|
||||||
|
}
|
||||||
|
seenDir[dir] = true;
|
||||||
|
try { fs.mkdirSync(dir); } catch (err) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
seenDir[REPO_ROOT] = true;
|
||||||
|
|
||||||
|
const toggleComments = (fileContents: string) => {
|
||||||
|
let lines = fileContents.split(/\r\n|\r|\n/);
|
||||||
|
let mode = 0;
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
const line = lines[i];
|
||||||
|
|
||||||
|
if (mode === 0) {
|
||||||
|
if (/\/\/ ESM-comment-begin/.test(line)) {
|
||||||
|
mode = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (/\/\/ ESM-uncomment-begin/.test(line)) {
|
||||||
|
mode = 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode === 1) {
|
||||||
|
if (/\/\/ ESM-comment-end/.test(line)) {
|
||||||
|
mode = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines[i] = '// ' + line;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode === 2) {
|
||||||
|
if (/\/\/ ESM-uncomment-end/.test(line)) {
|
||||||
|
mode = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines[i] = line.replace(/^(\s*)\/\/ ?/, function (_, indent) {
|
||||||
|
return indent;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines.join('\n');
|
||||||
|
};
|
||||||
|
|
||||||
|
const write = (filePath: string, contents: string | Buffer) => {
|
||||||
|
let absoluteFilePath: string;
|
||||||
|
if (/\.ts$/.test(filePath)) {
|
||||||
|
absoluteFilePath = path.join(OUT_FOLDER, filePath);
|
||||||
|
} else {
|
||||||
|
absoluteFilePath = path.join(OUT_RESOURCES_FOLDER, filePath);
|
||||||
|
}
|
||||||
|
createDirectoryRecursive(path.dirname(absoluteFilePath));
|
||||||
|
if (/(\.ts$)|(\.js$)/.test(filePath)) {
|
||||||
|
contents = toggleComments(contents.toString());
|
||||||
|
}
|
||||||
|
fs.writeFileSync(absoluteFilePath, contents);
|
||||||
|
};
|
||||||
|
|
||||||
|
options.entryPoints.forEach((entryPoint) => enqueue(entryPoint));
|
||||||
|
|
||||||
|
while (queue.length > 0) {
|
||||||
|
const module = queue.shift();
|
||||||
|
if (transportCSS(module, enqueue, write)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (transportResource(options, module, enqueue, write)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (transportDTS(options, module, enqueue, write)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let filename: string;
|
||||||
|
if (options.redirects[module]) {
|
||||||
|
filename = path.join(SRC_DIR, options.redirects[module] + '.ts');
|
||||||
|
} else {
|
||||||
|
filename = path.join(SRC_DIR, module + '.ts');
|
||||||
|
}
|
||||||
|
let fileContents = fs.readFileSync(filename).toString();
|
||||||
|
|
||||||
|
const info = ts.preProcessFile(fileContents);
|
||||||
|
|
||||||
|
for (let i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||||
|
const importedFilename = info.importedFiles[i].fileName;
|
||||||
|
const pos = info.importedFiles[i].pos;
|
||||||
|
const end = info.importedFiles[i].end;
|
||||||
|
|
||||||
|
let importedFilepath: string;
|
||||||
|
if (/^vs\/css!/.test(importedFilename)) {
|
||||||
|
importedFilepath = importedFilename.substr('vs/css!'.length) + '.css';
|
||||||
|
} else {
|
||||||
|
importedFilepath = importedFilename;
|
||||||
|
}
|
||||||
|
if (/(^\.\/)|(^\.\.\/)/.test(importedFilepath)) {
|
||||||
|
importedFilepath = path.join(path.dirname(module), importedFilepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
enqueue(importedFilepath);
|
||||||
|
|
||||||
|
let relativePath: string;
|
||||||
|
if (importedFilepath === path.dirname(module)) {
|
||||||
|
relativePath = '../' + path.basename(path.dirname(module));
|
||||||
|
} else if (importedFilepath === path.dirname(path.dirname(module))) {
|
||||||
|
relativePath = '../../' + path.basename(path.dirname(path.dirname(module)));
|
||||||
|
} else {
|
||||||
|
relativePath = path.relative(path.dirname(module), importedFilepath);
|
||||||
|
}
|
||||||
|
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
|
||||||
|
relativePath = './' + relativePath;
|
||||||
|
}
|
||||||
|
fileContents = (
|
||||||
|
fileContents.substring(0, pos + 1)
|
||||||
|
+ relativePath
|
||||||
|
+ fileContents.substring(end + 1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fileContents = fileContents.replace(/import ([a-zA-z0-9]+) = require\(('[^']+')\);/g, function (_, m1, m2) {
|
||||||
|
return `import * as ${m1} from ${m2};`;
|
||||||
|
});
|
||||||
|
fileContents = fileContents.replace(/Thenable/g, 'PromiseLike');
|
||||||
|
|
||||||
|
write(module + '.ts', fileContents);
|
||||||
|
}
|
||||||
|
|
||||||
|
const esm_opts = {
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": path.relative(path.dirname(OUT_FOLDER), OUT_RESOURCES_FOLDER),
|
||||||
|
"rootDir": "src",
|
||||||
|
"module": "es6",
|
||||||
|
"target": "es5",
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"es5",
|
||||||
|
"es2015.collection",
|
||||||
|
"es2015.promise"
|
||||||
|
],
|
||||||
|
"types": [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fs.writeFileSync(path.join(path.dirname(OUT_FOLDER), 'tsconfig.json'), JSON.stringify(esm_opts, null, '\t'));
|
||||||
|
|
||||||
|
const monacodts = fs.readFileSync(path.join(SRC_DIR, 'vs/monaco.d.ts')).toString();
|
||||||
|
fs.writeFileSync(path.join(OUT_FOLDER, 'vs/monaco.d.ts'), monacodts);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function transportCSS(module: string, enqueue: (module: string) => void, write: (path: string, contents: string | Buffer) => void): boolean {
|
||||||
|
|
||||||
|
if (!/\.css/.test(module)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const filename = path.join(SRC_DIR, module);
|
||||||
|
const fileContents = fs.readFileSync(filename).toString();
|
||||||
|
const inlineResources = 'base64'; // see https://github.com/Microsoft/monaco-editor/issues/148
|
||||||
|
const inlineResourcesLimit = 300000;//3000; // see https://github.com/Microsoft/monaco-editor/issues/336
|
||||||
|
|
||||||
|
const newContents = _rewriteOrInlineUrls(fileContents, inlineResources === 'base64', inlineResourcesLimit);
|
||||||
|
write(module, newContents);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
function _rewriteOrInlineUrls(contents: string, forceBase64: boolean, inlineByteLimit: number): string {
|
||||||
|
return _replaceURL(contents, (url) => {
|
||||||
|
let imagePath = path.join(path.dirname(module), url);
|
||||||
|
let fileContents = fs.readFileSync(path.join(SRC_DIR, imagePath));
|
||||||
|
|
||||||
|
if (fileContents.length < inlineByteLimit) {
|
||||||
|
const MIME = /\.svg$/.test(url) ? 'image/svg+xml' : 'image/png';
|
||||||
|
let DATA = ';base64,' + fileContents.toString('base64');
|
||||||
|
|
||||||
|
if (!forceBase64 && /\.svg$/.test(url)) {
|
||||||
|
// .svg => url encode as explained at https://codepen.io/tigt/post/optimizing-svgs-in-data-uris
|
||||||
|
let newText = fileContents.toString()
|
||||||
|
.replace(/"/g, '\'')
|
||||||
|
.replace(/</g, '%3C')
|
||||||
|
.replace(/>/g, '%3E')
|
||||||
|
.replace(/&/g, '%26')
|
||||||
|
.replace(/#/g, '%23')
|
||||||
|
.replace(/\s+/g, ' ');
|
||||||
|
let encodedData = ',' + newText;
|
||||||
|
if (encodedData.length < DATA.length) {
|
||||||
|
DATA = encodedData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '"data:' + MIME + DATA + '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
enqueue(imagePath);
|
||||||
|
return url;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function _replaceURL(contents: string, replacer: (url: string) => string): string {
|
||||||
|
// Use ")" as the terminator as quotes are oftentimes not used at all
|
||||||
|
return contents.replace(/url\(\s*([^\)]+)\s*\)?/g, (_: string, ...matches: string[]) => {
|
||||||
|
var url = matches[0];
|
||||||
|
// Eliminate starting quotes (the initial whitespace is not captured)
|
||||||
|
if (url.charAt(0) === '"' || url.charAt(0) === '\'') {
|
||||||
|
url = url.substring(1);
|
||||||
|
}
|
||||||
|
// The ending whitespace is captured
|
||||||
|
while (url.length > 0 && (url.charAt(url.length - 1) === ' ' || url.charAt(url.length - 1) === '\t')) {
|
||||||
|
url = url.substring(0, url.length - 1);
|
||||||
|
}
|
||||||
|
// Eliminate ending quotes
|
||||||
|
if (url.charAt(url.length - 1) === '"' || url.charAt(url.length - 1) === '\'') {
|
||||||
|
url = url.substring(0, url.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_startsWith(url, 'data:') && !_startsWith(url, 'http://') && !_startsWith(url, 'https://')) {
|
||||||
|
url = replacer(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'url(' + url + ')';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function _startsWith(haystack: string, needle: string): boolean {
|
||||||
|
return haystack.length >= needle.length && haystack.substr(0, needle.length) === needle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function transportResource(options: IOptions, module: string, enqueue: (module: string) => void, write: (path: string, contents: string | Buffer) => void): boolean {
|
||||||
|
|
||||||
|
if (!/\.svg/.test(module)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
write(module, fs.readFileSync(path.join(SRC_DIR, module)));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function transportDTS(options: IOptions, module: string, enqueue: (module: string) => void, write: (path: string, contents: string | Buffer) => void): boolean {
|
||||||
|
|
||||||
|
if (options.redirects[module] && fs.existsSync(path.join(SRC_DIR, options.redirects[module] + '.ts'))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fs.existsSync(path.join(SRC_DIR, module + '.d.ts'))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
write(module + '.d.ts', fs.readFileSync(path.join(SRC_DIR, module + '.d.ts')));
|
||||||
|
let filename: string;
|
||||||
|
if (options.redirects[module]) {
|
||||||
|
write(module + '.js', fs.readFileSync(path.join(SRC_DIR, options.redirects[module] + '.js')));
|
||||||
|
} else {
|
||||||
|
write(module + '.js', fs.readFileSync(path.join(SRC_DIR, module + '.js')));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
682
build/lib/treeshaking.js
Normal file
682
build/lib/treeshaking.js
Normal file
@@ -0,0 +1,682 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var fs = require("fs");
|
||||||
|
var path = require("path");
|
||||||
|
var ts = require("typescript");
|
||||||
|
var TYPESCRIPT_LIB_FOLDER = path.dirname(require.resolve('typescript/lib/lib.d.ts'));
|
||||||
|
var ShakeLevel;
|
||||||
|
(function (ShakeLevel) {
|
||||||
|
ShakeLevel[ShakeLevel["Files"] = 0] = "Files";
|
||||||
|
ShakeLevel[ShakeLevel["InnerFile"] = 1] = "InnerFile";
|
||||||
|
ShakeLevel[ShakeLevel["ClassMembers"] = 2] = "ClassMembers";
|
||||||
|
})(ShakeLevel = exports.ShakeLevel || (exports.ShakeLevel = {}));
|
||||||
|
function shake(options) {
|
||||||
|
var languageService = createTypeScriptLanguageService(options);
|
||||||
|
markNodes(languageService, options);
|
||||||
|
return generateResult(languageService, options.shakeLevel);
|
||||||
|
}
|
||||||
|
exports.shake = shake;
|
||||||
|
//#region Discovery, LanguageService & Setup
|
||||||
|
function createTypeScriptLanguageService(options) {
|
||||||
|
// Discover referenced files
|
||||||
|
var FILES = discoverAndReadFiles(options);
|
||||||
|
// Add fake usage files
|
||||||
|
options.inlineEntryPoints.forEach(function (inlineEntryPoint, index) {
|
||||||
|
FILES["inlineEntryPoint:" + index + ".ts"] = inlineEntryPoint;
|
||||||
|
});
|
||||||
|
// Resolve libs
|
||||||
|
var RESOLVED_LIBS = {};
|
||||||
|
options.libs.forEach(function (filename) {
|
||||||
|
var filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
|
||||||
|
RESOLVED_LIBS["defaultLib:" + filename] = fs.readFileSync(filepath).toString();
|
||||||
|
});
|
||||||
|
var host = new TypeScriptLanguageServiceHost(RESOLVED_LIBS, FILES, options.compilerOptions);
|
||||||
|
return ts.createLanguageService(host);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read imports and follow them until all files have been handled
|
||||||
|
*/
|
||||||
|
function discoverAndReadFiles(options) {
|
||||||
|
var FILES = {};
|
||||||
|
var in_queue = Object.create(null);
|
||||||
|
var queue = [];
|
||||||
|
var enqueue = function (moduleId) {
|
||||||
|
if (in_queue[moduleId]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
in_queue[moduleId] = true;
|
||||||
|
queue.push(moduleId);
|
||||||
|
};
|
||||||
|
options.entryPoints.forEach(function (entryPoint) { return enqueue(entryPoint); });
|
||||||
|
while (queue.length > 0) {
|
||||||
|
var moduleId = queue.shift();
|
||||||
|
var dts_filename = path.join(options.sourcesRoot, moduleId + '.d.ts');
|
||||||
|
if (fs.existsSync(dts_filename)) {
|
||||||
|
var dts_filecontents = fs.readFileSync(dts_filename).toString();
|
||||||
|
FILES[moduleId + '.d.ts'] = dts_filecontents;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var ts_filename = void 0;
|
||||||
|
if (options.redirects[moduleId]) {
|
||||||
|
ts_filename = path.join(options.sourcesRoot, options.redirects[moduleId] + '.ts');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ts_filename = path.join(options.sourcesRoot, moduleId + '.ts');
|
||||||
|
}
|
||||||
|
var ts_filecontents = fs.readFileSync(ts_filename).toString();
|
||||||
|
var info = ts.preProcessFile(ts_filecontents);
|
||||||
|
for (var i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||||
|
var importedFileName = info.importedFiles[i].fileName;
|
||||||
|
if (options.importIgnorePattern.test(importedFileName)) {
|
||||||
|
// Ignore vs/css! imports
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var importedModuleId = importedFileName;
|
||||||
|
if (/(^\.\/)|(^\.\.\/)/.test(importedModuleId)) {
|
||||||
|
importedModuleId = path.join(path.dirname(moduleId), importedModuleId);
|
||||||
|
}
|
||||||
|
enqueue(importedModuleId);
|
||||||
|
}
|
||||||
|
FILES[moduleId + '.ts'] = ts_filecontents;
|
||||||
|
}
|
||||||
|
return FILES;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A TypeScript language service host
|
||||||
|
*/
|
||||||
|
var TypeScriptLanguageServiceHost = /** @class */ (function () {
|
||||||
|
function TypeScriptLanguageServiceHost(libs, files, compilerOptions) {
|
||||||
|
this._libs = libs;
|
||||||
|
this._files = files;
|
||||||
|
this._compilerOptions = compilerOptions;
|
||||||
|
}
|
||||||
|
// --- language service host ---------------
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getCompilationSettings = function () {
|
||||||
|
return this._compilerOptions;
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getScriptFileNames = function () {
|
||||||
|
return ([]
|
||||||
|
.concat(Object.keys(this._libs))
|
||||||
|
.concat(Object.keys(this._files)));
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getScriptVersion = function (fileName) {
|
||||||
|
return '1';
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getProjectVersion = function () {
|
||||||
|
return '1';
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getScriptSnapshot = function (fileName) {
|
||||||
|
if (this._files.hasOwnProperty(fileName)) {
|
||||||
|
return ts.ScriptSnapshot.fromString(this._files[fileName]);
|
||||||
|
}
|
||||||
|
else if (this._libs.hasOwnProperty(fileName)) {
|
||||||
|
return ts.ScriptSnapshot.fromString(this._libs[fileName]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ts.ScriptSnapshot.fromString('');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getScriptKind = function (fileName) {
|
||||||
|
return ts.ScriptKind.TS;
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getCurrentDirectory = function () {
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getDefaultLibFileName = function (options) {
|
||||||
|
return 'defaultLib:lib.d.ts';
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.isDefaultLibFileName = function (fileName) {
|
||||||
|
return fileName === this.getDefaultLibFileName(this._compilerOptions);
|
||||||
|
};
|
||||||
|
return TypeScriptLanguageServiceHost;
|
||||||
|
}());
|
||||||
|
//#endregion
|
||||||
|
//#region Tree Shaking
|
||||||
|
var NodeColor;
|
||||||
|
(function (NodeColor) {
|
||||||
|
NodeColor[NodeColor["White"] = 0] = "White";
|
||||||
|
NodeColor[NodeColor["Gray"] = 1] = "Gray";
|
||||||
|
NodeColor[NodeColor["Black"] = 2] = "Black";
|
||||||
|
})(NodeColor || (NodeColor = {}));
|
||||||
|
function getColor(node) {
|
||||||
|
return node.$$$color || 0 /* White */;
|
||||||
|
}
|
||||||
|
function setColor(node, color) {
|
||||||
|
node.$$$color = color;
|
||||||
|
}
|
||||||
|
function nodeOrParentIsBlack(node) {
|
||||||
|
while (node) {
|
||||||
|
var color = getColor(node);
|
||||||
|
if (color === 2 /* Black */) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
node = node.parent;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function nodeOrChildIsBlack(node) {
|
||||||
|
if (getColor(node) === 2 /* Black */) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (var _i = 0, _a = node.getChildren(); _i < _a.length; _i++) {
|
||||||
|
var child = _a[_i];
|
||||||
|
if (nodeOrChildIsBlack(child)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function markNodes(languageService, options) {
|
||||||
|
var program = languageService.getProgram();
|
||||||
|
if (options.shakeLevel === 0 /* Files */) {
|
||||||
|
// Mark all source files Black
|
||||||
|
program.getSourceFiles().forEach(function (sourceFile) {
|
||||||
|
setColor(sourceFile, 2 /* Black */);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var black_queue = [];
|
||||||
|
var gray_queue = [];
|
||||||
|
var sourceFilesLoaded = {};
|
||||||
|
function enqueueTopLevelModuleStatements(sourceFile) {
|
||||||
|
sourceFile.forEachChild(function (node) {
|
||||||
|
if (ts.isImportDeclaration(node)) {
|
||||||
|
if (!node.importClause && ts.isStringLiteral(node.moduleSpecifier)) {
|
||||||
|
setColor(node, 2 /* Black */);
|
||||||
|
enqueueImport(node, node.moduleSpecifier.text);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ts.isExportDeclaration(node)) {
|
||||||
|
if (ts.isStringLiteral(node.moduleSpecifier)) {
|
||||||
|
setColor(node, 2 /* Black */);
|
||||||
|
enqueueImport(node, node.moduleSpecifier.text);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ts.isExpressionStatement(node)
|
||||||
|
|| ts.isIfStatement(node)
|
||||||
|
|| ts.isIterationStatement(node, true)
|
||||||
|
|| ts.isExportAssignment(node)) {
|
||||||
|
enqueue_black(node);
|
||||||
|
}
|
||||||
|
if (ts.isImportEqualsDeclaration(node)) {
|
||||||
|
if (/export/.test(node.getFullText(sourceFile))) {
|
||||||
|
// e.g. "export import Severity = BaseSeverity;"
|
||||||
|
enqueue_black(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function enqueue_gray(node) {
|
||||||
|
if (nodeOrParentIsBlack(node) || getColor(node) === 1 /* Gray */) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setColor(node, 1 /* Gray */);
|
||||||
|
gray_queue.push(node);
|
||||||
|
}
|
||||||
|
function enqueue_black(node) {
|
||||||
|
var previousColor = getColor(node);
|
||||||
|
if (previousColor === 2 /* Black */) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (previousColor === 1 /* Gray */) {
|
||||||
|
// remove from gray queue
|
||||||
|
gray_queue.splice(gray_queue.indexOf(node), 1);
|
||||||
|
setColor(node, 0 /* White */);
|
||||||
|
// add to black queue
|
||||||
|
enqueue_black(node);
|
||||||
|
// // move from one queue to the other
|
||||||
|
// black_queue.push(node);
|
||||||
|
// setColor(node, NodeColor.Black);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (nodeOrParentIsBlack(node)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var fileName = node.getSourceFile().fileName;
|
||||||
|
if (/^defaultLib:/.test(fileName) || /\.d\.ts$/.test(fileName)) {
|
||||||
|
setColor(node, 2 /* Black */);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var sourceFile = node.getSourceFile();
|
||||||
|
if (!sourceFilesLoaded[sourceFile.fileName]) {
|
||||||
|
sourceFilesLoaded[sourceFile.fileName] = true;
|
||||||
|
enqueueTopLevelModuleStatements(sourceFile);
|
||||||
|
}
|
||||||
|
if (ts.isSourceFile(node)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setColor(node, 2 /* Black */);
|
||||||
|
black_queue.push(node);
|
||||||
|
if (options.shakeLevel === 2 /* ClassMembers */ && (ts.isMethodDeclaration(node) || ts.isMethodSignature(node) || ts.isPropertySignature(node) || ts.isGetAccessor(node) || ts.isSetAccessor(node))) {
|
||||||
|
var references = languageService.getReferencesAtPosition(node.getSourceFile().fileName, node.name.pos + node.name.getLeadingTriviaWidth());
|
||||||
|
if (references) {
|
||||||
|
for (var i = 0, len = references.length; i < len; i++) {
|
||||||
|
var reference = references[i];
|
||||||
|
var referenceSourceFile = program.getSourceFile(reference.fileName);
|
||||||
|
var referenceNode = getTokenAtPosition(referenceSourceFile, reference.textSpan.start, false, false);
|
||||||
|
if (ts.isMethodDeclaration(referenceNode.parent)
|
||||||
|
|| ts.isPropertyDeclaration(referenceNode.parent)
|
||||||
|
|| ts.isGetAccessor(referenceNode.parent)
|
||||||
|
|| ts.isSetAccessor(referenceNode.parent)) {
|
||||||
|
enqueue_gray(referenceNode.parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function enqueueFile(filename) {
|
||||||
|
var sourceFile = program.getSourceFile(filename);
|
||||||
|
if (!sourceFile) {
|
||||||
|
console.warn("Cannot find source file " + filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
enqueue_black(sourceFile);
|
||||||
|
}
|
||||||
|
function enqueueImport(node, importText) {
|
||||||
|
if (options.importIgnorePattern.test(importText)) {
|
||||||
|
// this import should be ignored
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var nodeSourceFile = node.getSourceFile();
|
||||||
|
var fullPath;
|
||||||
|
if (/(^\.\/)|(^\.\.\/)/.test(importText)) {
|
||||||
|
fullPath = path.join(path.dirname(nodeSourceFile.fileName), importText) + '.ts';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fullPath = importText + '.ts';
|
||||||
|
}
|
||||||
|
enqueueFile(fullPath);
|
||||||
|
}
|
||||||
|
options.entryPoints.forEach(function (moduleId) { return enqueueFile(moduleId + '.ts'); });
|
||||||
|
// Add fake usage files
|
||||||
|
options.inlineEntryPoints.forEach(function (_, index) { return enqueueFile("inlineEntryPoint:" + index + ".ts"); });
|
||||||
|
var step = 0;
|
||||||
|
var checker = program.getTypeChecker();
|
||||||
|
var _loop_1 = function () {
|
||||||
|
++step;
|
||||||
|
var node = void 0;
|
||||||
|
if (step % 100 === 0) {
|
||||||
|
console.log(step + "/" + (step + black_queue.length + gray_queue.length) + " (" + black_queue.length + ", " + gray_queue.length + ")");
|
||||||
|
}
|
||||||
|
if (black_queue.length === 0) {
|
||||||
|
for (var i = 0; i < gray_queue.length; i++) {
|
||||||
|
var node_1 = gray_queue[i];
|
||||||
|
var nodeParent = node_1.parent;
|
||||||
|
if ((ts.isClassDeclaration(nodeParent) || ts.isInterfaceDeclaration(nodeParent)) && nodeOrChildIsBlack(nodeParent)) {
|
||||||
|
gray_queue.splice(i, 1);
|
||||||
|
black_queue.push(node_1);
|
||||||
|
setColor(node_1, 2 /* Black */);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (black_queue.length > 0) {
|
||||||
|
node = black_queue.shift();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "break";
|
||||||
|
}
|
||||||
|
var nodeSourceFile = node.getSourceFile();
|
||||||
|
var loop = function (node) {
|
||||||
|
var _a = getRealNodeSymbol(checker, node), symbol = _a[0], symbolImportNode = _a[1];
|
||||||
|
if (symbolImportNode) {
|
||||||
|
setColor(symbolImportNode, 2 /* Black */);
|
||||||
|
}
|
||||||
|
if (symbol && !nodeIsInItsOwnDeclaration(nodeSourceFile, node, symbol)) {
|
||||||
|
for (var i = 0, len = symbol.declarations.length; i < len; i++) {
|
||||||
|
var declaration = symbol.declarations[i];
|
||||||
|
if (ts.isSourceFile(declaration)) {
|
||||||
|
// Do not enqueue full source files
|
||||||
|
// (they can be the declaration of a module import)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (options.shakeLevel === 2 /* ClassMembers */ && (ts.isClassDeclaration(declaration) || ts.isInterfaceDeclaration(declaration))) {
|
||||||
|
enqueue_black(declaration.name);
|
||||||
|
for (var j = 0; j < declaration.members.length; j++) {
|
||||||
|
var member = declaration.members[j];
|
||||||
|
var memberName = member.name ? member.name.getText() : null;
|
||||||
|
if (ts.isConstructorDeclaration(member)
|
||||||
|
|| ts.isConstructSignatureDeclaration(member)
|
||||||
|
|| ts.isIndexSignatureDeclaration(member)
|
||||||
|
|| ts.isCallSignatureDeclaration(member)
|
||||||
|
|| memberName === 'toJSON'
|
||||||
|
|| memberName === 'toString'
|
||||||
|
|| memberName === 'dispose' // TODO: keeping all `dispose` methods
|
||||||
|
) {
|
||||||
|
enqueue_black(member);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// queue the heritage clauses
|
||||||
|
if (declaration.heritageClauses) {
|
||||||
|
for (var _i = 0, _b = declaration.heritageClauses; _i < _b.length; _i++) {
|
||||||
|
var heritageClause = _b[_i];
|
||||||
|
enqueue_black(heritageClause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
enqueue_black(declaration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node.forEachChild(loop);
|
||||||
|
};
|
||||||
|
node.forEachChild(loop);
|
||||||
|
};
|
||||||
|
while (black_queue.length > 0 || gray_queue.length > 0) {
|
||||||
|
var state_1 = _loop_1();
|
||||||
|
if (state_1 === "break")
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function nodeIsInItsOwnDeclaration(nodeSourceFile, node, symbol) {
|
||||||
|
for (var i = 0, len = symbol.declarations.length; i < len; i++) {
|
||||||
|
var declaration = symbol.declarations[i];
|
||||||
|
var declarationSourceFile = declaration.getSourceFile();
|
||||||
|
if (nodeSourceFile === declarationSourceFile) {
|
||||||
|
if (declaration.pos <= node.pos && node.end <= declaration.end) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function generateResult(languageService, shakeLevel) {
|
||||||
|
var program = languageService.getProgram();
|
||||||
|
var result = {};
|
||||||
|
var writeFile = function (filePath, contents) {
|
||||||
|
result[filePath] = contents;
|
||||||
|
};
|
||||||
|
program.getSourceFiles().forEach(function (sourceFile) {
|
||||||
|
var fileName = sourceFile.fileName;
|
||||||
|
if (/^defaultLib:/.test(fileName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var destination = fileName;
|
||||||
|
if (/\.d\.ts$/.test(fileName)) {
|
||||||
|
if (nodeOrChildIsBlack(sourceFile)) {
|
||||||
|
writeFile(destination, sourceFile.text);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var text = sourceFile.text;
|
||||||
|
var result = '';
|
||||||
|
function keep(node) {
|
||||||
|
result += text.substring(node.pos, node.end);
|
||||||
|
}
|
||||||
|
function write(data) {
|
||||||
|
result += data;
|
||||||
|
}
|
||||||
|
function writeMarkedNodes(node) {
|
||||||
|
if (getColor(node) === 2 /* Black */) {
|
||||||
|
return keep(node);
|
||||||
|
}
|
||||||
|
// Always keep certain top-level statements
|
||||||
|
if (ts.isSourceFile(node.parent)) {
|
||||||
|
if (ts.isExpressionStatement(node) && ts.isStringLiteral(node.expression) && node.expression.text === 'use strict') {
|
||||||
|
return keep(node);
|
||||||
|
}
|
||||||
|
if (ts.isVariableStatement(node) && nodeOrChildIsBlack(node)) {
|
||||||
|
return keep(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Keep the entire import in import * as X cases
|
||||||
|
if (ts.isImportDeclaration(node)) {
|
||||||
|
if (node.importClause && node.importClause.namedBindings) {
|
||||||
|
if (ts.isNamespaceImport(node.importClause.namedBindings)) {
|
||||||
|
if (getColor(node.importClause.namedBindings) === 2 /* Black */) {
|
||||||
|
return keep(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var survivingImports = [];
|
||||||
|
for (var i = 0; i < node.importClause.namedBindings.elements.length; i++) {
|
||||||
|
var importNode = node.importClause.namedBindings.elements[i];
|
||||||
|
if (getColor(importNode) === 2 /* Black */) {
|
||||||
|
survivingImports.push(importNode.getFullText(sourceFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var leadingTriviaWidth = node.getLeadingTriviaWidth();
|
||||||
|
var leadingTrivia = sourceFile.text.substr(node.pos, leadingTriviaWidth);
|
||||||
|
if (survivingImports.length > 0) {
|
||||||
|
if (node.importClause && getColor(node.importClause) === 2 /* Black */) {
|
||||||
|
return write(leadingTrivia + "import " + node.importClause.name.text + ", {" + survivingImports.join(',') + " } from" + node.moduleSpecifier.getFullText(sourceFile) + ";");
|
||||||
|
}
|
||||||
|
return write(leadingTrivia + "import {" + survivingImports.join(',') + " } from" + node.moduleSpecifier.getFullText(sourceFile) + ";");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (node.importClause && getColor(node.importClause) === 2 /* Black */) {
|
||||||
|
return write(leadingTrivia + "import " + node.importClause.name.text + " from" + node.moduleSpecifier.getFullText(sourceFile) + ";");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (node.importClause && getColor(node.importClause) === 2 /* Black */) {
|
||||||
|
return keep(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (shakeLevel === 2 /* ClassMembers */ && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) && nodeOrChildIsBlack(node)) {
|
||||||
|
var toWrite = node.getFullText();
|
||||||
|
for (var i = node.members.length - 1; i >= 0; i--) {
|
||||||
|
var member = node.members[i];
|
||||||
|
if (getColor(member) === 2 /* Black */) {
|
||||||
|
// keep method
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (/^_(.*)Brand$/.test(member.name.getText())) {
|
||||||
|
// TODO: keep all members ending with `Brand`...
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var pos = member.pos - node.pos;
|
||||||
|
var end = member.end - node.pos;
|
||||||
|
toWrite = toWrite.substring(0, pos) + toWrite.substring(end);
|
||||||
|
}
|
||||||
|
return write(toWrite);
|
||||||
|
}
|
||||||
|
if (ts.isFunctionDeclaration(node)) {
|
||||||
|
// Do not go inside functions if they haven't been marked
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
node.forEachChild(writeMarkedNodes);
|
||||||
|
}
|
||||||
|
if (getColor(sourceFile) !== 2 /* Black */) {
|
||||||
|
if (!nodeOrChildIsBlack(sourceFile)) {
|
||||||
|
// none of the elements are reachable => don't write this file at all!
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sourceFile.forEachChild(writeMarkedNodes);
|
||||||
|
result += sourceFile.endOfFileToken.getFullText(sourceFile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = text;
|
||||||
|
}
|
||||||
|
writeFile(destination, result);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
|
//#region Utils
|
||||||
|
/**
|
||||||
|
* Returns the node's symbol and the `import` node (if the symbol resolved from a different module)
|
||||||
|
*/
|
||||||
|
function getRealNodeSymbol(checker, node) {
|
||||||
|
/**
|
||||||
|
* Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 }
|
||||||
|
*/
|
||||||
|
/* @internal */
|
||||||
|
function getContainingObjectLiteralElement(node) {
|
||||||
|
switch (node.kind) {
|
||||||
|
case ts.SyntaxKind.StringLiteral:
|
||||||
|
case ts.SyntaxKind.NumericLiteral:
|
||||||
|
if (node.parent.kind === ts.SyntaxKind.ComputedPropertyName) {
|
||||||
|
return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined;
|
||||||
|
}
|
||||||
|
// falls through
|
||||||
|
case ts.SyntaxKind.Identifier:
|
||||||
|
return ts.isObjectLiteralElement(node.parent) &&
|
||||||
|
(node.parent.parent.kind === ts.SyntaxKind.ObjectLiteralExpression || node.parent.parent.kind === ts.SyntaxKind.JsxAttributes) &&
|
||||||
|
node.parent.name === node ? node.parent : undefined;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
function getPropertySymbolsFromType(type, propName) {
|
||||||
|
function getTextOfPropertyName(name) {
|
||||||
|
function isStringOrNumericLiteral(node) {
|
||||||
|
var kind = node.kind;
|
||||||
|
return kind === ts.SyntaxKind.StringLiteral
|
||||||
|
|| kind === ts.SyntaxKind.NumericLiteral;
|
||||||
|
}
|
||||||
|
switch (name.kind) {
|
||||||
|
case ts.SyntaxKind.Identifier:
|
||||||
|
return name.text;
|
||||||
|
case ts.SyntaxKind.StringLiteral:
|
||||||
|
case ts.SyntaxKind.NumericLiteral:
|
||||||
|
return name.text;
|
||||||
|
case ts.SyntaxKind.ComputedPropertyName:
|
||||||
|
return isStringOrNumericLiteral(name.expression) ? name.expression.text : undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var name = getTextOfPropertyName(propName);
|
||||||
|
if (name && type) {
|
||||||
|
var result = [];
|
||||||
|
var symbol_1 = type.getProperty(name);
|
||||||
|
if (type.flags & ts.TypeFlags.Union) {
|
||||||
|
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||||
|
var t = _a[_i];
|
||||||
|
var symbol_2 = t.getProperty(name);
|
||||||
|
if (symbol_2) {
|
||||||
|
result.push(symbol_2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (symbol_1) {
|
||||||
|
result.push(symbol_1);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
function getPropertySymbolsFromContextualType(typeChecker, node) {
|
||||||
|
var objectLiteral = node.parent;
|
||||||
|
var contextualType = typeChecker.getContextualType(objectLiteral);
|
||||||
|
return getPropertySymbolsFromType(contextualType, node.name);
|
||||||
|
}
|
||||||
|
// Go to the original declaration for cases:
|
||||||
|
//
|
||||||
|
// (1) when the aliased symbol was declared in the location(parent).
|
||||||
|
// (2) when the aliased symbol is originating from an import.
|
||||||
|
//
|
||||||
|
function shouldSkipAlias(node, declaration) {
|
||||||
|
if (node.kind !== ts.SyntaxKind.Identifier) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (node.parent === declaration) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
switch (declaration.kind) {
|
||||||
|
case ts.SyntaxKind.ImportClause:
|
||||||
|
case ts.SyntaxKind.ImportEqualsDeclaration:
|
||||||
|
return true;
|
||||||
|
case ts.SyntaxKind.ImportSpecifier:
|
||||||
|
return declaration.parent.kind === ts.SyntaxKind.NamedImports;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ts.isShorthandPropertyAssignment(node)) {
|
||||||
|
if (node.getChildCount() !== 0) {
|
||||||
|
return [null, null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var symbol = checker.getSymbolAtLocation(node);
|
||||||
|
var importNode = null;
|
||||||
|
if (symbol && symbol.flags & ts.SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) {
|
||||||
|
var aliased = checker.getAliasedSymbol(symbol);
|
||||||
|
if (aliased.declarations) {
|
||||||
|
// We should mark the import as visited
|
||||||
|
importNode = symbol.declarations[0];
|
||||||
|
symbol = aliased;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (symbol) {
|
||||||
|
// Because name in short-hand property assignment has two different meanings: property name and property value,
|
||||||
|
// using go-to-definition at such position should go to the variable declaration of the property value rather than
|
||||||
|
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
|
||||||
|
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
|
||||||
|
// assignment. This case and others are handled by the following code.
|
||||||
|
if (node.parent.kind === ts.SyntaxKind.ShorthandPropertyAssignment) {
|
||||||
|
symbol = checker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
|
||||||
|
}
|
||||||
|
// If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
|
||||||
|
// declaration the symbol (which is itself), we should try to get to the original type of the ObjectBindingPattern
|
||||||
|
// and return the property declaration for the referenced property.
|
||||||
|
// For example:
|
||||||
|
// import('./foo').then(({ b/*goto*/ar }) => undefined); => should get use to the declaration in file "./foo"
|
||||||
|
//
|
||||||
|
// function bar<T>(onfulfilled: (value: T) => void) { //....}
|
||||||
|
// interface Test {
|
||||||
|
// pr/*destination*/op1: number
|
||||||
|
// }
|
||||||
|
// bar<Test>(({pr/*goto*/op1})=>{});
|
||||||
|
if (ts.isPropertyName(node) && ts.isBindingElement(node.parent) && ts.isObjectBindingPattern(node.parent.parent) &&
|
||||||
|
(node === (node.parent.propertyName || node.parent.name))) {
|
||||||
|
var type = checker.getTypeAtLocation(node.parent.parent);
|
||||||
|
if (type) {
|
||||||
|
var propSymbols = getPropertySymbolsFromType(type, node);
|
||||||
|
if (propSymbols) {
|
||||||
|
symbol = propSymbols[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If the current location we want to find its definition is in an object literal, try to get the contextual type for the
|
||||||
|
// object literal, lookup the property symbol in the contextual type, and use this for goto-definition.
|
||||||
|
// For example
|
||||||
|
// interface Props{
|
||||||
|
// /*first*/prop1: number
|
||||||
|
// prop2: boolean
|
||||||
|
// }
|
||||||
|
// function Foo(arg: Props) {}
|
||||||
|
// Foo( { pr/*1*/op1: 10, prop2: false })
|
||||||
|
var element = getContainingObjectLiteralElement(node);
|
||||||
|
if (element && checker.getContextualType(element.parent)) {
|
||||||
|
var propertySymbols = getPropertySymbolsFromContextualType(checker, element);
|
||||||
|
if (propertySymbols) {
|
||||||
|
symbol = propertySymbols[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (symbol && symbol.declarations) {
|
||||||
|
return [symbol, importNode];
|
||||||
|
}
|
||||||
|
return [null, null];
|
||||||
|
}
|
||||||
|
/** Get the token whose text contains the position */
|
||||||
|
function getTokenAtPosition(sourceFile, position, allowPositionInLeadingTrivia, includeEndPosition) {
|
||||||
|
var current = sourceFile;
|
||||||
|
outer: while (true) {
|
||||||
|
// find the child that contains 'position'
|
||||||
|
for (var _i = 0, _a = current.getChildren(); _i < _a.length; _i++) {
|
||||||
|
var child = _a[_i];
|
||||||
|
var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, /*includeJsDoc*/ true);
|
||||||
|
if (start > position) {
|
||||||
|
// If this child begins after position, then all subsequent children will as well.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var end = child.getEnd();
|
||||||
|
if (position < end || (position === end && (child.kind === ts.SyntaxKind.EndOfFileToken || includeEndPosition))) {
|
||||||
|
current = child;
|
||||||
|
continue outer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
}
|
||||||
817
build/lib/treeshaking.ts
Normal file
817
build/lib/treeshaking.ts
Normal file
@@ -0,0 +1,817 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as ts from 'typescript';
|
||||||
|
|
||||||
|
const TYPESCRIPT_LIB_FOLDER = path.dirname(require.resolve('typescript/lib/lib.d.ts'));
|
||||||
|
|
||||||
|
export const enum ShakeLevel {
|
||||||
|
Files = 0,
|
||||||
|
InnerFile = 1,
|
||||||
|
ClassMembers = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ITreeShakingOptions {
|
||||||
|
/**
|
||||||
|
* The full path to the root where sources are.
|
||||||
|
*/
|
||||||
|
sourcesRoot: string;
|
||||||
|
/**
|
||||||
|
* Module ids.
|
||||||
|
* e.g. `vs/editor/editor.main` or `index`
|
||||||
|
*/
|
||||||
|
entryPoints: string[];
|
||||||
|
/**
|
||||||
|
* Inline usages.
|
||||||
|
*/
|
||||||
|
inlineEntryPoints: string[];
|
||||||
|
/**
|
||||||
|
* TypeScript libs.
|
||||||
|
* e.g. `lib.d.ts`, `lib.es2015.collection.d.ts`
|
||||||
|
*/
|
||||||
|
libs: string[];
|
||||||
|
/**
|
||||||
|
* TypeScript compiler options.
|
||||||
|
*/
|
||||||
|
compilerOptions: ts.CompilerOptions;
|
||||||
|
/**
|
||||||
|
* The shake level to perform.
|
||||||
|
*/
|
||||||
|
shakeLevel: ShakeLevel;
|
||||||
|
/**
|
||||||
|
* regex pattern to ignore certain imports e.g. `vs/css!` imports
|
||||||
|
*/
|
||||||
|
importIgnorePattern: RegExp;
|
||||||
|
|
||||||
|
redirects: { [module: string]: string; };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ITreeShakingResult {
|
||||||
|
[file: string]: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function shake(options: ITreeShakingOptions): ITreeShakingResult {
|
||||||
|
const languageService = createTypeScriptLanguageService(options);
|
||||||
|
|
||||||
|
markNodes(languageService, options);
|
||||||
|
|
||||||
|
return generateResult(languageService, options.shakeLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
//#region Discovery, LanguageService & Setup
|
||||||
|
function createTypeScriptLanguageService(options: ITreeShakingOptions): ts.LanguageService {
|
||||||
|
// Discover referenced files
|
||||||
|
const FILES = discoverAndReadFiles(options);
|
||||||
|
|
||||||
|
// Add fake usage files
|
||||||
|
options.inlineEntryPoints.forEach((inlineEntryPoint, index) => {
|
||||||
|
FILES[`inlineEntryPoint:${index}.ts`] = inlineEntryPoint;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Resolve libs
|
||||||
|
const RESOLVED_LIBS: ILibMap = {};
|
||||||
|
options.libs.forEach((filename) => {
|
||||||
|
const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
|
||||||
|
RESOLVED_LIBS[`defaultLib:${filename}`] = fs.readFileSync(filepath).toString();
|
||||||
|
});
|
||||||
|
|
||||||
|
const host = new TypeScriptLanguageServiceHost(RESOLVED_LIBS, FILES, options.compilerOptions);
|
||||||
|
return ts.createLanguageService(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read imports and follow them until all files have been handled
|
||||||
|
*/
|
||||||
|
function discoverAndReadFiles(options: ITreeShakingOptions): IFileMap {
|
||||||
|
const FILES: IFileMap = {};
|
||||||
|
|
||||||
|
const in_queue: { [module: string]: boolean; } = Object.create(null);
|
||||||
|
const queue: string[] = [];
|
||||||
|
|
||||||
|
const enqueue = (moduleId: string) => {
|
||||||
|
if (in_queue[moduleId]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
in_queue[moduleId] = true;
|
||||||
|
queue.push(moduleId);
|
||||||
|
};
|
||||||
|
|
||||||
|
options.entryPoints.forEach((entryPoint) => enqueue(entryPoint));
|
||||||
|
|
||||||
|
while (queue.length > 0) {
|
||||||
|
const moduleId = queue.shift();
|
||||||
|
const dts_filename = path.join(options.sourcesRoot, moduleId + '.d.ts');
|
||||||
|
if (fs.existsSync(dts_filename)) {
|
||||||
|
const dts_filecontents = fs.readFileSync(dts_filename).toString();
|
||||||
|
FILES[moduleId + '.d.ts'] = dts_filecontents;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let ts_filename: string;
|
||||||
|
if (options.redirects[moduleId]) {
|
||||||
|
ts_filename = path.join(options.sourcesRoot, options.redirects[moduleId] + '.ts');
|
||||||
|
} else {
|
||||||
|
ts_filename = path.join(options.sourcesRoot, moduleId + '.ts');
|
||||||
|
}
|
||||||
|
const ts_filecontents = fs.readFileSync(ts_filename).toString();
|
||||||
|
const info = ts.preProcessFile(ts_filecontents);
|
||||||
|
for (let i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||||
|
const importedFileName = info.importedFiles[i].fileName;
|
||||||
|
|
||||||
|
if (options.importIgnorePattern.test(importedFileName)) {
|
||||||
|
// Ignore vs/css! imports
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let importedModuleId = importedFileName;
|
||||||
|
if (/(^\.\/)|(^\.\.\/)/.test(importedModuleId)) {
|
||||||
|
importedModuleId = path.join(path.dirname(moduleId), importedModuleId);
|
||||||
|
}
|
||||||
|
enqueue(importedModuleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
FILES[moduleId + '.ts'] = ts_filecontents;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FILES;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ILibMap { [libName: string]: string; }
|
||||||
|
interface IFileMap { [fileName: string]: string; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A TypeScript language service host
|
||||||
|
*/
|
||||||
|
class TypeScriptLanguageServiceHost implements ts.LanguageServiceHost {
|
||||||
|
|
||||||
|
private readonly _libs: ILibMap;
|
||||||
|
private readonly _files: IFileMap;
|
||||||
|
private readonly _compilerOptions: ts.CompilerOptions;
|
||||||
|
|
||||||
|
constructor(libs: ILibMap, files: IFileMap, compilerOptions: ts.CompilerOptions) {
|
||||||
|
this._libs = libs;
|
||||||
|
this._files = files;
|
||||||
|
this._compilerOptions = compilerOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- language service host ---------------
|
||||||
|
|
||||||
|
getCompilationSettings(): ts.CompilerOptions {
|
||||||
|
return this._compilerOptions;
|
||||||
|
}
|
||||||
|
getScriptFileNames(): string[] {
|
||||||
|
return (
|
||||||
|
[]
|
||||||
|
.concat(Object.keys(this._libs))
|
||||||
|
.concat(Object.keys(this._files))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
getScriptVersion(fileName: string): string {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
getProjectVersion(): string {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
getScriptSnapshot(fileName: string): ts.IScriptSnapshot {
|
||||||
|
if (this._files.hasOwnProperty(fileName)) {
|
||||||
|
return ts.ScriptSnapshot.fromString(this._files[fileName]);
|
||||||
|
} else if (this._libs.hasOwnProperty(fileName)) {
|
||||||
|
return ts.ScriptSnapshot.fromString(this._libs[fileName]);
|
||||||
|
} else {
|
||||||
|
return ts.ScriptSnapshot.fromString('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getScriptKind(fileName: string): ts.ScriptKind {
|
||||||
|
return ts.ScriptKind.TS;
|
||||||
|
}
|
||||||
|
getCurrentDirectory(): string {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
getDefaultLibFileName(options: ts.CompilerOptions): string {
|
||||||
|
return 'defaultLib:lib.d.ts';
|
||||||
|
}
|
||||||
|
isDefaultLibFileName(fileName: string): boolean {
|
||||||
|
return fileName === this.getDefaultLibFileName(this._compilerOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
//#region Tree Shaking
|
||||||
|
|
||||||
|
const enum NodeColor {
|
||||||
|
White = 0,
|
||||||
|
Gray = 1,
|
||||||
|
Black = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
function getColor(node: ts.Node): NodeColor {
|
||||||
|
return (<any>node).$$$color || NodeColor.White;
|
||||||
|
}
|
||||||
|
function setColor(node: ts.Node, color: NodeColor): void {
|
||||||
|
(<any>node).$$$color = color;
|
||||||
|
}
|
||||||
|
function nodeOrParentIsBlack(node: ts.Node): boolean {
|
||||||
|
while (node) {
|
||||||
|
const color = getColor(node);
|
||||||
|
if (color === NodeColor.Black) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
node = node.parent;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function nodeOrChildIsBlack(node: ts.Node): boolean {
|
||||||
|
if (getColor(node) === NodeColor.Black) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (const child of node.getChildren()) {
|
||||||
|
if (nodeOrChildIsBlack(child)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function markNodes(languageService: ts.LanguageService, options: ITreeShakingOptions) {
|
||||||
|
const program = languageService.getProgram();
|
||||||
|
|
||||||
|
if (options.shakeLevel === ShakeLevel.Files) {
|
||||||
|
// Mark all source files Black
|
||||||
|
program.getSourceFiles().forEach((sourceFile) => {
|
||||||
|
setColor(sourceFile, NodeColor.Black);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const black_queue: ts.Node[] = [];
|
||||||
|
const gray_queue: ts.Node[] = [];
|
||||||
|
const sourceFilesLoaded: { [fileName: string]: boolean } = {};
|
||||||
|
|
||||||
|
function enqueueTopLevelModuleStatements(sourceFile: ts.SourceFile): void {
|
||||||
|
|
||||||
|
sourceFile.forEachChild((node: ts.Node) => {
|
||||||
|
|
||||||
|
if (ts.isImportDeclaration(node)) {
|
||||||
|
if (!node.importClause && ts.isStringLiteral(node.moduleSpecifier)) {
|
||||||
|
setColor(node, NodeColor.Black);
|
||||||
|
enqueueImport(node, node.moduleSpecifier.text);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ts.isExportDeclaration(node)) {
|
||||||
|
if (ts.isStringLiteral(node.moduleSpecifier)) {
|
||||||
|
setColor(node, NodeColor.Black);
|
||||||
|
enqueueImport(node, node.moduleSpecifier.text);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
ts.isExpressionStatement(node)
|
||||||
|
|| ts.isIfStatement(node)
|
||||||
|
|| ts.isIterationStatement(node, true)
|
||||||
|
|| ts.isExportAssignment(node)
|
||||||
|
) {
|
||||||
|
enqueue_black(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ts.isImportEqualsDeclaration(node)) {
|
||||||
|
if (/export/.test(node.getFullText(sourceFile))) {
|
||||||
|
// e.g. "export import Severity = BaseSeverity;"
|
||||||
|
enqueue_black(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function enqueue_gray(node: ts.Node): void {
|
||||||
|
if (nodeOrParentIsBlack(node) || getColor(node) === NodeColor.Gray) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setColor(node, NodeColor.Gray);
|
||||||
|
gray_queue.push(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
function enqueue_black(node: ts.Node): void {
|
||||||
|
const previousColor = getColor(node);
|
||||||
|
|
||||||
|
if (previousColor === NodeColor.Black) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previousColor === NodeColor.Gray) {
|
||||||
|
// remove from gray queue
|
||||||
|
gray_queue.splice(gray_queue.indexOf(node), 1);
|
||||||
|
setColor(node, NodeColor.White);
|
||||||
|
|
||||||
|
// add to black queue
|
||||||
|
enqueue_black(node);
|
||||||
|
|
||||||
|
// // move from one queue to the other
|
||||||
|
// black_queue.push(node);
|
||||||
|
// setColor(node, NodeColor.Black);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodeOrParentIsBlack(node)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileName = node.getSourceFile().fileName;
|
||||||
|
if (/^defaultLib:/.test(fileName) || /\.d\.ts$/.test(fileName)) {
|
||||||
|
setColor(node, NodeColor.Black);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sourceFile = node.getSourceFile();
|
||||||
|
if (!sourceFilesLoaded[sourceFile.fileName]) {
|
||||||
|
sourceFilesLoaded[sourceFile.fileName] = true;
|
||||||
|
enqueueTopLevelModuleStatements(sourceFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ts.isSourceFile(node)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setColor(node, NodeColor.Black);
|
||||||
|
black_queue.push(node);
|
||||||
|
|
||||||
|
if (options.shakeLevel === ShakeLevel.ClassMembers && (ts.isMethodDeclaration(node) || ts.isMethodSignature(node) || ts.isPropertySignature(node) || ts.isGetAccessor(node) || ts.isSetAccessor(node))) {
|
||||||
|
const references = languageService.getReferencesAtPosition(node.getSourceFile().fileName, node.name.pos + node.name.getLeadingTriviaWidth());
|
||||||
|
if (references) {
|
||||||
|
for (let i = 0, len = references.length; i < len; i++) {
|
||||||
|
const reference = references[i];
|
||||||
|
const referenceSourceFile = program.getSourceFile(reference.fileName);
|
||||||
|
const referenceNode = getTokenAtPosition(referenceSourceFile, reference.textSpan.start, false, false);
|
||||||
|
if (
|
||||||
|
ts.isMethodDeclaration(referenceNode.parent)
|
||||||
|
|| ts.isPropertyDeclaration(referenceNode.parent)
|
||||||
|
|| ts.isGetAccessor(referenceNode.parent)
|
||||||
|
|| ts.isSetAccessor(referenceNode.parent)
|
||||||
|
) {
|
||||||
|
enqueue_gray(referenceNode.parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function enqueueFile(filename: string): void {
|
||||||
|
const sourceFile = program.getSourceFile(filename);
|
||||||
|
if (!sourceFile) {
|
||||||
|
console.warn(`Cannot find source file ${filename}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
enqueue_black(sourceFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
function enqueueImport(node: ts.Node, importText: string): void {
|
||||||
|
if (options.importIgnorePattern.test(importText)) {
|
||||||
|
// this import should be ignored
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nodeSourceFile = node.getSourceFile();
|
||||||
|
let fullPath: string;
|
||||||
|
if (/(^\.\/)|(^\.\.\/)/.test(importText)) {
|
||||||
|
fullPath = path.join(path.dirname(nodeSourceFile.fileName), importText) + '.ts';
|
||||||
|
} else {
|
||||||
|
fullPath = importText + '.ts';
|
||||||
|
}
|
||||||
|
enqueueFile(fullPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
options.entryPoints.forEach(moduleId => enqueueFile(moduleId + '.ts'));
|
||||||
|
// Add fake usage files
|
||||||
|
options.inlineEntryPoints.forEach((_, index) => enqueueFile(`inlineEntryPoint:${index}.ts`));
|
||||||
|
|
||||||
|
let step = 0;
|
||||||
|
|
||||||
|
const checker = program.getTypeChecker();
|
||||||
|
while (black_queue.length > 0 || gray_queue.length > 0) {
|
||||||
|
++step;
|
||||||
|
let node: ts.Node;
|
||||||
|
|
||||||
|
if (step % 100 === 0) {
|
||||||
|
console.log(`${step}/${step+black_queue.length+gray_queue.length} (${black_queue.length}, ${gray_queue.length})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (black_queue.length === 0) {
|
||||||
|
for (let i = 0; i < gray_queue.length; i++) {
|
||||||
|
const node = gray_queue[i];
|
||||||
|
const nodeParent = node.parent;
|
||||||
|
if ((ts.isClassDeclaration(nodeParent) || ts.isInterfaceDeclaration(nodeParent)) && nodeOrChildIsBlack(nodeParent)) {
|
||||||
|
gray_queue.splice(i, 1);
|
||||||
|
black_queue.push(node);
|
||||||
|
setColor(node, NodeColor.Black);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (black_queue.length > 0) {
|
||||||
|
node = black_queue.shift();
|
||||||
|
} else {
|
||||||
|
// only gray nodes remaining...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const nodeSourceFile = node.getSourceFile();
|
||||||
|
|
||||||
|
const loop = (node: ts.Node) => {
|
||||||
|
const [symbol, symbolImportNode] = getRealNodeSymbol(checker, node);
|
||||||
|
if (symbolImportNode) {
|
||||||
|
setColor(symbolImportNode, NodeColor.Black);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (symbol && !nodeIsInItsOwnDeclaration(nodeSourceFile, node, symbol)) {
|
||||||
|
for (let i = 0, len = symbol.declarations.length; i < len; i++) {
|
||||||
|
const declaration = symbol.declarations[i];
|
||||||
|
if (ts.isSourceFile(declaration)) {
|
||||||
|
// Do not enqueue full source files
|
||||||
|
// (they can be the declaration of a module import)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.shakeLevel === ShakeLevel.ClassMembers && (ts.isClassDeclaration(declaration) || ts.isInterfaceDeclaration(declaration))) {
|
||||||
|
enqueue_black(declaration.name);
|
||||||
|
|
||||||
|
for (let j = 0; j < declaration.members.length; j++) {
|
||||||
|
const member = declaration.members[j];
|
||||||
|
const memberName = member.name ? member.name.getText() : null;
|
||||||
|
if (
|
||||||
|
ts.isConstructorDeclaration(member)
|
||||||
|
|| ts.isConstructSignatureDeclaration(member)
|
||||||
|
|| ts.isIndexSignatureDeclaration(member)
|
||||||
|
|| ts.isCallSignatureDeclaration(member)
|
||||||
|
|| memberName === 'toJSON'
|
||||||
|
|| memberName === 'toString'
|
||||||
|
|| memberName === 'dispose'// TODO: keeping all `dispose` methods
|
||||||
|
) {
|
||||||
|
enqueue_black(member);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// queue the heritage clauses
|
||||||
|
if (declaration.heritageClauses) {
|
||||||
|
for (let heritageClause of declaration.heritageClauses) {
|
||||||
|
enqueue_black(heritageClause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
enqueue_black(declaration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node.forEachChild(loop);
|
||||||
|
};
|
||||||
|
node.forEachChild(loop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function nodeIsInItsOwnDeclaration(nodeSourceFile: ts.SourceFile, node: ts.Node, symbol: ts.Symbol): boolean {
|
||||||
|
for (let i = 0, len = symbol.declarations.length; i < len; i++) {
|
||||||
|
const declaration = symbol.declarations[i];
|
||||||
|
const declarationSourceFile = declaration.getSourceFile();
|
||||||
|
|
||||||
|
if (nodeSourceFile === declarationSourceFile) {
|
||||||
|
if (declaration.pos <= node.pos && node.end <= declaration.end) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateResult(languageService: ts.LanguageService, shakeLevel: ShakeLevel): ITreeShakingResult {
|
||||||
|
const program = languageService.getProgram();
|
||||||
|
|
||||||
|
let result: ITreeShakingResult = {};
|
||||||
|
const writeFile = (filePath: string, contents: string): void => {
|
||||||
|
result[filePath] = contents;
|
||||||
|
};
|
||||||
|
|
||||||
|
program.getSourceFiles().forEach((sourceFile) => {
|
||||||
|
const fileName = sourceFile.fileName;
|
||||||
|
if (/^defaultLib:/.test(fileName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const destination = fileName;
|
||||||
|
if (/\.d\.ts$/.test(fileName)) {
|
||||||
|
if (nodeOrChildIsBlack(sourceFile)) {
|
||||||
|
writeFile(destination, sourceFile.text);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let text = sourceFile.text;
|
||||||
|
let result = '';
|
||||||
|
|
||||||
|
function keep(node: ts.Node): void {
|
||||||
|
result += text.substring(node.pos, node.end);
|
||||||
|
}
|
||||||
|
function write(data: string): void {
|
||||||
|
result += data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeMarkedNodes(node: ts.Node): void {
|
||||||
|
if (getColor(node) === NodeColor.Black) {
|
||||||
|
return keep(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Always keep certain top-level statements
|
||||||
|
if (ts.isSourceFile(node.parent)) {
|
||||||
|
if (ts.isExpressionStatement(node) && ts.isStringLiteral(node.expression) && node.expression.text === 'use strict') {
|
||||||
|
return keep(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ts.isVariableStatement(node) && nodeOrChildIsBlack(node)) {
|
||||||
|
return keep(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep the entire import in import * as X cases
|
||||||
|
if (ts.isImportDeclaration(node)) {
|
||||||
|
if (node.importClause && node.importClause.namedBindings) {
|
||||||
|
if (ts.isNamespaceImport(node.importClause.namedBindings)) {
|
||||||
|
if (getColor(node.importClause.namedBindings) === NodeColor.Black) {
|
||||||
|
return keep(node);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let survivingImports: string[] = [];
|
||||||
|
for (let i = 0; i < node.importClause.namedBindings.elements.length; i++) {
|
||||||
|
const importNode = node.importClause.namedBindings.elements[i];
|
||||||
|
if (getColor(importNode) === NodeColor.Black) {
|
||||||
|
survivingImports.push(importNode.getFullText(sourceFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const leadingTriviaWidth = node.getLeadingTriviaWidth();
|
||||||
|
const leadingTrivia = sourceFile.text.substr(node.pos, leadingTriviaWidth);
|
||||||
|
if (survivingImports.length > 0) {
|
||||||
|
if (node.importClause && getColor(node.importClause) === NodeColor.Black) {
|
||||||
|
return write(`${leadingTrivia}import ${node.importClause.name.text}, {${survivingImports.join(',')} } from${node.moduleSpecifier.getFullText(sourceFile)};`);
|
||||||
|
}
|
||||||
|
return write(`${leadingTrivia}import {${survivingImports.join(',')} } from${node.moduleSpecifier.getFullText(sourceFile)};`);
|
||||||
|
} else {
|
||||||
|
if (node.importClause && getColor(node.importClause) === NodeColor.Black) {
|
||||||
|
return write(`${leadingTrivia}import ${node.importClause.name.text} from${node.moduleSpecifier.getFullText(sourceFile)};`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (node.importClause && getColor(node.importClause) === NodeColor.Black) {
|
||||||
|
return keep(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shakeLevel === ShakeLevel.ClassMembers && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) && nodeOrChildIsBlack(node)) {
|
||||||
|
let toWrite = node.getFullText();
|
||||||
|
for (let i = node.members.length - 1; i >= 0; i--) {
|
||||||
|
const member = node.members[i];
|
||||||
|
if (getColor(member) === NodeColor.Black) {
|
||||||
|
// keep method
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (/^_(.*)Brand$/.test(member.name.getText())) {
|
||||||
|
// TODO: keep all members ending with `Brand`...
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let pos = member.pos - node.pos;
|
||||||
|
let end = member.end - node.pos;
|
||||||
|
toWrite = toWrite.substring(0, pos) + toWrite.substring(end);
|
||||||
|
}
|
||||||
|
return write(toWrite);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ts.isFunctionDeclaration(node)) {
|
||||||
|
// Do not go inside functions if they haven't been marked
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
node.forEachChild(writeMarkedNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getColor(sourceFile) !== NodeColor.Black) {
|
||||||
|
if (!nodeOrChildIsBlack(sourceFile)) {
|
||||||
|
// none of the elements are reachable => don't write this file at all!
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sourceFile.forEachChild(writeMarkedNodes);
|
||||||
|
result += sourceFile.endOfFileToken.getFullText(sourceFile);
|
||||||
|
} else {
|
||||||
|
result = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
writeFile(destination, result);
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
//#region Utils
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the node's symbol and the `import` node (if the symbol resolved from a different module)
|
||||||
|
*/
|
||||||
|
function getRealNodeSymbol(checker: ts.TypeChecker, node: ts.Node): [ts.Symbol, ts.Declaration] {
|
||||||
|
/**
|
||||||
|
* Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 }
|
||||||
|
*/
|
||||||
|
/* @internal */
|
||||||
|
function getContainingObjectLiteralElement(node: ts.Node): ts.ObjectLiteralElement | undefined {
|
||||||
|
switch (node.kind) {
|
||||||
|
case ts.SyntaxKind.StringLiteral:
|
||||||
|
case ts.SyntaxKind.NumericLiteral:
|
||||||
|
if (node.parent.kind === ts.SyntaxKind.ComputedPropertyName) {
|
||||||
|
return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined;
|
||||||
|
}
|
||||||
|
// falls through
|
||||||
|
case ts.SyntaxKind.Identifier:
|
||||||
|
return ts.isObjectLiteralElement(node.parent) &&
|
||||||
|
(node.parent.parent.kind === ts.SyntaxKind.ObjectLiteralExpression || node.parent.parent.kind === ts.SyntaxKind.JsxAttributes) &&
|
||||||
|
node.parent.name === node ? node.parent : undefined;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPropertySymbolsFromType(type: ts.Type, propName: ts.PropertyName) {
|
||||||
|
function getTextOfPropertyName(name: ts.PropertyName): string {
|
||||||
|
|
||||||
|
function isStringOrNumericLiteral(node: ts.Node): node is ts.StringLiteral | ts.NumericLiteral {
|
||||||
|
const kind = node.kind;
|
||||||
|
return kind === ts.SyntaxKind.StringLiteral
|
||||||
|
|| kind === ts.SyntaxKind.NumericLiteral;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (name.kind) {
|
||||||
|
case ts.SyntaxKind.Identifier:
|
||||||
|
return name.text;
|
||||||
|
case ts.SyntaxKind.StringLiteral:
|
||||||
|
case ts.SyntaxKind.NumericLiteral:
|
||||||
|
return name.text;
|
||||||
|
case ts.SyntaxKind.ComputedPropertyName:
|
||||||
|
return isStringOrNumericLiteral(name.expression) ? name.expression.text : undefined!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const name = getTextOfPropertyName(propName);
|
||||||
|
if (name && type) {
|
||||||
|
const result: ts.Symbol[] = [];
|
||||||
|
const symbol = type.getProperty(name);
|
||||||
|
if (type.flags & ts.TypeFlags.Union) {
|
||||||
|
for (const t of (<ts.UnionType>type).types) {
|
||||||
|
const symbol = t.getProperty(name);
|
||||||
|
if (symbol) {
|
||||||
|
result.push(symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (symbol) {
|
||||||
|
result.push(symbol);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPropertySymbolsFromContextualType(typeChecker: ts.TypeChecker, node: ts.ObjectLiteralElement): ts.Symbol[] {
|
||||||
|
const objectLiteral = <ts.ObjectLiteralExpression | ts.JsxAttributes>node.parent;
|
||||||
|
const contextualType = typeChecker.getContextualType(objectLiteral)!;
|
||||||
|
return getPropertySymbolsFromType(contextualType, node.name!)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go to the original declaration for cases:
|
||||||
|
//
|
||||||
|
// (1) when the aliased symbol was declared in the location(parent).
|
||||||
|
// (2) when the aliased symbol is originating from an import.
|
||||||
|
//
|
||||||
|
function shouldSkipAlias(node: ts.Node, declaration: ts.Node): boolean {
|
||||||
|
if (node.kind !== ts.SyntaxKind.Identifier) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (node.parent === declaration) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
switch (declaration.kind) {
|
||||||
|
case ts.SyntaxKind.ImportClause:
|
||||||
|
case ts.SyntaxKind.ImportEqualsDeclaration:
|
||||||
|
return true;
|
||||||
|
case ts.SyntaxKind.ImportSpecifier:
|
||||||
|
return declaration.parent.kind === ts.SyntaxKind.NamedImports;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ts.isShorthandPropertyAssignment(node)) {
|
||||||
|
if (node.getChildCount() !== 0) {
|
||||||
|
return [null, null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let symbol = checker.getSymbolAtLocation(node);
|
||||||
|
let importNode: ts.Declaration = null;
|
||||||
|
if (symbol && symbol.flags & ts.SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) {
|
||||||
|
const aliased = checker.getAliasedSymbol(symbol);
|
||||||
|
if (aliased.declarations) {
|
||||||
|
// We should mark the import as visited
|
||||||
|
importNode = symbol.declarations[0];
|
||||||
|
symbol = aliased;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (symbol) {
|
||||||
|
// Because name in short-hand property assignment has two different meanings: property name and property value,
|
||||||
|
// using go-to-definition at such position should go to the variable declaration of the property value rather than
|
||||||
|
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
|
||||||
|
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
|
||||||
|
// assignment. This case and others are handled by the following code.
|
||||||
|
if (node.parent.kind === ts.SyntaxKind.ShorthandPropertyAssignment) {
|
||||||
|
symbol = checker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
|
||||||
|
// declaration the symbol (which is itself), we should try to get to the original type of the ObjectBindingPattern
|
||||||
|
// and return the property declaration for the referenced property.
|
||||||
|
// For example:
|
||||||
|
// import('./foo').then(({ b/*goto*/ar }) => undefined); => should get use to the declaration in file "./foo"
|
||||||
|
//
|
||||||
|
// function bar<T>(onfulfilled: (value: T) => void) { //....}
|
||||||
|
// interface Test {
|
||||||
|
// pr/*destination*/op1: number
|
||||||
|
// }
|
||||||
|
// bar<Test>(({pr/*goto*/op1})=>{});
|
||||||
|
if (ts.isPropertyName(node) && ts.isBindingElement(node.parent) && ts.isObjectBindingPattern(node.parent.parent) &&
|
||||||
|
(node === (node.parent.propertyName || node.parent.name))) {
|
||||||
|
const type = checker.getTypeAtLocation(node.parent.parent);
|
||||||
|
if (type) {
|
||||||
|
const propSymbols = getPropertySymbolsFromType(type, node);
|
||||||
|
if (propSymbols) {
|
||||||
|
symbol = propSymbols[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the current location we want to find its definition is in an object literal, try to get the contextual type for the
|
||||||
|
// object literal, lookup the property symbol in the contextual type, and use this for goto-definition.
|
||||||
|
// For example
|
||||||
|
// interface Props{
|
||||||
|
// /*first*/prop1: number
|
||||||
|
// prop2: boolean
|
||||||
|
// }
|
||||||
|
// function Foo(arg: Props) {}
|
||||||
|
// Foo( { pr/*1*/op1: 10, prop2: false })
|
||||||
|
const element = getContainingObjectLiteralElement(node);
|
||||||
|
if (element && checker.getContextualType(element.parent as ts.Expression)) {
|
||||||
|
const propertySymbols = getPropertySymbolsFromContextualType(checker, element);
|
||||||
|
if (propertySymbols) {
|
||||||
|
symbol = propertySymbols[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (symbol && symbol.declarations) {
|
||||||
|
return [symbol, importNode];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [null, null];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get the token whose text contains the position */
|
||||||
|
function getTokenAtPosition(sourceFile: ts.SourceFile, position: number, allowPositionInLeadingTrivia: boolean, includeEndPosition: boolean): ts.Node {
|
||||||
|
let current: ts.Node = sourceFile;
|
||||||
|
outer: while (true) {
|
||||||
|
// find the child that contains 'position'
|
||||||
|
for (const child of current.getChildren()) {
|
||||||
|
const start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, /*includeJsDoc*/ true);
|
||||||
|
if (start > position) {
|
||||||
|
// If this child begins after position, then all subsequent children will as well.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const end = child.getEnd();
|
||||||
|
if (position < end || (position === end && (child.kind === ts.SyntaxKind.EndOfFileToken || includeEndPosition))) {
|
||||||
|
current = child;
|
||||||
|
continue outer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//#endregion
|
||||||
73
build/lib/tslint/noStandaloneEditorRule.js
Normal file
73
build/lib/tslint/noStandaloneEditorRule.js
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
"use strict";
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
var __extends = (this && this.__extends) || (function () {
|
||||||
|
var extendStatics = Object.setPrototypeOf ||
|
||||||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||||
|
return function (d, b) {
|
||||||
|
extendStatics(d, b);
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var ts = require("typescript");
|
||||||
|
var Lint = require("tslint");
|
||||||
|
var path_1 = require("path");
|
||||||
|
var Rule = /** @class */ (function (_super) {
|
||||||
|
__extends(Rule, _super);
|
||||||
|
function Rule() {
|
||||||
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
}
|
||||||
|
Rule.prototype.apply = function (sourceFile) {
|
||||||
|
if (/vs(\/|\\)editor/.test(sourceFile.fileName)) {
|
||||||
|
// the vs/editor folder is allowed to use the standalone editor
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return this.applyWithWalker(new NoStandaloneEditorRuleWalker(sourceFile, this.getOptions()));
|
||||||
|
};
|
||||||
|
return Rule;
|
||||||
|
}(Lint.Rules.AbstractRule));
|
||||||
|
exports.Rule = Rule;
|
||||||
|
var NoStandaloneEditorRuleWalker = /** @class */ (function (_super) {
|
||||||
|
__extends(NoStandaloneEditorRuleWalker, _super);
|
||||||
|
function NoStandaloneEditorRuleWalker(file, opts) {
|
||||||
|
return _super.call(this, file, opts) || this;
|
||||||
|
}
|
||||||
|
NoStandaloneEditorRuleWalker.prototype.visitImportEqualsDeclaration = function (node) {
|
||||||
|
if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) {
|
||||||
|
this._validateImport(node.moduleReference.expression.getText(), node);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
NoStandaloneEditorRuleWalker.prototype.visitImportDeclaration = function (node) {
|
||||||
|
this._validateImport(node.moduleSpecifier.getText(), node);
|
||||||
|
};
|
||||||
|
NoStandaloneEditorRuleWalker.prototype.visitCallExpression = function (node) {
|
||||||
|
_super.prototype.visitCallExpression.call(this, node);
|
||||||
|
// import('foo') statements inside the code
|
||||||
|
if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
|
||||||
|
var path = node.arguments[0];
|
||||||
|
this._validateImport(path.getText(), node);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
NoStandaloneEditorRuleWalker.prototype._validateImport = function (path, node) {
|
||||||
|
// remove quotes
|
||||||
|
path = path.slice(1, -1);
|
||||||
|
// resolve relative paths
|
||||||
|
if (path[0] === '.') {
|
||||||
|
path = path_1.join(this.getSourceFile().fileName, path);
|
||||||
|
}
|
||||||
|
if (/vs(\/|\\)editor(\/|\\)standalone/.test(path)
|
||||||
|
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone/.test(path)
|
||||||
|
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(path)
|
||||||
|
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(path)
|
||||||
|
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) {
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
//this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization`));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return NoStandaloneEditorRuleWalker;
|
||||||
|
}(Lint.RuleWalker));
|
||||||
66
build/lib/tslint/noStandaloneEditorRule.ts
Normal file
66
build/lib/tslint/noStandaloneEditorRule.ts
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as ts from 'typescript';
|
||||||
|
import * as Lint from 'tslint';
|
||||||
|
import { join } from 'path';
|
||||||
|
|
||||||
|
export class Rule extends Lint.Rules.AbstractRule {
|
||||||
|
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
||||||
|
if (/vs(\/|\\)editor/.test(sourceFile.fileName)) {
|
||||||
|
// the vs/editor folder is allowed to use the standalone editor
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return this.applyWithWalker(new NoStandaloneEditorRuleWalker(sourceFile, this.getOptions()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NoStandaloneEditorRuleWalker extends Lint.RuleWalker {
|
||||||
|
|
||||||
|
constructor(file: ts.SourceFile, opts: Lint.IOptions) {
|
||||||
|
super(file, opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void {
|
||||||
|
if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) {
|
||||||
|
this._validateImport(node.moduleReference.expression.getText(), node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected visitImportDeclaration(node: ts.ImportDeclaration): void {
|
||||||
|
this._validateImport(node.moduleSpecifier.getText(), node);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected visitCallExpression(node: ts.CallExpression): void {
|
||||||
|
super.visitCallExpression(node);
|
||||||
|
|
||||||
|
// import('foo') statements inside the code
|
||||||
|
if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
|
||||||
|
const [path] = node.arguments;
|
||||||
|
this._validateImport(path.getText(), node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private _validateImport(path: string, node: ts.Node): void {
|
||||||
|
// remove quotes
|
||||||
|
path = path.slice(1, -1);
|
||||||
|
|
||||||
|
// resolve relative paths
|
||||||
|
if (path[0] === '.') {
|
||||||
|
path = join(this.getSourceFile().fileName, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
/vs(\/|\\)editor(\/|\\)standalone/.test(path)
|
||||||
|
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone/.test(path)
|
||||||
|
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(path)
|
||||||
|
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(path)
|
||||||
|
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)
|
||||||
|
) {
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
//this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization`));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,10 +88,11 @@ var NoUnexternalizedStringsRuleWalker = /** @class */ (function (_super) {
|
|||||||
var info = this.findDescribingParent(node);
|
var info = this.findDescribingParent(node);
|
||||||
// Ignore strings in import and export nodes.
|
// Ignore strings in import and export nodes.
|
||||||
if (info && info.isImport && doubleQuoted) {
|
if (info && info.isImport && doubleQuoted) {
|
||||||
this.addFailureAtNode(node, NoUnexternalizedStringsRuleWalker.ImportFailureMessage, new Lint.Fix(NoUnexternalizedStringsRuleWalker.ImportFailureMessage, [
|
var fix = [
|
||||||
this.createReplacement(node.getStart(), 1, '\''),
|
Lint.Replacement.replaceFromTo(node.getStart(), 1, '\''),
|
||||||
this.createReplacement(node.getStart() + text.length - 1, 1, '\''),
|
Lint.Replacement.replaceFromTo(node.getStart() + text.length - 1, 1, '\''),
|
||||||
]));
|
];
|
||||||
|
this.addFailureAtNode(node, NoUnexternalizedStringsRuleWalker.ImportFailureMessage, fix);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var callInfo = info ? info.callInfo : null;
|
var callInfo = info ? info.callInfo : null;
|
||||||
@@ -101,8 +102,9 @@ var NoUnexternalizedStringsRuleWalker = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) {
|
if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) {
|
||||||
var s = node.getText();
|
var s = node.getText();
|
||||||
var replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "nls.localize('KEY-" + s.substring(1, s.length - 1) + "', " + s + ")");
|
var fix = [
|
||||||
var fix = new Lint.Fix('Unexternalitzed string', [replacement]);
|
Lint.Replacement.replaceFromTo(node.getStart(), node.getWidth(), "nls.localize('KEY-" + s.substring(1, s.length - 1) + "', " + s + ")"),
|
||||||
|
];
|
||||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "Unexternalized string found: " + node.getText(), fix));
|
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "Unexternalized string found: " + node.getText(), fix));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -134,16 +136,24 @@ var NoUnexternalizedStringsRuleWalker = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var messageArg = callInfo.argIndex === this.messageIndex
|
var messageArg = callInfo.callExpression.arguments[this.messageIndex];
|
||||||
? callInfo.callExpression.arguments[this.messageIndex]
|
if (messageArg && messageArg.kind !== ts.SyntaxKind.StringLiteral) {
|
||||||
: null;
|
|
||||||
if (messageArg && messageArg !== node) {
|
|
||||||
this.addFailure(this.createFailure(messageArg.getStart(), messageArg.getWidth(), "Message argument to '" + callInfo.callExpression.expression.getText() + "' must be a string literal."));
|
this.addFailure(this.createFailure(messageArg.getStart(), messageArg.getWidth(), "Message argument to '" + callInfo.callExpression.expression.getText() + "' must be a string literal."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
NoUnexternalizedStringsRuleWalker.prototype.recordKey = function (keyNode, messageNode) {
|
NoUnexternalizedStringsRuleWalker.prototype.recordKey = function (keyNode, messageNode) {
|
||||||
var text = keyNode.getText();
|
var text = keyNode.getText();
|
||||||
|
// We have an empty key
|
||||||
|
if (text.match(/(['"]) *\1/)) {
|
||||||
|
if (messageNode) {
|
||||||
|
this.addFailureAtNode(keyNode, "Key is empty for message: " + messageNode.getText());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.addFailureAtNode(keyNode, "Key is empty.");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
var occurrences = this.usedKeys[text];
|
var occurrences = this.usedKeys[text];
|
||||||
if (!occurrences) {
|
if (!occurrences) {
|
||||||
occurrences = [];
|
occurrences = [];
|
||||||
@@ -176,7 +186,7 @@ var NoUnexternalizedStringsRuleWalker = /** @class */ (function (_super) {
|
|||||||
node = parent;
|
node = parent;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
NoUnexternalizedStringsRuleWalker.ImportFailureMessage = 'Do not use double qoutes for imports.';
|
NoUnexternalizedStringsRuleWalker.ImportFailureMessage = 'Do not use double quotes for imports.';
|
||||||
NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE = '"';
|
NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE = '"';
|
||||||
return NoUnexternalizedStringsRuleWalker;
|
return NoUnexternalizedStringsRuleWalker;
|
||||||
}(Lint.RuleWalker));
|
}(Lint.RuleWalker));
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ interface KeyMessagePair {
|
|||||||
|
|
||||||
class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
||||||
|
|
||||||
private static ImportFailureMessage = 'Do not use double qoutes for imports.';
|
private static ImportFailureMessage = 'Do not use double quotes for imports.';
|
||||||
|
|
||||||
private static DOUBLE_QUOTE: string = '"';
|
private static DOUBLE_QUOTE: string = '"';
|
||||||
|
|
||||||
@@ -104,13 +104,14 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||||||
let info = this.findDescribingParent(node);
|
let info = this.findDescribingParent(node);
|
||||||
// Ignore strings in import and export nodes.
|
// Ignore strings in import and export nodes.
|
||||||
if (info && info.isImport && doubleQuoted) {
|
if (info && info.isImport && doubleQuoted) {
|
||||||
|
const fix = [
|
||||||
|
Lint.Replacement.replaceFromTo(node.getStart(), 1, '\''),
|
||||||
|
Lint.Replacement.replaceFromTo(node.getStart() + text.length - 1, 1, '\''),
|
||||||
|
];
|
||||||
this.addFailureAtNode(
|
this.addFailureAtNode(
|
||||||
node,
|
node,
|
||||||
NoUnexternalizedStringsRuleWalker.ImportFailureMessage,
|
NoUnexternalizedStringsRuleWalker.ImportFailureMessage,
|
||||||
new Lint.Fix(NoUnexternalizedStringsRuleWalker.ImportFailureMessage, [
|
fix
|
||||||
this.createReplacement(node.getStart(), 1, '\''),
|
|
||||||
this.createReplacement(node.getStart() + text.length - 1, 1, '\''),
|
|
||||||
])
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -122,8 +123,9 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||||||
|
|
||||||
if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) {
|
if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) {
|
||||||
const s = node.getText();
|
const s = node.getText();
|
||||||
const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), `nls.localize('KEY-${s.substring(1, s.length - 1)}', ${s})`);
|
const fix = [
|
||||||
const fix = new Lint.Fix('Unexternalitzed string', [replacement]);
|
Lint.Replacement.replaceFromTo(node.getStart(), node.getWidth(), `nls.localize('KEY-${s.substring(1, s.length - 1)}', ${s})`),
|
||||||
|
];
|
||||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Unexternalized string found: ${node.getText()}`, fix));
|
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Unexternalized string found: ${node.getText()}`, fix));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -154,10 +156,10 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let messageArg: ts.Expression = callInfo.argIndex === this.messageIndex
|
|
||||||
? callInfo.callExpression.arguments[this.messageIndex]
|
const messageArg = callInfo.callExpression.arguments[this.messageIndex];
|
||||||
: null;
|
|
||||||
if (messageArg && messageArg !== node) {
|
if (messageArg && messageArg.kind !== ts.SyntaxKind.StringLiteral) {
|
||||||
this.addFailure(this.createFailure(
|
this.addFailure(this.createFailure(
|
||||||
messageArg.getStart(), messageArg.getWidth(),
|
messageArg.getStart(), messageArg.getWidth(),
|
||||||
`Message argument to '${callInfo.callExpression.expression.getText()}' must be a string literal.`));
|
`Message argument to '${callInfo.callExpression.expression.getText()}' must be a string literal.`));
|
||||||
@@ -167,6 +169,15 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||||||
|
|
||||||
private recordKey(keyNode: ts.StringLiteral, messageNode: ts.Node) {
|
private recordKey(keyNode: ts.StringLiteral, messageNode: ts.Node) {
|
||||||
let text = keyNode.getText();
|
let text = keyNode.getText();
|
||||||
|
// We have an empty key
|
||||||
|
if (text.match(/(['"]) *\1/)) {
|
||||||
|
if (messageNode) {
|
||||||
|
this.addFailureAtNode(keyNode, `Key is empty for message: ${messageNode.getText()}`);
|
||||||
|
} else {
|
||||||
|
this.addFailureAtNode(keyNode, `Key is empty.`);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
let occurrences: KeyMessagePair[] = this.usedKeys[text];
|
let occurrences: KeyMessagePair[] = this.usedKeys[text];
|
||||||
if (!occurrences) {
|
if (!occurrences) {
|
||||||
occurrences = [];
|
occurrences = [];
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ var TranslationRemindRuleWalker = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!resourceDefined) {
|
if (!resourceDefined) {
|
||||||
this.addFailureAtNode(node, "Please add '" + resource + "' to ./builds/lib/i18n.resources.json file to use translations here.");
|
this.addFailureAtNode(node, "Please add '" + resource + "' to ./build/lib/i18n.resources.json file to use translations here.");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
TranslationRemindRuleWalker.NLS_MODULE = 'vs/nls';
|
TranslationRemindRuleWalker.NLS_MODULE = 'vs/nls';
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class TranslationRemindRuleWalker extends Lint.RuleWalker {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!resourceDefined) {
|
if (!resourceDefined) {
|
||||||
this.addFailureAtNode(node, `Please add '${resource}' to ./builds/lib/i18n.resources.json file to use translations here.`);
|
this.addFailureAtNode(node, `Please add '${resource}' to ./build/lib/i18n.resources.json file to use translations here.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
build/lib/typings/event-stream.d.ts
vendored
9
build/lib/typings/event-stream.d.ts
vendored
@@ -1,7 +1,14 @@
|
|||||||
declare module "event-stream" {
|
declare module "event-stream" {
|
||||||
import { Stream } from 'stream';
|
import { Stream } from 'stream';
|
||||||
import { ThroughStream } from 'through';
|
import { ThroughStream as _ThroughStream} from 'through';
|
||||||
import { MapStream } from 'map-stream';
|
import { MapStream } from 'map-stream';
|
||||||
|
import * as File from 'vinyl';
|
||||||
|
|
||||||
|
export interface ThroughStream extends _ThroughStream {
|
||||||
|
queue(data: File | null);
|
||||||
|
push(data: File | null);
|
||||||
|
paused: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
function merge(streams: Stream[]): ThroughStream;
|
function merge(streams: Stream[]): ThroughStream;
|
||||||
function merge(...streams: Stream[]): ThroughStream;
|
function merge(...streams: Stream[]): ThroughStream;
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ function loadSourcemaps() {
|
|||||||
cb(null, f);
|
cb(null, f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
f.contents = new Buffer(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8');
|
f.contents = Buffer.from(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8');
|
||||||
fs.readFile(path.join(path.dirname(f.path), lastMatch[1]), 'utf8', function (err, contents) {
|
fs.readFile(path.join(path.dirname(f.path), lastMatch[1]), 'utf8', function (err, contents) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return cb(err);
|
return cb(err);
|
||||||
@@ -160,7 +160,7 @@ function stripSourceMappingURL() {
|
|||||||
var output = input
|
var output = input
|
||||||
.pipe(es.mapSync(function (f) {
|
.pipe(es.mapSync(function (f) {
|
||||||
var contents = f.contents.toString('utf8');
|
var contents = f.contents.toString('utf8');
|
||||||
f.contents = new Buffer(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8');
|
f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8');
|
||||||
return f;
|
return f;
|
||||||
}));
|
}));
|
||||||
return es.duplex(input, output);
|
return es.duplex(input, output);
|
||||||
@@ -173,7 +173,6 @@ function rimraf(dir) {
|
|||||||
if (!err) {
|
if (!err) {
|
||||||
return cb();
|
return cb();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
if (err.code === 'ENOTEMPTY' && ++retries < 5) {
|
if (err.code === 'ENOTEMPTY' && ++retries < 5) {
|
||||||
return setTimeout(function () { return retry(cb); }, 10);
|
return setTimeout(function () { return retry(cb); }, 10);
|
||||||
}
|
}
|
||||||
@@ -211,3 +210,12 @@ function filter(fn) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.filter = filter;
|
exports.filter = filter;
|
||||||
|
function versionStringToNumber(versionStr) {
|
||||||
|
var semverRegex = /(\d+)\.(\d+)\.(\d+)/;
|
||||||
|
var match = versionStr.match(semverRegex);
|
||||||
|
if (!match) {
|
||||||
|
throw new Error('Version string is not properly formatted: ' + versionStr);
|
||||||
|
}
|
||||||
|
return parseInt(match[1], 10) * 1e4 + parseInt(match[2], 10) * 1e2 + parseInt(match[3], 10);
|
||||||
|
}
|
||||||
|
exports.versionStringToNumber = versionStringToNumber;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export interface IStreamProvider {
|
|||||||
(cancellationToken?: ICancellationToken): NodeJS.ReadWriteStream;
|
(cancellationToken?: ICancellationToken): NodeJS.ReadWriteStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function incremental(streamProvider: IStreamProvider, initial: NodeJS.ReadWriteStream, supportsCancellation: boolean): NodeJS.ReadWriteStream {
|
export function incremental(streamProvider: IStreamProvider, initial: NodeJS.ReadWriteStream, supportsCancellation?: boolean): NodeJS.ReadWriteStream {
|
||||||
const input = es.through();
|
const input = es.through();
|
||||||
const output = es.through();
|
const output = es.through();
|
||||||
let state = 'idle';
|
let state = 'idle';
|
||||||
@@ -129,7 +129,7 @@ export function skipDirectories(): NodeJS.ReadWriteStream {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cleanNodeModule(name: string, excludes: string[], includes: string[]): NodeJS.ReadWriteStream {
|
export function cleanNodeModule(name: string, excludes: string[], includes?: string[]): NodeJS.ReadWriteStream {
|
||||||
const toGlob = (path: string) => '**/node_modules/' + name + (path ? '/' + path : '');
|
const toGlob = (path: string) => '**/node_modules/' + name + (path ? '/' + path : '');
|
||||||
const negate = (str: string) => '!' + str;
|
const negate = (str: string) => '!' + str;
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ export function loadSourcemaps(): NodeJS.ReadWriteStream {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f.contents = new Buffer(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8');
|
f.contents = Buffer.from(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8');
|
||||||
|
|
||||||
fs.readFile(path.join(path.dirname(f.path), lastMatch[1]), 'utf8', (err, contents) => {
|
fs.readFile(path.join(path.dirname(f.path), lastMatch[1]), 'utf8', (err, contents) => {
|
||||||
if (err) { return cb(err); }
|
if (err) { return cb(err); }
|
||||||
@@ -209,7 +209,7 @@ export function stripSourceMappingURL(): NodeJS.ReadWriteStream {
|
|||||||
const output = input
|
const output = input
|
||||||
.pipe(es.mapSync<VinylFile, VinylFile>(f => {
|
.pipe(es.mapSync<VinylFile, VinylFile>(f => {
|
||||||
const contents = (<Buffer>f.contents).toString('utf8');
|
const contents = (<Buffer>f.contents).toString('utf8');
|
||||||
f.contents = new Buffer(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8');
|
f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8');
|
||||||
return f;
|
return f;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ export function rimraf(dir: string): (cb: any) => void {
|
|||||||
_rimraf(dir, { maxBusyTries: 1 }, (err: any) => {
|
_rimraf(dir, { maxBusyTries: 1 }, (err: any) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
return cb();
|
return cb();
|
||||||
};
|
}
|
||||||
|
|
||||||
if (err.code === 'ENOTEMPTY' && ++retries < 5) {
|
if (err.code === 'ENOTEMPTY' && ++retries < 5) {
|
||||||
return setTimeout(() => retry(cb), 10);
|
return setTimeout(() => retry(cb), 10);
|
||||||
@@ -268,4 +268,14 @@ export function filter(fn: (data: any) => boolean): FilterStream {
|
|||||||
|
|
||||||
result.restore = es.through();
|
result.restore = es.through();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function versionStringToNumber(versionStr: string) {
|
||||||
|
const semverRegex = /(\d+)\.(\d+)\.(\d+)/;
|
||||||
|
const match = versionStr.match(semverRegex);
|
||||||
|
if (!match) {
|
||||||
|
throw new Error('Version string is not properly formatted: ' + versionStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parseInt(match[1], 10) * 1e4 + parseInt(match[2], 10) * 1e2 + parseInt(match[3], 10);
|
||||||
|
}
|
||||||
|
|||||||
1
build/lib/watch/.gitignore
vendored
Normal file
1
build/lib/watch/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.yarnrc
|
||||||
@@ -9,7 +9,7 @@ const es = require('event-stream');
|
|||||||
function handleDeletions() {
|
function handleDeletions() {
|
||||||
return es.mapSync(f => {
|
return es.mapSync(f => {
|
||||||
if (/\.ts$/.test(f.relative) && !f.contents) {
|
if (/\.ts$/.test(f.relative) && !f.contents) {
|
||||||
f.contents = new Buffer('');
|
f.contents = Buffer.from('');
|
||||||
f.stat = { mtime: new Date() };
|
f.stat = { mtime: new Date() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ function watch(root) {
|
|||||||
path: path,
|
path: path,
|
||||||
base: root
|
base: root
|
||||||
});
|
});
|
||||||
|
//@ts-ignore
|
||||||
file.event = type;
|
file.event = type;
|
||||||
result.emit('data', file);
|
result.emit('data', file);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsfw(root, function(events) {
|
nsfw(root, function (events) {
|
||||||
for (var i = 0; i < events.length; i++) {
|
for (var i = 0; i < events.length; i++) {
|
||||||
var e = events[i];
|
var e = events[i];
|
||||||
var changeType = e.action;
|
var changeType = e.action;
|
||||||
@@ -47,16 +47,16 @@ function watch(root) {
|
|||||||
handleEvent(path.join(e.directory, e.file), toChangeType(changeType));
|
handleEvent(path.join(e.directory, e.file), toChangeType(changeType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).then(function(watcher) {
|
}).then(function (watcher) {
|
||||||
watcher.start();
|
watcher.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cache = Object.create(null);
|
var cache = Object.create(null);
|
||||||
|
|
||||||
module.exports = function(pattern, options) {
|
module.exports = function (pattern, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
var cwd = path.normalize(options.cwd || process.cwd());
|
var cwd = path.normalize(options.cwd || process.cwd());
|
||||||
@@ -66,7 +66,7 @@ module.exports = function(pattern, options) {
|
|||||||
watcher = cache[cwd] = watch(cwd);
|
watcher = cache[cwd] = watch(cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
var rebase = !options.base ? es.through() : es.mapSync(function(f) {
|
var rebase = !options.base ? es.through() : es.mapSync(function (f) {
|
||||||
f.base = options.base;
|
f.base = options.base;
|
||||||
return f;
|
return f;
|
||||||
});
|
});
|
||||||
@@ -74,13 +74,13 @@ module.exports = function(pattern, options) {
|
|||||||
return watcher
|
return watcher
|
||||||
.pipe(filter(['**', '!.git{,/**}'])) // ignore all things git
|
.pipe(filter(['**', '!.git{,/**}'])) // ignore all things git
|
||||||
.pipe(filter(pattern))
|
.pipe(filter(pattern))
|
||||||
.pipe(es.map(function(file, cb) {
|
.pipe(es.map(function (file, cb) {
|
||||||
fs.stat(file.path, function(err, stat) {
|
fs.stat(file.path, function (err, stat) {
|
||||||
if (err && err.code === 'ENOENT') { return cb(null, file); }
|
if (err && err.code === 'ENOENT') { return cb(null, file); }
|
||||||
if (err) { return cb(); }
|
if (err) { return cb(); }
|
||||||
if (!stat.isFile()) { return cb(); }
|
if (!stat.isFile()) { return cb(); }
|
||||||
|
|
||||||
fs.readFile(file.path, function(err, contents) {
|
fs.readFile(file.path, function (err, contents) {
|
||||||
if (err && err.code === 'ENOENT') { return cb(null, file); }
|
if (err && err.code === 'ENOENT') { return cb(null, file); }
|
||||||
if (err) { return cb(); }
|
if (err) { return cb(); }
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ function watch(root) {
|
|||||||
var result = es.through();
|
var result = es.through();
|
||||||
var child = cp.spawn(watcherPath, [root]);
|
var child = cp.spawn(watcherPath, [root]);
|
||||||
|
|
||||||
child.stdout.on('data', function(data) {
|
child.stdout.on('data', function (data) {
|
||||||
|
// @ts-ignore
|
||||||
var lines = data.toString('utf8').split('\n');
|
var lines = data.toString('utf8').split('\n');
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
var line = lines[i].trim();
|
var line = lines[i].trim();
|
||||||
@@ -46,17 +47,17 @@ function watch(root) {
|
|||||||
path: changePathFull,
|
path: changePathFull,
|
||||||
base: root
|
base: root
|
||||||
});
|
});
|
||||||
|
//@ts-ignore
|
||||||
file.event = toChangeType(changeType);
|
file.event = toChangeType(changeType);
|
||||||
result.emit('data', file);
|
result.emit('data', file);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
child.stderr.on('data', function(data) {
|
child.stderr.on('data', function (data) {
|
||||||
result.emit('error', data);
|
result.emit('error', data);
|
||||||
});
|
});
|
||||||
|
|
||||||
child.on('exit', function(code) {
|
child.on('exit', function (code) {
|
||||||
result.emit('error', 'Watcher died with code ' + code);
|
result.emit('error', 'Watcher died with code ' + code);
|
||||||
child = null;
|
child = null;
|
||||||
});
|
});
|
||||||
@@ -70,7 +71,7 @@ function watch(root) {
|
|||||||
|
|
||||||
var cache = Object.create(null);
|
var cache = Object.create(null);
|
||||||
|
|
||||||
module.exports = function(pattern, options) {
|
module.exports = function (pattern, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
var cwd = path.normalize(options.cwd || process.cwd());
|
var cwd = path.normalize(options.cwd || process.cwd());
|
||||||
|
|||||||
1302
build/lib/watch/yarn.lock
Normal file
1302
build/lib/watch/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
21
build/monaco/LICENSE
Normal file
21
build/monaco/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The Source EULA
|
||||||
|
|
||||||
|
Copyright (c) 2016 - present Microsoft Corporation
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -134,7 +134,25 @@ function getTopLevelDeclaration(sourceFile, typeName) {
|
|||||||
function getNodeText(sourceFile, node) {
|
function getNodeText(sourceFile, node) {
|
||||||
return sourceFile.getFullText().substring(node.pos, node.end);
|
return sourceFile.getFullText().substring(node.pos, node.end);
|
||||||
}
|
}
|
||||||
function getMassagedTopLevelDeclarationText(sourceFile, declaration) {
|
function hasModifier(modifiers, kind) {
|
||||||
|
if (modifiers) {
|
||||||
|
for (var i = 0; i < modifiers.length; i++) {
|
||||||
|
var mod = modifiers[i];
|
||||||
|
if (mod.kind === kind) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function isStatic(member) {
|
||||||
|
return hasModifier(member.modifiers, ts.SyntaxKind.StaticKeyword);
|
||||||
|
}
|
||||||
|
function isDefaultExport(declaration) {
|
||||||
|
return (hasModifier(declaration.modifiers, ts.SyntaxKind.DefaultKeyword)
|
||||||
|
&& hasModifier(declaration.modifiers, ts.SyntaxKind.ExportKeyword));
|
||||||
|
}
|
||||||
|
function getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage) {
|
||||||
var result = getNodeText(sourceFile, declaration);
|
var result = getNodeText(sourceFile, declaration);
|
||||||
// if (result.indexOf('MonacoWorker') >= 0) {
|
// if (result.indexOf('MonacoWorker') >= 0) {
|
||||||
// console.log('here!');
|
// console.log('here!');
|
||||||
@@ -142,6 +160,18 @@ function getMassagedTopLevelDeclarationText(sourceFile, declaration) {
|
|||||||
// }
|
// }
|
||||||
if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) {
|
if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) {
|
||||||
var interfaceDeclaration = declaration;
|
var interfaceDeclaration = declaration;
|
||||||
|
var staticTypeName_1 = (isDefaultExport(interfaceDeclaration)
|
||||||
|
? importName + ".default"
|
||||||
|
: importName + "." + declaration.name.text);
|
||||||
|
var instanceTypeName_1 = staticTypeName_1;
|
||||||
|
var typeParametersCnt = (interfaceDeclaration.typeParameters ? interfaceDeclaration.typeParameters.length : 0);
|
||||||
|
if (typeParametersCnt > 0) {
|
||||||
|
var arr = [];
|
||||||
|
for (var i = 0; i < typeParametersCnt; i++) {
|
||||||
|
arr.push('any');
|
||||||
|
}
|
||||||
|
instanceTypeName_1 = instanceTypeName_1 + "<" + arr.join(',') + ">";
|
||||||
|
}
|
||||||
var members = interfaceDeclaration.members;
|
var members = interfaceDeclaration.members;
|
||||||
members.forEach(function (member) {
|
members.forEach(function (member) {
|
||||||
try {
|
try {
|
||||||
@@ -151,6 +181,15 @@ function getMassagedTopLevelDeclarationText(sourceFile, declaration) {
|
|||||||
result = result.replace(memberText, '');
|
result = result.replace(memberText, '');
|
||||||
// console.log('AFTER: ', result);
|
// console.log('AFTER: ', result);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
var memberName = member.name.text;
|
||||||
|
if (isStatic(member)) {
|
||||||
|
usage.push("a = " + staticTypeName_1 + "." + memberName + ";");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
usage.push("a = (<" + instanceTypeName_1 + ">b)." + memberName + ";");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
// life..
|
// life..
|
||||||
@@ -171,9 +210,7 @@ function format(text) {
|
|||||||
function getRuleProvider(options) {
|
function getRuleProvider(options) {
|
||||||
// Share this between multiple formatters using the same options.
|
// Share this between multiple formatters using the same options.
|
||||||
// This represents the bulk of the space the formatter uses.
|
// This represents the bulk of the space the formatter uses.
|
||||||
var ruleProvider = new ts.formatting.RulesProvider();
|
return ts.formatting.getFormatContext(options);
|
||||||
ruleProvider.ensureUpToDate(options);
|
|
||||||
return ruleProvider;
|
|
||||||
}
|
}
|
||||||
function applyEdits(text, edits) {
|
function applyEdits(text, edits) {
|
||||||
// Apply edits in reverse on the existing text
|
// Apply edits in reverse on the existing text
|
||||||
@@ -210,8 +247,19 @@ function createReplacer(data) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
function generateDeclarationFile(out, inputFiles, recipe) {
|
function generateDeclarationFile(out, inputFiles, recipe) {
|
||||||
var lines = recipe.split(/\r\n|\n|\r/);
|
var endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
|
||||||
|
var lines = recipe.split(endl);
|
||||||
var result = [];
|
var result = [];
|
||||||
|
var usageCounter = 0;
|
||||||
|
var usageImports = [];
|
||||||
|
var usage = [];
|
||||||
|
usage.push("var a;");
|
||||||
|
usage.push("var b;");
|
||||||
|
var generateUsageImport = function (moduleId) {
|
||||||
|
var importName = 'm' + (++usageCounter);
|
||||||
|
usageImports.push("import * as " + importName + " from '" + moduleId.replace(/\.d\.ts$/, '') + "';");
|
||||||
|
return importName;
|
||||||
|
};
|
||||||
lines.forEach(function (line) {
|
lines.forEach(function (line) {
|
||||||
var m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
var m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||||
if (m1) {
|
if (m1) {
|
||||||
@@ -221,6 +269,7 @@ function generateDeclarationFile(out, inputFiles, recipe) {
|
|||||||
if (!sourceFile_1) {
|
if (!sourceFile_1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var importName_1 = generateUsageImport(moduleId);
|
||||||
var replacer_1 = createReplacer(m1[2]);
|
var replacer_1 = createReplacer(m1[2]);
|
||||||
var typeNames = m1[3].split(/,/);
|
var typeNames = m1[3].split(/,/);
|
||||||
typeNames.forEach(function (typeName) {
|
typeNames.forEach(function (typeName) {
|
||||||
@@ -233,7 +282,7 @@ function generateDeclarationFile(out, inputFiles, recipe) {
|
|||||||
logErr('Cannot find type ' + typeName);
|
logErr('Cannot find type ' + typeName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result.push(replacer_1(getMassagedTopLevelDeclarationText(sourceFile_1, declaration)));
|
result.push(replacer_1(getMassagedTopLevelDeclarationText(sourceFile_1, declaration, importName_1, usage)));
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -245,6 +294,7 @@ function generateDeclarationFile(out, inputFiles, recipe) {
|
|||||||
if (!sourceFile_2) {
|
if (!sourceFile_2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var importName_2 = generateUsageImport(moduleId);
|
||||||
var replacer_2 = createReplacer(m2[2]);
|
var replacer_2 = createReplacer(m2[2]);
|
||||||
var typeNames = m2[3].split(/,/);
|
var typeNames = m2[3].split(/,/);
|
||||||
var typesToExcludeMap_1 = {};
|
var typesToExcludeMap_1 = {};
|
||||||
@@ -272,21 +322,23 @@ function generateDeclarationFile(out, inputFiles, recipe) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.push(replacer_2(getMassagedTopLevelDeclarationText(sourceFile_2, declaration)));
|
result.push(replacer_2(getMassagedTopLevelDeclarationText(sourceFile_2, declaration, importName_2, usage)));
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result.push(line);
|
result.push(line);
|
||||||
});
|
});
|
||||||
var resultTxt = result.join('\n');
|
var resultTxt = result.join(endl);
|
||||||
resultTxt = resultTxt.replace(/\bURI\b/g, 'Uri');
|
resultTxt = resultTxt.replace(/\bURI\b/g, 'Uri');
|
||||||
resultTxt = resultTxt.replace(/\bEvent</g, 'IEvent<');
|
resultTxt = resultTxt.replace(/\bEvent</g, 'IEvent<');
|
||||||
resultTxt = resultTxt.replace(/\bTPromise</g, 'Promise<');
|
resultTxt = resultTxt.replace(/\bTPromise</g, 'Promise<');
|
||||||
resultTxt = format(resultTxt);
|
resultTxt = format(resultTxt);
|
||||||
resultTxt = resultTxt.replace(/\r\n/g, '\n');
|
return [
|
||||||
return resultTxt;
|
resultTxt,
|
||||||
|
usageImports.join('\n') + "\n\n" + usage.join('\n')
|
||||||
|
];
|
||||||
}
|
}
|
||||||
function getFilesToWatch(out) {
|
function getIncludesInRecipe() {
|
||||||
var recipe = fs.readFileSync(RECIPE_PATH).toString();
|
var recipe = fs.readFileSync(RECIPE_PATH).toString();
|
||||||
var lines = recipe.split(/\r\n|\n|\r/);
|
var lines = recipe.split(/\r\n|\n|\r/);
|
||||||
var result = [];
|
var result = [];
|
||||||
@@ -294,30 +346,37 @@ function getFilesToWatch(out) {
|
|||||||
var m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
var m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||||
if (m1) {
|
if (m1) {
|
||||||
var moduleId = m1[1];
|
var moduleId = m1[1];
|
||||||
result.push(moduleIdToPath(out, moduleId));
|
result.push(moduleId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var m2 = line.match(/^\s*#includeAll\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
var m2 = line.match(/^\s*#includeAll\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||||
if (m2) {
|
if (m2) {
|
||||||
var moduleId = m2[1];
|
var moduleId = m2[1];
|
||||||
result.push(moduleIdToPath(out, moduleId));
|
result.push(moduleId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
function getFilesToWatch(out) {
|
||||||
|
return getIncludesInRecipe().map(function (moduleId) { return moduleIdToPath(out, moduleId); });
|
||||||
|
}
|
||||||
exports.getFilesToWatch = getFilesToWatch;
|
exports.getFilesToWatch = getFilesToWatch;
|
||||||
function run(out, inputFiles) {
|
function run(out, inputFiles) {
|
||||||
log('Starting monaco.d.ts generation');
|
log('Starting monaco.d.ts generation');
|
||||||
SOURCE_FILE_MAP = {};
|
SOURCE_FILE_MAP = {};
|
||||||
var recipe = fs.readFileSync(RECIPE_PATH).toString();
|
var recipe = fs.readFileSync(RECIPE_PATH).toString();
|
||||||
var result = generateDeclarationFile(out, inputFiles, recipe);
|
var _a = generateDeclarationFile(out, inputFiles, recipe), result = _a[0], usageContent = _a[1];
|
||||||
var currentContent = fs.readFileSync(DECLARATION_PATH).toString();
|
var currentContent = fs.readFileSync(DECLARATION_PATH).toString();
|
||||||
log('Finished monaco.d.ts generation');
|
log('Finished monaco.d.ts generation');
|
||||||
|
var one = currentContent.replace(/\r\n/gm, '\n');
|
||||||
|
var other = result.replace(/\r\n/gm, '\n');
|
||||||
|
var isTheSame = one === other;
|
||||||
return {
|
return {
|
||||||
content: result,
|
content: result,
|
||||||
|
usageContent: usageContent,
|
||||||
filePath: DECLARATION_PATH,
|
filePath: DECLARATION_PATH,
|
||||||
isTheSame: currentContent === result
|
isTheSame: isTheSame
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.run = run;
|
exports.run = run;
|
||||||
@@ -325,3 +384,78 @@ function complainErrors() {
|
|||||||
logErr('Not running monaco.d.ts generation due to compile errors');
|
logErr('Not running monaco.d.ts generation due to compile errors');
|
||||||
}
|
}
|
||||||
exports.complainErrors = complainErrors;
|
exports.complainErrors = complainErrors;
|
||||||
|
var TypeScriptLanguageServiceHost = /** @class */ (function () {
|
||||||
|
function TypeScriptLanguageServiceHost(libs, files, compilerOptions) {
|
||||||
|
this._libs = libs;
|
||||||
|
this._files = files;
|
||||||
|
this._compilerOptions = compilerOptions;
|
||||||
|
}
|
||||||
|
// --- language service host ---------------
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getCompilationSettings = function () {
|
||||||
|
return this._compilerOptions;
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getScriptFileNames = function () {
|
||||||
|
return ([]
|
||||||
|
.concat(Object.keys(this._libs))
|
||||||
|
.concat(Object.keys(this._files)));
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getScriptVersion = function (fileName) {
|
||||||
|
return '1';
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getProjectVersion = function () {
|
||||||
|
return '1';
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getScriptSnapshot = function (fileName) {
|
||||||
|
if (this._files.hasOwnProperty(fileName)) {
|
||||||
|
return ts.ScriptSnapshot.fromString(this._files[fileName]);
|
||||||
|
}
|
||||||
|
else if (this._libs.hasOwnProperty(fileName)) {
|
||||||
|
return ts.ScriptSnapshot.fromString(this._libs[fileName]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ts.ScriptSnapshot.fromString('');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getScriptKind = function (fileName) {
|
||||||
|
return ts.ScriptKind.TS;
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getCurrentDirectory = function () {
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.getDefaultLibFileName = function (options) {
|
||||||
|
return 'defaultLib:es5';
|
||||||
|
};
|
||||||
|
TypeScriptLanguageServiceHost.prototype.isDefaultLibFileName = function (fileName) {
|
||||||
|
return fileName === this.getDefaultLibFileName(this._compilerOptions);
|
||||||
|
};
|
||||||
|
return TypeScriptLanguageServiceHost;
|
||||||
|
}());
|
||||||
|
function execute() {
|
||||||
|
var OUTPUT_FILES = {};
|
||||||
|
var SRC_FILES = {};
|
||||||
|
var SRC_FILE_TO_EXPECTED_NAME = {};
|
||||||
|
getIncludesInRecipe().forEach(function (moduleId) {
|
||||||
|
if (/\.d\.ts$/.test(moduleId)) {
|
||||||
|
var fileName_1 = path.join(SRC, moduleId);
|
||||||
|
OUTPUT_FILES[moduleIdToPath('src', moduleId)] = fs.readFileSync(fileName_1).toString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var fileName = path.join(SRC, moduleId) + '.ts';
|
||||||
|
SRC_FILES[fileName] = fs.readFileSync(fileName).toString();
|
||||||
|
SRC_FILE_TO_EXPECTED_NAME[fileName] = moduleIdToPath('src', moduleId);
|
||||||
|
});
|
||||||
|
var languageService = ts.createLanguageService(new TypeScriptLanguageServiceHost({}, SRC_FILES, {}));
|
||||||
|
var t1 = Date.now();
|
||||||
|
Object.keys(SRC_FILES).forEach(function (fileName) {
|
||||||
|
var t = Date.now();
|
||||||
|
var emitOutput = languageService.getEmitOutput(fileName, true);
|
||||||
|
OUTPUT_FILES[SRC_FILE_TO_EXPECTED_NAME[fileName]] = emitOutput.outputFiles[0].text;
|
||||||
|
// console.log(`Generating .d.ts for ${fileName} took ${Date.now() - t} ms`);
|
||||||
|
});
|
||||||
|
console.log("Generating .d.ts took " + (Date.now() - t1) + " ms");
|
||||||
|
// console.log(result.filePath);
|
||||||
|
// fs.writeFileSync(result.filePath, result.content.replace(/\r\n/gm, '\n'));
|
||||||
|
// fs.writeFileSync(path.join(SRC, 'user.ts'), result.usageContent.replace(/\r\n/gm, '\n'));
|
||||||
|
return run('src', OUTPUT_FILES);
|
||||||
|
}
|
||||||
|
exports.execute = execute;
|
||||||
|
|||||||
@@ -24,15 +24,15 @@ function logErr(message: any, ...rest: any[]): void {
|
|||||||
util.log(util.colors.red('[monaco.d.ts]'), message, ...rest);
|
util.log(util.colors.red('[monaco.d.ts]'), message, ...rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
function moduleIdToPath(out:string, moduleId:string): string {
|
function moduleIdToPath(out: string, moduleId: string): string {
|
||||||
if (/\.d\.ts/.test(moduleId)) {
|
if (/\.d\.ts/.test(moduleId)) {
|
||||||
return path.join(SRC, moduleId);
|
return path.join(SRC, moduleId);
|
||||||
}
|
}
|
||||||
return path.join(OUT_ROOT, out, moduleId) + '.d.ts';
|
return path.join(OUT_ROOT, out, moduleId) + '.d.ts';
|
||||||
}
|
}
|
||||||
|
|
||||||
let SOURCE_FILE_MAP: {[moduleId:string]:ts.SourceFile;} = {};
|
let SOURCE_FILE_MAP: { [moduleId: string]: ts.SourceFile; } = {};
|
||||||
function getSourceFile(out:string, inputFiles: { [file: string]: string; }, moduleId:string): ts.SourceFile {
|
function getSourceFile(out: string, inputFiles: { [file: string]: string; }, moduleId: string): ts.SourceFile {
|
||||||
if (!SOURCE_FILE_MAP[moduleId]) {
|
if (!SOURCE_FILE_MAP[moduleId]) {
|
||||||
let filePath = path.normalize(moduleIdToPath(out, moduleId));
|
let filePath = path.normalize(moduleIdToPath(out, moduleId));
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ function getSourceFile(out:string, inputFiles: { [file: string]: string; }, modu
|
|||||||
type TSTopLevelDeclaration = ts.InterfaceDeclaration | ts.EnumDeclaration | ts.ClassDeclaration | ts.TypeAliasDeclaration | ts.FunctionDeclaration | ts.ModuleDeclaration;
|
type TSTopLevelDeclaration = ts.InterfaceDeclaration | ts.EnumDeclaration | ts.ClassDeclaration | ts.TypeAliasDeclaration | ts.FunctionDeclaration | ts.ModuleDeclaration;
|
||||||
type TSTopLevelDeclare = TSTopLevelDeclaration | ts.VariableStatement;
|
type TSTopLevelDeclare = TSTopLevelDeclaration | ts.VariableStatement;
|
||||||
|
|
||||||
function isDeclaration(a:TSTopLevelDeclare): a is TSTopLevelDeclaration {
|
function isDeclaration(a: TSTopLevelDeclare): a is TSTopLevelDeclaration {
|
||||||
return (
|
return (
|
||||||
a.kind === ts.SyntaxKind.InterfaceDeclaration
|
a.kind === ts.SyntaxKind.InterfaceDeclaration
|
||||||
|| a.kind === ts.SyntaxKind.EnumDeclaration
|
|| a.kind === ts.SyntaxKind.EnumDeclaration
|
||||||
@@ -64,7 +64,7 @@ function isDeclaration(a:TSTopLevelDeclare): a is TSTopLevelDeclaration {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function visitTopLevelDeclarations(sourceFile:ts.SourceFile, visitor:(node:TSTopLevelDeclare)=>boolean): void {
|
function visitTopLevelDeclarations(sourceFile: ts.SourceFile, visitor: (node: TSTopLevelDeclare) => boolean): void {
|
||||||
let stop = false;
|
let stop = false;
|
||||||
|
|
||||||
let visit = (node: ts.Node): void => {
|
let visit = (node: ts.Node): void => {
|
||||||
@@ -100,8 +100,8 @@ function visitTopLevelDeclarations(sourceFile:ts.SourceFile, visitor:(node:TSTop
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getAllTopLevelDeclarations(sourceFile:ts.SourceFile): TSTopLevelDeclare[] {
|
function getAllTopLevelDeclarations(sourceFile: ts.SourceFile): TSTopLevelDeclare[] {
|
||||||
let all:TSTopLevelDeclare[] = [];
|
let all: TSTopLevelDeclare[] = [];
|
||||||
visitTopLevelDeclarations(sourceFile, (node) => {
|
visitTopLevelDeclarations(sourceFile, (node) => {
|
||||||
if (node.kind === ts.SyntaxKind.InterfaceDeclaration || node.kind === ts.SyntaxKind.ClassDeclaration || node.kind === ts.SyntaxKind.ModuleDeclaration) {
|
if (node.kind === ts.SyntaxKind.InterfaceDeclaration || node.kind === ts.SyntaxKind.ClassDeclaration || node.kind === ts.SyntaxKind.ModuleDeclaration) {
|
||||||
let interfaceDeclaration = <ts.InterfaceDeclaration>node;
|
let interfaceDeclaration = <ts.InterfaceDeclaration>node;
|
||||||
@@ -128,8 +128,8 @@ function getAllTopLevelDeclarations(sourceFile:ts.SourceFile): TSTopLevelDeclare
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getTopLevelDeclaration(sourceFile:ts.SourceFile, typeName:string): TSTopLevelDeclare {
|
function getTopLevelDeclaration(sourceFile: ts.SourceFile, typeName: string): TSTopLevelDeclare {
|
||||||
let result:TSTopLevelDeclare = null;
|
let result: TSTopLevelDeclare = null;
|
||||||
visitTopLevelDeclarations(sourceFile, (node) => {
|
visitTopLevelDeclarations(sourceFile, (node) => {
|
||||||
if (isDeclaration(node)) {
|
if (isDeclaration(node)) {
|
||||||
if (node.name.text === typeName) {
|
if (node.name.text === typeName) {
|
||||||
@@ -149,12 +149,34 @@ function getTopLevelDeclaration(sourceFile:ts.SourceFile, typeName:string): TSTo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getNodeText(sourceFile:ts.SourceFile, node:{pos:number; end:number;}): string {
|
function getNodeText(sourceFile: ts.SourceFile, node: { pos: number; end: number; }): string {
|
||||||
return sourceFile.getFullText().substring(node.pos, node.end);
|
return sourceFile.getFullText().substring(node.pos, node.end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasModifier(modifiers: ts.NodeArray<ts.Modifier>, kind: ts.SyntaxKind): boolean {
|
||||||
|
if (modifiers) {
|
||||||
|
for (let i = 0; i < modifiers.length; i++) {
|
||||||
|
let mod = modifiers[i];
|
||||||
|
if (mod.kind === kind) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaration: TSTopLevelDeclare): string {
|
function isStatic(member: ts.ClassElement | ts.TypeElement): boolean {
|
||||||
|
return hasModifier(member.modifiers, ts.SyntaxKind.StaticKeyword);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDefaultExport(declaration: ts.InterfaceDeclaration | ts.ClassDeclaration): boolean {
|
||||||
|
return (
|
||||||
|
hasModifier(declaration.modifiers, ts.SyntaxKind.DefaultKeyword)
|
||||||
|
&& hasModifier(declaration.modifiers, ts.SyntaxKind.ExportKeyword)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declaration: TSTopLevelDeclare, importName: string, usage: string[]): string {
|
||||||
let result = getNodeText(sourceFile, declaration);
|
let result = getNodeText(sourceFile, declaration);
|
||||||
// if (result.indexOf('MonacoWorker') >= 0) {
|
// if (result.indexOf('MonacoWorker') >= 0) {
|
||||||
// console.log('here!');
|
// console.log('here!');
|
||||||
@@ -163,7 +185,23 @@ function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaratio
|
|||||||
if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) {
|
if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) {
|
||||||
let interfaceDeclaration = <ts.InterfaceDeclaration | ts.ClassDeclaration>declaration;
|
let interfaceDeclaration = <ts.InterfaceDeclaration | ts.ClassDeclaration>declaration;
|
||||||
|
|
||||||
let members:ts.NodeArray<ts.Node> = interfaceDeclaration.members;
|
const staticTypeName = (
|
||||||
|
isDefaultExport(interfaceDeclaration)
|
||||||
|
? `${importName}.default`
|
||||||
|
: `${importName}.${declaration.name.text}`
|
||||||
|
);
|
||||||
|
|
||||||
|
let instanceTypeName = staticTypeName;
|
||||||
|
const typeParametersCnt = (interfaceDeclaration.typeParameters ? interfaceDeclaration.typeParameters.length : 0);
|
||||||
|
if (typeParametersCnt > 0) {
|
||||||
|
let arr: string[] = [];
|
||||||
|
for (let i = 0; i < typeParametersCnt; i++) {
|
||||||
|
arr.push('any');
|
||||||
|
}
|
||||||
|
instanceTypeName = `${instanceTypeName}<${arr.join(',')}>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const members: ts.NodeArray<ts.ClassElement | ts.TypeElement> = interfaceDeclaration.members;
|
||||||
members.forEach((member) => {
|
members.forEach((member) => {
|
||||||
try {
|
try {
|
||||||
let memberText = getNodeText(sourceFile, member);
|
let memberText = getNodeText(sourceFile, member);
|
||||||
@@ -171,6 +209,13 @@ function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaratio
|
|||||||
// console.log('BEFORE: ', result);
|
// console.log('BEFORE: ', result);
|
||||||
result = result.replace(memberText, '');
|
result = result.replace(memberText, '');
|
||||||
// console.log('AFTER: ', result);
|
// console.log('AFTER: ', result);
|
||||||
|
} else {
|
||||||
|
const memberName = (<ts.Identifier | ts.StringLiteral>member.name).text;
|
||||||
|
if (isStatic(member)) {
|
||||||
|
usage.push(`a = ${staticTypeName}.${memberName};`);
|
||||||
|
} else {
|
||||||
|
usage.push(`a = (<${instanceTypeName}>b).${memberName};`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// life..
|
// life..
|
||||||
@@ -182,7 +227,7 @@ function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaratio
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function format(text:string): string {
|
function format(text: string): string {
|
||||||
|
|
||||||
// Parse the source text
|
// Parse the source text
|
||||||
let sourceFile = ts.createSourceFile('file.ts', text, ts.ScriptTarget.Latest, /*setParentPointers*/ true);
|
let sourceFile = ts.createSourceFile('file.ts', text, ts.ScriptTarget.Latest, /*setParentPointers*/ true);
|
||||||
@@ -196,9 +241,7 @@ function format(text:string): string {
|
|||||||
function getRuleProvider(options: ts.FormatCodeSettings) {
|
function getRuleProvider(options: ts.FormatCodeSettings) {
|
||||||
// Share this between multiple formatters using the same options.
|
// Share this between multiple formatters using the same options.
|
||||||
// This represents the bulk of the space the formatter uses.
|
// This represents the bulk of the space the formatter uses.
|
||||||
let ruleProvider = new (<any>ts).formatting.RulesProvider();
|
return (ts as any).formatting.getFormatContext(options);
|
||||||
ruleProvider.ensureUpToDate(options);
|
|
||||||
return ruleProvider;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyEdits(text: string, edits: ts.TextChange[]): string {
|
function applyEdits(text: string, edits: ts.TextChange[]): string {
|
||||||
@@ -214,10 +257,10 @@ function format(text:string): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createReplacer(data:string): (str:string)=>string {
|
function createReplacer(data: string): (str: string) => string {
|
||||||
data = data || '';
|
data = data || '';
|
||||||
let rawDirectives = data.split(';');
|
let rawDirectives = data.split(';');
|
||||||
let directives: [RegExp,string][] = [];
|
let directives: [RegExp, string][] = [];
|
||||||
rawDirectives.forEach((rawDirective) => {
|
rawDirectives.forEach((rawDirective) => {
|
||||||
if (rawDirective.length === 0) {
|
if (rawDirective.length === 0) {
|
||||||
return;
|
return;
|
||||||
@@ -231,7 +274,7 @@ function createReplacer(data:string): (str:string)=>string {
|
|||||||
directives.push([new RegExp(findStr, 'g'), replaceStr]);
|
directives.push([new RegExp(findStr, 'g'), replaceStr]);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (str:string)=> {
|
return (str: string) => {
|
||||||
for (let i = 0; i < directives.length; i++) {
|
for (let i = 0; i < directives.length; i++) {
|
||||||
str = str.replace(directives[i][0], directives[i][1]);
|
str = str.replace(directives[i][0], directives[i][1]);
|
||||||
}
|
}
|
||||||
@@ -239,10 +282,24 @@ function createReplacer(data:string): (str:string)=>string {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateDeclarationFile(out: string, inputFiles: { [file: string]: string; }, recipe:string): string {
|
function generateDeclarationFile(out: string, inputFiles: { [file: string]: string; }, recipe: string): [string, string] {
|
||||||
let lines = recipe.split(/\r\n|\n|\r/);
|
const endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
|
||||||
let result = [];
|
|
||||||
|
|
||||||
|
let lines = recipe.split(endl);
|
||||||
|
let result: string[] = [];
|
||||||
|
|
||||||
|
let usageCounter = 0;
|
||||||
|
let usageImports: string[] = [];
|
||||||
|
let usage: string[] = [];
|
||||||
|
|
||||||
|
usage.push(`var a;`);
|
||||||
|
usage.push(`var b;`);
|
||||||
|
|
||||||
|
const generateUsageImport = (moduleId: string) => {
|
||||||
|
let importName = 'm' + (++usageCounter);
|
||||||
|
usageImports.push(`import * as ${importName} from '${moduleId.replace(/\.d\.ts$/, '')}';`);
|
||||||
|
return importName;
|
||||||
|
};
|
||||||
|
|
||||||
lines.forEach(line => {
|
lines.forEach(line => {
|
||||||
|
|
||||||
@@ -255,6 +312,8 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const importName = generateUsageImport(moduleId);
|
||||||
|
|
||||||
let replacer = createReplacer(m1[2]);
|
let replacer = createReplacer(m1[2]);
|
||||||
|
|
||||||
let typeNames = m1[3].split(/,/);
|
let typeNames = m1[3].split(/,/);
|
||||||
@@ -268,7 +327,7 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
|
|||||||
logErr('Cannot find type ' + typeName);
|
logErr('Cannot find type ' + typeName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration)));
|
result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage)));
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -282,10 +341,12 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const importName = generateUsageImport(moduleId);
|
||||||
|
|
||||||
let replacer = createReplacer(m2[2]);
|
let replacer = createReplacer(m2[2]);
|
||||||
|
|
||||||
let typeNames = m2[3].split(/,/);
|
let typeNames = m2[3].split(/,/);
|
||||||
let typesToExcludeMap: {[typeName:string]:boolean;} = {};
|
let typesToExcludeMap: { [typeName: string]: boolean; } = {};
|
||||||
let typesToExcludeArr: string[] = [];
|
let typesToExcludeArr: string[] = [];
|
||||||
typeNames.forEach((typeName) => {
|
typeNames.forEach((typeName) => {
|
||||||
typeName = typeName.trim();
|
typeName = typeName.trim();
|
||||||
@@ -310,7 +371,7 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration)));
|
result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage)));
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -318,18 +379,20 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
|
|||||||
result.push(line);
|
result.push(line);
|
||||||
});
|
});
|
||||||
|
|
||||||
let resultTxt = result.join('\n');
|
let resultTxt = result.join(endl);
|
||||||
resultTxt = resultTxt.replace(/\bURI\b/g, 'Uri');
|
resultTxt = resultTxt.replace(/\bURI\b/g, 'Uri');
|
||||||
resultTxt = resultTxt.replace(/\bEvent</g, 'IEvent<');
|
resultTxt = resultTxt.replace(/\bEvent</g, 'IEvent<');
|
||||||
resultTxt = resultTxt.replace(/\bTPromise</g, 'Promise<');
|
resultTxt = resultTxt.replace(/\bTPromise</g, 'Promise<');
|
||||||
|
|
||||||
resultTxt = format(resultTxt);
|
resultTxt = format(resultTxt);
|
||||||
|
|
||||||
resultTxt = resultTxt.replace(/\r\n/g, '\n');
|
return [
|
||||||
return resultTxt;
|
resultTxt,
|
||||||
|
`${usageImports.join('\n')}\n\n${usage.join('\n')}`
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFilesToWatch(out:string): string[] {
|
function getIncludesInRecipe(): string[] {
|
||||||
let recipe = fs.readFileSync(RECIPE_PATH).toString();
|
let recipe = fs.readFileSync(RECIPE_PATH).toString();
|
||||||
let lines = recipe.split(/\r\n|\n|\r/);
|
let lines = recipe.split(/\r\n|\n|\r/);
|
||||||
let result = [];
|
let result = [];
|
||||||
@@ -339,14 +402,14 @@ export function getFilesToWatch(out:string): string[] {
|
|||||||
let m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
let m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||||
if (m1) {
|
if (m1) {
|
||||||
let moduleId = m1[1];
|
let moduleId = m1[1];
|
||||||
result.push(moduleIdToPath(out, moduleId));
|
result.push(moduleId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let m2 = line.match(/^\s*#includeAll\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
let m2 = line.match(/^\s*#includeAll\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||||
if (m2) {
|
if (m2) {
|
||||||
let moduleId = m2[1];
|
let moduleId = m2[1];
|
||||||
result.push(moduleIdToPath(out, moduleId));
|
result.push(moduleId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -354,8 +417,13 @@ export function getFilesToWatch(out:string): string[] {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getFilesToWatch(out: string): string[] {
|
||||||
|
return getIncludesInRecipe().map((moduleId) => moduleIdToPath(out, moduleId));
|
||||||
|
}
|
||||||
|
|
||||||
export interface IMonacoDeclarationResult {
|
export interface IMonacoDeclarationResult {
|
||||||
content: string;
|
content: string;
|
||||||
|
usageContent: string;
|
||||||
filePath: string;
|
filePath: string;
|
||||||
isTheSame: boolean;
|
isTheSame: boolean;
|
||||||
}
|
}
|
||||||
@@ -365,18 +433,116 @@ export function run(out: string, inputFiles: { [file: string]: string; }): IMona
|
|||||||
SOURCE_FILE_MAP = {};
|
SOURCE_FILE_MAP = {};
|
||||||
|
|
||||||
let recipe = fs.readFileSync(RECIPE_PATH).toString();
|
let recipe = fs.readFileSync(RECIPE_PATH).toString();
|
||||||
let result = generateDeclarationFile(out, inputFiles, recipe);
|
let [result, usageContent] = generateDeclarationFile(out, inputFiles, recipe);
|
||||||
|
|
||||||
let currentContent = fs.readFileSync(DECLARATION_PATH).toString();
|
let currentContent = fs.readFileSync(DECLARATION_PATH).toString();
|
||||||
log('Finished monaco.d.ts generation');
|
log('Finished monaco.d.ts generation');
|
||||||
|
|
||||||
|
const one = currentContent.replace(/\r\n/gm, '\n');
|
||||||
|
const other = result.replace(/\r\n/gm, '\n');
|
||||||
|
const isTheSame = one === other;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: result,
|
content: result,
|
||||||
|
usageContent: usageContent,
|
||||||
filePath: DECLARATION_PATH,
|
filePath: DECLARATION_PATH,
|
||||||
isTheSame: currentContent === result
|
isTheSame
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function complainErrors() {
|
export function complainErrors() {
|
||||||
logErr('Not running monaco.d.ts generation due to compile errors');
|
logErr('Not running monaco.d.ts generation due to compile errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
interface ILibMap { [libName: string]: string; }
|
||||||
|
interface IFileMap { [fileName: string]: string; }
|
||||||
|
|
||||||
|
class TypeScriptLanguageServiceHost implements ts.LanguageServiceHost {
|
||||||
|
|
||||||
|
private readonly _libs: ILibMap;
|
||||||
|
private readonly _files: IFileMap;
|
||||||
|
private readonly _compilerOptions: ts.CompilerOptions;
|
||||||
|
|
||||||
|
constructor(libs: ILibMap, files: IFileMap, compilerOptions: ts.CompilerOptions) {
|
||||||
|
this._libs = libs;
|
||||||
|
this._files = files;
|
||||||
|
this._compilerOptions = compilerOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- language service host ---------------
|
||||||
|
|
||||||
|
getCompilationSettings(): ts.CompilerOptions {
|
||||||
|
return this._compilerOptions;
|
||||||
|
}
|
||||||
|
getScriptFileNames(): string[] {
|
||||||
|
return (
|
||||||
|
[]
|
||||||
|
.concat(Object.keys(this._libs))
|
||||||
|
.concat(Object.keys(this._files))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
getScriptVersion(fileName: string): string {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
getProjectVersion(): string {
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
getScriptSnapshot(fileName: string): ts.IScriptSnapshot {
|
||||||
|
if (this._files.hasOwnProperty(fileName)) {
|
||||||
|
return ts.ScriptSnapshot.fromString(this._files[fileName]);
|
||||||
|
} else if (this._libs.hasOwnProperty(fileName)) {
|
||||||
|
return ts.ScriptSnapshot.fromString(this._libs[fileName]);
|
||||||
|
} else {
|
||||||
|
return ts.ScriptSnapshot.fromString('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getScriptKind(fileName: string): ts.ScriptKind {
|
||||||
|
return ts.ScriptKind.TS;
|
||||||
|
}
|
||||||
|
getCurrentDirectory(): string {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
getDefaultLibFileName(options: ts.CompilerOptions): string {
|
||||||
|
return 'defaultLib:es5';
|
||||||
|
}
|
||||||
|
isDefaultLibFileName(fileName: string): boolean {
|
||||||
|
return fileName === this.getDefaultLibFileName(this._compilerOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function execute(): IMonacoDeclarationResult {
|
||||||
|
|
||||||
|
const OUTPUT_FILES: { [file: string]: string; } = {};
|
||||||
|
const SRC_FILES: IFileMap = {};
|
||||||
|
const SRC_FILE_TO_EXPECTED_NAME: { [filename: string]: string; } = {};
|
||||||
|
getIncludesInRecipe().forEach((moduleId) => {
|
||||||
|
if (/\.d\.ts$/.test(moduleId)) {
|
||||||
|
let fileName = path.join(SRC, moduleId);
|
||||||
|
OUTPUT_FILES[moduleIdToPath('src', moduleId)] = fs.readFileSync(fileName).toString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let fileName = path.join(SRC, moduleId) + '.ts';
|
||||||
|
SRC_FILES[fileName] = fs.readFileSync(fileName).toString();
|
||||||
|
SRC_FILE_TO_EXPECTED_NAME[fileName] = moduleIdToPath('src', moduleId);
|
||||||
|
});
|
||||||
|
|
||||||
|
const languageService = ts.createLanguageService(new TypeScriptLanguageServiceHost({}, SRC_FILES, {}));
|
||||||
|
|
||||||
|
var t1 = Date.now();
|
||||||
|
Object.keys(SRC_FILES).forEach((fileName) => {
|
||||||
|
var t = Date.now();
|
||||||
|
const emitOutput = languageService.getEmitOutput(fileName, true);
|
||||||
|
OUTPUT_FILES[SRC_FILE_TO_EXPECTED_NAME[fileName]] = emitOutput.outputFiles[0].text;
|
||||||
|
// console.log(`Generating .d.ts for ${fileName} took ${Date.now() - t} ms`);
|
||||||
|
});
|
||||||
|
console.log(`Generating .d.ts took ${Date.now() - t1} ms`);
|
||||||
|
|
||||||
|
// console.log(result.filePath);
|
||||||
|
// fs.writeFileSync(result.filePath, result.content.replace(/\r\n/gm, '\n'));
|
||||||
|
// fs.writeFileSync(path.join(SRC, 'user.ts'), result.usageContent.replace(/\r\n/gm, '\n'));
|
||||||
|
|
||||||
|
return run('src', OUTPUT_FILES);
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
declare module monaco {
|
declare namespace monaco {
|
||||||
|
|
||||||
type Thenable<T> = PromiseLike<T>;
|
export type Thenable<T> = PromiseLike<T>;
|
||||||
|
|
||||||
export interface IDisposable {
|
export interface IDisposable {
|
||||||
dispose(): void;
|
dispose(): void;
|
||||||
@@ -32,6 +32,18 @@ declare module monaco {
|
|||||||
Error = 3,
|
Error = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum MarkerTag {
|
||||||
|
Unnecessary = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum MarkerSeverity {
|
||||||
|
Hint = 1,
|
||||||
|
Info = 2,
|
||||||
|
Warning = 4,
|
||||||
|
Error = 8,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, Promise
|
#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, Promise
|
||||||
#include(vs/base/common/cancellation): CancellationTokenSource, CancellationToken
|
#include(vs/base/common/cancellation): CancellationTokenSource, CancellationToken
|
||||||
#include(vs/base/common/uri): URI, UriComponents
|
#include(vs/base/common/uri): URI, UriComponents
|
||||||
@@ -46,41 +58,46 @@ declare module monaco {
|
|||||||
#include(vs/editor/common/core/token): Token
|
#include(vs/editor/common/core/token): Token
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module monaco.editor {
|
declare namespace monaco.editor {
|
||||||
|
|
||||||
#includeAll(vs/editor/standalone/browser/standaloneEditor;modes.=>languages.;editorCommon.=>):
|
#includeAll(vs/editor/standalone/browser/standaloneEditor;modes.=>languages.;editorCommon.=>):
|
||||||
#include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors
|
#include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors
|
||||||
#include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule
|
#include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule
|
||||||
#include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions
|
#include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions
|
||||||
#include(vs/editor/standalone/browser/standaloneCodeEditor): IEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
|
#include(vs/editor/standalone/browser/standaloneCodeEditor): IActionDescriptor, IEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
|
||||||
export interface ICommandHandler {
|
export interface ICommandHandler {
|
||||||
(...args:any[]): void;
|
(...args:any[]): void;
|
||||||
}
|
}
|
||||||
#include(vs/platform/contextkey/common/contextkey): IContextKey
|
#include(vs/platform/contextkey/common/contextkey): IContextKey
|
||||||
#include(vs/editor/standalone/browser/standaloneServices): IEditorOverrideServices
|
#include(vs/editor/standalone/browser/standaloneServices): IEditorOverrideServices
|
||||||
#include(vs/platform/markers/common/markers): IMarker, IMarkerData
|
#include(vs/platform/markers/common/markers): IMarker, IMarkerData, IRelatedInformation
|
||||||
#include(vs/editor/standalone/browser/colorizer): IColorizerOptions, IColorizerElementOptions
|
#include(vs/editor/standalone/browser/colorizer): IColorizerOptions, IColorizerElementOptions
|
||||||
#include(vs/base/common/scrollable): ScrollbarVisibility
|
#include(vs/base/common/scrollable): ScrollbarVisibility
|
||||||
#include(vs/platform/theme/common/themeService): ThemeColor
|
#include(vs/platform/theme/common/themeService): ThemeColor
|
||||||
#includeAll(vs/editor/common/editorCommon;IMode=>languages.IMode;LanguageIdentifier=>languages.LanguageIdentifier;editorOptions.=>): ISelection, IScrollEvent
|
#includeAll(vs/editor/common/model;LanguageIdentifier=>languages.LanguageIdentifier): IScrollEvent
|
||||||
|
#includeAll(vs/editor/common/editorCommon;editorOptions.=>): IScrollEvent
|
||||||
#includeAll(vs/editor/common/model/textModelEvents):
|
#includeAll(vs/editor/common/model/textModelEvents):
|
||||||
#includeAll(vs/editor/common/controller/cursorEvents):
|
#includeAll(vs/editor/common/controller/cursorEvents):
|
||||||
#includeAll(vs/editor/common/config/editorOptions):
|
#includeAll(vs/editor/common/config/editorOptions):
|
||||||
#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>):
|
#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>):
|
||||||
#include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo
|
#include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo
|
||||||
|
|
||||||
|
//compatibility:
|
||||||
|
export type IReadOnlyModel = ITextModel;
|
||||||
|
export type IModel = ITextModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module monaco.languages {
|
declare namespace monaco.languages {
|
||||||
|
|
||||||
#includeAll(vs/editor/standalone/browser/standaloneLanguages;modes.=>;editorCommon.=>editor.;IMarkerData=>editor.IMarkerData):
|
#includeAll(vs/editor/standalone/browser/standaloneLanguages;modes.=>;editorCommon.=>editor.;model.=>editor.;IMarkerData=>editor.IMarkerData):
|
||||||
#includeAll(vs/editor/common/modes/languageConfiguration):
|
#includeAll(vs/editor/common/modes/languageConfiguration):
|
||||||
#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.):
|
#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.;IMarkerData=>editor.IMarkerData;model.=>editor.):
|
||||||
#include(vs/editor/common/services/modeService): ILanguageExtensionPoint
|
#include(vs/editor/common/services/modeService): ILanguageExtensionPoint
|
||||||
#includeAll(vs/editor/standalone/common/monarch/monarchTypes):
|
#includeAll(vs/editor/standalone/common/monarch/monarchTypes):
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module monaco.worker {
|
declare namespace monaco.worker {
|
||||||
|
|
||||||
#includeAll(vs/editor/common/services/editorSimpleWorker;):
|
#includeAll(vs/editor/common/services/editorSimpleWorker;):
|
||||||
|
|
||||||
|
|||||||
82
build/monaco/monaco.usage.recipe
Normal file
82
build/monaco/monaco.usage.recipe
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
|
||||||
|
// This file is adding references to various symbols which should not be removed via tree shaking
|
||||||
|
|
||||||
|
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||||
|
import { IHighlight } from 'vs/base/parts/quickopen/browser/quickOpenModel';
|
||||||
|
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||||
|
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||||
|
import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge';
|
||||||
|
import { SimpleWorkerClient, create as create1 } from 'vs/base/common/worker/simpleWorker';
|
||||||
|
import { create as create2 } from 'vs/editor/common/services/editorSimpleWorker';
|
||||||
|
import { QuickOpenWidget } from 'vs/base/parts/quickopen/browser/quickOpenWidget';
|
||||||
|
import { SyncDescriptor0, SyncDescriptor1, SyncDescriptor2, SyncDescriptor3, SyncDescriptor4, SyncDescriptor5, SyncDescriptor6, SyncDescriptor7, SyncDescriptor8 } from 'vs/platform/instantiation/common/descriptors';
|
||||||
|
import { PolyfillPromise } from 'vs/base/common/winjs.polyfill.promise';
|
||||||
|
import { DiffNavigator } from 'vs/editor/browser/widget/diffNavigator';
|
||||||
|
import * as editorAPI from 'vs/editor/editor.api';
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var a: any;
|
||||||
|
var b: any;
|
||||||
|
a = (<IContextViewService>b).layout; // IContextViewProvider
|
||||||
|
a = (<IWorkspaceContextService>b).getWorkspaceFolder; // IWorkspaceFolderProvider
|
||||||
|
a = (<IWorkspaceContextService>b).getWorkspace; // IWorkspaceFolderProvider
|
||||||
|
a = (<CountBadge>b).style; // IThemable
|
||||||
|
a = (<QuickOpenWidget>b).style; // IThemable
|
||||||
|
a = (<IEnvironmentService>b).userHome; // IUserHomeProvider
|
||||||
|
a = (<DiffNavigator>b).previous; // IDiffNavigator
|
||||||
|
a = (<ServiceIdentifier<any>>b).type;
|
||||||
|
a = (<IHighlight>b).start;
|
||||||
|
a = (<IHighlight>b).end;
|
||||||
|
a = (<SimpleWorkerClient<any>>b).getProxyObject; // IWorkerClient
|
||||||
|
a = create1;
|
||||||
|
a = create2;
|
||||||
|
|
||||||
|
// promise polyfill
|
||||||
|
a = PolyfillPromise.all;
|
||||||
|
a = PolyfillPromise.race;
|
||||||
|
a = PolyfillPromise.resolve;
|
||||||
|
a = PolyfillPromise.reject;
|
||||||
|
a = (<PolyfillPromise>b).then;
|
||||||
|
a = (<PolyfillPromise>b).catch;
|
||||||
|
|
||||||
|
// injection madness
|
||||||
|
a = (<SyncDescriptor0<any>>b).ctor;
|
||||||
|
a = (<SyncDescriptor0<any>>b).bind;
|
||||||
|
a = (<SyncDescriptor1<any, any>>b).ctor;
|
||||||
|
a = (<SyncDescriptor1<any, any>>b).bind;
|
||||||
|
a = (<SyncDescriptor1<any, any>>b).ctor;
|
||||||
|
a = (<SyncDescriptor1<any, any>>b).bind;
|
||||||
|
a = (<SyncDescriptor2<any, any, any>>b).ctor;
|
||||||
|
a = (<SyncDescriptor2<any, any, any>>b).bind;
|
||||||
|
a = (<SyncDescriptor3<any, any, any, any>>b).ctor;
|
||||||
|
a = (<SyncDescriptor3<any, any, any, any>>b).bind;
|
||||||
|
a = (<SyncDescriptor4<any, any, any, any, any>>b).ctor;
|
||||||
|
a = (<SyncDescriptor4<any, any, any, any, any>>b).bind;
|
||||||
|
a = (<SyncDescriptor5<any, any, any, any, any, any>>b).ctor;
|
||||||
|
a = (<SyncDescriptor5<any, any, any, any, any, any>>b).bind;
|
||||||
|
a = (<SyncDescriptor6<any, any, any, any, any, any, any>>b).ctor;
|
||||||
|
a = (<SyncDescriptor6<any, any, any, any, any, any, any>>b).bind;
|
||||||
|
a = (<SyncDescriptor7<any, any, any, any, any, any, any, any>>b).ctor;
|
||||||
|
a = (<SyncDescriptor7<any, any, any, any, any, any, any, any>>b).bind;
|
||||||
|
a = (<SyncDescriptor8<any, any, any, any, any, any, any, any, any>>b).ctor;
|
||||||
|
a = (<SyncDescriptor8<any, any, any, any, any, any, any, any, any>>b).bind;
|
||||||
|
|
||||||
|
// exported API
|
||||||
|
a = editorAPI.CancellationTokenSource;
|
||||||
|
a = editorAPI.Emitter;
|
||||||
|
a = editorAPI.KeyCode;
|
||||||
|
a = editorAPI.KeyMod;
|
||||||
|
a = editorAPI.Position;
|
||||||
|
a = editorAPI.Range;
|
||||||
|
a = editorAPI.Selection;
|
||||||
|
a = editorAPI.SelectionDirection;
|
||||||
|
a = editorAPI.Severity;
|
||||||
|
a = editorAPI.MarkerSeverity;
|
||||||
|
a = editorAPI.MarkerTag;
|
||||||
|
a = editorAPI.Promise;
|
||||||
|
a = editorAPI.Uri;
|
||||||
|
a = editorAPI.Token;
|
||||||
|
a = editorAPI.editor;
|
||||||
|
a = editorAPI.languages;
|
||||||
|
})();
|
||||||
@@ -1,57 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "monaco-editor-core",
|
"name": "monaco-editor-core",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.9.0",
|
"version": "0.12.0",
|
||||||
"description": "A browser based code editor",
|
"description": "A browser based code editor",
|
||||||
"author": "Microsoft Corporation",
|
"author": "Microsoft Corporation",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"typings": "./esm/vs/editor/editor.api.d.ts",
|
||||||
|
"module": "./esm/vs/editor/editor.main.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Microsoft/vscode"
|
"url": "https://github.com/Microsoft/vscode"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/Microsoft/vscode/issues"
|
"url": "https://github.com/Microsoft/vscode/issues"
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/minimist": "1.2.0",
|
|
||||||
"@types/mocha": "2.2.39",
|
|
||||||
"@types/semver": "5.3.30",
|
|
||||||
"@types/sinon": "1.16.34",
|
|
||||||
"debounce": "^1.0.0",
|
|
||||||
"eslint": "^3.4.0",
|
|
||||||
"event-stream": "^3.1.7",
|
|
||||||
"ghooks": "1.0.3",
|
|
||||||
"glob": "^5.0.13",
|
|
||||||
"gulp": "^3.8.9",
|
|
||||||
"gulp-bom": "^1.0.0",
|
|
||||||
"gulp-concat": "^2.6.0",
|
|
||||||
"gulp-cssnano": "^2.1.0",
|
|
||||||
"gulp-filter": "^3.0.0",
|
|
||||||
"gulp-flatmap": "^1.0.0",
|
|
||||||
"gulp-rename": "^1.2.0",
|
|
||||||
"gulp-sourcemaps": "^1.11.0",
|
|
||||||
"gulp-tsb": "^2.0.3",
|
|
||||||
"gulp-tslint": "^7.0.1",
|
|
||||||
"gulp-uglify": "^2.0.0",
|
|
||||||
"gulp-util": "^3.0.6",
|
|
||||||
"gulp-watch": "^4.3.9",
|
|
||||||
"is": "^3.1.0",
|
|
||||||
"istanbul": "^0.3.17",
|
|
||||||
"jsdom-no-contextify": "^3.1.0",
|
|
||||||
"lazy.js": "^0.4.2",
|
|
||||||
"minimatch": "^2.0.10",
|
|
||||||
"mocha": "^2.2.5",
|
|
||||||
"object-assign": "^4.0.1",
|
|
||||||
"pump": "^1.0.1",
|
|
||||||
"remap-istanbul": "^0.6.4",
|
|
||||||
"rimraf": "^2.2.8",
|
|
||||||
"sinon": "^1.17.2",
|
|
||||||
"source-map": "^0.4.4",
|
|
||||||
"tslint": "^4.3.1",
|
|
||||||
"typescript": "2.5.2",
|
|
||||||
"typescript-formatter": "4.0.1",
|
|
||||||
"underscore": "^1.8.2",
|
|
||||||
"vinyl": "^0.4.5",
|
|
||||||
"vscode-nls-dev": "^2.0.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4668
build/monaco/yarn.lock
Normal file
4668
build/monaco/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,59 +5,55 @@
|
|||||||
|
|
||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
const fs = require('fs');
|
||||||
|
const yarn = process.platform === 'win32' ? 'yarn.cmd' : 'yarn';
|
||||||
|
|
||||||
function npmInstall(location, opts) {
|
function yarnInstall(location, opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
opts.cwd = location;
|
opts.cwd = location;
|
||||||
opts.stdio = 'inherit';
|
opts.stdio = 'inherit';
|
||||||
|
|
||||||
const result = cp.spawnSync(npm, ['install'], opts);
|
const result = cp.spawnSync(yarn, ['install'], opts);
|
||||||
|
|
||||||
if (result.error || result.status !== 0) {
|
if (result.error || result.status !== 0) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
yarnInstall('extensions'); // node modules shared by all extensions
|
||||||
const protocol = [
|
|
||||||
'jsonrpc',
|
|
||||||
'types',
|
|
||||||
'client'
|
|
||||||
];
|
|
||||||
|
|
||||||
protocol.forEach(item => npmInstall(`dataprotocol-node/${item}`));
|
const allExtensionFolders = fs.readdirSync('extensions');
|
||||||
|
const extensions = allExtensionFolders.filter(e => {
|
||||||
|
try {
|
||||||
|
let packageJSON = JSON.parse(fs.readFileSync(path.join('extensions', e, 'package.json')).toString());
|
||||||
|
return packageJSON && (packageJSON.dependencies || packageJSON.devDependencies);
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
extensions.forEach(extension => yarnInstall(`extensions/${extension}`));
|
||||||
npmInstall('extensions-modules');
|
|
||||||
npmInstall('extensions'); // node modules shared by all extensions
|
|
||||||
|
|
||||||
const extensions = [
|
function yarnInstallBuildDependencies() {
|
||||||
'vscode-colorize-tests',
|
// make sure we install the deps of build/lib/watch for the system installed
|
||||||
'git',
|
|
||||||
'json',
|
|
||||||
'mssql',
|
|
||||||
'configuration-editing',
|
|
||||||
'extension-editing',
|
|
||||||
'markdown',
|
|
||||||
'merge-conflict',
|
|
||||||
'insights-default',
|
|
||||||
'account-provider-azure'
|
|
||||||
];
|
|
||||||
|
|
||||||
extensions.forEach(extension => npmInstall(`extensions/${extension}`));
|
|
||||||
|
|
||||||
function npmInstallBuildDependencies() {
|
|
||||||
// make sure we install gulp watch for the system installed
|
|
||||||
// node, since that is the driver of gulp
|
// node, since that is the driver of gulp
|
||||||
|
//@ts-ignore
|
||||||
const env = Object.assign({}, process.env);
|
const env = Object.assign({}, process.env);
|
||||||
|
const watchPath = path.join(path.dirname(__dirname), 'lib', 'watch');
|
||||||
|
const yarnrcPath = path.join(watchPath, '.yarnrc');
|
||||||
|
|
||||||
delete env['npm_config_disturl'];
|
const disturl = 'https://nodejs.org/download/release';
|
||||||
delete env['npm_config_target'];
|
const target = process.versions.node;
|
||||||
delete env['npm_config_runtime'];
|
const runtime = 'node';
|
||||||
|
|
||||||
npmInstall(path.join(path.dirname(__dirname), 'lib', 'watch'), { env });
|
const yarnrc = `disturl "${disturl}"
|
||||||
|
target "${target}"
|
||||||
|
runtime "${runtime}"`;
|
||||||
|
|
||||||
|
fs.writeFileSync(yarnrcPath, yarnrc, 'utf8');
|
||||||
|
yarnInstall(watchPath, { env });
|
||||||
}
|
}
|
||||||
|
|
||||||
npmInstall(`build`); // node modules required for build
|
yarnInstall(`build`); // node modules required for build
|
||||||
npmInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
|
yarnInstall('test/smoke'); // node modules required for smoketest
|
||||||
|
yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
|
||||||
@@ -3,13 +3,21 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
if (process.env['npm_config_disturl'] !== 'https://atom.io/download/electron') {
|
let err = false;
|
||||||
console.error("You can't use plain npm to install Code's dependencies.");
|
|
||||||
console.error(
|
|
||||||
/^win/.test(process.platform)
|
|
||||||
? "Please run '.\\scripts\\npm.bat install' instead."
|
|
||||||
: "Please run './scripts/npm.sh install' instead."
|
|
||||||
);
|
|
||||||
|
|
||||||
|
const major = parseInt(/^(\d+)\./.exec(process.versions.node)[1]);
|
||||||
|
|
||||||
|
if (major < 8) {
|
||||||
|
console.error('\033[1;31m*** Please use node>=8.\033[0;0m');
|
||||||
|
err = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!/yarn\.js$|yarnpkg$/.test(process.env['npm_execpath'])) {
|
||||||
|
console.error('\033[1;31m*** Please use yarn to install dependencies.\033[0;0m');
|
||||||
|
err = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.error('');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
@@ -4,9 +4,11 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
function updateGrammar(location) {
|
function updateGrammar(location) {
|
||||||
|
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||||
const result = cp.spawnSync(npm, ['run', 'update-grammar'], {
|
const result = cp.spawnSync(npm, ['run', 'update-grammar'], {
|
||||||
cwd: location,
|
cwd: location,
|
||||||
stdio: 'inherit'
|
stdio: 'inherit'
|
||||||
@@ -17,50 +19,17 @@ function updateGrammar(location) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const extensions = [
|
const allExtensionFolders = fs.readdirSync('extensions');
|
||||||
// 'bat' Grammar no longer available
|
const extensions = allExtensionFolders.filter(e => {
|
||||||
'clojure',
|
try {
|
||||||
'coffeescript',
|
let packageJSON = JSON.parse(fs.readFileSync(path.join('extensions', e, 'package.json')).toString());
|
||||||
'cpp',
|
return packageJSON && packageJSON.scripts && packageJSON.scripts['update-grammar'];
|
||||||
'csharp',
|
} catch (e) {
|
||||||
'css',
|
return false;
|
||||||
'diff',
|
}
|
||||||
'docker',
|
});
|
||||||
'fsharp',
|
|
||||||
'gitsyntax',
|
console.log(`Updating ${extensions.length} grammars...`);
|
||||||
'go',
|
|
||||||
'groovy',
|
|
||||||
'handlebars',
|
|
||||||
'hlsl',
|
|
||||||
'html',
|
|
||||||
'ini',
|
|
||||||
'java',
|
|
||||||
// 'javascript', updated through JavaScript
|
|
||||||
'json',
|
|
||||||
'less',
|
|
||||||
'lua',
|
|
||||||
'make',
|
|
||||||
'markdown',
|
|
||||||
'objective-c',
|
|
||||||
'perl',
|
|
||||||
'php',
|
|
||||||
// 'powershell', grammar not ready yet, @daviwil will ping when ready
|
|
||||||
'pug',
|
|
||||||
'python',
|
|
||||||
'r',
|
|
||||||
'razor',
|
|
||||||
'ruby',
|
|
||||||
'rust',
|
|
||||||
'scss',
|
|
||||||
'shaderlab',
|
|
||||||
'shellscript',
|
|
||||||
'sql',
|
|
||||||
'swift',
|
|
||||||
'typescript',
|
|
||||||
'vb',
|
|
||||||
'xml',
|
|
||||||
'yaml'
|
|
||||||
];
|
|
||||||
|
|
||||||
extensions.forEach(extension => updateGrammar(`extensions/${extension}`));
|
extensions.forEach(extension => updateGrammar(`extensions/${extension}`));
|
||||||
|
|
||||||
@@ -70,4 +39,5 @@ if (process.platform === 'win32') {
|
|||||||
cp.spawn('.\scripts\test-integration.bat', [], { env: process.env, stdio: 'inherit' });
|
cp.spawn('.\scripts\test-integration.bat', [], { env: process.env, stdio: 'inherit' });
|
||||||
} else {
|
} else {
|
||||||
cp.spawn('/bin/bash', ['./scripts/test-integration.sh'], { env: process.env, stdio: 'inherit' });
|
cp.spawn('/bin/bash', ['./scripts/test-integration.sh'], { env: process.env, stdio: 'inherit' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,14 +14,19 @@ var url = require('url');
|
|||||||
|
|
||||||
function getOptions(urlString) {
|
function getOptions(urlString) {
|
||||||
var _url = url.parse(urlString);
|
var _url = url.parse(urlString);
|
||||||
|
var headers = {
|
||||||
|
'User-Agent': 'VSCode'
|
||||||
|
};
|
||||||
|
var token = process.env['GITHUB_TOKEN'];
|
||||||
|
if (token) {
|
||||||
|
headers['Authorization'] = 'token ' + token
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
protocol: _url.protocol,
|
protocol: _url.protocol,
|
||||||
host: _url.host,
|
host: _url.host,
|
||||||
port: _url.port,
|
port: _url.port,
|
||||||
path: _url.path,
|
path: _url.path,
|
||||||
headers: {
|
headers: headers
|
||||||
'User-Agent': 'NodeJS'
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,12 +37,16 @@ function download(url, redirectCount) {
|
|||||||
response.on('data', function (data) {
|
response.on('data', function (data) {
|
||||||
content += data.toString();
|
content += data.toString();
|
||||||
}).on('end', function () {
|
}).on('end', function () {
|
||||||
|
if (response.statusCode === 403 && response.headers['x-ratelimit-remaining'] === '0') {
|
||||||
|
e('GitHub API rate exceeded. Set GITHUB_TOKEN environment variable to increase rate limit.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
let count = redirectCount || 0;
|
let count = redirectCount || 0;
|
||||||
if (count < 5 && response.statusCode >= 300 && response.statusCode <= 303 || response.statusCode === 307) {
|
if (count < 5 && response.statusCode >= 300 && response.statusCode <= 303 || response.statusCode === 307) {
|
||||||
let location = response.headers['location'];
|
let location = response.headers['location'];
|
||||||
if (location) {
|
if (location) {
|
||||||
console.log("Redirected " + url + " to " + location);
|
console.log("Redirected " + url + " to " + location);
|
||||||
download(location, count+1).then(c, e);
|
download(location, count + 1).then(c, e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,17 +68,13 @@ function getCommitSha(repoId, repoPath) {
|
|||||||
commitDate: lastCommit.commit.author.date
|
commitDate: lastCommit.commit.author.date
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed extracting the SHA: " + content);
|
return Promise.reject(new Error("Failed extracting the SHA: " + content));
|
||||||
return Promise.resolve(null);
|
|
||||||
}
|
}
|
||||||
}, function () {
|
|
||||||
console.error('Failed loading ' + commitInfo);
|
|
||||||
return Promise.resolve(null);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.update = function (repoId, repoPath, dest, modifyGrammar) {
|
exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'master') {
|
||||||
var contentPath = 'https://raw.githubusercontent.com/' + repoId + '/master/' + repoPath;
|
var contentPath = 'https://raw.githubusercontent.com/' + repoId + `/${version}/` + repoPath;
|
||||||
console.log('Reading from ' + contentPath);
|
console.log('Reading from ' + contentPath);
|
||||||
return download(contentPath).then(function (content) {
|
return download(contentPath).then(function (content) {
|
||||||
var ext = path.extname(repoPath);
|
var ext = path.extname(repoPath);
|
||||||
@@ -78,11 +83,10 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar) {
|
|||||||
grammar = plist.parse(content);
|
grammar = plist.parse(content);
|
||||||
} else if (ext === '.cson') {
|
} else if (ext === '.cson') {
|
||||||
grammar = cson.parse(content);
|
grammar = cson.parse(content);
|
||||||
} else if (ext === '.json') {
|
} else if (ext === '.json' || ext === '.JSON-tmLanguage') {
|
||||||
grammar = JSON.parse(content);
|
grammar = JSON.parse(content);
|
||||||
} else {
|
} else {
|
||||||
console.error('Unknown file extension: ' + ext);
|
return Promise.reject(new Error('Unknown file extension: ' + ext));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (modifyGrammar) {
|
if (modifyGrammar) {
|
||||||
modifyGrammar(grammar);
|
modifyGrammar(grammar);
|
||||||
@@ -99,8 +103,10 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar) {
|
|||||||
if (info) {
|
if (info) {
|
||||||
result.version = 'https://github.com/' + repoId + '/commit/' + info.commitSha;
|
result.version = 'https://github.com/' + repoId + '/commit/' + info.commitSha;
|
||||||
}
|
}
|
||||||
for (let key in grammar) {
|
|
||||||
if (!result.hasOwnProperty(key)) {
|
let keys = ['name', 'scopeName', 'comment', 'injections', 'patterns', 'repository'];
|
||||||
|
for (let key of keys) {
|
||||||
|
if (grammar.hasOwnProperty(key)) {
|
||||||
result[key] = grammar[key];
|
result[key] = grammar[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,11 +119,14 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar) {
|
|||||||
console.log('Updated ' + path.basename(dest));
|
console.log('Updated ' + path.basename(dest));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
return Promise.reject(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}, console.error);
|
}, console.error).catch(e => {
|
||||||
|
console.error(e);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (path.basename(process.argv[1]) === 'update-grammar.js') {
|
if (path.basename(process.argv[1]) === 'update-grammar.js') {
|
||||||
|
|||||||
74
build/npm/update-localization-extension.js
Normal file
74
build/npm/update-localization-extension.js
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
let i18n = require("../lib/i18n");
|
||||||
|
|
||||||
|
let fs = require("fs");
|
||||||
|
let path = require("path");
|
||||||
|
let vfs = require("vinyl-fs");
|
||||||
|
let rimraf = require('rimraf');
|
||||||
|
|
||||||
|
function update(idOrPath) {
|
||||||
|
if (!idOrPath) {
|
||||||
|
throw new Error('Argument must be the location of the localization extension.');
|
||||||
|
}
|
||||||
|
let locExtFolder = idOrPath;
|
||||||
|
if (/^\w{2}(-\w+)?$/.test(idOrPath)) {
|
||||||
|
locExtFolder = '../vscode-language-pack-' + idOrPath;
|
||||||
|
}
|
||||||
|
let locExtStat = fs.statSync(locExtFolder);
|
||||||
|
if (!locExtStat || !locExtStat.isDirectory) {
|
||||||
|
throw new Error('No directory found at ' + idOrPath);
|
||||||
|
}
|
||||||
|
let packageJSON = JSON.parse(fs.readFileSync(path.join(locExtFolder, 'package.json')).toString());
|
||||||
|
let contributes = packageJSON['contributes'];
|
||||||
|
if (!contributes) {
|
||||||
|
throw new Error('The extension must define a "localizations" contribution in the "package.json"');
|
||||||
|
}
|
||||||
|
let localizations = contributes['localizations'];
|
||||||
|
if (!localizations) {
|
||||||
|
throw new Error('The extension must define a "localizations" contribution of type array in the "package.json"');
|
||||||
|
}
|
||||||
|
|
||||||
|
localizations.forEach(function (localization) {
|
||||||
|
if (!localization.languageId || !localization.languageName || !localization.localizedLanguageName) {
|
||||||
|
throw new Error('Each localization contribution must define "languageId", "languageName" and "localizedLanguageName" properties.');
|
||||||
|
}
|
||||||
|
let server = localization.server || 'www.transifex.com';
|
||||||
|
let userName = localization.userName || 'api';
|
||||||
|
let apiToken = process.env.TRANSIFEX_API_TOKEN;
|
||||||
|
let languageId = localization.transifexId || localization.languageId;
|
||||||
|
let translationDataFolder = path.join(locExtFolder, 'translations');
|
||||||
|
if (languageId === "zh-cn") {
|
||||||
|
languageId = "zh-hans";
|
||||||
|
}
|
||||||
|
if (languageId === "zh-tw") {
|
||||||
|
languageId = "zh-hant";
|
||||||
|
}
|
||||||
|
if (fs.existsSync(translationDataFolder) && fs.existsSync(path.join(translationDataFolder, 'main.i18n.json'))) {
|
||||||
|
console.log('Clearing \'' + translationDataFolder + '\'...');
|
||||||
|
rimraf.sync(translationDataFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Downloading translations for \'' + languageId + '\' to \'' + translationDataFolder + '\'...');
|
||||||
|
const translationPaths = [];
|
||||||
|
i18n.pullI18nPackFiles(server, userName, apiToken, { id: languageId }, translationPaths)
|
||||||
|
.pipe(vfs.dest(translationDataFolder)).on('end', function () {
|
||||||
|
localization.translations = [];
|
||||||
|
for (let tp of translationPaths) {
|
||||||
|
localization.translations.push({ id: tp.id, path: `./translations/${tp.resourceName}`});
|
||||||
|
}
|
||||||
|
fs.writeFileSync(path.join(locExtFolder, 'package.json'), JSON.stringify(packageJSON, null, '\t'));
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if (path.basename(process.argv[1]) === 'update-localization-extension.js') {
|
||||||
|
update(process.argv[2]);
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "sqlops-oss-dev-build",
|
"name": "azuredatastudio-oss-dev-build",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/azure": "0.9.19",
|
"@types/azure": "0.9.19",
|
||||||
@@ -7,22 +7,27 @@
|
|||||||
"@types/es6-collections": "0.5.31",
|
"@types/es6-collections": "0.5.31",
|
||||||
"@types/es6-promise": "0.0.33",
|
"@types/es6-promise": "0.0.33",
|
||||||
"@types/mime": "0.0.29",
|
"@types/mime": "0.0.29",
|
||||||
|
"@types/minimatch": "^3.0.3",
|
||||||
"@types/node": "8.0.33",
|
"@types/node": "8.0.33",
|
||||||
"@types/xml2js": "0.0.33",
|
"@types/xml2js": "0.0.33",
|
||||||
|
"@types/request": "^2.47.0",
|
||||||
"azure-storage": "^2.1.0",
|
"azure-storage": "^2.1.0",
|
||||||
"decompress": "^4.2.0",
|
"decompress": "^4.2.0",
|
||||||
"documentdb": "^1.11.0",
|
"documentdb": "1.13.0",
|
||||||
"extensions-modules": "file:../extensions-modules",
|
"service-downloader": "github:anthonydresser/service-downloader#0.1.5",
|
||||||
"fs-extra-promise": "^1.0.1",
|
"fs-extra-promise": "^1.0.1",
|
||||||
"mime": "^1.3.4",
|
"mime": "^1.3.4",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"typescript": "2.5.2",
|
"typescript": "2.9.2",
|
||||||
"vscode": "^1.0.1",
|
"vscode": "^1.0.1",
|
||||||
"xml2js": "^0.4.17"
|
"xml2js": "^0.4.17",
|
||||||
|
"github-releases": "^0.4.1",
|
||||||
|
"request": "^2.85.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc",
|
"compile": "tsc -p tsconfig.build.json",
|
||||||
"watch": "tsc --watch",
|
"watch": "tsc -p tsconfig.build.json --watch",
|
||||||
"postinstall": "npm run compile"
|
"postinstall": "npm run compile",
|
||||||
|
"npmCheckJs": "tsc --noEmit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# set agent specific npm cache
|
|
||||||
if [ -n "$AGENT_WORKFOLDER" ]
|
|
||||||
then
|
|
||||||
export npm_config_cache="$AGENT_WORKFOLDER/npm-cache"
|
|
||||||
echo "Using npm cache: $npm_config_cache"
|
|
||||||
fi
|
|
||||||
|
|
||||||
SUMMARY="Task;Duration"$'\n'
|
|
||||||
step() {
|
|
||||||
START=$SECONDS
|
|
||||||
TASK=$1; shift
|
|
||||||
echo ""
|
|
||||||
echo "*****************************************************************************"
|
|
||||||
echo "Start: $TASK"
|
|
||||||
echo "*****************************************************************************"
|
|
||||||
"$@"
|
|
||||||
|
|
||||||
# Calculate total duration
|
|
||||||
TOTAL=$(echo "$SECONDS - $START" | bc)
|
|
||||||
M=$(echo "$TOTAL / 60" | bc)
|
|
||||||
S=$(echo "$TOTAL % 60" | bc)
|
|
||||||
DURATION="$(printf "%02d" $M):$(printf "%02d" $S)"
|
|
||||||
|
|
||||||
echo "*****************************************************************************"
|
|
||||||
echo "End: $TASK, Total: $DURATION"
|
|
||||||
echo "*****************************************************************************"
|
|
||||||
SUMMARY="$SUMMARY$TASK;$DURATION"$'\n'
|
|
||||||
}
|
|
||||||
|
|
||||||
done_steps() {
|
|
||||||
echo ""
|
|
||||||
echo "Build Summary"
|
|
||||||
echo "============="
|
|
||||||
echo "${SUMMARY}" | column -t -s';'
|
|
||||||
}
|
|
||||||
|
|
||||||
trap done_steps EXIT
|
|
||||||
@@ -4,23 +4,15 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
||||||
|
|
||||||
function npmInstall(package: string, args: string[]): void {
|
function yarnInstall(package: string): void {
|
||||||
const result = cp.spawnSync(npm, ['install', package, ...args], {
|
cp.execSync(`yarn add --no-lockfile ${package}`);
|
||||||
stdio: 'inherit'
|
|
||||||
});
|
|
||||||
|
|
||||||
if (result.error || result.status !== 0) {
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const product = require('../../../product.json');
|
const product = require('../../../product.json');
|
||||||
const dependencies = product.dependencies || {} as { [name: string]: string; };
|
const dependencies = product.dependencies || {} as { [name: string]: string; };
|
||||||
const [, , ...args] = process.argv;
|
|
||||||
|
|
||||||
Object.keys(dependencies).forEach(name => {
|
Object.keys(dependencies).forEach(name => {
|
||||||
const url = dependencies[name];
|
const url = dependencies[name];
|
||||||
npmInstall(url, args);
|
yarnInstall(url);
|
||||||
});
|
});
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# setup nvm
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
export NVM_DIR=~/.nvm
|
|
||||||
source $(brew --prefix nvm)/nvm.sh
|
|
||||||
else
|
|
||||||
source $NVM_DIR/nvm.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
# install node
|
|
||||||
NODE_VERSION=7.10.0
|
|
||||||
nvm install $NODE_VERSION
|
|
||||||
nvm use $NODE_VERSION
|
|
||||||
@@ -14,8 +14,9 @@ import * as mime from 'mime';
|
|||||||
import * as minimist from 'minimist';
|
import * as minimist from 'minimist';
|
||||||
import { DocumentClient, NewDocument } from 'documentdb';
|
import { DocumentClient, NewDocument } from 'documentdb';
|
||||||
|
|
||||||
if (process.argv.length < 6) {
|
// {{SQL CARBON EDIT}}
|
||||||
console.error('Usage: node publish.js <product> <platform> <type> <name> <version> <commit> <is_update> <file>');
|
if (process.argv.length < 9) {
|
||||||
|
console.error('Usage: node publish.js <product_quality> <platform> <file_type> <file_name> <version> <is_update> <file> [commit_id]');
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +70,7 @@ interface Asset {
|
|||||||
hash: string;
|
hash: string;
|
||||||
sha256hash: string;
|
sha256hash: string;
|
||||||
size: number;
|
size: number;
|
||||||
|
supportsFastUpdate?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createOrUpdate(commit: string, quality: string, platform: string, type: string, release: NewDocument, asset: Asset, isUpdate: boolean): Promise<void> {
|
function createOrUpdate(commit: string, quality: string, platform: string, type: string, release: NewDocument, asset: Asset, isUpdate: boolean): Promise<void> {
|
||||||
@@ -183,21 +185,10 @@ async function publish(commit: string, quality: string, platform: string, type:
|
|||||||
const blobService = azure.createBlobService(storageAccount, process.env['AZURE_STORAGE_ACCESS_KEY_2'])
|
const blobService = azure.createBlobService(storageAccount, process.env['AZURE_STORAGE_ACCESS_KEY_2'])
|
||||||
.withFilter(new azure.ExponentialRetryPolicyFilter(20));
|
.withFilter(new azure.ExponentialRetryPolicyFilter(20));
|
||||||
|
|
||||||
const mooncakeBlobService = azure.createBlobService(storageAccount, process.env['MOONCAKE_STORAGE_ACCESS_KEY'], `${storageAccount}.blob.core.chinacloudapi.cn`)
|
// {{SQL CARBON EDIT}}
|
||||||
.withFilter(new azure.ExponentialRetryPolicyFilter(20));
|
await assertContainer(blobService, quality);
|
||||||
|
|
||||||
// mooncake is fussy and far away, this is needed!
|
const blobExists = await doesAssetExist(blobService, quality, blobName);
|
||||||
mooncakeBlobService.defaultClientRequestTimeoutInMs = 10 * 60 * 1000;
|
|
||||||
|
|
||||||
await Promise.all([
|
|
||||||
assertContainer(blobService, quality),
|
|
||||||
assertContainer(mooncakeBlobService, quality)
|
|
||||||
]);
|
|
||||||
|
|
||||||
const [blobExists, moooncakeBlobExists] = await Promise.all([
|
|
||||||
doesAssetExist(blobService, quality, blobName),
|
|
||||||
doesAssetExist(mooncakeBlobService, quality, blobName)
|
|
||||||
]);
|
|
||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
@@ -205,10 +196,38 @@ async function publish(commit: string, quality: string, platform: string, type:
|
|||||||
promises.push(uploadBlob(blobService, quality, blobName, file));
|
promises.push(uploadBlob(blobService, quality, blobName, file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!moooncakeBlobExists) {
|
// {{SQL CARBON EDIT}}
|
||||||
promises.push(uploadBlob(mooncakeBlobService, quality, blobName, file));
|
if (process.env['MOONCAKE_STORAGE_ACCESS_KEY']) {
|
||||||
|
const mooncakeBlobService = azure.createBlobService(storageAccount, process.env['MOONCAKE_STORAGE_ACCESS_KEY'], `${storageAccount}.blob.core.chinacloudapi.cn`)
|
||||||
|
.withFilter(new azure.ExponentialRetryPolicyFilter(20));
|
||||||
|
|
||||||
|
// mooncake is fussy and far away, this is needed!
|
||||||
|
mooncakeBlobService.defaultClientRequestTimeoutInMs = 10 * 60 * 1000;
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
assertContainer(blobService, quality),
|
||||||
|
assertContainer(mooncakeBlobService, quality)
|
||||||
|
]);
|
||||||
|
|
||||||
|
const [blobExists, moooncakeBlobExists] = await Promise.all([
|
||||||
|
doesAssetExist(blobService, quality, blobName),
|
||||||
|
doesAssetExist(mooncakeBlobService, quality, blobName)
|
||||||
|
]);
|
||||||
|
|
||||||
|
const promises = [];
|
||||||
|
|
||||||
|
if (!blobExists) {
|
||||||
|
promises.push(uploadBlob(blobService, quality, blobName, file));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!moooncakeBlobExists) {
|
||||||
|
promises.push(uploadBlob(mooncakeBlobService, quality, blobName, file));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Skipping Mooncake publishing.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (promises.length === 0) {
|
if (promises.length === 0) {
|
||||||
console.log(`Blob ${quality}, ${blobName} already exists, not publishing again.`);
|
console.log(`Blob ${quality}, ${blobName} already exists, not publishing again.`);
|
||||||
return;
|
return;
|
||||||
@@ -228,12 +247,20 @@ async function publish(commit: string, quality: string, platform: string, type:
|
|||||||
platform: platform,
|
platform: platform,
|
||||||
type: type,
|
type: type,
|
||||||
url: `${process.env['AZURE_CDN_URL']}/${quality}/${blobName}`,
|
url: `${process.env['AZURE_CDN_URL']}/${quality}/${blobName}`,
|
||||||
mooncakeUrl: `${process.env['MOONCAKE_CDN_URL']}/${quality}/${blobName}`,
|
// {{SQL CARBON EDIT}}
|
||||||
|
mooncakeUrl: process.env['MOONCAKE_CDN_URL'] ? `${process.env['MOONCAKE_CDN_URL']}/${quality}/${blobName}` : undefined,
|
||||||
hash: sha1hash,
|
hash: sha1hash,
|
||||||
sha256hash,
|
sha256hash,
|
||||||
size
|
size
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Remove this if we ever need to rollback fast updates for windows
|
||||||
|
if (/win32/.test(platform)) {
|
||||||
|
asset.supportsFastUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Asset:', JSON.stringify(asset, null, ' '));
|
||||||
|
|
||||||
const release = {
|
const release = {
|
||||||
id: commit,
|
id: commit,
|
||||||
timestamp: (new Date()).getTime(),
|
timestamp: (new Date()).getTime(),
|
||||||
@@ -261,8 +288,11 @@ function main(): void {
|
|||||||
boolean: ['upload-only']
|
boolean: ['upload-only']
|
||||||
});
|
});
|
||||||
|
|
||||||
const [quality, platform, type, name, version, _isUpdate, file] = opts._;
|
// {{SQL CARBON EDIT}}
|
||||||
const commit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();
|
let [quality, platform, type, name, version, _isUpdate, file, commit] = opts._;
|
||||||
|
if (!commit) {
|
||||||
|
commit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();
|
||||||
|
}
|
||||||
|
|
||||||
publish(commit, quality, platform, type, name, version, _isUpdate, file, opts).catch(err => {
|
publish(commit, quality, platform, type, name, version, _isUpdate, file, opts).catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|||||||
219
build/tfs/common/symbols.ts
Normal file
219
build/tfs/common/symbols.ts
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import * as request from 'request';
|
||||||
|
import { createReadStream, createWriteStream, unlink, mkdir } from 'fs';
|
||||||
|
import * as github from 'github-releases';
|
||||||
|
import { join } from 'path';
|
||||||
|
import { tmpdir } from 'os';
|
||||||
|
import { promisify } from 'util';
|
||||||
|
|
||||||
|
const BASE_URL = 'https://rink.hockeyapp.net/api/2/';
|
||||||
|
const HOCKEY_APP_TOKEN_HEADER = 'X-HockeyAppToken';
|
||||||
|
|
||||||
|
export interface IVersions {
|
||||||
|
app_versions: IVersion[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IVersion {
|
||||||
|
id: number;
|
||||||
|
version: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IApplicationAccessor {
|
||||||
|
accessToken: string;
|
||||||
|
appId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IVersionAccessor extends IApplicationAccessor {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Platform {
|
||||||
|
WIN_32 = 'win32-ia32',
|
||||||
|
WIN_64 = 'win32-x64',
|
||||||
|
LINUX_32 = 'linux-ia32',
|
||||||
|
LINUX_64 = 'linux-x64',
|
||||||
|
MAC_OS = 'darwin-x64'
|
||||||
|
}
|
||||||
|
|
||||||
|
function symbolsZipName(platform: Platform, electronVersion: string, insiders: boolean): string {
|
||||||
|
return `${insiders ? 'insiders' : 'stable'}-symbols-v${electronVersion}-${platform}.zip`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SEED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
async function tmpFile(name: string): Promise<string> {
|
||||||
|
let res = '';
|
||||||
|
for (let i = 0; i < 8; i++) {
|
||||||
|
res += SEED.charAt(Math.floor(Math.random() * SEED.length));
|
||||||
|
}
|
||||||
|
|
||||||
|
const tmpParent = join(tmpdir(), res);
|
||||||
|
|
||||||
|
await promisify(mkdir)(tmpParent);
|
||||||
|
|
||||||
|
return join(tmpParent, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVersions(accessor: IApplicationAccessor): Promise<IVersions> {
|
||||||
|
return asyncRequest<IVersions>({
|
||||||
|
url: `${BASE_URL}/apps/${accessor.appId}/app_versions`,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
[HOCKEY_APP_TOKEN_HEADER]: accessor.accessToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function createVersion(accessor: IApplicationAccessor, version: string): Promise<IVersion> {
|
||||||
|
return asyncRequest<IVersion>({
|
||||||
|
url: `${BASE_URL}/apps/${accessor.appId}/app_versions/new`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
[HOCKEY_APP_TOKEN_HEADER]: accessor.accessToken
|
||||||
|
},
|
||||||
|
formData: {
|
||||||
|
bundle_version: version
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateVersion(accessor: IVersionAccessor, symbolsPath: string) {
|
||||||
|
return asyncRequest<IVersions>({
|
||||||
|
url: `${BASE_URL}/apps/${accessor.appId}/app_versions/${accessor.id}`,
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
[HOCKEY_APP_TOKEN_HEADER]: accessor.accessToken
|
||||||
|
},
|
||||||
|
formData: {
|
||||||
|
dsym: createReadStream(symbolsPath)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function asyncRequest<T>(options: request.UrlOptions & request.CoreOptions): Promise<T> {
|
||||||
|
return new Promise<T>((resolve, reject) => {
|
||||||
|
request(options, (error, response, body) => {
|
||||||
|
if (error) {
|
||||||
|
reject(error);
|
||||||
|
} else {
|
||||||
|
resolve(JSON.parse(body));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadAsset(repository, assetName: string, targetPath: string, electronVersion: string) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
repository.getReleases({ tag_name: `v${electronVersion}` }, (err, releases) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
const asset = releases[0].assets.filter(asset => asset.name === assetName)[0];
|
||||||
|
if (!asset) {
|
||||||
|
reject(new Error(`Asset with name ${assetName} not found`));
|
||||||
|
} else {
|
||||||
|
repository.downloadAsset(asset, (err, reader) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
const writer = createWriteStream(targetPath);
|
||||||
|
writer.on('error', reject);
|
||||||
|
writer.on('close', resolve);
|
||||||
|
reader.on('error', reject);
|
||||||
|
|
||||||
|
reader.pipe(writer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IOptions {
|
||||||
|
repository: string;
|
||||||
|
platform: Platform;
|
||||||
|
versions: { code: string; insiders: boolean; electron: string; };
|
||||||
|
access: { hockeyAppToken: string; hockeyAppId: string; githubToken: string };
|
||||||
|
}
|
||||||
|
|
||||||
|
async function ensureVersionAndSymbols(options: IOptions) {
|
||||||
|
|
||||||
|
// Check version does not exist
|
||||||
|
console.log(`HockeyApp: checking for existing version ${options.versions.code} (${options.platform})`);
|
||||||
|
const versions = await getVersions({ accessToken: options.access.hockeyAppToken, appId: options.access.hockeyAppId });
|
||||||
|
if (versions.app_versions.some(v => v.version === options.versions.code)) {
|
||||||
|
console.log(`HockeyApp: Returning without uploading symbols because version ${options.versions.code} (${options.platform}) was already found`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Download symbols for platform and electron version
|
||||||
|
const symbolsName = symbolsZipName(options.platform, options.versions.electron, options.versions.insiders);
|
||||||
|
const symbolsPath = await tmpFile('symbols.zip');
|
||||||
|
console.log(`HockeyApp: downloading symbols ${symbolsName} for electron ${options.versions.electron} (${options.platform}) into ${symbolsPath}`);
|
||||||
|
await downloadAsset(new github({ repo: options.repository, token: options.access.githubToken }), symbolsName, symbolsPath, options.versions.electron);
|
||||||
|
|
||||||
|
// Create version
|
||||||
|
console.log(`HockeyApp: creating new version ${options.versions.code} (${options.platform})`);
|
||||||
|
const version = await createVersion({ accessToken: options.access.hockeyAppToken, appId: options.access.hockeyAppId }, options.versions.code);
|
||||||
|
|
||||||
|
// Upload symbols
|
||||||
|
console.log(`HockeyApp: uploading symbols for version ${options.versions.code} (${options.platform})`);
|
||||||
|
await updateVersion({ id: String(version.id), accessToken: options.access.hockeyAppToken, appId: options.access.hockeyAppId }, symbolsPath);
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
await promisify(unlink)(symbolsPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Environment
|
||||||
|
const pakage = require('../../../package.json');
|
||||||
|
const product = require('../../../product.json');
|
||||||
|
const repository = product.electronRepository;
|
||||||
|
const electronVersion = require('../../lib/electron').getElectronVersion();
|
||||||
|
const insiders = product.quality !== 'stable';
|
||||||
|
let codeVersion = pakage.version;
|
||||||
|
if (insiders) {
|
||||||
|
codeVersion = `${codeVersion}-insider`;
|
||||||
|
}
|
||||||
|
const githubToken = process.argv[2];
|
||||||
|
const hockeyAppToken = process.argv[3];
|
||||||
|
const is64 = process.argv[4] === 'x64';
|
||||||
|
const hockeyAppId = process.argv[5];
|
||||||
|
|
||||||
|
let platform: Platform;
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
platform = Platform.MAC_OS;
|
||||||
|
} else if (process.platform === 'win32') {
|
||||||
|
platform = is64 ? Platform.WIN_64 : Platform.WIN_32;
|
||||||
|
} else {
|
||||||
|
platform = is64 ? Platform.LINUX_64 : Platform.LINUX_32;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create version and upload symbols in HockeyApp
|
||||||
|
if (repository && codeVersion && electronVersion && (product.quality === 'stable' || product.quality === 'insider')) {
|
||||||
|
ensureVersionAndSymbols({
|
||||||
|
repository,
|
||||||
|
platform,
|
||||||
|
versions: {
|
||||||
|
code: codeVersion,
|
||||||
|
insiders,
|
||||||
|
electron: electronVersion
|
||||||
|
},
|
||||||
|
access: {
|
||||||
|
githubToken,
|
||||||
|
hockeyAppToken,
|
||||||
|
hockeyAppId
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
console.log('HockeyApp: done');
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(`HockeyApp: error (${error})`);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log(`HockeyApp: skipping due to unexpected context (repository: ${repository}, codeVersion: ${codeVersion}, electronVersion: ${electronVersion}, quality: ${product.quality})`);
|
||||||
|
}
|
||||||
15
build/tfs/continuous-build.yml
Normal file
15
build/tfs/continuous-build.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
phases:
|
||||||
|
- phase: Windows
|
||||||
|
queue: Hosted VS2017
|
||||||
|
steps:
|
||||||
|
- template: win32/continuous-build-win32.yml
|
||||||
|
|
||||||
|
- phase: Linux
|
||||||
|
queue: Hosted Linux Preview
|
||||||
|
steps:
|
||||||
|
- template: linux/continuous-build-linux.yml
|
||||||
|
|
||||||
|
- phase: macOS
|
||||||
|
queue: Hosted macOS Preview
|
||||||
|
steps:
|
||||||
|
- template: darwin/continuous-build-darwin.yml
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
. ./build/tfs/common/node.sh
|
|
||||||
. ./scripts/env.sh
|
|
||||||
. ./build/tfs/common/common.sh
|
|
||||||
|
|
||||||
export VSCODE_MIXIN_PASSWORD="$1"
|
|
||||||
export AZURE_STORAGE_ACCESS_KEY="$2"
|
|
||||||
export AZURE_STORAGE_ACCESS_KEY_2="$3"
|
|
||||||
export MOONCAKE_STORAGE_ACCESS_KEY="$4"
|
|
||||||
export AZURE_DOCUMENTDB_MASTERKEY="$5"
|
|
||||||
VSO_PAT="$6"
|
|
||||||
|
|
||||||
echo "machine monacotools.visualstudio.com password $VSO_PAT" > ~/.netrc
|
|
||||||
|
|
||||||
step "Install dependencies" \
|
|
||||||
npm install
|
|
||||||
|
|
||||||
step "Hygiene" \
|
|
||||||
npm run gulp -- hygiene
|
|
||||||
|
|
||||||
step "Mix in repository from vscode-distro" \
|
|
||||||
npm run gulp -- mixin
|
|
||||||
|
|
||||||
step "Install distro dependencies" \
|
|
||||||
node build/tfs/common/installDistro.js
|
|
||||||
|
|
||||||
step "Build minified & upload source maps" \
|
|
||||||
npm run gulp -- vscode-darwin-min upload-vscode-sourcemaps
|
|
||||||
|
|
||||||
# step "Create loader snapshot"
|
|
||||||
# node build/lib/snapshotLoader.js
|
|
||||||
|
|
||||||
step "Run unit tests" \
|
|
||||||
./scripts/test.sh --build --reporter dot
|
|
||||||
|
|
||||||
step "Run integration tests" \
|
|
||||||
./scripts/test-integration.sh
|
|
||||||
|
|
||||||
# function smoketest {
|
|
||||||
# ARTIFACTS="$AGENT_BUILDDIRECTORY/smoketest-artifacts"
|
|
||||||
# rm -rf $ARTIFACTS
|
|
||||||
|
|
||||||
# [[ "$VSCODE_QUALITY" == "insider" ]] && VSCODE_APPNAME="Visual Studio Code - Insiders" || VSCODE_APPNAME="Visual Studio Code"
|
|
||||||
# npm run smoketest -- --build "$AGENT_BUILDDIRECTORY/VSCode-darwin/$VSCODE_APPNAME.app" --log $ARTIFACTS
|
|
||||||
# }
|
|
||||||
|
|
||||||
# step "Run smoke test" \
|
|
||||||
# smoketest
|
|
||||||
|
|
||||||
step "Publish release" \
|
|
||||||
./build/tfs/darwin/release.sh
|
|
||||||
|
|
||||||
step "Generate and upload configuration.json" \
|
|
||||||
npm run gulp -- upload-vscode-configuration
|
|
||||||
48
build/tfs/darwin/continuous-build-darwin.yml
Normal file
48
build/tfs/darwin/continuous-build-darwin.yml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
steps:
|
||||||
|
- task: NodeTool@0
|
||||||
|
inputs:
|
||||||
|
versionSpec: "8.9.1"
|
||||||
|
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||||
|
inputs:
|
||||||
|
versionSpec: "1.3.2"
|
||||||
|
- script: |
|
||||||
|
yarn
|
||||||
|
displayName: Install Dependencies
|
||||||
|
- script: |
|
||||||
|
yarn gulp electron-x64
|
||||||
|
displayName: Download Electron
|
||||||
|
- script: |
|
||||||
|
yarn gulp hygiene
|
||||||
|
displayName: Run Hygiene Checks
|
||||||
|
- script: |
|
||||||
|
yarn check-monaco-editor-compilation
|
||||||
|
displayName: Run Monaco Editor Checks
|
||||||
|
- script: |
|
||||||
|
yarn compile
|
||||||
|
displayName: Compile Sources
|
||||||
|
- script: |
|
||||||
|
yarn download-builtin-extensions
|
||||||
|
displayName: Download Built-in Extensions
|
||||||
|
- script: |
|
||||||
|
./scripts/test.sh --tfs "Unit Tests"
|
||||||
|
displayName: Run Unit Tests
|
||||||
|
- script: |
|
||||||
|
./scripts/test-integration.sh --tfs "Integration Tests"
|
||||||
|
displayName: Run Integration Tests
|
||||||
|
- script: |
|
||||||
|
yarn smoketest --screenshots "$(Build.ArtifactStagingDirectory)/artifacts" --log "$(Build.ArtifactStagingDirectory)/artifacts/smoketest.log"
|
||||||
|
displayName: Run Smoke Tests
|
||||||
|
continueOnError: true
|
||||||
|
- task: PublishBuildArtifacts@1
|
||||||
|
displayName: Publish Smoketest Artifacts
|
||||||
|
inputs:
|
||||||
|
PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts'
|
||||||
|
ArtifactName: build-artifacts-darwin
|
||||||
|
publishLocation: Container
|
||||||
|
condition: eq(variables['System.PullRequest.IsFork'], 'False')
|
||||||
|
- task: PublishTestResults@2
|
||||||
|
displayName: Publish Tests Results
|
||||||
|
inputs:
|
||||||
|
testResultsFiles: '*-results.xml'
|
||||||
|
searchFolder: '$(Build.ArtifactStagingDirectory)/test-results'
|
||||||
|
condition: succeededOrFailed()
|
||||||
106
build/tfs/darwin/enqueue.js
Normal file
106
build/tfs/darwin/enqueue.js
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||||
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
|
function step(op) {
|
||||||
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
|
while (_) try {
|
||||||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
|
switch (op[0]) {
|
||||||
|
case 0: case 1: t = op; break;
|
||||||
|
case 4: _.label++; return { value: op[1], done: false };
|
||||||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||||
|
default:
|
||||||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||||
|
if (t[2]) _.ops.pop();
|
||||||
|
_.trys.pop(); continue;
|
||||||
|
}
|
||||||
|
op = body.call(thisArg, _);
|
||||||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var child_process_1 = require("child_process");
|
||||||
|
var documentdb_1 = require("documentdb");
|
||||||
|
var azure = require("azure-storage");
|
||||||
|
function queueSigningRequest(quality, commit) {
|
||||||
|
var retryOperations = new azure.ExponentialRetryPolicyFilter();
|
||||||
|
var queueSvc = azure
|
||||||
|
.createQueueService(process.env['AZURE_STORAGE_ACCOUNT_2'], process.env['AZURE_STORAGE_ACCESS_KEY_2'])
|
||||||
|
.withFilter(retryOperations);
|
||||||
|
queueSvc.messageEncoder = new azure.QueueMessageEncoder.TextBase64QueueMessageEncoder();
|
||||||
|
var message = quality + "/" + commit;
|
||||||
|
return new Promise(function (c, e) { return queueSvc.createMessage('sign-darwin', message, function (err) { return err ? e(err) : c(); }); });
|
||||||
|
}
|
||||||
|
function isBuildSigned(quality, commit) {
|
||||||
|
var client = new documentdb_1.DocumentClient(process.env['AZURE_DOCUMENTDB_ENDPOINT'], { masterKey: process.env['AZURE_DOCUMENTDB_MASTERKEY'] });
|
||||||
|
var collection = 'dbs/builds/colls/' + quality;
|
||||||
|
var updateQuery = {
|
||||||
|
query: 'SELECT TOP 1 * FROM c WHERE c.id = @id',
|
||||||
|
parameters: [{ name: '@id', value: commit }]
|
||||||
|
};
|
||||||
|
return new Promise(function (c, e) {
|
||||||
|
client.queryDocuments(collection, updateQuery).toArray(function (err, results) {
|
||||||
|
if (err) {
|
||||||
|
return e(err);
|
||||||
|
}
|
||||||
|
if (results.length !== 1) {
|
||||||
|
return c(false);
|
||||||
|
}
|
||||||
|
var release = results[0];
|
||||||
|
var assets = release.assets;
|
||||||
|
var isSigned = assets.some(function (a) { return a.platform === 'darwin' && a.type === 'archive'; });
|
||||||
|
c(isSigned);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// async function waitForSignedBuild(quality: string, commit: string): Promise<void> {
|
||||||
|
// let retries = 0;
|
||||||
|
// while (retries < 180) {
|
||||||
|
// if (await isBuildSigned(quality, commit)) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// await new Promise<void>(c => setTimeout(c, 10000));
|
||||||
|
// retries++;
|
||||||
|
// }
|
||||||
|
// throw new Error('Timed out waiting for signed build');
|
||||||
|
// }
|
||||||
|
function main(quality) {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
var commit;
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0:
|
||||||
|
commit = child_process_1.execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();
|
||||||
|
console.log("Queueing signing request for '" + quality + "/" + commit + "'...");
|
||||||
|
return [4 /*yield*/, queueSigningRequest(quality, commit)];
|
||||||
|
case 1:
|
||||||
|
_a.sent();
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
main(process.argv[2]).catch(function (err) {
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
63
build/tfs/darwin/product-build-darwin.yml
Normal file
63
build/tfs/darwin/product-build-darwin.yml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
steps:
|
||||||
|
- task: NodeTool@0
|
||||||
|
inputs:
|
||||||
|
versionSpec: "8.9.1"
|
||||||
|
|
||||||
|
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||||
|
inputs:
|
||||||
|
versionSpec: "1.3.2"
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
set -e
|
||||||
|
echo "machine monacotools.visualstudio.com password $(VSO_PAT)" > ~/.netrc
|
||||||
|
yarn
|
||||||
|
npm run gulp -- hygiene
|
||||||
|
npm run monaco-compile-check
|
||||||
|
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- mixin
|
||||||
|
node build/tfs/common/installDistro.js
|
||||||
|
node build/lib/builtInExtensions.js
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
set -e
|
||||||
|
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" \
|
||||||
|
AZURE_STORAGE_ACCESS_KEY="$(AZURE_STORAGE_ACCESS_KEY)" \
|
||||||
|
npm run gulp -- vscode-darwin-min upload-vscode-sourcemaps
|
||||||
|
name: build
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
set -e
|
||||||
|
./scripts/test.sh --build --tfs "Unit Tests"
|
||||||
|
APP_NAME="`ls $(agent.builddirectory)/VSCode-darwin | head -n 1`"
|
||||||
|
# yarn smoketest -- --build "$(agent.builddirectory)/VSCode-darwin/$APP_NAME"
|
||||||
|
name: test
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
set -e
|
||||||
|
# archive the unsigned build
|
||||||
|
pushd ../VSCode-darwin && zip -r -X -y ../VSCode-darwin-unsigned.zip * && popd
|
||||||
|
|
||||||
|
# publish the unsigned build
|
||||||
|
PACKAGEJSON=`ls ../VSCode-darwin/*.app/Contents/Resources/app/package.json`
|
||||||
|
VERSION=`node -p "require(\"$PACKAGEJSON\").version"`
|
||||||
|
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
|
||||||
|
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
|
||||||
|
MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
|
||||||
|
node build/tfs/common/publish.js \
|
||||||
|
"$(VSCODE_QUALITY)" \
|
||||||
|
darwin \
|
||||||
|
archive-unsigned \
|
||||||
|
"VSCode-darwin-$(VSCODE_QUALITY)-unsigned.zip" \
|
||||||
|
$VERSION \
|
||||||
|
false \
|
||||||
|
../VSCode-darwin-unsigned.zip
|
||||||
|
|
||||||
|
# publish hockeyapp symbols
|
||||||
|
node build/tfs/common/symbols.js "$(VSCODE_MIXIN_PASSWORD)" "$(VSCODE_HOCKEYAPP_TOKEN)" "$(VSCODE_ARCH)" "$(VSCODE_HOCKEYAPP_ID_MACOS)"
|
||||||
|
|
||||||
|
# enqueue the unsigned build
|
||||||
|
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
|
||||||
|
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
|
||||||
|
node build/tfs/darwin/enqueue.js "$(VSCODE_QUALITY)"
|
||||||
|
|
||||||
|
AZURE_STORAGE_ACCESS_KEY="$(AZURE_STORAGE_ACCESS_KEY)" \
|
||||||
|
npm run gulp -- upload-vscode-configuration
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
. ./scripts/env.sh
|
|
||||||
. ./build/tfs/common/common.sh
|
|
||||||
|
|
||||||
(cd $BUILD_SOURCESDIRECTORY/build/tfs/common && \
|
|
||||||
step "Install build dependencies" \
|
|
||||||
npm i)
|
|
||||||
|
|
||||||
REPO=`pwd`
|
|
||||||
ZIP=$REPO/../VSCode-darwin-selfsigned.zip
|
|
||||||
UNSIGNEDZIP=$REPO/../VSCode-darwin-unsigned.zip
|
|
||||||
BUILD=$REPO/../VSCode-darwin
|
|
||||||
PACKAGEJSON=`ls $BUILD/*.app/Contents/Resources/app/package.json`
|
|
||||||
VERSION=`node -p "require(\"$PACKAGEJSON\").version"`
|
|
||||||
|
|
||||||
rm -rf $UNSIGNEDZIP
|
|
||||||
(cd $BUILD && \
|
|
||||||
step "Create unsigned archive" \
|
|
||||||
zip -r -X -y $UNSIGNEDZIP *)
|
|
||||||
|
|
||||||
step "Upload unsigned archive" \
|
|
||||||
node build/tfs/common/publish.js $VSCODE_QUALITY darwin archive-unsigned VSCode-darwin-$VSCODE_QUALITY-unsigned.zip $VERSION false $UNSIGNEDZIP
|
|
||||||
|
|
||||||
step "Sign build" \
|
|
||||||
node build/tfs/common/enqueue.js $VSCODE_QUALITY
|
|
||||||
3
build/tfs/linux/.gitignore
vendored
3
build/tfs/linux/.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
pat
|
pat
|
||||||
|
*.js
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
./build/tfs/linux/build.sh ia32 "$@"
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
./build/tfs/linux/build.sh x64 "$@"
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
. ./build/tfs/common/node.sh
|
|
||||||
. ./scripts/env.sh
|
|
||||||
. ./build/tfs/common/common.sh
|
|
||||||
|
|
||||||
export ARCH="$1"
|
|
||||||
export VSCODE_MIXIN_PASSWORD="$2"
|
|
||||||
export AZURE_STORAGE_ACCESS_KEY="$3"
|
|
||||||
export AZURE_STORAGE_ACCESS_KEY_2="$4"
|
|
||||||
export MOONCAKE_STORAGE_ACCESS_KEY="$5"
|
|
||||||
export AZURE_DOCUMENTDB_MASTERKEY="$6"
|
|
||||||
export LINUX_REPO_PASSWORD="$7"
|
|
||||||
VSO_PAT="$8"
|
|
||||||
|
|
||||||
echo "machine monacotools.visualstudio.com password $VSO_PAT" > ~/.netrc
|
|
||||||
|
|
||||||
step "Install dependencies" \
|
|
||||||
npm install --arch=$ARCH --unsafe-perm
|
|
||||||
|
|
||||||
step "Hygiene" \
|
|
||||||
npm run gulp -- hygiene
|
|
||||||
|
|
||||||
step "Mix in repository from vscode-distro" \
|
|
||||||
npm run gulp -- mixin
|
|
||||||
|
|
||||||
step "Get Electron" \
|
|
||||||
npm run gulp -- "electron-$ARCH"
|
|
||||||
|
|
||||||
step "Install distro dependencies" \
|
|
||||||
node build/tfs/common/installDistro.js --arch=$ARCH
|
|
||||||
|
|
||||||
step "Build minified" \
|
|
||||||
npm run gulp -- "vscode-linux-$ARCH-min"
|
|
||||||
|
|
||||||
# step "Create loader snapshot"
|
|
||||||
# node build/lib/snapshotLoader.js --arch=$ARCH
|
|
||||||
|
|
||||||
step "Run unit tests" \
|
|
||||||
./scripts/test.sh --build --reporter dot
|
|
||||||
|
|
||||||
# function smoketest {
|
|
||||||
# id -u testuser &>/dev/null || (useradd -m testuser; chpasswd <<< testuser:testpassword)
|
|
||||||
# sudo -i -u testuser -- sh -c 'git config --global user.name "VS Code Agent" && git config --global user.email "monacotools@microsoft.com"'
|
|
||||||
|
|
||||||
# ARTIFACTS="$AGENT_BUILDDIRECTORY/smoketest-artifacts"
|
|
||||||
# rm -rf $ARTIFACTS
|
|
||||||
# mkdir -p $ARTIFACTS
|
|
||||||
# chown -R testuser $ARTIFACTS
|
|
||||||
|
|
||||||
# ps -o pid= -u testuser | xargs sudo kill -9
|
|
||||||
# DISPLAY=:10 sudo -i -u testuser -- sh -c "cd $BUILD_SOURCESDIRECTORY/test/smoke && ./node_modules/.bin/mocha --build $AGENT_BUILDDIRECTORY/VSCode-linux-$ARCH --log $ARTIFACTS"
|
|
||||||
# # DISPLAY=:10 sudo -i -u testuser -- sh -c "cd /vso/work/1/s/test/smoke && ./node_modules/.bin/mocha --build /vso/work/1/VSCode-linux-ia32"
|
|
||||||
# }
|
|
||||||
|
|
||||||
# step "Run smoke test" \
|
|
||||||
# smoketest
|
|
||||||
|
|
||||||
step "Publish release" \
|
|
||||||
./build/tfs/linux/release.sh
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user