Skip to content

Commit

Permalink
ESM merge to main (#227184)
Browse files Browse the repository at this point in the history
Co-authored-by: Johannes Rieken <[email protected]>
Co-authored-by: Alexandru Dima <[email protected]>
  • Loading branch information
3 people committed Aug 30, 2024
1 parent 11ad426 commit 6b924c5
Show file tree
Hide file tree
Showing 3,921 changed files with 50,112 additions and 50,068 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
27 changes: 24 additions & 3 deletions .eslintplugin/code-import-patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export = new class implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/microsoft/vscode/wiki/Source-Code-Organization',
badFilename: 'Missing definition in `code-import-patterns` for this file. Define rules at https://github.com/microsoft/vscode/blob/main/.eslintrc.json'
badFilename: 'Missing definition in `code-import-patterns` for this file. Define rules at https://github.com/microsoft/vscode/blob/main/.eslintrc.json',
badAbsolute: 'Imports have to be relative to support ESM',
badExtension: 'Imports have to end with `.js` or `.css` to support ESM',
},
docs: {
url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization'
Expand Down Expand Up @@ -181,8 +183,8 @@ export = new class implements eslint.Rule.RuleModule {

if (targetIsVS) {
// Always add "vs/nls" and "vs/amdX"
restrictions.push('vs/nls');
restrictions.push('vs/amdX'); // TODO@jrieken remove after ESM is real
restrictions.push('vs/nls.js');
restrictions.push('vs/amdX.js'); // TODO@jrieken remove after ESM is real
}

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

private _checkImport(context: eslint.Rule.RuleContext, config: ImportPatternsConfig, node: TSESTree.Node, importPath: string) {
const targetIsVS = /^src\/vs\//.test(getRelativeFilename(context));
if (targetIsVS) {

// ESM: check for import ending with ".js" or ".css"
if (importPath[0] === '.' && !importPath.endsWith('.js') && !importPath.endsWith('.css')) {
context.report({
loc: node.loc,
messageId: 'badExtension',
});
}

// check for import being relative
if (importPath.startsWith('vs/')) {
context.report({
loc: node.loc,
messageId: 'badAbsolute',
});
}
}

// resolve relative paths
if (importPath[0] === '.') {
Expand Down
20 changes: 16 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@
"http",
"https",
"minimist",
"node:module",
"native-keymap",
"native-watchdog",
"net",
Expand Down Expand Up @@ -692,6 +693,7 @@
"when": "test",
"allow": [
"vs/css.build",
"vs/css.build.js",
"assert",
"sinon",
"sinon-test"
Expand Down Expand Up @@ -937,6 +939,10 @@
"when": "hasBrowser",
"pattern": "vs/workbench/workbench.web.main"
},
{
"when": "hasBrowser",
"pattern": "vs/workbench/workbench.web.main.js"
},
{
"when": "hasBrowser",
"pattern": "vs/workbench/~"
Expand Down Expand Up @@ -977,11 +983,13 @@
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/editor.all",
"vs/editor/editor.all.js",
"vs/workbench/~",
"vs/workbench/api/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/workbench/contrib/terminal/terminal.all"
"vs/workbench/contrib/terminal/terminal.all",
"vs/workbench/contrib/terminal/terminal.all.js"
]
},
{
Expand All @@ -994,11 +1002,13 @@
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/editor.all",
"vs/editor/editor.all.js",
"vs/workbench/~",
"vs/workbench/api/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/workbench/workbench.common.main"
"vs/workbench/workbench.common.main",
"vs/workbench/workbench.common.main.js"
]
},
{
Expand All @@ -1011,11 +1021,13 @@
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/editor.all",
"vs/editor/editor.all.js",
"vs/workbench/~",
"vs/workbench/api/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/workbench/workbench.common.main"
"vs/workbench/workbench.common.main",
"vs/workbench/workbench.common.main.js"
]
},
{
Expand All @@ -1025,7 +1037,7 @@
]
},
{
"target": "src/vs/{loader.d.ts,css.ts,css.build.ts,monaco.d.ts,nls.messages.ts,nls.ts}",
"target": "src/vs/{loader.d.ts,css.ts,css.build.ts,monaco.d.ts,nls.ts,nls.messages.ts}",
"restrictions": []
},
{
Expand Down
50 changes: 25 additions & 25 deletions .github/workflows/monaco-editor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,34 @@ jobs:
- name: Run Monaco Editor Checks
run: yarn monaco-compile-check

- name: Editor Distro & ESM
run: yarn gulp editor-esm
# - name: Editor Distro & ESM
# run: yarn gulp editor-esm

- name: Editor ESM sources check
working-directory: ./test/monaco
run: yarn run esm-check
# - name: Editor ESM sources check
# working-directory: ./test/monaco
# run: yarn run esm-check

- name: Typings validation prep
run: |
mkdir typings-test
# - name: Typings validation prep
# run: |
# mkdir typings-test

- name: Typings validation
working-directory: ./typings-test
run: |
yarn init -yp
../node_modules/.bin/tsc --init
echo "import '../out-monaco-editor-core';" > a.ts
../node_modules/.bin/tsc --noEmit
# - name: Typings validation
# working-directory: ./typings-test
# run: |
# yarn init -yp
# ../node_modules/.bin/tsc --init
# echo "import '../out-monaco-editor-core';" > a.ts
# ../node_modules/.bin/tsc --noEmit

- name: Package Editor with Webpack
working-directory: ./test/monaco
run: yarn run bundle-webpack
# - name: Package Editor with Webpack
# working-directory: ./test/monaco
# run: yarn run bundle-webpack

- name: Compile Editor Tests
working-directory: ./test/monaco
run: yarn run compile
# - name: Compile Editor Tests
# working-directory: ./test/monaco
# run: yarn run compile

- name: Run Editor Tests
timeout-minutes: 5
working-directory: ./test/monaco
run: yarn test
# - name: Run Editor Tests
# timeout-minutes: 5
# working-directory: ./test/monaco
# run: yarn test
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"npm.exclude": "**/extensions/**",
"npm.packageManager": "yarn",
"emmet.excludeLanguages": [],
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.preferences.quoteStyle": "single",
"json.schemas": [
{
Expand Down
50 changes: 25 additions & 25 deletions build/azure-pipelines/darwin/product-build-darwin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
type: boolean
- name: VSCODE_RUN_SMOKE_TESTS
type: boolean
- name: VSCODE_BUILD_ESM
- name: VSCODE_BUILD_AMD
type: boolean
default: false

Expand All @@ -20,19 +20,19 @@ steps:

- ${{ if eq(parameters.VSCODE_RUN_UNIT_TESTS, true) }}:
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
- ${{ if eq(parameters.VSCODE_BUILD_ESM, true) }}:
- script: ./scripts/test-esm.sh --tfs "Unit Tests"
displayName: Run unit tests (Electron) [ESM]
- ${{ if eq(parameters.VSCODE_BUILD_AMD, true) }}:
- script: ./scripts/test-amd.sh --tfs "Unit Tests"
displayName: Run unit tests (Electron) [AMD]
timeoutInMinutes: 15
- script: yarn test-node-esm
displayName: Run unit tests (node.js) [ESM]
- script: yarn test-node-amd
displayName: Run unit tests (node.js) [AMD]
timeoutInMinutes: 15
- script: yarn test-browser-esm-no-install --sequential --browser chromium --browser webkit --tfs "Browser Unit Tests"
- script: yarn test-browser-amd-no-install --sequential --browser chromium --browser webkit --tfs "Browser Unit Tests"
env:
DEBUG: "*browser*"
displayName: Run unit tests (Browser, Chromium & Webkit) [ESM]
displayName: Run unit tests (Browser, Chromium & Webkit) [AMD]
timeoutInMinutes: 30
- ${{ if eq(parameters.VSCODE_BUILD_ESM, false) }}:
- ${{ if eq(parameters.VSCODE_BUILD_AMD, false) }}:
- script: ./scripts/test.sh --tfs "Unit Tests"
displayName: Run unit tests (Electron)
timeoutInMinutes: 15
Expand All @@ -46,19 +46,19 @@ steps:
timeoutInMinutes: 30

- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
- ${{ if eq(parameters.VSCODE_BUILD_ESM, true) }}:
- script: ./scripts/test-esm.sh --build --tfs "Unit Tests"
displayName: Run unit tests (Electron) [ESM]
- ${{ if eq(parameters.VSCODE_BUILD_AMD, true) }}:
- script: ./scripts/test-amd.sh --build --tfs "Unit Tests"
displayName: Run unit tests (Electron) [AMD]
timeoutInMinutes: 15
- script: yarn test-node-esm --build
displayName: Run unit tests (node.js) [ESM]
- script: yarn test-node-amd --build
displayName: Run unit tests (node.js) [AMD]
timeoutInMinutes: 15
- script: yarn test-browser-esm-no-install --sequential --build --browser chromium --browser webkit --tfs "Browser Unit Tests"
- script: yarn test-browser-amd-no-install --sequential --build --browser chromium --browser webkit --tfs "Browser Unit Tests"
env:
DEBUG: "*browser*"
displayName: Run unit tests (Browser, Chromium & Webkit) [ESM]
displayName: Run unit tests (Browser, Chromium & Webkit) [AMD]
timeoutInMinutes: 30
- ${{ if eq(parameters.VSCODE_BUILD_ESM, false) }}:
- ${{ if eq(parameters.VSCODE_BUILD_AMD, false) }}:
- script: ./scripts/test.sh --build --tfs "Unit Tests"
displayName: Run unit tests (Electron)
timeoutInMinutes: 15
Expand Down Expand Up @@ -94,17 +94,17 @@ steps:
displayName: Build integration tests
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
- ${{ if eq(parameters.VSCODE_BUILD_ESM, true) }}:
- script: ./scripts/test-integration-esm.sh --tfs "Integration Tests"
displayName: Run integration tests (Electron) [ESM]
- ${{ if eq(parameters.VSCODE_BUILD_AMD, true) }}:
- script: ./scripts/test-integration-amd.sh --tfs "Integration Tests"
displayName: Run integration tests (Electron) [AMD]
timeoutInMinutes: 20
- ${{ if eq(parameters.VSCODE_BUILD_ESM, false) }}:
- ${{ if eq(parameters.VSCODE_BUILD_AMD, false) }}:
- script: ./scripts/test-integration --tfs "Integration Tests"
displayName: Run integration tests (Electron)
timeoutInMinutes: 20

- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
- ${{ if eq(parameters.VSCODE_BUILD_ESM, true) }}:
- ${{ if eq(parameters.VSCODE_BUILD_AMD, true) }}:
- script: |
# Figure out the full absolute path of the product we just built
# including the remote server and configure the integration tests
Expand All @@ -113,12 +113,12 @@ steps:
APP_ROOT="$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)"
APP_NAME="`ls $APP_ROOT | head -n 1`"
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \
./scripts/test-integration-esm.sh --build --tfs "Integration Tests"
./scripts/test-integration-amd.sh --build --tfs "Integration Tests"
env:
VSCODE_REMOTE_SERVER_PATH: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)
displayName: Run integration tests (Electron) [ESM]
displayName: Run integration tests (Electron) [AMD]
timeoutInMinutes: 20
- ${{ if eq(parameters.VSCODE_BUILD_ESM, false) }}:
- ${{ if eq(parameters.VSCODE_BUILD_AMD, false) }}:
- script: |
# Figure out the full absolute path of the product we just built
# including the remote server and configure the integration tests
Expand Down
4 changes: 2 additions & 2 deletions build/azure-pipelines/darwin/product-build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ parameters:
type: boolean
- name: VSCODE_RUN_SMOKE_TESTS
type: boolean
- name: VSCODE_BUILD_ESM
- name: VSCODE_BUILD_AMD
type: boolean
default: false

Expand Down Expand Up @@ -177,7 +177,7 @@ steps:
VSCODE_RUN_UNIT_TESTS: ${{ parameters.VSCODE_RUN_UNIT_TESTS }}
VSCODE_RUN_INTEGRATION_TESTS: ${{ parameters.VSCODE_RUN_INTEGRATION_TESTS }}
VSCODE_RUN_SMOKE_TESTS: ${{ parameters.VSCODE_RUN_SMOKE_TESTS }}
VSCODE_BUILD_ESM: ${{ parameters.VSCODE_BUILD_ESM }}
VSCODE_BUILD_AMD: ${{ parameters.VSCODE_BUILD_AMD }}

- ${{ elseif and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'oss')) }}:
- task: DownloadPipelineArtifact@2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parameters:
type: boolean
- name: VSCODE_ARCH
type: string
- name: VSCODE_BUILD_ESM
- name: VSCODE_BUILD_AMD
type: boolean
default: false

Expand Down Expand Up @@ -204,7 +204,7 @@ steps:
VSCODE_RUN_UNIT_TESTS: false
VSCODE_RUN_INTEGRATION_TESTS: ${{ parameters.VSCODE_RUN_INTEGRATION_TESTS }}
VSCODE_RUN_SMOKE_TESTS: false
VSCODE_BUILD_ESM: ${{ parameters.VSCODE_BUILD_ESM }}
VSCODE_BUILD_AMD: ${{ parameters.VSCODE_BUILD_AMD }}
${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
PUBLISH_TASK_NAME: 1ES.PublishPipelineArtifact@1

Expand Down
Loading

0 comments on commit 6b924c5

Please sign in to comment.