Skip to content

Commit 6b924c5

Browse files
bpaserojriekenalexdima
authored
ESM merge to main (#227184)
Co-authored-by: Johannes Rieken <[email protected]> Co-authored-by: Alexandru Dima <[email protected]>
1 parent 11ad426 commit 6b924c5

File tree

3,921 files changed

+50112
-50068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,921 files changed

+50112
-50068
lines changed

.eslintplugin/code-import-patterns.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export = new class implements eslint.Rule.RuleModule {
4444
readonly meta: eslint.Rule.RuleMetaData = {
4545
messages: {
4646
badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/microsoft/vscode/wiki/Source-Code-Organization',
47-
badFilename: 'Missing definition in `code-import-patterns` for this file. Define rules at https://github.com/microsoft/vscode/blob/main/.eslintrc.json'
47+
badFilename: 'Missing definition in `code-import-patterns` for this file. Define rules at https://github.com/microsoft/vscode/blob/main/.eslintrc.json',
48+
badAbsolute: 'Imports have to be relative to support ESM',
49+
badExtension: 'Imports have to end with `.js` or `.css` to support ESM',
4850
},
4951
docs: {
5052
url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization'
@@ -181,8 +183,8 @@ export = new class implements eslint.Rule.RuleModule {
181183

182184
if (targetIsVS) {
183185
// Always add "vs/nls" and "vs/amdX"
184-
restrictions.push('vs/nls');
185-
restrictions.push('vs/amdX'); // TODO@jrieken remove after ESM is real
186+
restrictions.push('vs/nls.js');
187+
restrictions.push('vs/amdX.js'); // TODO@jrieken remove after ESM is real
186188
}
187189

188190
if (targetIsVS && option.layer) {
@@ -212,6 +214,25 @@ export = new class implements eslint.Rule.RuleModule {
212214
}
213215

214216
private _checkImport(context: eslint.Rule.RuleContext, config: ImportPatternsConfig, node: TSESTree.Node, importPath: string) {
217+
const targetIsVS = /^src\/vs\//.test(getRelativeFilename(context));
218+
if (targetIsVS) {
219+
220+
// ESM: check for import ending with ".js" or ".css"
221+
if (importPath[0] === '.' && !importPath.endsWith('.js') && !importPath.endsWith('.css')) {
222+
context.report({
223+
loc: node.loc,
224+
messageId: 'badExtension',
225+
});
226+
}
227+
228+
// check for import being relative
229+
if (importPath.startsWith('vs/')) {
230+
context.report({
231+
loc: node.loc,
232+
messageId: 'badAbsolute',
233+
});
234+
}
235+
}
215236

216237
// resolve relative paths
217238
if (importPath[0] === '.') {

.eslintrc.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@
656656
"http",
657657
"https",
658658
"minimist",
659+
"node:module",
659660
"native-keymap",
660661
"native-watchdog",
661662
"net",
@@ -692,6 +693,7 @@
692693
"when": "test",
693694
"allow": [
694695
"vs/css.build",
696+
"vs/css.build.js",
695697
"assert",
696698
"sinon",
697699
"sinon-test"
@@ -937,6 +939,10 @@
937939
"when": "hasBrowser",
938940
"pattern": "vs/workbench/workbench.web.main"
939941
},
942+
{
943+
"when": "hasBrowser",
944+
"pattern": "vs/workbench/workbench.web.main.js"
945+
},
940946
{
941947
"when": "hasBrowser",
942948
"pattern": "vs/workbench/~"
@@ -977,11 +983,13 @@
977983
"vs/editor/~",
978984
"vs/editor/contrib/*/~",
979985
"vs/editor/editor.all",
986+
"vs/editor/editor.all.js",
980987
"vs/workbench/~",
981988
"vs/workbench/api/~",
982989
"vs/workbench/services/*/~",
983990
"vs/workbench/contrib/*/~",
984-
"vs/workbench/contrib/terminal/terminal.all"
991+
"vs/workbench/contrib/terminal/terminal.all",
992+
"vs/workbench/contrib/terminal/terminal.all.js"
985993
]
986994
},
987995
{
@@ -994,11 +1002,13 @@
9941002
"vs/editor/~",
9951003
"vs/editor/contrib/*/~",
9961004
"vs/editor/editor.all",
1005+
"vs/editor/editor.all.js",
9971006
"vs/workbench/~",
9981007
"vs/workbench/api/~",
9991008
"vs/workbench/services/*/~",
10001009
"vs/workbench/contrib/*/~",
1001-
"vs/workbench/workbench.common.main"
1010+
"vs/workbench/workbench.common.main",
1011+
"vs/workbench/workbench.common.main.js"
10021012
]
10031013
},
10041014
{
@@ -1011,11 +1021,13 @@
10111021
"vs/editor/~",
10121022
"vs/editor/contrib/*/~",
10131023
"vs/editor/editor.all",
1024+
"vs/editor/editor.all.js",
10141025
"vs/workbench/~",
10151026
"vs/workbench/api/~",
10161027
"vs/workbench/services/*/~",
10171028
"vs/workbench/contrib/*/~",
1018-
"vs/workbench/workbench.common.main"
1029+
"vs/workbench/workbench.common.main",
1030+
"vs/workbench/workbench.common.main.js"
10191031
]
10201032
},
10211033
{
@@ -1025,7 +1037,7 @@
10251037
]
10261038
},
10271039
{
1028-
"target": "src/vs/{loader.d.ts,css.ts,css.build.ts,monaco.d.ts,nls.messages.ts,nls.ts}",
1040+
"target": "src/vs/{loader.d.ts,css.ts,css.build.ts,monaco.d.ts,nls.ts,nls.messages.ts}",
10291041
"restrictions": []
10301042
},
10311043
{

.github/workflows/monaco-editor.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -65,34 +65,34 @@ jobs:
6565
- name: Run Monaco Editor Checks
6666
run: yarn monaco-compile-check
6767

68-
- name: Editor Distro & ESM
69-
run: yarn gulp editor-esm
68+
# - name: Editor Distro & ESM
69+
# run: yarn gulp editor-esm
7070

71-
- name: Editor ESM sources check
72-
working-directory: ./test/monaco
73-
run: yarn run esm-check
71+
# - name: Editor ESM sources check
72+
# working-directory: ./test/monaco
73+
# run: yarn run esm-check
7474

75-
- name: Typings validation prep
76-
run: |
77-
mkdir typings-test
75+
# - name: Typings validation prep
76+
# run: |
77+
# mkdir typings-test
7878

79-
- name: Typings validation
80-
working-directory: ./typings-test
81-
run: |
82-
yarn init -yp
83-
../node_modules/.bin/tsc --init
84-
echo "import '../out-monaco-editor-core';" > a.ts
85-
../node_modules/.bin/tsc --noEmit
79+
# - name: Typings validation
80+
# working-directory: ./typings-test
81+
# run: |
82+
# yarn init -yp
83+
# ../node_modules/.bin/tsc --init
84+
# echo "import '../out-monaco-editor-core';" > a.ts
85+
# ../node_modules/.bin/tsc --noEmit
8686

87-
- name: Package Editor with Webpack
88-
working-directory: ./test/monaco
89-
run: yarn run bundle-webpack
87+
# - name: Package Editor with Webpack
88+
# working-directory: ./test/monaco
89+
# run: yarn run bundle-webpack
9090

91-
- name: Compile Editor Tests
92-
working-directory: ./test/monaco
93-
run: yarn run compile
91+
# - name: Compile Editor Tests
92+
# working-directory: ./test/monaco
93+
# run: yarn run compile
9494

95-
- name: Run Editor Tests
96-
timeout-minutes: 5
97-
working-directory: ./test/monaco
98-
run: yarn test
95+
# - name: Run Editor Tests
96+
# timeout-minutes: 5
97+
# working-directory: ./test/monaco
98+
# run: yarn test

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"npm.exclude": "**/extensions/**",
7777
"npm.packageManager": "yarn",
7878
"emmet.excludeLanguages": [],
79-
"typescript.preferences.importModuleSpecifier": "non-relative",
79+
"typescript.preferences.importModuleSpecifier": "relative",
8080
"typescript.preferences.quoteStyle": "single",
8181
"json.schemas": [
8282
{

build/azure-pipelines/darwin/product-build-darwin-test.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77
type: boolean
88
- name: VSCODE_RUN_SMOKE_TESTS
99
type: boolean
10-
- name: VSCODE_BUILD_ESM
10+
- name: VSCODE_BUILD_AMD
1111
type: boolean
1212
default: false
1313

@@ -20,19 +20,19 @@ steps:
2020

2121
- ${{ if eq(parameters.VSCODE_RUN_UNIT_TESTS, true) }}:
2222
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
23-
- ${{ if eq(parameters.VSCODE_BUILD_ESM, true) }}:
24-
- script: ./scripts/test-esm.sh --tfs "Unit Tests"
25-
displayName: Run unit tests (Electron) [ESM]
23+
- ${{ if eq(parameters.VSCODE_BUILD_AMD, true) }}:
24+
- script: ./scripts/test-amd.sh --tfs "Unit Tests"
25+
displayName: Run unit tests (Electron) [AMD]
2626
timeoutInMinutes: 15
27-
- script: yarn test-node-esm
28-
displayName: Run unit tests (node.js) [ESM]
27+
- script: yarn test-node-amd
28+
displayName: Run unit tests (node.js) [AMD]
2929
timeoutInMinutes: 15
30-
- script: yarn test-browser-esm-no-install --sequential --browser chromium --browser webkit --tfs "Browser Unit Tests"
30+
- script: yarn test-browser-amd-no-install --sequential --browser chromium --browser webkit --tfs "Browser Unit Tests"
3131
env:
3232
DEBUG: "*browser*"
33-
displayName: Run unit tests (Browser, Chromium & Webkit) [ESM]
33+
displayName: Run unit tests (Browser, Chromium & Webkit) [AMD]
3434
timeoutInMinutes: 30
35-
- ${{ if eq(parameters.VSCODE_BUILD_ESM, false) }}:
35+
- ${{ if eq(parameters.VSCODE_BUILD_AMD, false) }}:
3636
- script: ./scripts/test.sh --tfs "Unit Tests"
3737
displayName: Run unit tests (Electron)
3838
timeoutInMinutes: 15
@@ -46,19 +46,19 @@ steps:
4646
timeoutInMinutes: 30
4747

4848
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
49-
- ${{ if eq(parameters.VSCODE_BUILD_ESM, true) }}:
50-
- script: ./scripts/test-esm.sh --build --tfs "Unit Tests"
51-
displayName: Run unit tests (Electron) [ESM]
49+
- ${{ if eq(parameters.VSCODE_BUILD_AMD, true) }}:
50+
- script: ./scripts/test-amd.sh --build --tfs "Unit Tests"
51+
displayName: Run unit tests (Electron) [AMD]
5252
timeoutInMinutes: 15
53-
- script: yarn test-node-esm --build
54-
displayName: Run unit tests (node.js) [ESM]
53+
- script: yarn test-node-amd --build
54+
displayName: Run unit tests (node.js) [AMD]
5555
timeoutInMinutes: 15
56-
- script: yarn test-browser-esm-no-install --sequential --build --browser chromium --browser webkit --tfs "Browser Unit Tests"
56+
- script: yarn test-browser-amd-no-install --sequential --build --browser chromium --browser webkit --tfs "Browser Unit Tests"
5757
env:
5858
DEBUG: "*browser*"
59-
displayName: Run unit tests (Browser, Chromium & Webkit) [ESM]
59+
displayName: Run unit tests (Browser, Chromium & Webkit) [AMD]
6060
timeoutInMinutes: 30
61-
- ${{ if eq(parameters.VSCODE_BUILD_ESM, false) }}:
61+
- ${{ if eq(parameters.VSCODE_BUILD_AMD, false) }}:
6262
- script: ./scripts/test.sh --build --tfs "Unit Tests"
6363
displayName: Run unit tests (Electron)
6464
timeoutInMinutes: 15
@@ -94,17 +94,17 @@ steps:
9494
displayName: Build integration tests
9595
9696
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
97-
- ${{ if eq(parameters.VSCODE_BUILD_ESM, true) }}:
98-
- script: ./scripts/test-integration-esm.sh --tfs "Integration Tests"
99-
displayName: Run integration tests (Electron) [ESM]
97+
- ${{ if eq(parameters.VSCODE_BUILD_AMD, true) }}:
98+
- script: ./scripts/test-integration-amd.sh --tfs "Integration Tests"
99+
displayName: Run integration tests (Electron) [AMD]
100100
timeoutInMinutes: 20
101-
- ${{ if eq(parameters.VSCODE_BUILD_ESM, false) }}:
101+
- ${{ if eq(parameters.VSCODE_BUILD_AMD, false) }}:
102102
- script: ./scripts/test-integration --tfs "Integration Tests"
103103
displayName: Run integration tests (Electron)
104104
timeoutInMinutes: 20
105105

106106
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
107-
- ${{ if eq(parameters.VSCODE_BUILD_ESM, true) }}:
107+
- ${{ if eq(parameters.VSCODE_BUILD_AMD, true) }}:
108108
- script: |
109109
# Figure out the full absolute path of the product we just built
110110
# including the remote server and configure the integration tests
@@ -113,12 +113,12 @@ steps:
113113
APP_ROOT="$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)"
114114
APP_NAME="`ls $APP_ROOT | head -n 1`"
115115
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \
116-
./scripts/test-integration-esm.sh --build --tfs "Integration Tests"
116+
./scripts/test-integration-amd.sh --build --tfs "Integration Tests"
117117
env:
118118
VSCODE_REMOTE_SERVER_PATH: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)
119-
displayName: Run integration tests (Electron) [ESM]
119+
displayName: Run integration tests (Electron) [AMD]
120120
timeoutInMinutes: 20
121-
- ${{ if eq(parameters.VSCODE_BUILD_ESM, false) }}:
121+
- ${{ if eq(parameters.VSCODE_BUILD_AMD, false) }}:
122122
- script: |
123123
# Figure out the full absolute path of the product we just built
124124
# including the remote server and configure the integration tests

build/azure-pipelines/darwin/product-build-darwin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ parameters:
99
type: boolean
1010
- name: VSCODE_RUN_SMOKE_TESTS
1111
type: boolean
12-
- name: VSCODE_BUILD_ESM
12+
- name: VSCODE_BUILD_AMD
1313
type: boolean
1414
default: false
1515

@@ -177,7 +177,7 @@ steps:
177177
VSCODE_RUN_UNIT_TESTS: ${{ parameters.VSCODE_RUN_UNIT_TESTS }}
178178
VSCODE_RUN_INTEGRATION_TESTS: ${{ parameters.VSCODE_RUN_INTEGRATION_TESTS }}
179179
VSCODE_RUN_SMOKE_TESTS: ${{ parameters.VSCODE_RUN_SMOKE_TESTS }}
180-
VSCODE_BUILD_ESM: ${{ parameters.VSCODE_BUILD_ESM }}
180+
VSCODE_BUILD_AMD: ${{ parameters.VSCODE_BUILD_AMD }}
181181

182182
- ${{ elseif and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'oss')) }}:
183183
- task: DownloadPipelineArtifact@2

build/azure-pipelines/linux/product-build-linux-legacy-server.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ parameters:
55
type: boolean
66
- name: VSCODE_ARCH
77
type: string
8-
- name: VSCODE_BUILD_ESM
8+
- name: VSCODE_BUILD_AMD
99
type: boolean
1010
default: false
1111

@@ -204,7 +204,7 @@ steps:
204204
VSCODE_RUN_UNIT_TESTS: false
205205
VSCODE_RUN_INTEGRATION_TESTS: ${{ parameters.VSCODE_RUN_INTEGRATION_TESTS }}
206206
VSCODE_RUN_SMOKE_TESTS: false
207-
VSCODE_BUILD_ESM: ${{ parameters.VSCODE_BUILD_ESM }}
207+
VSCODE_BUILD_AMD: ${{ parameters.VSCODE_BUILD_AMD }}
208208
${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
209209
PUBLISH_TASK_NAME: 1ES.PublishPipelineArtifact@1
210210

0 commit comments

Comments
 (0)