瀏覽代碼

Merge branch 'main' into mdx

Henning Dieterichs 2 年之前
父節點
當前提交
181f03ecce
共有 100 個文件被更改,包括 6723 次插入13051 次删除
  1. 57 0
      .azure-pipelines/publish-nightly.yml
  2. 78 0
      .azure-pipelines/publish-stable.yml
  3. 8 0
      .devcontainer/devcontainer.json
  4. 7 1
      .github/ISSUE_TEMPLATE/1_bug_report.yaml
  5. 13 0
      .github/ISSUE_TEMPLATE/2_feature_request.yaml
  6. 19 4
      .github/workflows/ci.yml
  7. 3 4
      .github/workflows/info-needed-closer.yml
  8. 0 25
      .github/workflows/pr-chat.yml
  9. 0 14
      .github/workflows/publish-website.sh
  10. 0 235
      .github/workflows/publish.yml
  11. 8 4
      .github/workflows/publish/computeState.js
  12. 0 19
      .github/workflows/publish/setDevDependencyVersion.js
  13. 0 17
      .github/workflows/publish/setVersion.js
  14. 25 12
      .github/workflows/website.yml
  15. 6 2
      .gitignore
  16. 3 1
      .prettierignore
  17. 25 18
      .vscode/launch.json
  18. 5 2
      .vscode/settings.json
  19. 30 0
      .vscode/tasks.json
  20. 57 2
      CHANGELOG.md
  21. 81 60
      CONTRIBUTING.md
  22. 4 1
      MAINTAINING.md
  23. 18 18
      README.md
  24. 15 20
      build/build-languages.ts
  25. 29 21
      build/build-monaco-editor.ts
  26. 53 0
      build/check-samples.ts
  27. 12 97
      build/importTypescript.ts
  28. 1 1
      build/npm/installAll.ts
  29. 1 1
      build/npm/removeAll.ts
  30. 22 9
      build/releaseMetadata.ts
  31. 2 1
      build/tsconfig.json
  32. 12 10
      build/utils.ts
  33. 0 163
      build/website.ts
  34. 275 0
      docs/code-structure.dio.svg
  35. 二進制
      docs/debugging-core.gif
  36. 二進制
      docs/debugging-languages.gif
  37. 1 1
      docs/integrate-esm.md
  38. 二進制
      docs/launch config.png
  39. 0 0
      docs/out-folders.dio.svg
  40. 1770 1373
      package-lock.json
  41. 29 12
      package.json
  42. 39 39
      samples/browser-esm-vite-react/package-lock.json
  43. 2 2
      samples/browser-esm-vite-react/package.json
  44. 7 5
      samples/browser-esm-vite-react/src/components/Editor.tsx
  45. 1 1
      samples/browser-esm-webpack-small/index.js
  46. 64 64
      samples/browser-esm-webpack-typescript-react/package-lock.json
  47. 3 1
      samples/electron-amd-nodeIntegration/main.js
  48. 3 2
      samples/electron-esm-webpack/.gitignore
  49. 214 322
      samples/package-lock.json
  50. 6 3
      samples/package.json
  51. 77 0
      scripts/ci/monaco-editor-core-prepare.ts
  52. 34 0
      scripts/ci/monaco-editor-core.sh
  53. 71 0
      scripts/ci/monaco-editor-prepare.ts
  54. 28 0
      scripts/ci/monaco-editor.sh
  55. 92 0
      scripts/lib/index.ts
  56. 4 1
      src/basic-languages/cpp/cpp.ts
  57. 27 0
      src/basic-languages/elixir/elixir.test.ts
  58. 25 1
      src/basic-languages/elixir/elixir.ts
  59. 26 0
      src/basic-languages/html/html.test.ts
  60. 14 0
      src/basic-languages/html/html.ts
  61. 1 1
      src/basic-languages/kotlin/kotlin.contribution.ts
  62. 1 0
      src/basic-languages/mysql/mysql.ts
  63. 1 1
      src/basic-languages/perl/perl.contribution.ts
  64. 4 0
      src/basic-languages/pgsql/pgsql.ts
  65. 6 2
      src/basic-languages/python/python.ts
  66. 2 1
      src/basic-languages/qsharp/qsharp.ts
  67. 1 1
      src/basic-languages/typescript/typescript.contribution.ts
  68. 1 0
      src/basic-languages/typescript/typescript.ts
  69. 2 0
      src/basic-languages/xml/xml.contribution.ts
  70. 193 0
      src/basic-languages/yaml/yaml.test.ts
  71. 2 2
      src/basic-languages/yaml/yaml.ts
  72. 29 29
      src/language/typescript/languageFeatures.ts
  73. 17 3
      src/language/typescript/lib/lib.index.ts
  74. 0 1
      src/language/typescript/lib/lib.ts
  75. 0 9385
      src/language/typescript/lib/typescriptServices-amd.js
  76. 246 308
      src/language/typescript/lib/typescriptServices.d.ts
  77. 2240 555
      src/language/typescript/lib/typescriptServices.js
  78. 1 1
      src/language/typescript/lib/typescriptServicesMetadata.ts
  79. 108 11
      src/language/typescript/monaco.contribution.ts
  80. 119 32
      src/language/typescript/tsMode.ts
  81. 14 12
      src/language/typescript/tsWorker.ts
  82. 39 51
      src/language/typescript/workerManager.ts
  83. 5 2
      src/tsconfig.json
  84. 2 2
      test/smoke/amd/index.html
  85. 6 1
      test/smoke/common.js
  86. 0 0
      test/smoke/esbuild/index.html
  87. 6 1
      test/smoke/esbuild/index.js
  88. 5 3
      test/smoke/package-esbuild.ts
  89. 19 0
      test/smoke/package-vite.ts
  90. 56 0
      test/smoke/package-webpack.ts
  91. 11 0
      test/smoke/parcel/index.html
  92. 41 0
      test/smoke/parcel/index.js
  93. 6 0
      test/smoke/parcel/package.json
  94. 22 12
      test/smoke/runner.js
  95. 64 41
      test/smoke/smoke.test.js
  96. 10 0
      test/smoke/vite/index.html
  97. 31 0
      test/smoke/vite/index.js
  98. 0 0
      test/smoke/webpack/index.html
  99. 0 0
      test/smoke/webpack/index.js
  100. 6 4
      test/unit/all.js

+ 57 - 0
.azure-pipelines/publish-nightly.yml

@@ -0,0 +1,57 @@
+###############################################################################################
+#  Copyright (c) Microsoft Corporation. All rights reserved.
+#  Licensed under the MIT License. See License.txt in the project root for license information.
+###############################################################################################
+name: $(Date:yyyyMMdd)$(Rev:.r)
+
+trigger: none
+pr: none
+
+schedules:
+  - cron: '0 7 * * *'
+    displayName: Daily release
+    branches:
+      include:
+        - main
+    always: true
+
+resources:
+  repositories:
+    - repository: templates
+      type: github
+      name: microsoft/vscode-engineering
+      ref: main
+      endpoint: Monaco
+
+extends:
+  template: azure-pipelines/npm-package/pipeline.yml@templates
+  parameters:
+    npmPackages:
+      - name: monaco-editor-core
+        workingDirectory: $(Build.SourcesDirectory)/dependencies/vscode/out-monaco-editor-core
+        testPlatforms: []
+        buildSteps:
+          - script: npm ci
+            displayName: Install NPM dependencies
+
+          - script: yarn ts-node ./scripts/ci/monaco-editor-core-prepare nightly
+            displayName: Setup, Build & Test monaco-editor-core
+
+        tag: next
+        ghCreateTag: false
+        publishPackage: true
+        publishRequiresApproval: false
+
+      - name: monaco-editor
+        workingDirectory: $(Build.SourcesDirectory)/out/monaco-editor
+        testPlatforms: []
+        buildSteps:
+          - script: npm ci
+            displayName: Install NPM dependencies
+
+          - script: yarn ts-node ./scripts/ci/monaco-editor-prepare nightly
+            displayName: Setup, Build & Test monaco-editor
+
+        tag: next
+        publishPackage: true
+        publishRequiresApproval: false

+ 78 - 0
.azure-pipelines/publish-stable.yml

@@ -0,0 +1,78 @@
+###############################################################################################
+#  Copyright (c) Microsoft Corporation. All rights reserved.
+#  Licensed under the MIT License. See License.txt in the project root for license information.
+###############################################################################################
+name: $(Date:yyyyMMdd)$(Rev:.r)
+
+trigger: none
+pr: none
+
+resources:
+  repositories:
+    - repository: templates
+      type: github
+      name: microsoft/vscode-engineering
+      ref: main
+      endpoint: Monaco
+
+parameters:
+  - name: publishMonacoEditorCore
+    displayName: 🚀 Publish Monaco Editor Core
+    type: boolean
+    default: false
+  - name: publishMonacoEditor
+    displayName: 🚀 Publish Editor Core
+    type: boolean
+    default: false
+  - name: publishWebpackPlugin
+    displayName: 🚀 Publish Webpack Plugin
+    type: boolean
+    default: false
+
+extends:
+  template: azure-pipelines/npm-package/pipeline.yml@templates
+  parameters:
+    npmPackages:
+      - name: monaco-editor-core
+        workingDirectory: $(Build.SourcesDirectory)/dependencies/vscode/out-monaco-editor-core
+        testPlatforms: []
+        buildSteps:
+          - script: npm ci
+            displayName: Install NPM dependencies
+
+          - script: yarn ts-node ./scripts/ci/monaco-editor-core-prepare stable
+            displayName: Setup, Build & Test monaco-editor-core
+
+        tag: latest
+        ghCreateTag: false
+        publishPackage: ${{ parameters.publishMonacoEditorCore }}
+        publishRequiresApproval: false
+
+      - name: monaco-editor
+        workingDirectory: $(Build.SourcesDirectory)/out/monaco-editor
+        testPlatforms: []
+        buildSteps:
+          - script: npm ci
+            displayName: Install NPM dependencies
+
+          - script: yarn ts-node ./scripts/ci/monaco-editor-prepare stable
+            displayName: Setup, Build & Test monaco-editor
+
+        tag: latest
+        publishPackage: ${{ parameters.publishMonacoEditor }}
+        publishRequiresApproval: false
+
+      - name: monaco-editor-webpack-plugin
+        workingDirectory: $(Build.SourcesDirectory)/webpack-plugin
+        testPlatforms: []
+        buildSteps:
+          - script: npm ci
+            displayName: Install NPM dependencies
+
+          - script: npm run compile
+            displayName: Build plugin
+
+        tag: latest
+        ghCreateTag: false
+        publishPackage: ${{ parameters.publishWebpackPlugin }}
+        publishRequiresApproval: false

+ 8 - 0
.devcontainer/devcontainer.json

@@ -0,0 +1,8 @@
+{
+	"image": "mcr.microsoft.com/devcontainers/typescript-node",
+	"customizations": {
+		"vscode": {
+			"extensions": ["ms-vscode.js-debug-nightly"]
+		}
+	}
+}

+ 7 - 1
.github/ISSUE_TEMPLATE/1_bug_report.yaml

@@ -21,11 +21,17 @@ body:
       description: Can you reproduce the bug in [the monaco editor playground](https://microsoft.github.io/monaco-editor/playground.html)? A minimal reproducible example will make it significantly easier for us to get this bug fixed.
       options:
         - label: Not reproducible in [the monaco editor playground](https://microsoft.github.io/monaco-editor/playground.html)
+  - type: textarea
+    id: playgroundLink
+    attributes:
+      label: Monaco Editor Playground Link
+      description: Please share the link to the [monaco editor playground](https://microsoft.github.io/monaco-editor/playground.html) after you entered your example. In case of regressions, please also provide the first broken version.
+
   - type: textarea
     id: playgroundSourceCode
     attributes:
       label: Monaco Editor Playground Code
-      description: Please provide the code to reproduce in the [monaco editor playground](https://microsoft.github.io/monaco-editor/playground.html)
+      description: Please provide the code from the monaco editor playground example.
       render: typescript
   - type: textarea
     id: steps

+ 13 - 0
.github/ISSUE_TEMPLATE/2_feature_request.yaml

@@ -23,3 +23,16 @@ body:
     attributes:
       label: Description
       description: Please describe your feature request.
+
+  - type: textarea
+    id: relevantCodePlaygroundLink
+    attributes:
+      label: Monaco Editor Playground Link
+      description: If applicable, please share the link to a relevant [monaco editor playground sample](https://microsoft.github.io/monaco-editor/playground.html)
+
+  - type: textarea
+    id: releveantCode
+    attributes:
+      label: Monaco Editor Playground Code
+      description: If applicable, please share the code from the monaco editor playground sample.
+      render: typescript

+ 19 - 4
.github/workflows/ci.yml

@@ -5,7 +5,7 @@ on: [push, pull_request]
 jobs:
   build:
     name: CI
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
 
@@ -39,7 +39,7 @@ jobs:
         run: npm run prettier-check
 
       - name: Build
-        run: npm run release
+        run: npm run build-monaco-editor
 
       - name: Run unit tests
         run: npm test
@@ -48,13 +48,28 @@ jobs:
         run: npm run compile --prefix webpack-plugin
 
       - name: Package using webpack plugin
-        run: npm run package-for-smoketest --prefix webpack-plugin
+        run: npm run package-for-smoketest-webpack
 
       - name: Package using esbuild
         run: npm run package-for-smoketest-esbuild
 
+      - name: Package using vite
+        run: npm run package-for-smoketest-vite
+
+      - name: Package using parcel
+        run: npm run package-for-smoketest-parcel --prefix test/smoke/parcel
+
       - name: Run smoke test
         run: npm run smoketest
 
+      - name: Install website node modules
+        working-directory: website
+        run: yarn install --frozen-lockfile
+
       - name: Build website
-        run: npm run build-website
+        working-directory: website
+        run: yarn run build
+
+      - name: Test website
+        working-directory: website
+        run: yarn test

+ 3 - 4
.github/workflows/needs-more-info-closer.yml → .github/workflows/info-needed-closer.yml

@@ -1,4 +1,4 @@
-name: Needs More Info Closer
+name: Info Needed Closer
 on:
   schedule:
     - cron: 20 12 * * * # 5:20am Redmond
@@ -18,11 +18,10 @@ jobs:
           ref: stable
       - name: Install Actions
         run: npm install --production --prefix ./actions
-      - name: Run Needs More Info Closer
+      - name: Run Info Needed Closer
         uses: ./actions/needs-more-info-closer
         with:
-          appInsightsKey: ${{secrets.TRIAGE_ACTIONS_APP_INSIGHTS}}
-          label: needs more info
+          label: info-needed
           closeDays: 7
           additionalTeam: 'spahnke|rcjsuen'
           closeComment: "This issue has been closed automatically because it needs more information and has not had recent activity. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines.\n\nHappy Coding!"

+ 0 - 25
.github/workflows/pr-chat.yml

@@ -1,25 +0,0 @@
-name: PR Chat
-on:
-  pull_request_target:
-    types: [opened, ready_for_review, closed]
-
-jobs:
-  main:
-    runs-on: ubuntu-latest
-    if: ${{ !github.event.pull_request.draft }}
-    steps:
-      - name: Checkout Actions
-        uses: actions/checkout@v2
-        with:
-          repository: 'microsoft/vscode-github-triage-actions'
-          ref: stable
-          path: ./actions
-      - name: Install Actions
-        run: npm install --production --prefix ./actions
-      - name: Run Code Review Chat
-        uses: ./actions/code-review-chat
-        with:
-          token: ${{secrets.GITHUB_TOKEN}}
-          slack_token: ${{ secrets.SLACK_TOKEN }}
-          slack_bot_name: 'VSCodeBot'
-          notification_channel: codereview

+ 0 - 14
.github/workflows/publish-website.sh

@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-
-COMMITTER_USER_NAME="$(git log --format='%an' -1)"
-COMMITTER_EMAIL="$(git log --format='%ae' -1)"
-
-cd ../monaco-editor-website
-git init
-git config user.name "${COMMITTER_USER_NAME}"
-git config user.email "${COMMITTER_EMAIL}"
-git remote add origin "https://x-access-token:${GITHUB_TOKEN}@github.com/microsoft/monaco-editor.git"
-git checkout -b gh-pages
-git add .
-git commit -m "Publish website"
-git push origin gh-pages --force

+ 0 - 235
.github/workflows/publish.yml

@@ -1,235 +0,0 @@
-name: Publish to npm
-
-on:
-  schedule:
-    - cron: '0 7 * * *'
-  # enable users to manually trigger with workflow_dispatch
-  workflow_dispatch:
-    inputs:
-      nightly:
-        description: 'is nightly?'
-        required: true
-        default: 'true'
-jobs:
-  publish:
-    if: ${{ github.repository == 'microsoft/monaco-editor' }}
-    name: Publish to npm
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/setup-node@v2
-        with:
-          node-version: 16
-
-      - name: (monaco-editor) checkout
-        uses: actions/checkout@v2
-        with:
-          repository: 'microsoft/monaco-editor'
-          path: './monaco-editor'
-
-      - name: Compute state
-        id: state
-        run: |
-          echo '::echo::on'
-          node ./monaco-editor/.github/workflows/publish/computeState.js "${{github.event_name}}" "${{github.event.inputs.nightly}}"
-        # outputs: dist_tag, version, vscode_branch, skip_monaco_editor_core, skip_monaco_editor
-
-      - name: (vscode) checkout
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        uses: actions/checkout@v2
-        with:
-          repository: 'microsoft/vscode'
-          ref: ${{ steps.state.outputs.vscode_branch }}
-          path: './vscode'
-
-      - name: (vscode-loc) checkout
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        uses: actions/checkout@v2
-        with:
-          repository: 'microsoft/vscode-loc'
-          path: './vscode-loc'
-
-      - name: (vscode) execute `yarn`
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode'
-        run: yarn --frozen-lockfile --network-timeout 180000
-
-      - name: (vscode) Download Playwright
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: ./vscode
-        run: yarn playwright-install
-
-      - name: (vscode) Run Hygiene Checks
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode'
-        run: yarn gulp hygiene
-
-      - name: (vscode) Run Valid Layers Checks
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode'
-        run: yarn valid-layers-check
-
-      - name: (vscode) Compile /build/
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode'
-        run: yarn --cwd build compile
-
-      - name: (vscode) Run eslint
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode'
-        run: yarn eslint
-
-      - name: (vscode) Run Monaco Editor Checks
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode'
-        run: yarn monaco-compile-check
-
-      - name: (vscode) Compile
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode'
-        run: yarn --max_old_space_size=4095 compile
-
-      - name: (vscode) Run Unit Tests (Browser)
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode'
-        run: yarn test-browser --browser chromium
-
-      - name: (vscode) Patch package.json version
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        run: node ./monaco-editor/.github/workflows/publish/setVersion.js ./vscode/build/monaco/package.json ${{ steps.state.outputs.version }}
-
-      - name: (vscode) Editor Distro
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode'
-        run: yarn gulp editor-distro
-
-      - name: Editor ESM sources check
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode/test/monaco'
-        run: yarn run esm-check
-
-      - name: (vscode) Typings validation prep
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode'
-        run: mkdir typings-test
-
-      - name: (vscode) Typings validation
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: ./vscode/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: (vscode) Package Editor with Webpack
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: ./vscode/test/monaco
-        run: yarn run bundle-webpack
-
-      - name: (vscode) Compile Editor Tests
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: ./vscode/test/monaco
-        run: yarn run compile
-
-      - name: (vscode) Run Editor Tests
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        timeout-minutes: 5
-        working-directory: ./vscode/test/monaco
-        run: yarn test
-
-      - name: Set `npm` config
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        run: npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
-        env:
-          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
-
-      - name: Publish `monaco-editor-core`
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        working-directory: './vscode/out-monaco-editor-core'
-        run: npm publish --tag ${{ steps.state.outputs.dist_tag }}
-
-      - name: Delete `npm` config
-        if: ${{ steps.state.outputs.skip_monaco_editor_core == 'false' }}
-        run: npm config delete //registry.npmjs.org/:_authToken
-
-      - name: (monaco-editor) Patch package.json version
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        run: node ./monaco-editor/.github/workflows/publish/setVersion.js ./monaco-editor/package.json ${{ steps.state.outputs.version }}
-
-      - name: (monaco-editor) execute `npm ci` (1)
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor'
-        run: npm ci
-
-      - name: (monaco-editor) execute `npm ci` (2)
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor/webpack-plugin'
-        run: npm ci
-
-      - name: (monaco-editor) Patch package.json monaco-editor-core dev dependency version
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        run: node ./monaco-editor/.github/workflows/publish/setDevDependencyVersion.js ./monaco-editor/package.json monaco-editor-core ${{ steps.state.outputs.version }}
-
-      - name: (monaco-editor) execute `npm install` to pick up local monaco-editor-core
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor'
-        run: npm install
-
-      - name: (monaco-editor) Install OS Dependencies for Playwright
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor'
-        run: sudo npm run playwright-install-deps
-
-      - name: (monaco-editor) Check prettier
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor'
-        run: npm run prettier-check
-
-      - name: (monaco-editor) Build
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor'
-        run: npm run release
-
-      - name: (monaco-editor) Run unit tests
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor'
-        run: npm test
-
-      - name: (monaco-editor) Compile webpack plugin
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor'
-        run: npm run compile --prefix webpack-plugin
-
-      - name: (monaco-editor) Package using webpack plugin
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor'
-        run: npm run package-for-smoketest --prefix webpack-plugin
-
-      - name: (monaco-editor) Run smoke test
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor'
-        run: npm run smoketest
-
-      - name: (monaco-editor) Build website
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor'
-        run: npm run build-website
-
-      - name: Set `npm` config
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        run: npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
-        env:
-          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
-
-      - name: Publish `monaco-editor`
-        if: ${{ steps.state.outputs.skip_monaco_editor == 'false' }}
-        working-directory: './monaco-editor/release'
-        run: npm publish --tag ${{ steps.state.outputs.dist_tag }}
-
-      - name: Create Issue On Failure
-        if: failure()
-        uses: JasonEtco/create-an-issue@9e6213aec58987fa7d2f4deb8b256b99e63107a2
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          filename: ./monaco-editor/.github/publish-failure-issue-template.md

+ 8 - 4
.github/workflows/publish/computeState.js

@@ -90,10 +90,14 @@ function npmGetLatestVersion(packageName) {
  * @returns {boolean}
  */
 function npmExists(packageName, version) {
-	const output = cp.execSync(`npm show ${packageName}@${version} version`).toString();
-	const result = output.split(/\r\n|\r|\n/g)[0];
-	if (result.trim().length === 0) {
+	try {
+		const output = cp.execSync(`npm show ${packageName}@${version} version`).toString();
+		const result = output.split(/\r\n|\r|\n/g)[0];
+		if (result.trim().length === 0) {
+			return false;
+		}
+		return true;
+	} catch (err) {
 		return false;
 	}
-	return true;
 }

+ 0 - 19
.github/workflows/publish/setDevDependencyVersion.js

@@ -1,19 +0,0 @@
-/*---------------------------------------------------------------------------------------------
- *  Copyright (c) Microsoft Corporation. All rights reserved.
- *  Licensed under the MIT License. See License.txt in the project root for license information.
- *--------------------------------------------------------------------------------------------*/
-
-//@ts-check
-
-const fs = require('fs');
-
-if (process.argv.length !== 5) {
-	console.error(
-		`usage: node setDevDependencyVersion.js <PATH_TO_PACKAGE_JSON_FILE> <PACKAGE> <VERSION>`
-	);
-	process.exit(1);
-}
-
-const packagejson = JSON.parse(fs.readFileSync(process.argv[2]).toString());
-packagejson['devDependencies'][process.argv[3]] = process.argv[4];
-fs.writeFileSync(process.argv[2], JSON.stringify(packagejson, null, '\t') + '\n');

+ 0 - 17
.github/workflows/publish/setVersion.js

@@ -1,17 +0,0 @@
-/*---------------------------------------------------------------------------------------------
- *  Copyright (c) Microsoft Corporation. All rights reserved.
- *  Licensed under the MIT License. See License.txt in the project root for license information.
- *--------------------------------------------------------------------------------------------*/
-
-//@ts-check
-
-const fs = require('fs');
-
-if (process.argv.length !== 4) {
-	console.error(`usage: node setVersion.js <PATH_TO_PACKAGE_JSON_FILE> <VERSION>`);
-	process.exit(1);
-}
-
-const packagejson = JSON.parse(fs.readFileSync(process.argv[2]).toString());
-packagejson.version = process.argv[3];
-fs.writeFileSync(process.argv[2], JSON.stringify(packagejson, null, '\t') + '\n');

+ 25 - 12
.github/workflows/website.yml

@@ -2,8 +2,8 @@ name: Publish Website
 
 on:
   push:
-    branches:
-      - main
+    tags:
+      - 'v*'
   # enable users to manually trigger with workflow_dispatch
   workflow_dispatch: {}
 
@@ -12,9 +12,9 @@ jobs:
     name: Publish Website
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6 # pin@v2
 
-      - uses: actions/setup-node@v2
+      - uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # pin@v2
         with:
           node-version: 16
 
@@ -23,17 +23,30 @@ jobs:
         uses: actions/cache@v2
         with:
           path: '**/node_modules'
-          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('**/package-lock.json') }}
-          restore-keys: ${{ runner.os }}-cacheNodeModules-
+          key: ${{ runner.os }}-cacheNodeModules2-${{ hashFiles('**/package-lock.json') }}
+          restore-keys: ${{ runner.os }}-cacheNodeModules2-
 
-      - name: Install node modules (1)
+      - name: execute `npm ci` (1)
         if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
         run: npm ci
 
+      - name: Build
+        run: npm run build-monaco-editor
+
+      - name: Install website node modules
+        working-directory: website
+        run: yarn install --frozen-lockfile
+
+      - name: Install most recent version of monaco-editor
+        working-directory: website
+        run: yarn add monaco-editor
+
       - name: Build website
-        run: npm run build-website
+        working-directory: website
+        run: yarn run build
 
-      - name: Deploy to GitHub Pages
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        run: ./.github/workflows/publish-website.sh
+      - name: Upload website to github pages
+        uses: peaceiris/actions-gh-pages@bd8c6b06eba6b3d25d72b7a1767993c0aeee42e7 # pin@v3
+        with:
+          github_token: ${{ secrets.GITHUB_TOKEN }}
+          publish_dir: ./website/dist

+ 6 - 2
.gitignore

@@ -1,4 +1,8 @@
 **/node_modules/
-**/out/
-**/release/
+**/dependencies/
 /test/manual/generated/**
+/test/smoke/vite/dist/**
+/test/smoke/parcel/dist/**
+/test/smoke/parcel/.cache/**
+**/dist/
+**/out/

+ 3 - 1
.prettierignore

@@ -1,6 +1,6 @@
 **/node_modules/
+**/dist/
 **/out/
-**/release/
 /samples/browser-esm-parcel/.parcel-cache/
 /samples/browser-esm-parcel/dist/
 /samples/browser-esm-vite-react/dist/**/*.js
@@ -13,3 +13,5 @@
 /test/manual/generated/
 /website/lib/
 /website/typedoc/monaco.d.ts
+/test/smoke/vite/dist
+/test/smoke/parcel/dist

+ 25 - 18
.vscode/launch.json

@@ -5,34 +5,41 @@
 	"version": "0.2.0",
 	"configurations": [
 		{
-			"type": "pwa-node",
+			"name": "Monaco Editor Playground",
+			"type": "chrome",
 			"request": "launch",
-			"name": "Monaco Languages Unit Tests",
-			"skipFiles": ["<node_internals>/**"],
-			"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
-			"args": ["-r", "test/unit/all.js"],
-			"outFiles": ["${workspaceFolder}/**/*.js"]
+			"url": "https://microsoft.github.io/monaco-editor/playground.html?sourceLanguages=http%3A%2F%2Flocalhost%3A5002%2Fout%2Flanguages%2Famd-tsc",
+			"preLaunchTask": "Launch Http Server",
+			"presentation": {
+				"group": "monaco",
+				"order": 1
+			}
 		},
 		{
-			"type": "pwa-node",
+			// Clone VS Code and make sure the task "Launch Http Server" runs.
+			// Then the editor is build from sources.
+			// We recommend to use the workspace feature for this.
+			"name": "Monaco Editor Playground (Load From VS Code Http Server)",
+			"type": "chrome",
 			"request": "launch",
-			"name": "release",
-			"skipFiles": ["<node_internals>/**"],
-			"program": "${workspaceFolder}/build/release.js",
-			"args": [],
-			"cwd": "${workspaceFolder}"
+			"url": "https://microsoft.github.io/monaco-editor/playground.html?sourceLanguages=http%3A%2F%2Flocalhost%3A5002%2Fout%2Flanguages%2Famd-tsc&source=http%3A%2F%2Flocalhost%3A5001%2Fout%2Fvs",
+			"preLaunchTask": "Launch Http Server",
+			"presentation": {
+				"group": "monaco",
+				"order": 1
+			}
 		},
 		{
-			"type": "pwa-node",
+			"type": "node",
 			"request": "launch",
-			"name": "website",
+			"name": "Monaco Languages Unit Tests",
 			"skipFiles": ["<node_internals>/**"],
-			"program": "${workspaceFolder}/build/website.js",
-			"args": [],
-			"cwd": "${workspaceFolder}"
+			"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
+			"args": ["-r", "test/unit/all.js"],
+			"outFiles": ["${workspaceFolder}/**/*.js"]
 		},
 		{
-			"type": "pwa-node",
+			"type": "node",
 			"request": "launch",
 			"name": "webpack plugin test",
 			"skipFiles": ["<node_internals>/**"],

+ 5 - 2
.vscode/settings.json

@@ -6,8 +6,11 @@
 	"files.trimTrailingWhitespace": true,
 	"search.exclude": {
 		"**/node_modules": true,
-		"**/release": true,
+		"**/dist": true,
 		"**/out": true
 	},
-	"typescript.tsdk": "./node_modules/typescript/lib"
+	"typescript.tsdk": "./node_modules/typescript/lib",
+	"git.branchProtection": ["main", "release/*"],
+	"git.branchProtectionPrompt": "alwaysCommitToNewBranch",
+	"git.branchRandomName.enable": true
 }

+ 30 - 0
.vscode/tasks.json

@@ -0,0 +1,30 @@
+{
+	"version": "2.0.0",
+	"tasks": [
+		{
+			"label": "Launch Http Server",
+			"type": "shell",
+			"command": "node_modules/.bin/http-server --cors --port 5002 -a 127.0.0.1 -c-1",
+			"isBackground": true,
+			"problemMatcher": {
+				"pattern": {
+					"regexp": "does not support problems"
+				},
+				"background": {
+					"activeOnStart": true,
+					"beginsPattern": "Shutting down http-server (will never match)",
+					"endsPattern": "Starting up http-server"
+				}
+			},
+			"dependsOn": ["npm: watch"]
+		},
+		{
+			"type": "npm",
+			"script": "watch",
+			"group": "build",
+			"problemMatcher": ["$tsc-watch"],
+			"isBackground": true,
+			"label": "npm: watch"
+		}
+	]
+}

+ 57 - 2
CHANGELOG.md

@@ -1,6 +1,51 @@
 # Monaco Editor Changelog
 
-## [0.34.0] (Unreleased)
+## [0.36.1]
+
+- Marks unneeded dependencies as dev dependencies.
+
+## [0.36.0]
+
+- Maintenance release
+
+## [0.35.0]
+
+- Adds sticky scrolling
+- Support for custom diff algorithms
+
+### Breaking Changes
+
+- Renamed the option `enableDropIntoEditor` to `dropIntoEditor`
+- Changed `IContentWidgetPosition.range: Range` to `IContentWidgetPosition.secondaryPosition: Position`
+- `renderFinalNewline` config: is now of type `'on' | 'off' | 'dimmed'` (was `boolean`).
+- `cursorSmoothCaretAnimation` config: is now of type `'off' | 'explicit' | 'on'` (was `boolean`)
+
+Contributions to `monaco-editor`:
+
+- [@andrewimcclement](https://github.com/andrewimcclement): Add .props & .targets as XML extensions [PR #3510](https://github.com/microsoft/monaco-editor/pull/3510)
+- [@DetachHead](https://github.com/DetachHead): add `satisfies` keyword to typescript [PR #3337](https://github.com/microsoft/monaco-editor/pull/3337)
+- [@jeremy-rifkin (Jeremy Rifkin)](https://github.com/jeremy-rifkin): Add AVX 512 types to C++ syntax highlighting [PR #3286](https://github.com/microsoft/monaco-editor/pull/3286)
+- [@joecarl (José Carlos)](https://github.com/joecarl): Add setModeConfiguration for monaco.languages.typescript.[typescript|javascript]Defaults [PR #3489](https://github.com/microsoft/monaco-editor/pull/3489)
+- [@jonatanklosko (Jonatan Kłosko)](https://github.com/jonatanklosko): Update Elixir tokenizer [PR #3453](https://github.com/microsoft/monaco-editor/pull/3453)
+- [@JoyceZhu (Joyce Zhu)](https://github.com/JoyceZhu): Update import path for `browser-esm-webpack-small` [PR #3402](https://github.com/microsoft/monaco-editor/pull/3402)
+- [@Jozebel11 (Joseph Hardwicke)](https://github.com/Jozebel11): Add position styling to playground container to equal 'relative' [PR #3446](https://github.com/microsoft/monaco-editor/pull/3446)
+- [@kirjs (Kirill Cherkashin)](https://github.com/kirjs): Fix broken link in the changelog [PR #3382](https://github.com/microsoft/monaco-editor/pull/3382)
+- [@LeoDog896 (Tristan F.)](https://github.com/LeoDog896)
+  - Ignore dist from vite/parcel in prettier [PR #3466](https://github.com/microsoft/monaco-editor/pull/3466)
+  - Add .kts as a file extension [PR #3467](https://github.com/microsoft/monaco-editor/pull/3467)
+- [@MasterOdin (Matthew Peveler)](https://github.com/MasterOdin): Add new pgsql 15 functions [PR #3363](https://github.com/microsoft/monaco-editor/pull/3363)
+- [@mofux (Thomas Zilz)](https://github.com/mofux): Resolve URIs with special characters correctly [PR #3392](https://github.com/microsoft/monaco-editor/pull/3392)
+- [@nnnnoel (Noel Kim (김민혁))](https://github.com/nnnnoel): fix(mysql/tokenizer): Fix single quoted string escape [PR #3232](https://github.com/microsoft/monaco-editor/pull/3232)
+- [@rcjsuen (Remy Suen)](https://github.com/rcjsuen): Fix the color provider's columns [PR #3348](https://github.com/microsoft/monaco-editor/pull/3348)
+- [@RubenRBS (Rubén Rincón Blanco)](https://github.com/RubenRBS): Recognize \0 as an escape sequence [PR #3443](https://github.com/microsoft/monaco-editor/pull/3443)
+- [@sekedus (Sekedus)](https://github.com/sekedus): add homepage url [PR #3497](https://github.com/microsoft/monaco-editor/pull/3497)
+- [@tr3ysmith (Trey Smith)](https://github.com/tr3ysmith): Fix possible duplicate of editors in vite sample [PR #3390](https://github.com/microsoft/monaco-editor/pull/3390)
+
+## [0.34.1]
+
+- Adds API to register global actions, commands, or keybinding rules
+
+## [0.34.0]
 
 - Introduction of `IEditor.createDecorationsCollection` API
 - New function `removeAllMarkers` to remove all markers
@@ -26,6 +71,16 @@
 - `InlayHint` API tweaks
 - Soft deprecation of `ICodeEditor.deltaDecorations`, no adoption required. `IEditor.createDecorationsCollection` API should be used instead.
 
+Contributions to `monaco-editor`:
+
+- [@alexander-zw (Alexander Wu)](https://github.com/alexander-zw): [webpack readme] Add how to get languages/features [PR #3171](https://github.com/microsoft/monaco-editor/pull/3171)
+- [@anjbur (Angela Burton)](https://github.com/anjbur): Update Q# keywords [PR #3222](https://github.com/microsoft/monaco-editor/pull/3222)
+- [@bsorrentino (bsorrentino)](https://github.com/bsorrentino): Fix issue #2295 - Models with "@" in their name do not resolve as dependencies [PR #3057](https://github.com/microsoft/monaco-editor/pull/3057)
+- [@MasterOdin (Matthew Peveler)](https://github.com/MasterOdin): Remove duplicate testcases for mysql [PR #3138](https://github.com/microsoft/monaco-editor/pull/3138)
+- [@mhsdesign (Marc Henry Schultz)](https://github.com/mhsdesign): [DOCS] IEditorOptions.automaticLayout uses ResizeObserver 3051 [PR #3052](https://github.com/microsoft/monaco-editor/pull/3052)
+- [@supersonictw (SuperSonic)](https://github.com/supersonictw): Fix menu link in integrate-esm.md [PR #3214](https://github.com/microsoft/monaco-editor/pull/3214)
+- [@tonilastre (Toni)](https://github.com/tonilastre): Add config and tokenizer for query language Cypher [PR #3102](https://github.com/microsoft/monaco-editor/pull/3102)
+
 ## [0.33.0]
 
 - The first parameter of all `monaco.languages.register*Provider` functions has changed to take a `DocumentSelector` instead of a single `languageId`
@@ -482,7 +537,7 @@ Contributions to `monaco-typescript`:
 - Many improvements in `monaco-typescript`: support for "deprecated" tags, API to participate in the web worker, improved lib.d.ts resolving.
 - New tokenization support for: Julia, Scala, Lexon, Terraform HCL, Dart, Systemverilog.
 - New semantic tokens provider [sample on the playground](https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-semantic-tokens-provider-example).
-- New [shadow dom sample](https://github.com/microsoft/monaco-editor-samples/tree/master/browser-amd-shadow-dom)
+- New [shadow dom sample](https://github.com/microsoft/monaco-editor/tree/main/samples/browser-amd-shadow-dom)
 - New `overflowWidgetsDomNode` constructor option to pass in a parent for overflowing widgets.
 - New `minimap.size` option: `proportional`, `fill`, `fit`.
 - New `OnTypeRename` provider and option `renameOnType`.

+ 81 - 60
CONTRIBUTING.md

@@ -1,15 +1,17 @@
-# Contributing
+# Contributing / Dev Setup
 
-Checkout [MAINTAINING.md](./MAINTAINING.md) for common maintaining tasks.
+## Source Code Structure
 
-## A brief explanation on the source code structure
+It is important to understand that the Monaco Editor _Core_ is built directly from the [VS Code source code](https://github.com/microsoft/vscode).
+The Monaco Editor then enhances the Monaco Editor Core with some basic language features.
 
-This repository contains source code only for Monaco Editor Languages, the core editor source lives in the [vscode repository](https://github.com/microsoft/vscode).
+This diagram describes the relationships between the repositories and the npm packages:
 
-| repository                                                  | npm module                                                             | explanation                                                             |
-| ----------------------------------------------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------- |
-| [vscode](https://github.com/microsoft/vscode)               | [monaco-editor-core](https://www.npmjs.com/package/monaco-editor-core) | editor core functionality (language agnostic) is shipped out of vscode. |
-| [monaco-editor](https://github.com/microsoft/monaco-editor) | [monaco-editor](https://www.npmjs.com/package/monaco-editor)           | the Monaco Editor.                                                      |
+![](./docs/code-structure.dio.svg)
+
+By default, `monaco-editor-core` is installed from npm (through the initial `npm install`), so you can work on Monaco Editor language features without having to build the core editor / VS Code.
+The nightly builds build a fresh version of `monaco-editor-core` from the `main` branch of VS Code.
+For a stable release, the commit specified in `vscodeRef` in [package.json](./package.json) specifies the commit of VS Code that is used to build `monaco-editor-core`.
 
 ## Contributing a new tokenizer / a new language
 
@@ -25,80 +27,99 @@ Please understand that we only bundle languages with the monaco editor that have
 import './{myLang}/{myLang}.contribution';
 ```
 
-## Running the editor from source
+## Debugging / Developing The Core Editor
 
-You need to have all the build setup of VS Code to be able to build the Monaco Editor.
+To debug core editor issues.
 
-- Install all the [prerequisites](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites)
+This can be done directly from the VS Code repository and does not involve the monaco editor repository.
 
-```bash
-# clone vscode-loc repository for localized string resources
-/src> git clone https://github.com/microsoft/vscode-loc
-# clone VS Code repository
-/src> git clone https://github.com/microsoft/vscode
-/src> cd vscode
-# install npm deps for vscode
-/src/vscode> yarn
-# start the compiler in the background
-/src/vscode> yarn watch
-```
+- Clone the [VS Code repository](https://github.com/microsoft/vscode): `git clone https://github.com/microsoft/vscode`
+- Open the repository in VS Code: `code vscode`
+- Run `yarn install`
+- Select and run the launch configuration "Monaco Editor Playground" (this might take a while, as it compiles the sources):
 
-- For the monaco editor test pages:
+  ![](./docs/launch%20config.png)
 
-```bash
-# clone monaco-editor (note the folders must be siblings!)
-/src> git clone https://github.com/microsoft/monaco-editor
+- Now you can set breakpoints and change the source code
 
-# install npm deps for monaco-editor
-/src/monaco-editor> npm install .
+  ![](./docs/debugging-core.gif)
 
-# compile and bundle all plugins
-/src/monaco-editor> npm run release
+- Optionally, you can build `monaco-editor-core` and link it to the monaco editor repository:
 
-# start a local http server in the background
-/src/monaco-editor> npm run simpleserver
-```
+  ```bash
+  # builds out-monaco-editor-core
+  > yarn gulp editor-distro
 
-Open [http://localhost:8080/monaco-editor/test/manual/?editor=src](http://localhost:8080/monaco-editor/test/manual/?editor=src) to run.
+  > cd out-monaco-editor-core
+  > npm link
+  > cd ../path/to/monaco-editor
 
-## Running the editor tests
+  # symlinks the monaco-editor-core package to the out-monaco-editor-core folder we just built
+  > npm link monaco-editor-core
+  ```
 
-```bash
-# create a local release
-/src/monaco-editor> npm run release
+## Debugging / Developing Language Support
 
-# run unit tests
-/src/monaco-editor> npm run test
+To debug bundled languages, such as JSON, HTML or TypeScript/JavaScript.
 
-# compile the webpack plugin
-/src/monaco-editor> npm run compile --prefix webpack-plugin
+- Clone the [monaco editor repository](https://github.com/microsoft/monaco-editor): `git clone https://github.com/microsoft/monaco-editor`
+- Open the repository in VS Code: `code monaco-editor`
+- Run `npm install`
+- Select and run the launch configuration "Monaco Editor Playground" (this might take a while, as it compiles the sources):
 
-# package using the webpack plugin
-/src/monaco-editor> npm run package-for-smoketest --prefix webpack-plugin
+  ![](./docs/launch%20config.png)
 
-# run the smoketest
-/src/monaco-editor> npm run smoketest-debug
-```
+- Now you can set breakpoints and change the source code
 
-> Tip: All folders must be cloned as siblings.
+  ![](./docs/debugging-languages.gif)
 
-> Tip: When running the test pages, use the control panel in the top right corner to switch between running from source, running from npm or running from the local release:
-> ![image](https://cloud.githubusercontent.com/assets/5047891/19599080/eb0d7622-979e-11e6-96ce-dde98cd95dc1.png)
+- Optionally, you can build `monaco-editor` and link it if you want to test your changes in a real application:
 
-## Running the website locally
+  ```bash
+  # builds out/monaco-editor
+  > npm run build-monaco-editor
 
-> Note: The website is published automatically when pushing to the `master` branch.
+  > cd out/monaco-editor
+  > npm link
 
-```bash
-# create a local release
-/src/monaco-editor> npm run release
+  > cd ../path/to/my-app
+  > npm link monaco-editor
+  ```
+
+## Running the editor tests
 
-# build the website
-/src/monaco-editor> npm run build-website
+```bash
+> npm run build-monaco-editor
+> npm run test
+> npm run compile --prefix webpack-plugin
+
+> npm run package-for-smoketest-webpack
+> npm run package-for-smoketest-esbuild
+> npm run package-for-smoketest-vite
+> npm run package-for-smoketest-parcel --prefix test/smoke/parcel
+> npm run smoketest-debug
+```
 
-# start local webserver
-/src/monaco-editor> npm run simpleserver
+## Running the website locally
 
-# open http://localhost:8080/monaco-editor-website/
+```bash
+> npm install
+> npm run build-monaco-editor
 
+> cd website
+> yarn install
+> yarn typedoc
+> yarn dev
 ```
+
+Now webpack logs the path to the website.
+
+## Out Folders
+
+This diagram describes the output folders of the build process:
+
+![](./docs/out-folders.dio.svg)
+
+## Maintaining
+
+Checkout [MAINTAINING.md](./MAINTAINING.md) for common maintaining tasks (for maintainers only).

+ 4 - 1
MAINTAINING.md

@@ -1,6 +1,9 @@
 # Maintaining
 
-(For maintainers)
+(For maintainers only)
+
+- [P1 Inbox Queue](https://github.com/microsoft/monaco-editor/issues?q=is%3Aissue+is%3Aopen+-label%3Afeature-request+-label%3Aquestion+-label%3Aupstream+-label%3A%22help+wanted%22+-label%3A%22info-needed%22+-label%3A%22as-designed%22+-label%3Abug+-label%3A*question+)
+- [Inbox Queue](https://github.com/microsoft/monaco-editor/issues?q=is%3Aissue+is%3Aopen+no%3Aassignee+-label%3Afeature-request+-label%3Aquestion+-label%3Aupstream+-label%3A%22help+wanted%22+-label%3A%22info-needed%22+-label%3A%22as-designed%22+)
 
 ## Updating TypeScript
 

+ 18 - 18
README.md

@@ -1,29 +1,32 @@
 # Monaco Editor
 
-[![Build Status](https://dev.azure.com/ms/monaco-editor/_apis/build/status/microsoft.monaco-editor?label=website)](https://dev.azure.com/ms/monaco-editor/_build/latest?definitionId=3)
+[![Versions](https://img.shields.io/npm/v/monaco-editor)](https://www.npmjs.com/package/monaco-editor)
+[![Versions](https://img.shields.io/npm/v/monaco-editor/next)](https://www.npmjs.com/package/monaco-editor)
+[![Feature Requests](https://img.shields.io/github/issues/microsoft/monaco-editor/feature-request.svg)](https://github.com/microsoft/monaco-editor/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc)
+[![Bugs](https://img.shields.io/github/issues/microsoft/monaco-editor/bug.svg)](https://github.com/microsoft/monaco-editor/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Abug)
 
-The Monaco Editor is the code editor which powers [VS Code](https://github.com/microsoft/vscode), with the features better described [here](https://code.visualstudio.com/docs/editor/editingevolved).
-
-Please note that this repository contains no source code for the code editor, it only contains the scripts to package everything together and ship the `monaco-editor` npm module.
+The Monaco Editor is the fully featured code editor from [VS Code](https://github.com/microsoft/vscode). Check out the [VS Code docs](https://code.visualstudio.com/docs/editor/editingevolved) to see some of the supported features.
 
 ![image](https://user-images.githubusercontent.com/5047891/94183711-290c0780-fea3-11ea-90e3-c88ff9d21bd6.png)
 
 ## Try it out
 
-Try the editor out [on our website](https://microsoft.github.io/monaco-editor/index.html).
+Try out the editor and see various examples [in our interactive playground](https://microsoft.github.io/monaco-editor/playground.html).
+
+The playground is the best way to learn about how to use the editor, which features is supports, to try out different versions and to create minimal reproducible examples for bug reports.
 
 ## Installing
 
 ```
-$ npm install monaco-editor
+> npm install monaco-editor
 ```
 
 You will get:
 
-- inside `esm`: ESM version of the editor (compatible with e.g. webpack)
-- inside `dev`: AMD bundled, not minified
-- inside `min`: AMD bundled, and minified
-- inside `min-maps`: source maps for `min`
+- inside `/esm`: ESM version of the editor (compatible with e.g. webpack)
+- inside `/dev`: AMD bundled, not minified
+- inside `/min`: AMD bundled, and minified
+- inside `/min-maps`: source maps for `min`
 - `monaco.d.ts`: this specifies the API of the editor (this is what is actually versioned, everything else is considered private and might break with any release).
 
 It is recommended to develop against the `dev` version, and in production to use the `min` version.
@@ -34,14 +37,14 @@ It is recommended to develop against the `dev` version, and in production to use
   - [Integrate the AMD version](./docs/integrate-amd.md).
   - [Integrate the ESM version](./docs/integrate-esm.md)
 - Learn how to use the editor API and try out your own customizations in the [playground](https://microsoft.github.io/monaco-editor/playground.html).
-- Explore the [API docs](https://microsoft.github.io/monaco-editor/api/index.html) or read them straight from [`monaco.d.ts`](https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts).
+- Explore the [API docs](https://microsoft.github.io/monaco-editor/docs.html) or read them straight from [`monaco.d.ts`](https://github.com/microsoft/monaco-editor/blob/main/website/typedoc/monaco.d.ts).
 - Read [this guide](https://github.com/microsoft/monaco-editor/wiki/Accessibility-Guide-for-Integrators) to ensure the editor is accessible to all your users!
 - Create a Monarch tokenizer for a new programming language [in the Monarch playground](https://microsoft.github.io/monaco-editor/monarch.html).
 - Ask questions on [StackOverflow](https://stackoverflow.com/questions/tagged/monaco-editor)! Search open and closed issues, there are a lot of tips in there!
 
 ## Issues
 
-Create [issues](https://github.com/microsoft/monaco-editor/issues) in this repository for anything related to the Monaco Editor. Always mention **the version** of the editor when creating issues and **the browser** you're having trouble in. Please search for existing issues to avoid duplicates.
+Create [issues](https://github.com/microsoft/monaco-editor/issues) in this repository for anything related to the Monaco Editor. Please search for existing issues to avoid duplicates.
 
 ## FAQ
 
@@ -79,13 +82,10 @@ No.
 
 - Please see https://github.com/bolinfest/monaco-tm which puts together `monaco-editor`, `vscode-oniguruma` and `vscode-textmate` to get TM grammar support in the editor.
 
-❓ **What about IE 11 support?**
-
-- The Monaco Editor no longer supports IE 11. The last version that was tested on IE 11 is `0.18.1`.
-
-## Development setup
+## Contributing / Local Development
 
-Please see [CONTRIBUTING](./CONTRIBUTING.md)
+We are welcoming contributions from the community!
+Please see [CONTRIBUTING](./CONTRIBUTING.md) for details how you can contribute effectively, how you can run the editor from sources and how you can debug and fix issues.
 
 ## Code of Conduct
 

+ 15 - 20
build/build.ts → build/build-languages.ts

@@ -4,33 +4,33 @@
  *--------------------------------------------------------------------------------------------*/
 
 import glob from 'glob';
-import { tsc, dts, buildESM, buildAMD } from './utils';
+import { runTsc, massageAndCopyDts, buildESM, buildAMD } from './utils';
 import { copyFile, removeDir } from './fs';
 
-removeDir(`out`);
+removeDir(`out/languages`);
 
-tsc(`src/tsconfig.json`);
+runTsc(`src/tsconfig.json`);
 
 //#region Type Defintion
 
-dts(
-	`out/amd/language/css/monaco.contribution.d.ts`,
-	`out/release/css.d.ts`,
+massageAndCopyDts(
+	`out/languages/amd-tsc/language/css/monaco.contribution.d.ts`,
+	`out/languages/bundled/css.d.ts`,
 	'monaco.languages.css'
 );
-dts(
-	`out/amd/language/html/monaco.contribution.d.ts`,
-	`out/release/html.d.ts`,
+massageAndCopyDts(
+	`out/languages/amd-tsc/language/html/monaco.contribution.d.ts`,
+	`out/languages/bundled/html.d.ts`,
 	'monaco.languages.html'
 );
-dts(
-	`out/amd/language/json/monaco.contribution.d.ts`,
-	`out/release/json.d.ts`,
+massageAndCopyDts(
+	`out/languages/amd-tsc/language/json/monaco.contribution.d.ts`,
+	`out/languages/bundled/json.d.ts`,
 	'monaco.languages.json'
 );
-dts(
-	`out/amd/language/typescript/monaco.contribution.d.ts`,
-	`out/release/typescript.d.ts`,
+massageAndCopyDts(
+	`out/languages/amd-tsc/language/typescript/monaco.contribution.d.ts`,
+	`out/languages/bundled/typescript.d.ts`,
 	'monaco.languages.typescript'
 );
 
@@ -131,11 +131,6 @@ buildAMD({
 
 //#region typescript
 
-copyFile(
-	`src/language/typescript/lib/typescriptServices-amd.js`,
-	`out/amd/language/typescript/lib/typescriptServices.js`
-);
-
 buildESM({
 	base: 'language/typescript',
 	entryPoints: [

+ 29 - 21
build/release.ts → build/build-monaco-editor.ts

@@ -10,7 +10,7 @@ import { removeDir } from '../build/fs';
 import ts = require('typescript');
 import { generateMetadata } from './releaseMetadata';
 
-removeDir(`release`);
+removeDir(`out/monaco-editor`);
 
 // dev folder
 AMD_releaseOne('dev');
@@ -39,7 +39,7 @@ generateMetadata();
 	delete json.scripts['postinstall'];
 
 	packageJSON.contents = Buffer.from(JSON.stringify(json, null, '  '));
-	writeFiles([packageJSON], `release`);
+	writeFiles([packageJSON], `out/monaco-editor`);
 })();
 
 (() => {
@@ -59,7 +59,7 @@ generateMetadata();
 		})
 	);
 
-	writeFiles(otherFiles, `release`);
+	writeFiles(otherFiles, `out/monaco-editor`);
 })();
 
 /**
@@ -70,13 +70,13 @@ function AMD_releaseOne(type: 'dev' | 'min') {
 		base: `node_modules/monaco-editor-core/${type}`
 	});
 	AMD_addPluginContribs(type, coreFiles);
-	writeFiles(coreFiles, `release/${type}`);
+	writeFiles(coreFiles, `out/monaco-editor/${type}`);
 
-	const pluginFiles = readFiles(`out/release/${type}/**/*`, {
-		base: `out/release/${type}`,
+	const pluginFiles = readFiles(`out/languages/bundled/amd-${type}/**/*`, {
+		base: `out/languages/bundled/amd-${type}`,
 		ignore: ['**/monaco.contribution.js']
 	});
-	writeFiles(pluginFiles, `release/${type}`);
+	writeFiles(pluginFiles, `out/monaco-editor/${type}`);
 }
 
 /**
@@ -96,8 +96,8 @@ function AMD_addPluginContribs(type: 'dev' | 'min', files: IFile[]) {
 		// Rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main'
 		contents = contents.replace(/"vs\/editor\/editor\.main\"/, '"vs/editor/edcore.main"');
 
-		const pluginFiles = readFiles(`out/release/${type}/**/monaco.contribution.js`, {
-			base: `out/release/${type}`
+		const pluginFiles = readFiles(`out/languages/bundled/amd-${type}/**/monaco.contribution.js`, {
+			base: `out/languages/bundled/amd-${type}`
 		});
 
 		const extraContent = pluginFiles.map((file) => {
@@ -141,7 +141,7 @@ function ESM_release() {
 	});
 	ESM_addImportSuffix(coreFiles);
 	ESM_addPluginContribs(coreFiles);
-	writeFiles(coreFiles, `release/esm`);
+	writeFiles(coreFiles, `out/monaco-editor/esm`);
 
 	ESM_releasePlugins();
 }
@@ -152,7 +152,7 @@ function ESM_release() {
  * Rewrites imports for 'monaco-editor-core/**'
  */
 function ESM_releasePlugins() {
-	const files = readFiles(`out/release/esm/**/*`, { base: 'out/release/esm/' });
+	const files = readFiles(`out/languages/bundled/esm/**/*`, { base: 'out/languages/bundled/esm/' });
 
 	for (const file of files) {
 		if (!/(\.js$)|(\.ts$)/.test(file.path)) {
@@ -210,7 +210,7 @@ function ESM_releasePlugins() {
 	}
 
 	ESM_addImportSuffix(files);
-	writeFiles(files, `release/esm`);
+	writeFiles(files, `out/monaco-editor/esm`);
 }
 
 /**
@@ -256,8 +256,8 @@ function ESM_addPluginContribs(files: IFile[]) {
 
 	const mainFileDestPath = 'vs/editor/editor.main.js';
 
-	const mainFileImports = readFiles(`out/release/esm/**/monaco.contribution.js`, {
-		base: `out/release/esm`
+	const mainFileImports = readFiles(`out/languages/bundled/esm/**/monaco.contribution.js`, {
+		base: `out/languages/bundled/esm`
 	}).map((file) => {
 		let relativePath = path
 			.relative(path.dirname(mainFileDestPath), file.path)
@@ -292,8 +292,8 @@ function releaseDTS() {
 
 	let contents = monacodts.contents.toString();
 
-	const extraContent = readFiles('out/release/*.d.ts', {
-		base: 'out/release/'
+	const extraContent = readFiles('out/languages/bundled/*.d.ts', {
+		base: 'out/languages/bundled/'
 	}).map((file) => {
 		return file.contents.toString().replace(/\/\/\/ <reference.*\n/m, '');
 	});
@@ -321,10 +321,9 @@ function releaseDTS() {
 		contents: Buffer.from(toExternalDTS(contents))
 	};
 
-	writeFiles([monacodts, editorapidts], `release`);
+	writeFiles([monacodts, editorapidts], `out/monaco-editor`);
 
-	fs.writeFileSync('website/playground/monaco.d.ts.txt', contents);
-	fs.writeFileSync('website/typedoc/monaco.d.ts', contents);
+	// fs.writeFileSync('website/typedoc/monaco.d.ts', contents);
 }
 
 /**
@@ -364,7 +363,16 @@ function toExternalDTS(contents: string): string {
 		}
 
 		if (line.indexOf('declare let MonacoEnvironment') === 0) {
-			lines[i] = `declare global {\n    let MonacoEnvironment: Environment | undefined;\n}`;
+			lines[i] = [
+				'declare global {',
+				'    let MonacoEnvironment: Environment | undefined;',
+				'',
+				'    interface Window {',
+				'        MonacoEnvironment?: Environment | undefined;',
+				'    }',
+				'}',
+				''
+			].join('\n');
 		}
 		if (line.indexOf('    MonacoEnvironment?') === 0) {
 			lines[i] = `    MonacoEnvironment?: Environment | undefined;`;
@@ -414,5 +422,5 @@ function releaseThirdPartyNotices() {
 	contents += '\n' + thirdPartyNoticeContent;
 	tpn.contents = Buffer.from(contents);
 
-	writeFiles([tpn], `release`);
+	writeFiles([tpn], `out/monaco-editor`);
 }

+ 53 - 0
build/check-samples.ts

@@ -0,0 +1,53 @@
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+
+import * as fs from 'fs';
+import * as glob from 'glob';
+import * as path from 'path';
+import { REPO_ROOT } from './utils';
+
+checkEveryMonacoLanguageHasASample();
+
+function checkEveryMonacoLanguageHasASample() {
+	let languages = glob
+		.sync('src/basic-languages/*/*.contribution.ts', { cwd: REPO_ROOT })
+		.map((f) => path.dirname(f))
+		.map((f) => f.substring('src/basic-languages/'.length));
+	languages.push('css');
+	languages.push('html');
+	languages.push('json');
+	languages.push('typescript');
+
+	// some languages have a different id than their folder
+	languages = languages.map((l) => {
+		switch (l) {
+			case 'coffee':
+				return 'coffeescript';
+			case 'protobuf':
+				return 'proto';
+			case 'solidity':
+				return 'sol';
+			case 'sophia':
+				return 'aes';
+			default:
+				return l;
+		}
+	});
+
+	let fail = false;
+	for (const language of languages) {
+		const expectedSamplePath = path.join(
+			REPO_ROOT,
+			`website/src/website/data/home-samples/sample.${language}.txt`
+		);
+		if (!fs.existsSync(expectedSamplePath)) {
+			console.error(`Missing sample for ${language} at ${expectedSamplePath}`);
+			fail = true;
+		}
+	}
+	if (fail) {
+		process.exit(1);
+	}
+}

+ 12 - 97
build/importTypescript.ts

@@ -35,97 +35,18 @@ const TYPESCRIPT_LIB_DESTINATION = path.join(REPO_ROOT, 'src/language/typescript
 export const typescriptVersion = "${typeScriptDependencyVersion}";\n`
 	);
 
-	let tsServices = fs
-		.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescriptServices.js'))
-		.toString();
+	let tsServices = fs.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescript.js')).toString();
 
-	// Ensure we never run into the node system...
-	// (this also removes require calls that trick webpack into shimming those modules...)
-	tsServices = tsServices.replace(
-		/\n    ts\.sys =([^]*)\n    \}\)\(\);/m,
-		`\n    // MONACOCHANGE\n    ts.sys = undefined;\n    // END MONACOCHANGE`
-	);
-
-	// Eliminate more require() calls...
-	tsServices = tsServices.replace(
-		/^( +)etwModule = require\(.*$/m,
-		'$1// MONACOCHANGE\n$1etwModule = undefined;\n$1// END MONACOCHANGE'
-	);
-	tsServices = tsServices.replace(
-		/^( +)var result = ts\.sys\.require\(.*$/m,
-		'$1// MONACOCHANGE\n$1var result = undefined;\n$1// END MONACOCHANGE'
-	);
-	tsServices = tsServices.replace(
-		/^( +)fs = require\("fs"\);$/m,
-		'$1// MONACOCHANGE\n$1fs = undefined;\n$1// END MONACOCHANGE'
-	);
-	tsServices = tsServices.replace(
-		/^( +)debugger;$/m,
-		'$1// MONACOCHANGE\n$1// debugger;\n$1// END MONACOCHANGE'
-	);
-	tsServices = tsServices.replace(
-		/= require\("perf_hooks"\)/m,
-		'/* MONACOCHANGE */= {}/* END MONACOCHANGE */'
-	);
-	tsServices = tsServices.replace(
-		/typeof require === "function"/m,
-		'/* MONACOCHANGE */false/* END MONACOCHANGE */'
-	);
-
-	tsServices = tsServices.replace(
-		/module.exports = ts;/m,
-		'/* MONACOCHANGE */ /*module.exports = ts;*/ /* END MONACOCHANGE */'
-	);
-
-	// Flag any new require calls (outside comments) so they can be corrected preemptively.
-	// To avoid missing cases (or using an even more complex regex), temporarily remove comments
-	// about require() and then check for lines actually calling require().
-	// \/[*/] matches the start of a comment (single or multi-line).
-	// ^\s+\*[^/] matches (presumably) a later line of a multi-line comment.
-	const tsServicesNoCommentedRequire = tsServices.replace(
-		/(\/[*/]|^\s+\*[^/]).*\brequire\(.*/gm,
-		''
-	);
-	const linesWithRequire = tsServicesNoCommentedRequire.match(/^.*?\brequire\(.*$/gm);
-
-	// Allow error messages to include references to require() in their strings
-	const runtimeRequires =
-		linesWithRequire &&
-		linesWithRequire.filter((l) => !l.includes(': diag(') && !l.includes('ts.DiagnosticCategory'));
-
-	if (runtimeRequires && runtimeRequires.length && linesWithRequire) {
-		console.error(
-			'Found new require() calls on the following lines. These should be removed to avoid breaking webpack builds.\n'
-		);
-		console.error(
-			runtimeRequires.map((r) => `${r} (${tsServicesNoCommentedRequire.indexOf(r)})`).join('\n')
-		);
-		process.exit(1);
-	}
-
-	const tsServices_amd =
-		generatedNote +
-		tsServices +
+	// The output from this build will only be accessible via ESM; rather than removing
+	// references to require/module, define them as dummy variables that bundlers will ignore.
+	// The TS code can figure out that it's not running under Node even with these defined.
+	tsServices =
 		`
-// MONACOCHANGE
-// Defining the entire module name because r.js has an issue and cannot bundle this file
-// correctly with an anonymous define call
-define("vs/language/typescript/lib/typescriptServices", [], function() { return ts; });
-// END MONACOCHANGE
-`;
-	fs.writeFileSync(
-		path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices-amd.js'),
-		stripSourceMaps(tsServices_amd)
-	);
-
-	// Remove pattern that creates warnings with esbuild
-	// e.g.
-	// > /src/typescript/lib/typescriptServices.js:20:21: warning: Top-level "this" will be replaced with undefined since this file is an ECMAScript module
-	// 20 │ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
-	//    ╵                      ~~~~
-	//
-
-	tsServices = tsServices.replace(/\nvar ([^ ]+) = \(this && this\.([^)]+)\) \|\|/gm, '\nvar $1 =');
+/* MONACOCHANGE */
+var require = undefined;
+var module = { exports: {} };
+/* END MONACOCHANGE */
+` + tsServices;
 
 	const tsServices_esm =
 		generatedNote +
@@ -149,14 +70,8 @@ export var typescript = ts;
 		stripSourceMaps(tsServices_esm)
 	);
 
-	let dtsServices = fs
-		.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescriptServices.d.ts'))
-		.toString();
-	dtsServices += `
-// MONACOCHANGE
-export = ts;
-// END MONACOCHANGE
-`;
+	let dtsServices = fs.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescript.d.ts')).toString();
+
 	fs.writeFileSync(
 		path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices.d.ts'),
 		generatedNote + dtsServices

+ 1 - 1
build/npm/installAll.ts

@@ -12,7 +12,7 @@ import { REPO_ROOT } from '../utils';
 
 const files = glob.sync('**/package.json', {
 	cwd: REPO_ROOT,
-	ignore: ['**/node_modules/**', '**/out/**', '**/release/**']
+	ignore: ['**/node_modules/**', '**/dist/**', '**/out/**']
 });
 
 for (const file of files) {

+ 1 - 1
build/npm/removeAll.ts

@@ -10,7 +10,7 @@ import { REPO_ROOT } from '../utils';
 
 const files = glob.sync('**/package-lock.json', {
 	cwd: REPO_ROOT,
-	ignore: ['**/node_modules/**', '**/out/**', '**/release/**']
+	ignore: ['**/node_modules/**', '**/out/**']
 });
 
 for (const file of files) {

+ 22 - 9
build/releaseMetadata.ts

@@ -26,7 +26,7 @@ const customFeatureLabels = {
 function getBasicLanguages(): Promise<{ label: string; entry: string }[]> {
 	return new Promise((resolve, reject) => {
 		glob(
-			'./release/esm/vs/basic-languages/*/*.contribution.js',
+			'./out/monaco-editor/esm/vs/basic-languages/*/*.contribution.js',
 			{ cwd: path.dirname(__dirname) },
 			(err, files) => {
 				if (err) {
@@ -36,7 +36,7 @@ function getBasicLanguages(): Promise<{ label: string; entry: string }[]> {
 
 				resolve(
 					files.map((file) => {
-						const entry = file.substring('./release/esm/'.length).replace(/\.js$/, '');
+						const entry = file.substring('./out/monaco-editor/esm/'.length).replace(/\.js$/, '');
 						const label = path.basename(file).replace(/\.contribution\.js$/, '');
 						return {
 							label: label,
@@ -52,7 +52,7 @@ function getBasicLanguages(): Promise<{ label: string; entry: string }[]> {
 function readAdvancedLanguages(): Promise<string[]> {
 	return new Promise((resolve, reject) => {
 		glob(
-			'./release/esm/vs/language/*/monaco.contribution.js',
+			'./out/monaco-editor/esm/vs/language/*/monaco.contribution.js',
 			{ cwd: path.dirname(__dirname) },
 			(err, files) => {
 				if (err) {
@@ -62,7 +62,7 @@ function readAdvancedLanguages(): Promise<string[]> {
 
 				resolve(
 					files
-						.map((file) => file.substring('./release/esm/vs/language/'.length))
+						.map((file) => file.substring('./out/monaco-editor/esm/vs/language/'.length))
 						.map((file) => file.substring(0, file.length - '/monaco.contribution.js'.length))
 				);
 			}
@@ -95,7 +95,7 @@ function getAdvancedLanguages(): Promise<
 	});
 
 	function checkFileExists(moduleName) {
-		const filePath = path.join(REPO_ROOT, 'release/esm', `${moduleName}.js`);
+		const filePath = path.join(REPO_ROOT, 'out/monaco-editor/esm', `${moduleName}.js`);
 		if (!fs.existsSync(filePath)) {
 			console.error(`Could not find ${filePath}.`);
 			process.exit(1);
@@ -174,7 +174,7 @@ export type EditorFeature = ${features.map((el) => `'${el.label}'`).join(' | ')}
 export type NegatedEditorFeature = ${features.map((el) => `'!${el.label}'`).join(' | ')};
 
 `;
-			const dtsDestination = path.join(REPO_ROOT, 'release/esm/metadata.d.ts');
+			const dtsDestination = path.join(REPO_ROOT, 'out/monaco-editor/esm/metadata.d.ts');
 			ensureDir(path.dirname(dtsDestination));
 			fs.writeFileSync(dtsDestination, dtsContents.replace(/\r\n/g, '\n'));
 
@@ -182,9 +182,18 @@ export type NegatedEditorFeature = ${features.map((el) => `'!${el.label}'`).join
 exports.features = ${JSON.stringify(features, null, '  ')};
 exports.languages = ${JSON.stringify(languages, null, '  ')};
 `;
-			const jsDestination = path.join(REPO_ROOT, 'release/esm/metadata.js');
+			const jsDestination = path.join(REPO_ROOT, 'out/monaco-editor/esm/metadata.js');
 			ensureDir(path.dirname(jsDestination));
 			fs.writeFileSync(jsDestination, jsContents.replace(/\r\n/g, '\n'));
+
+			for (const feature of [...features, ...languages]) {
+				const entries = [].concat(feature.entry);
+				for (const entry of entries) {
+					const dtsDestination = path.join(REPO_ROOT, 'out/monaco-editor/esm', entry) + '.d.ts';
+					ensureDir(path.dirname(dtsDestination));
+					fs.writeFileSync(dtsDestination, 'export {}\n');
+				}
+			}
 		}
 	);
 }
@@ -213,8 +222,12 @@ function getFeatures(): { label: string; entry: string | string[] }[] {
 
 	let features: string[] = [];
 	const files =
-		fs.readFileSync(path.join(REPO_ROOT, 'release/esm/vs/editor/edcore.main.js')).toString() +
-		fs.readFileSync(path.join(REPO_ROOT, 'release/esm/vs/editor/editor.all.js')).toString();
+		fs
+			.readFileSync(path.join(REPO_ROOT, 'out/monaco-editor/esm/vs/editor/edcore.main.js'))
+			.toString() +
+		fs
+			.readFileSync(path.join(REPO_ROOT, 'out/monaco-editor/esm/vs/editor/editor.all.js'))
+			.toString();
 	files.split(/\r\n|\n/).forEach((line) => {
 		const m = line.match(/import '([^']+)'/);
 		if (m) {

+ 2 - 1
build/tsconfig.json

@@ -1,7 +1,8 @@
 {
 	"compilerOptions": {
 		"noEmit": true,
+		"module": "CommonJS",
 		"esModuleInterop": true
 	},
-	"files": ["./**/*"]
+	"include": ["./**/*"]
 }

+ 12 - 10
build/utils.ts

@@ -16,7 +16,7 @@ export const REPO_ROOT = path.join(__dirname, '../');
 /**
  * Launch the typescript compiler synchronously over a project.
  */
-export function tsc(_projectPath: string) {
+export function runTsc(_projectPath: string) {
 	const projectPath = path.join(REPO_ROOT, _projectPath);
 	console.log(`Launching compiler at ${_projectPath}...`);
 	const res = cp.spawnSync(
@@ -47,12 +47,12 @@ export function prettier(_filePath: string) {
 /**
  * Transform an external .d.ts file to an internal .d.ts file
  */
-export function dts(_source: string, _destination: string, namespace: string) {
-	const source = path.join(REPO_ROOT, _source);
-	const destination = path.join(REPO_ROOT, _destination);
+export function massageAndCopyDts(source: string, destination: string, namespace: string) {
+	const absoluteSource = path.join(REPO_ROOT, source);
+	const absoluteDestination = path.join(REPO_ROOT, destination);
 
 	const lines = fs
-		.readFileSync(source)
+		.readFileSync(absoluteSource)
 		.toString()
 		.split(/\r\n|\r|\n/);
 
@@ -81,10 +81,10 @@ export function dts(_source: string, _destination: string, namespace: string) {
 	result.push(`}`);
 	result.push(``);
 
-	ensureDir(path.dirname(destination));
-	fs.writeFileSync(destination, result.join('\n'));
+	ensureDir(path.dirname(absoluteDestination));
+	fs.writeFileSync(absoluteDestination, result.join('\n'));
 
-	prettier(_destination);
+	prettier(destination);
 }
 
 export function build(options: import('esbuild').BuildOptions) {
@@ -104,6 +104,7 @@ export function buildESM(options: { base: string; entryPoints: string[]; externa
 		bundle: true,
 		target: 'esnext',
 		format: 'esm',
+		drop: ['debugger'],
 		define: {
 			AMD: 'false'
 		},
@@ -112,7 +113,7 @@ export function buildESM(options: { base: string; entryPoints: string[]; externa
 		},
 		external: options.external,
 		outbase: `src/${options.base}`,
-		outdir: `out/release/esm/vs/${options.base}/`,
+		outdir: `out/languages/bundled/esm/vs/${options.base}/`,
 		plugins: [
 			alias({
 				'vscode-nls': path.join(__dirname, 'fillers/vscode-nls.ts')
@@ -141,6 +142,7 @@ function buildOneAMD(
 		bundle: true,
 		target: 'esnext',
 		format: 'iife',
+		drop: ['debugger'],
 		define: {
 			AMD: 'true'
 		},
@@ -154,7 +156,7 @@ function buildOneAMD(
 			js: 'return moduleExports;\n});'
 		},
 		outbase: `src/${options.base}`,
-		outdir: `out/release/${type}/vs/${options.base}/`,
+		outdir: `out/languages/bundled/amd-${type}/vs/${options.base}/`,
 		plugins: [
 			alias({
 				'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),

+ 0 - 163
build/website.ts

@@ -1,163 +0,0 @@
-/*---------------------------------------------------------------------------------------------
- *  Copyright (c) Microsoft Corporation. All rights reserved.
- *  Licensed under the MIT License. See License.txt in the project root for license information.
- *--------------------------------------------------------------------------------------------*/
-
-import glob = require('glob');
-import path = require('path');
-import fs = require('fs');
-import cp = require('child_process');
-import CleanCSS from 'clean-css';
-import { REPO_ROOT, readFiles, writeFiles } from './utils';
-import { removeDir } from './fs';
-
-const MONACO_EDITOR_VERSION: string = (() => {
-	const output = cp.execSync(`npm show monaco-editor version`).toString();
-	const version = output.split(/\r\n|\r|\n/g)[0];
-	if (!/\d+\.\d+\.\d+/.test(version)) {
-		console.log('unrecognized package.json version: ' + version);
-		process.exit(1);
-	}
-	return version;
-})();
-
-removeDir(`../monaco-editor-website`);
-checkSamples();
-generateWebsite();
-
-/**
- * Check that there are samples for all available languages
- */
-function checkSamples() {
-	let languages = glob
-		.sync('src/basic-languages/*/*.contribution.ts', { cwd: REPO_ROOT })
-		.map((f) => path.dirname(f))
-		.map((f) => f.substring('src/basic-languages/'.length));
-	languages.push('css');
-	languages.push('html');
-	languages.push('json');
-	languages.push('typescript');
-
-	// some languages have a different id than their folder
-	languages = languages.map((l) => {
-		switch (l) {
-			case 'coffee':
-				return 'coffeescript';
-			case 'protobuf':
-				return 'proto';
-			case 'solidity':
-				return 'sol';
-			case 'sophia':
-				return 'aes';
-			default:
-				return l;
-		}
-	});
-
-	let fail = false;
-	for (const language of languages) {
-		const expectedSamplePath = path.join(REPO_ROOT, `website/index/samples/sample.${language}.txt`);
-		if (!fs.existsSync(expectedSamplePath)) {
-			console.error(`Missing sample for ${language} at ${expectedSamplePath}`);
-			fail = true;
-		}
-	}
-	if (fail) {
-		process.exit(1);
-	}
-}
-
-function replaceWithRelativeResource(
-	dataPath: string,
-	contents: string,
-	regex: RegExp,
-	callback: (match: string, fileContents: Buffer) => string
-): string {
-	return contents.replace(regex, function (_, m0) {
-		const filePath = path.join(REPO_ROOT, 'website', path.dirname(dataPath), m0);
-		return callback(m0, fs.readFileSync(filePath));
-	});
-}
-
-function generateWebsite() {
-	const files = readFiles('website/**/*', {
-		base: 'website',
-		ignore: ['website/typedoc/**/*'],
-		dot: true
-	});
-
-	for (const file of files) {
-		if (!file.contents || !/\.(html)$/.test(file.path) || /new-samples/.test(file.path)) {
-			continue;
-		}
-
-		let contents = file.contents.toString();
-		contents = contents.replace(/\.\.\/release\/dev/g, 'node_modules/monaco-editor/min');
-		// contents = contents.replace(/\.\.\/\.\.\/release\/dev/g, '../monaco-editor/release/dev');
-		contents = contents.replace(/{{version}}/g, MONACO_EDITOR_VERSION);
-		contents = contents.replace(/{{year}}/g, String(new Date().getFullYear()));
-
-		// Preload xhr contents
-		contents = replaceWithRelativeResource(
-			file.path,
-			contents,
-			/<pre data-preload="([^"]+)".*/g,
-			function (m0, fileContents) {
-				return (
-					'<pre data-preload="' +
-					m0 +
-					'" style="display:none">' +
-					fileContents
-						.toString('utf8')
-						.replace(/&/g, '&amp;')
-						.replace(/</g, '&lt;')
-						.replace(/>/g, '&gt;') +
-					'</pre>'
-				);
-			}
-		);
-
-		// Inline fork.png
-		contents = replaceWithRelativeResource(
-			file.path,
-			contents,
-			/src="(\.\/fork.png)"/g,
-			function (m0, fileContents) {
-				return 'src="data:image/png;base64,' + fileContents.toString('base64') + '"';
-			}
-		);
-
-		// let allCSS = '';
-		contents = replaceWithRelativeResource(
-			file.path,
-			contents,
-			/<link data-inline="yes-please" href="([^"]+)".*/g,
-			function (m0, fileContents) {
-				const minifiedCSS = (new CleanCSS() as any).minify(fileContents.toString('utf8')).styles;
-				return `<style>${minifiedCSS}</style>`;
-			}
-		);
-
-		// Inline javascript
-		contents = replaceWithRelativeResource(
-			file.path,
-			contents,
-			/<script data-inline="yes-please" src="([^"]+)".*/g,
-			function (m0, fileContents) {
-				return '<script>' + fileContents.toString('utf8') + '</script>';
-			}
-		);
-
-		file.contents = Buffer.from(contents.split(/\r\n|\r|\n/).join('\n'));
-	}
-
-	writeFiles(files, `../monaco-editor-website`);
-
-	// temporarily create package.json so that npm install doesn't bark
-	fs.writeFileSync(path.join(REPO_ROOT, '../monaco-editor-website/package.json'), '{}');
-	fs.writeFileSync(path.join(REPO_ROOT, '../monaco-editor-website/.nojekyll'), '');
-	cp.execSync('npm install monaco-editor', {
-		cwd: path.join(REPO_ROOT, '../monaco-editor-website')
-	});
-	fs.unlinkSync(path.join(REPO_ROOT, '../monaco-editor-website/package.json'));
-}

+ 275 - 0
docs/code-structure.dio.svg

@@ -0,0 +1,275 @@
+<svg host="65bd71144e" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="601px" height="391px" viewBox="-0.5 -0.5 601 391" content="&lt;mxfile&gt;&lt;diagram id=&quot;cU4r2CM7fKKh95v30pN0&quot; name=&quot;Page-1&quot;&gt;1Vpdk9osFP41XrqThBj1sqvd9qKd6XTfmbaXmKChjSED8au//j0kkA+IdtXo7t6sgcAJPOechwfYAZqt9584zuKvLCLJwHOi/QDNB57nOhMHfmTNoayZ+KpixWmkGtUVz/Qv0T1V7YZGRLQa5owlOc3alSFLUxLmrTrMOdu1my1Z0v5qhlfEqngOcWLX/qBRHqtZeOO6/jOhq1h/2Q2m5Zs11o3VTESMI7ZrVKGPAzTjjOXl03o/I4kET+NS9ns68rYaGCdp/pIOHlLjyA96ciSCuapiylL4eYzzdQIlFx7JnuY/4dl5GKnSr8abuXSxowsHXUhzfmh0ksVfzXd1t6Kk+5VDk+M5OjtVJdiGh7pVoCIC8xXRzcYVthCUhK0JfAfacJLgnG7b9rGKjlXVrgYQHhSG3Xgir7SxxclGWf3G2bYIVxhSTOrByrjjneh/wQtImBbsOKGrFJ5DmDnhULElPKcQkR/UizWNImnjkRNB/+JFYU+CmDGa5sWMRo+D0byCVRog+0FHuqjOdZA2AS8DxkZSWXIeIJnLXiq3FSAvRlqZ/iaHXdsdul7L6tD32ybYcinA26arqhG+yHs6dBre+0Tzz5sF1H0nGRM0Z3KUQQJoPC7Ae8FKPq1pyJlgS/j+01aEwHeWX3cxzclzhoso3QEttv171CdWsB+F3tXuUhAFU1Xe1RTlauaNG/QUONfHvTu2kEuzdTH+8I9kUxszluKQDUkkMR2GjJ+N2ZImyYwlkEQVUZlZkbPsNuBWK9a/wHWdPtCdXh+XLbzPhbob1w4H9AA1mvw7jpHfBbXbA9TazxcG8ivkPZq28XIdryM2gxslPhrdV0B4ZykIkkYfpN6TK2eChaBhWflEk7YHzhUZlexsiIyGgLtMZBRdYbz40Gig1u+jK6M/NphpZCg+sz0y2k8cw9/lCC5dQ5G9EjQUUILT1aZII2dJcL7htSASdmrRNEw2EU1X0Oi/QwYSnNMM5jKTgSxDqngKhSgffguW2kZwGsE7BtqLi85Yfctyq0yvE3ILTYO2MlLGr9VbuovWW1p/9aq39EcasfIEezHCbS+CKcHDV6DXkdPOl3HXyu90sOuoj9XIv5RdG9xaM203u0ZYxCTSBm7GmF4f7GgFanUmoOnM1FslQ6te10WrrcLmRAAlLSSJxYCZPIaAP4sNTaJ3RzVlrJ2gGteZGJsw1AvXGNJ6aBjoh2nsffkppinWGXu1uL+Yuy/bjC9lGyXLzhVz47PE3J14SgnaXo+PLlJ2gdbWmtrMszwzjwLnVPvrlZ29NZqTLVTMSQbIkzQ8vD/SO+LZivTGAGubnrx+SK9tdHIDzkPBxel8h2y+awK/ztYsMBMSnU7gkaFlpqjnBJ5YCaxONR7KrdM7S94ywE9tjnyt2Qxtce3uqG01GN9CsYxsxUKTjvMnMHTSi7cXLYH7iqIF3fkG640cQKE3cwBl7sCm0/MOoIz217OcbyWOdQVXXjc4+sy2PoF6bwx4+jZu6Dw4vtvrfdxNBYt9HCRimmUg+o+76A4Xa+aJadfFWtf5un8+vUGxvvwvIaz/hQJ9/B8=&lt;/diagram&gt;&lt;/mxfile&gt;">
+    <defs/>
+    <g>
+        <path d="M 90 60 L 90 143.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
+        <path d="M 90 148.88 L 86.5 141.88 L 90 143.63 L 93.5 141.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 74px; margin-left: 80px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">
+                                Provides the source for
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="80" y="77" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="11px" text-anchor="middle">
+                    Provides the source for
+                </text>
+            </switch>
+        </g>
+        <rect x="0" y="0" width="180" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 178px; height: 1px; padding-top: 30px; margin-left: 1px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
+                                GitHub Repository
+                                <br/>
+                                microsoft/vscode
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="90" y="34" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
+                    GitHub Repository...
+                </text>
+            </switch>
+        </g>
+        <rect x="0" y="150" width="180" height="100" fill="none" stroke="rgb(0, 0, 0)" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 178px; height: 1px; padding-top: 157px; margin-left: 1px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
+                                npm package
+                                <br/>
+                                monaco-editor-core
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="90" y="169" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
+                    npm package...
+                </text>
+            </switch>
+        </g>
+        <rect x="260" y="0" width="340" height="110" fill="none" stroke="rgb(0, 0, 0)" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 338px; height: 1px; padding-top: 7px; margin-left: 261px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
+                                GitHub Repository
+                                <br/>
+                                microsoft/monaco-editor
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="430" y="19" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
+                    GitHub Repository...
+                </text>
+            </switch>
+        </g>
+        <rect x="270" y="330" width="160" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 360px; margin-left: 271px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
+                                npm package
+                                <br/>
+                                monaco-editor
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="350" y="364" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
+                    npm package...
+                </text>
+            </switch>
+        </g>
+        <path d="M 430 100 L 358 154 Q 350 160 342 166 L 318 184 Q 310 190 310 200 L 310 323.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
+        <path d="M 310 328.88 L 306.5 321.88 L 310 323.63 L 313.5 321.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 231px; margin-left: 290px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">
+                                Provides language feature sources
+                                <br/>
+                                including TypeScript, html, css, json
+                                <br/>
+                                and others
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="290" y="234" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="11px" text-anchor="middle">
+                    Provides language feature sources...
+                </text>
+            </switch>
+        </g>
+        <rect x="380" y="50" width="100" height="50" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 75px; margin-left: 381px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
+                                Folder
+                                <br/>
+                                /src
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="430" y="79" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
+                    Folder...
+                </text>
+            </switch>
+        </g>
+        <path d="M 270 75 L 96.25 108.78" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" stroke-dasharray="3 3" pointer-events="stroke"/>
+        <path d="M 91.1 109.79 L 97.3 105.01 L 96.25 108.78 L 98.64 111.89 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 91px; margin-left: 190px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">
+                                Describe how to build
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="190" y="94" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="11px" text-anchor="middle">
+                    Describe how to build
+                </text>
+            </switch>
+        </g>
+        <rect x="270" y="50" width="100" height="50" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 75px; margin-left: 271px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
+                                Folder
+                                <br/>
+                                /scripts
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="320" y="79" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
+                    Folder...
+                </text>
+            </switch>
+        </g>
+        <path d="M 515 100 L 515 120 Q 515 130 505 130 L 150 130 Q 140 130 138.27 136.91 L 136.54 143.82" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" stroke-dasharray="3 3" pointer-events="stroke"/>
+        <path d="M 135.27 148.92 L 133.57 141.28 L 136.54 143.82 L 140.36 142.97 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 120px; margin-left: 181px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">
+                                Dev Dependency
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="181" y="124" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="11px" text-anchor="middle">
+                    Dev Dependency
+                </text>
+            </switch>
+        </g>
+        <path d="M 540 100 L 540 130 Q 540 140 531.68 145.55 L 398.32 234.45 Q 390 240 390 250 L 390 323.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
+        <path d="M 390 328.88 L 386.5 321.88 L 390 323.63 L 393.5 321.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 300px; margin-left: 391px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">
+                                package.json
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="391" y="303" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="11px" text-anchor="middle">
+                    package.json
+                </text>
+            </switch>
+        </g>
+        <rect x="490" y="50" width="100" height="50" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 75px; margin-left: 491px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
+                                File
+                                <br/>
+                                /package.json
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="540" y="79" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
+                    File...
+                </text>
+            </switch>
+        </g>
+        <path d="M 90 240 L 90 290 Q 90 300 100 300 L 300 300 Q 310 300 310 310 L 310 323.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
+        <path d="M 310 328.88 L 306.5 321.88 L 310 323.63 L 313.5 321.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 290px; margin-left: 179px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">
+                                Provides the core editor sources
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="179" y="294" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="11px" text-anchor="middle">
+                    Provides the core editor sources
+                </text>
+            </switch>
+        </g>
+        <rect x="10" y="200" width="160" height="40" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
+        <g transform="translate(-0.5 -0.5)">
+            <switch>
+                <foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
+                    <div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 220px; margin-left: 11px;">
+                        <div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
+                            <div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
+                                shipped sources
+                            </div>
+                        </div>
+                    </div>
+                </foreignObject>
+                <text x="90" y="224" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
+                    shipped sources
+                </text>
+            </switch>
+        </g>
+    </g>
+    <switch>
+        <g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/>
+        <a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank">
+            <text text-anchor="middle" font-size="10px" x="50%" y="100%">
+                Text is not SVG - cannot display
+            </text>
+        </a>
+    </switch>
+</svg>

二進制
docs/debugging-core.gif


二進制
docs/debugging-languages.gif


+ 1 - 1
docs/integrate-esm.md

@@ -1,7 +1,7 @@
 ## Integrating the ESM version of the Monaco Editor
 
 - [Webpack](#using-webpack)
-  - [Option 1: Using the Monaco Editor Loader Plugin](#option-1-using-the-monaco-editor-loader-plugin)
+  - [Option 1: Using the Monaco Editor WebPack Plugin](#option-1-using-the-monaco-editor-webpack-plugin)
   - [Option 2: Using plain webpack](#option-2-using-plain-webpack)
 - [Parcel](#using-parcel)
 - [Vite](#using-vite)

二進制
docs/launch config.png


文件差異過大導致無法顯示
+ 0 - 0
docs/out-folders.dio.svg


文件差異過大導致無法顯示
+ 1770 - 1373
package-lock.json


+ 29 - 12
package.json

@@ -1,30 +1,34 @@
 {
 	"name": "monaco-editor",
-	"version": "0.33.0",
-	"vscode": "6a4e5cc26b29359472378c2a8951c33f4ea73244",
+	"version": "0.36.1",
+	"vscodeRef": "07d120e10a4d3ac790e65b8a6dc85195546df664",
 	"private": true,
 	"description": "A browser based code editor",
+	"homepage": "https://github.com/microsoft/monaco-editor",
 	"author": "Microsoft Corporation",
 	"license": "MIT",
 	"scripts": {
-		"build-website": "ts-node ./build/website && npm run typedoc",
 		"import-typescript": "ts-node ./build/importTypescript",
-		"package-for-smoketest-esbuild": "ts-node ./test/smoke/package-esbuild",
 		"playwright-install": "node ./node_modules/playwright/install.js",
 		"playwright-install-deps": "playwright install-deps",
 		"postinstall": "ts-node ./build/postinstall",
 		"prettier-check": "prettier --check .",
 		"prettier": "prettier --write .",
 		"pretty-quick": "pretty-quick --staged",
-		"release": "ts-node ./build/build && ts-node ./build/release",
 		"simpleserver": "ts-node ./build/simpleserver",
-		"smoketest-debug": "node ./test/smoke/runner.js --debug-tests",
+		"package-for-smoketest-webpack": "ts-node ./test/smoke/package-webpack",
+		"package-for-smoketest-webpack-cross-origin": "ts-node ./test/smoke/package-webpack --cross-origin",
+		"package-for-smoketest-esbuild": "ts-node ./test/smoke/package-esbuild",
+		"package-for-smoketest-vite": "ts-node ./test/smoke/package-vite",
 		"smoketest": "node ./test/smoke/runner.js",
-		"test": "mocha test/unit/all.js",
+		"smoketest-debug": "node ./test/smoke/runner.js --debug-tests",
+		"test": "mocha test/unit/all.js && ts-node ./build/check-samples",
 		"deps-all-remove": "ts-node ./build/npm/removeAll",
 		"deps-all-install": "ts-node ./build/npm/installAll",
-		"typedoc": "cd website/typedoc && \"../../node_modules/.bin/typedoc\" --options ./typedoc.json",
-		"watch": "tsc -w -p ./src"
+		"update-actions": "pin-github-action ./.github/workflows/website.yml",
+		"watch": "tsc -w -p ./src",
+		"build": "ts-node ./build/build-languages",
+		"build-monaco-editor": "npm run build && ts-node ./build/build-monaco-editor"
 	},
 	"typings": "./esm/vs/editor/editor.api.d.ts",
 	"module": "./esm/vs/editor/editor.main.js",
@@ -34,31 +38,44 @@
 	},
 	"devDependencies": {
 		"@types/mocha": "^9.1.0",
+		"@types/shelljs": "^0.8.11",
 		"@typescript/vfs": "^1.3.5",
 		"chai": "^4.3.6",
 		"clean-css": "^5.2.4",
+		"css-loader": "^6.7.1",
 		"esbuild": "^0.14.49",
 		"esbuild-plugin-alias": "^0.2.1",
+		"file-loader": "^6.2.0",
 		"glob": "^7.2.0",
+		"http-server": "^14.1.1",
 		"husky": "^7.0.4",
 		"jsdom": "^19.0.0",
 		"jsonc-parser": "^3.0.0",
 		"mocha": "^9.2.0",
-		"monaco-editor-core": "0.34.0-dev.20220720",
+		"monaco-editor-core": "^0.36.0-dev.20230224",
+		"parcel": "^2.7.0",
+		"pin-github-action": "^1.8.0",
 		"playwright": "^1.18.1",
 		"prettier": "^2.5.1",
 		"pretty-quick": "^3.1.3",
 		"requirejs": "^2.3.6",
+		"shelljs": "^0.8.5",
+		"style-loader": "^3.3.1",
 		"terser": "^5.14.2",
 		"ts-node": "^10.6.0",
-		"typedoc": "^0.22.11",
-		"typescript": "4.5.5",
+		"typescript": "^5.0.2",
+		"vite": "^3.1.8",
 		"vscode-css-languageservice": "5.4.1",
 		"vscode-html-languageservice": "4.2.4",
 		"vscode-json-languageservice": "4.2.1",
 		"vscode-languageserver-textdocument": "^1.0.4",
 		"vscode-languageserver-types": "3.16.0",
 		"vscode-uri": "3.0.3",
+		"webpack": "^5.76.0",
 		"yaserver": "^0.4.0"
+	},
+	"alias": {
+		"process": false,
+		"buffer": false
 	}
 }

+ 39 - 39
samples/browser-esm-vite-react/package-lock.json

@@ -12,8 +12,8 @@
 				"monaco-editor": "^0.32.0",
 				"react": "^17.0.2",
 				"react-dom": "^17.0.2",
-				"typescript": "^4.5.5",
-				"vite": "^2.7.13"
+				"typescript": "^5.0.2",
+				"vite": "^2.9.13"
 			}
 		},
 		"node_modules/@ampproject/remapping": {
@@ -1104,9 +1104,9 @@
 			}
 		},
 		"node_modules/json5": {
-			"version": "2.2.1",
-			"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
-			"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
+			"version": "2.2.3",
+			"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+			"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
 			"dev": true,
 			"bin": {
 				"json5": "lib/cli.js"
@@ -1140,9 +1140,9 @@
 			"dev": true
 		},
 		"node_modules/nanoid": {
-			"version": "3.3.2",
-			"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.2.tgz",
-			"integrity": "sha512-CuHBogktKwpm5g2sRgv83jEy2ijFzBwMoYA60orPDR7ynsLijJDqgsi4RDGj3OJpy3Ieb+LYwiRmIOGyytgITA==",
+			"version": "3.3.4",
+			"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
+			"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
 			"dev": true,
 			"bin": {
 				"nanoid": "bin/nanoid.cjs"
@@ -1191,9 +1191,9 @@
 			}
 		},
 		"node_modules/postcss": {
-			"version": "8.4.12",
-			"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.12.tgz",
-			"integrity": "sha512-lg6eITwYe9v6Hr5CncVbK70SoioNQIq81nsaG86ev5hAidQvmOeETBqs7jm43K2F5/Ley3ytDtriImV6TpNiSg==",
+			"version": "8.4.16",
+			"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz",
+			"integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==",
 			"dev": true,
 			"funding": [
 				{
@@ -1206,7 +1206,7 @@
 				}
 			],
 			"dependencies": {
-				"nanoid": "^3.3.1",
+				"nanoid": "^3.3.4",
 				"picocolors": "^1.0.0",
 				"source-map-js": "^1.0.2"
 			},
@@ -1359,26 +1359,26 @@
 			}
 		},
 		"node_modules/typescript": {
-			"version": "4.6.3",
-			"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz",
-			"integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==",
+			"version": "5.0.2",
+			"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz",
+			"integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==",
 			"dev": true,
 			"bin": {
 				"tsc": "bin/tsc",
 				"tsserver": "bin/tsserver"
 			},
 			"engines": {
-				"node": ">=4.2.0"
+				"node": ">=12.20"
 			}
 		},
 		"node_modules/vite": {
-			"version": "2.8.6",
-			"resolved": "https://registry.npmjs.org/vite/-/vite-2.8.6.tgz",
-			"integrity": "sha512-e4H0QpludOVKkmOsRyqQ7LTcMUDF3mcgyNU4lmi0B5JUbe0ZxeBBl8VoZ8Y6Rfn9eFKYtdXNPcYK97ZwH+K2ug==",
+			"version": "2.9.13",
+			"resolved": "https://registry.npmjs.org/vite/-/vite-2.9.13.tgz",
+			"integrity": "sha512-AsOBAaT0AD7Mhe8DuK+/kE4aWYFMx/i0ZNi98hJclxb4e0OhQcZYUrvLjIaQ8e59Ui7txcvKMiJC1yftqpQoDw==",
 			"dev": true,
 			"dependencies": {
-				"esbuild": "^0.14.14",
-				"postcss": "^8.4.6",
+				"esbuild": "^0.14.27",
+				"postcss": "^8.4.13",
 				"resolve": "^1.22.0",
 				"rollup": "^2.59.0"
 			},
@@ -2116,9 +2116,9 @@
 			"dev": true
 		},
 		"json5": {
-			"version": "2.2.1",
-			"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
-			"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
+			"version": "2.2.3",
+			"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+			"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
 			"dev": true
 		},
 		"loose-envify": {
@@ -2143,9 +2143,9 @@
 			"dev": true
 		},
 		"nanoid": {
-			"version": "3.3.2",
-			"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.2.tgz",
-			"integrity": "sha512-CuHBogktKwpm5g2sRgv83jEy2ijFzBwMoYA60orPDR7ynsLijJDqgsi4RDGj3OJpy3Ieb+LYwiRmIOGyytgITA==",
+			"version": "3.3.4",
+			"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
+			"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
 			"dev": true
 		},
 		"node-releases": {
@@ -2179,12 +2179,12 @@
 			"dev": true
 		},
 		"postcss": {
-			"version": "8.4.12",
-			"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.12.tgz",
-			"integrity": "sha512-lg6eITwYe9v6Hr5CncVbK70SoioNQIq81nsaG86ev5hAidQvmOeETBqs7jm43K2F5/Ley3ytDtriImV6TpNiSg==",
+			"version": "8.4.16",
+			"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz",
+			"integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==",
 			"dev": true,
 			"requires": {
-				"nanoid": "^3.3.1",
+				"nanoid": "^3.3.4",
 				"picocolors": "^1.0.0",
 				"source-map-js": "^1.0.2"
 			}
@@ -2292,20 +2292,20 @@
 			"dev": true
 		},
 		"typescript": {
-			"version": "4.6.3",
-			"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz",
-			"integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==",
+			"version": "5.0.2",
+			"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz",
+			"integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==",
 			"dev": true
 		},
 		"vite": {
-			"version": "2.8.6",
-			"resolved": "https://registry.npmjs.org/vite/-/vite-2.8.6.tgz",
-			"integrity": "sha512-e4H0QpludOVKkmOsRyqQ7LTcMUDF3mcgyNU4lmi0B5JUbe0ZxeBBl8VoZ8Y6Rfn9eFKYtdXNPcYK97ZwH+K2ug==",
+			"version": "2.9.13",
+			"resolved": "https://registry.npmjs.org/vite/-/vite-2.9.13.tgz",
+			"integrity": "sha512-AsOBAaT0AD7Mhe8DuK+/kE4aWYFMx/i0ZNi98hJclxb4e0OhQcZYUrvLjIaQ8e59Ui7txcvKMiJC1yftqpQoDw==",
 			"dev": true,
 			"requires": {
-				"esbuild": "^0.14.14",
+				"esbuild": "^0.14.27",
 				"fsevents": "~2.3.2",
-				"postcss": "^8.4.6",
+				"postcss": "^8.4.13",
 				"resolve": "^1.22.0",
 				"rollup": "^2.59.0"
 			}

+ 2 - 2
samples/browser-esm-vite-react/package.json

@@ -14,7 +14,7 @@
 		"@types/react": "^17.0.39",
 		"@types/react-dom": "^17.0.11",
 		"@vitejs/plugin-react": "^1.1.4",
-		"typescript": "^4.5.5",
-		"vite": "^2.7.13"
+		"typescript": "^5.0.2",
+		"vite": "^2.9.13"
 	}
 }

+ 7 - 5
samples/browser-esm-vite-react/src/components/Editor.tsx

@@ -7,13 +7,15 @@ export const Editor: VFC = () => {
 	const monacoEl = useRef(null);
 
 	useEffect(() => {
-		if (monacoEl && !editor) {
-			setEditor(
-				monaco.editor.create(monacoEl.current!, {
+		if (monacoEl) {
+			setEditor((editor) => {
+				if (editor) return editor;
+
+				return monaco.editor.create(monacoEl.current!, {
 					value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
 					language: 'typescript'
-				})
-			);
+				});
+			});
 		}
 
 		return () => editor?.dispose();

+ 1 - 1
samples/browser-esm-webpack-small/index.js

@@ -17,7 +17,7 @@ import 'monaco-editor/esm/vs/editor/browser/controller/coreCommands.js';
 // import 'monaco-editor/esm/vs/editor/contrib/cursorUndo/cursorUndo.js';
 // import 'monaco-editor/esm/vs/editor/contrib/dnd/dnd.js';
 // import 'monaco-editor/esm/vs/editor/contrib/documentSymbols/documentSymbols.js';
-import 'monaco-editor/esm/vs/editor/contrib/find/findController.js';
+import 'monaco-editor/esm/vs/editor/contrib/find/browser/findController.js';
 // import 'monaco-editor/esm/vs/editor/contrib/folding/folding.js';
 // import 'monaco-editor/esm/vs/editor/contrib/fontZoom/fontZoom.js';
 // import 'monaco-editor/esm/vs/editor/contrib/format/formatActions.js';

+ 64 - 64
samples/browser-esm-webpack-typescript-react/package-lock.json

@@ -1892,9 +1892,9 @@
 			"dev": true
 		},
 		"node_modules/@types/node": {
-			"version": "17.0.23",
-			"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz",
-			"integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==",
+			"version": "18.14.6",
+			"resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.6.tgz",
+			"integrity": "sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==",
 			"dev": true,
 			"peer": true
 		},
@@ -2106,9 +2106,9 @@
 			"peer": true
 		},
 		"node_modules/acorn": {
-			"version": "8.7.0",
-			"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
-			"integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
+			"version": "8.8.2",
+			"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
+			"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
 			"dev": true,
 			"peer": true,
 			"bin": {
@@ -2488,9 +2488,9 @@
 			}
 		},
 		"node_modules/enhanced-resolve": {
-			"version": "5.9.2",
-			"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.2.tgz",
-			"integrity": "sha512-GIm3fQfwLJ8YZx2smuHpBKkXC1yOk+OBEmKckVyL0i/ea8mqDEykK3ld5dgH1QYPNyT/lIllxV2LULnxCHaHkA==",
+			"version": "5.12.0",
+			"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz",
+			"integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==",
 			"dev": true,
 			"peer": true,
 			"dependencies": {
@@ -2692,9 +2692,9 @@
 			}
 		},
 		"node_modules/graceful-fs": {
-			"version": "4.2.9",
-			"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz",
-			"integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==",
+			"version": "4.2.10",
+			"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
+			"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
 			"dev": true,
 			"peer": true
 		},
@@ -2808,10 +2808,10 @@
 				"node": ">=4"
 			}
 		},
-		"node_modules/json-parse-better-errors": {
-			"version": "1.0.2",
-			"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
-			"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
+		"node_modules/json-parse-even-better-errors": {
+			"version": "2.3.1",
+			"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
+			"integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
 			"dev": true,
 			"peer": true
 		},
@@ -2822,9 +2822,9 @@
 			"dev": true
 		},
 		"node_modules/json5": {
-			"version": "2.2.1",
-			"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
-			"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
+			"version": "2.2.3",
+			"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+			"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
 			"dev": true,
 			"bin": {
 				"json5": "lib/cli.js"
@@ -2844,9 +2844,9 @@
 			}
 		},
 		"node_modules/loader-utils": {
-			"version": "2.0.2",
-			"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
-			"integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
+			"version": "2.0.4",
+			"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz",
+			"integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==",
 			"dev": true,
 			"dependencies": {
 				"big.js": "^5.2.2",
@@ -3509,9 +3509,9 @@
 			}
 		},
 		"node_modules/watchpack": {
-			"version": "2.3.1",
-			"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz",
-			"integrity": "sha512-x0t0JuydIo8qCNctdDrn1OzH/qDzk2+rdCOC3YzumZ42fiMqmQ7T3xQurykYMhYfHaPHTp4ZxAx2NfUo1K6QaA==",
+			"version": "2.4.0",
+			"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
+			"integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==",
 			"dev": true,
 			"peer": true,
 			"dependencies": {
@@ -3523,9 +3523,9 @@
 			}
 		},
 		"node_modules/webpack": {
-			"version": "5.70.0",
-			"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.70.0.tgz",
-			"integrity": "sha512-ZMWWy8CeuTTjCxbeaQI21xSswseF2oNOwc70QSKNePvmxE7XW36i7vpBMYZFAUHPwQiEbNGCEYIOOlyRbdGmxw==",
+			"version": "5.76.1",
+			"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.1.tgz",
+			"integrity": "sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==",
 			"dev": true,
 			"peer": true,
 			"dependencies": {
@@ -3534,24 +3534,24 @@
 				"@webassemblyjs/ast": "1.11.1",
 				"@webassemblyjs/wasm-edit": "1.11.1",
 				"@webassemblyjs/wasm-parser": "1.11.1",
-				"acorn": "^8.4.1",
+				"acorn": "^8.7.1",
 				"acorn-import-assertions": "^1.7.6",
 				"browserslist": "^4.14.5",
 				"chrome-trace-event": "^1.0.2",
-				"enhanced-resolve": "^5.9.2",
+				"enhanced-resolve": "^5.10.0",
 				"es-module-lexer": "^0.9.0",
 				"eslint-scope": "5.1.1",
 				"events": "^3.2.0",
 				"glob-to-regexp": "^0.4.1",
 				"graceful-fs": "^4.2.9",
-				"json-parse-better-errors": "^1.0.2",
+				"json-parse-even-better-errors": "^2.3.1",
 				"loader-runner": "^4.2.0",
 				"mime-types": "^2.1.27",
 				"neo-async": "^2.6.2",
 				"schema-utils": "^3.1.0",
 				"tapable": "^2.1.1",
 				"terser-webpack-plugin": "^5.1.3",
-				"watchpack": "^2.3.1",
+				"watchpack": "^2.4.0",
 				"webpack-sources": "^3.2.3"
 			},
 			"bin": {
@@ -4892,9 +4892,9 @@
 			"dev": true
 		},
 		"@types/node": {
-			"version": "17.0.23",
-			"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz",
-			"integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==",
+			"version": "18.14.6",
+			"resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.6.tgz",
+			"integrity": "sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==",
 			"dev": true,
 			"peer": true
 		},
@@ -5106,9 +5106,9 @@
 			"peer": true
 		},
 		"acorn": {
-			"version": "8.7.0",
-			"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
-			"integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
+			"version": "8.8.2",
+			"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
+			"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
 			"dev": true,
 			"peer": true
 		},
@@ -5382,9 +5382,9 @@
 			"dev": true
 		},
 		"enhanced-resolve": {
-			"version": "5.9.2",
-			"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.2.tgz",
-			"integrity": "sha512-GIm3fQfwLJ8YZx2smuHpBKkXC1yOk+OBEmKckVyL0i/ea8mqDEykK3ld5dgH1QYPNyT/lIllxV2LULnxCHaHkA==",
+			"version": "5.12.0",
+			"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz",
+			"integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==",
 			"dev": true,
 			"peer": true,
 			"requires": {
@@ -5540,9 +5540,9 @@
 			"dev": true
 		},
 		"graceful-fs": {
-			"version": "4.2.9",
-			"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz",
-			"integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==",
+			"version": "4.2.10",
+			"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
+			"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
 			"dev": true,
 			"peer": true
 		},
@@ -5625,10 +5625,10 @@
 			"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
 			"dev": true
 		},
-		"json-parse-better-errors": {
-			"version": "1.0.2",
-			"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
-			"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
+		"json-parse-even-better-errors": {
+			"version": "2.3.1",
+			"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
+			"integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
 			"dev": true,
 			"peer": true
 		},
@@ -5639,9 +5639,9 @@
 			"dev": true
 		},
 		"json5": {
-			"version": "2.2.1",
-			"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
-			"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
+			"version": "2.2.3",
+			"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+			"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
 			"dev": true
 		},
 		"loader-runner": {
@@ -5652,9 +5652,9 @@
 			"peer": true
 		},
 		"loader-utils": {
-			"version": "2.0.2",
-			"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
-			"integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
+			"version": "2.0.4",
+			"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz",
+			"integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==",
 			"dev": true,
 			"requires": {
 				"big.js": "^5.2.2",
@@ -6150,9 +6150,9 @@
 			}
 		},
 		"watchpack": {
-			"version": "2.3.1",
-			"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz",
-			"integrity": "sha512-x0t0JuydIo8qCNctdDrn1OzH/qDzk2+rdCOC3YzumZ42fiMqmQ7T3xQurykYMhYfHaPHTp4ZxAx2NfUo1K6QaA==",
+			"version": "2.4.0",
+			"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
+			"integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==",
 			"dev": true,
 			"peer": true,
 			"requires": {
@@ -6161,9 +6161,9 @@
 			}
 		},
 		"webpack": {
-			"version": "5.70.0",
-			"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.70.0.tgz",
-			"integrity": "sha512-ZMWWy8CeuTTjCxbeaQI21xSswseF2oNOwc70QSKNePvmxE7XW36i7vpBMYZFAUHPwQiEbNGCEYIOOlyRbdGmxw==",
+			"version": "5.76.1",
+			"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.1.tgz",
+			"integrity": "sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==",
 			"dev": true,
 			"peer": true,
 			"requires": {
@@ -6172,24 +6172,24 @@
 				"@webassemblyjs/ast": "1.11.1",
 				"@webassemblyjs/wasm-edit": "1.11.1",
 				"@webassemblyjs/wasm-parser": "1.11.1",
-				"acorn": "^8.4.1",
+				"acorn": "^8.7.1",
 				"acorn-import-assertions": "^1.7.6",
 				"browserslist": "^4.14.5",
 				"chrome-trace-event": "^1.0.2",
-				"enhanced-resolve": "^5.9.2",
+				"enhanced-resolve": "^5.10.0",
 				"es-module-lexer": "^0.9.0",
 				"eslint-scope": "5.1.1",
 				"events": "^3.2.0",
 				"glob-to-regexp": "^0.4.1",
 				"graceful-fs": "^4.2.9",
-				"json-parse-better-errors": "^1.0.2",
+				"json-parse-even-better-errors": "^2.3.1",
 				"loader-runner": "^4.2.0",
 				"mime-types": "^2.1.27",
 				"neo-async": "^2.6.2",
 				"schema-utils": "^3.1.0",
 				"tapable": "^2.1.1",
 				"terser-webpack-plugin": "^5.1.3",
-				"watchpack": "^2.3.1",
+				"watchpack": "^2.4.0",
 				"webpack-sources": "^3.2.3"
 			}
 		},

+ 3 - 1
samples/electron-amd-nodeIntegration/main.js

@@ -10,7 +10,9 @@ function createWindow() {
 		height: 600,
 		webPreferences: {
 			nodeIntegration: true,
-			worldSafeExecuteJavaScript: true
+			worldSafeExecuteJavaScript: true,
+			sandbox: false,
+			contextIsolation: false
 		}
 	});
 	mainWindow.loadURL(`file://${__dirname}/electron-index.html`);

+ 3 - 2
samples/electron-esm-webpack/.gitignore

@@ -1,2 +1,3 @@
-/dist/*.js
-/dist/*.ttf
+dist/*.js
+dist/*.txt
+dist/*.ttf

文件差異過大導致無法顯示
+ 214 - 322
samples/package-lock.json


+ 6 - 3
samples/package.json

@@ -11,7 +11,7 @@
 	"license": "MIT",
 	"devDependencies": {
 		"css-loader": "^5.2.7",
-		"electron": "^17.2.0",
+		"electron": "^19.1.8",
 		"file-loader": "^6.2.0",
 		"glob": "^7.2.0",
 		"html-webpack-plugin": "^5.5.0",
@@ -20,10 +20,13 @@
 		"style-loader": "^3.3.1",
 		"terser-webpack-plugin": "^5.3.1",
 		"ts-loader": "^9.2.6",
-		"typescript": "^4.5.5",
+		"typescript": "^5.0.2",
 		"webpack-cli": "^4.9.2",
 		"webpack-dev-server": "^4.7.4",
-		"webpack": "^5.68.0",
+		"webpack": "^5.76.0",
 		"yaserver": "^0.4.0"
+	},
+	"overrides": {
+		"@electron/get": "2.0.0"
 	}
 }

+ 77 - 0
scripts/ci/monaco-editor-core-prepare.ts

@@ -0,0 +1,77 @@
+import { mkdir, rm } from 'fs/promises';
+import { join, resolve } from 'path';
+import { PackageJson, group, gitShallowClone, run, writeJsonFile, getNightlyVersion } from '../lib';
+
+const selfPath = __dirname;
+const rootPath = join(selfPath, '..', '..');
+const dependenciesPath = join(rootPath, 'dependencies');
+const vscodePath = resolve(dependenciesPath, 'vscode');
+const monacoEditorPackageJsonPath = resolve(rootPath, 'package.json');
+
+async function prepareMonacoEditorCoreReleaseStableOrNightly() {
+	const monacoEditorPackageJson = require(monacoEditorPackageJsonPath) as {
+		version: string;
+		vscodeRef: string;
+	};
+	let version: string;
+	let ref: string;
+
+	const arg = process.argv[2];
+	if (arg === 'stable') {
+		version = monacoEditorPackageJson.version;
+		ref = monacoEditorPackageJson.vscodeRef;
+	} else if (arg === 'nightly') {
+		version = getNightlyVersion(monacoEditorPackageJson.version);
+		ref = 'main';
+	} else {
+		throw new Error('Invalid argument');
+	}
+
+	await prepareMonacoEditorCoreRelease(version, ref);
+
+	// npm package is now in dependencies/vscode/out-monaco-editor-core, ready to be published
+}
+
+async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string) {
+	await mkdir(vscodePath, { recursive: true });
+
+	await rm(dependenciesPath, { force: true, recursive: true });
+
+	let vscodeCommitId: string;
+
+	await group('Checkout vscode', async () => {
+		const result = await gitShallowClone(
+			vscodePath,
+			'https://github.com/microsoft/vscode.git',
+			vscodeRef
+		);
+		vscodeCommitId = result.commitId;
+	});
+
+	await group('Checkout vscode-loc', async () => {
+		await gitShallowClone(
+			// Must be a sibling to the vscode repository
+			'dependencies/vscode-loc',
+			'https://github.com/microsoft/vscode-loc.git',
+			'main'
+		);
+	});
+
+	await group('Set Version', async () => {
+		const monacoEditorCorePackageJsonSourcePath = resolve(
+			vscodePath,
+			'./build/monaco/package.json'
+		);
+		const packageJson = require(monacoEditorCorePackageJsonSourcePath) as PackageJson;
+		packageJson.version = version;
+		// This ensures we can always figure out which commit monaco-editor-core was built from
+		packageJson.vscodeCommitId = vscodeCommitId;
+		await writeJsonFile(monacoEditorCorePackageJsonSourcePath, packageJson);
+	});
+
+	await group('Building & Testing', async () => {
+		await run(resolve(selfPath, './monaco-editor-core.sh'), { cwd: vscodePath });
+	});
+}
+
+prepareMonacoEditorCoreReleaseStableOrNightly();

+ 34 - 0
scripts/ci/monaco-editor-core.sh

@@ -0,0 +1,34 @@
+#!/bin/bash
+set -e
+
+# cwd must be the vscode repository.
+
+yarn --frozen-lockfile --network-timeout 180000
+yarn playwright-install
+yarn gulp hygiene
+yarn valid-layers-check
+yarn --cwd build compile
+yarn eslint
+yarn monaco-compile-check
+yarn --max_old_space_size=4095 compile
+
+yarn test-browser --browser chromium
+
+yarn gulp editor-distro
+mkdir typings-test
+
+cd typings-test
+yarn init -yp
+../node_modules/.bin/tsc --init
+echo "import '../out-monaco-editor-core';" > a.ts
+../node_modules/.bin/tsc --noEmit
+cd ..
+
+cd test/monaco
+yarn run esm-check
+yarn run bundle-webpack
+yarn run compile
+yarn test
+cd ../..
+
+# npm package is now in dependencies/vscode/out-monaco-editor-core, ready to be published

+ 71 - 0
scripts/ci/monaco-editor-prepare.ts

@@ -0,0 +1,71 @@
+import { readFile } from 'fs/promises';
+import { join, resolve } from 'path';
+import { PackageJson, getNightlyVersion, group, run, writeJsonFile, gitCommitId } from '../lib';
+
+const selfPath = __dirname;
+const rootPath = join(selfPath, '..', '..');
+const monacoEditorPackageJsonPath = resolve(rootPath, 'package.json');
+const monacoEditorCorePackageJsonPath = resolve(
+	rootPath,
+	'node_modules',
+	'monaco-editor-core',
+	'package.json'
+);
+
+async function prepareMonacoEditorReleaseStableOrNightly() {
+	const monacoEditorPackageJson = JSON.parse(
+		await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
+	) as PackageJson;
+
+	let version: string;
+
+	const arg = process.argv[2];
+	if (arg === 'stable') {
+		version = monacoEditorPackageJson.version;
+	} else if (arg === 'nightly') {
+		version = getNightlyVersion(monacoEditorPackageJson.version);
+	} else {
+		throw new Error('Invalid argument');
+	}
+
+	await prepareMonacoEditorRelease(version);
+
+	// npm package is now in ./out/monaco-editor, ready to be published
+}
+
+async function prepareMonacoEditorRelease(monacoEditorCoreVersion: string) {
+	await group('npm ci', async () => {
+		await run('npm ci', { cwd: resolve(rootPath, 'webpack-plugin') });
+	});
+
+	await group('Set Version & Update monaco-editor-core Version', async () => {
+		const packageJson = JSON.parse(
+			await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
+		) as PackageJson;
+		packageJson.version = monacoEditorCoreVersion;
+		packageJson.devDependencies['monaco-editor-core'] = monacoEditorCoreVersion;
+		await writeJsonFile(monacoEditorPackageJsonPath, packageJson);
+	});
+
+	await group('npm install to pick up monaco-editor-core', async () => {
+		await run('npm install', { cwd: rootPath });
+	});
+
+	await group('Setting vscode commitId from monaco-editor-core', async () => {
+		const monacoEditorCorePackageJson = JSON.parse(
+			await readFile(monacoEditorCorePackageJsonPath, { encoding: 'utf-8' })
+		) as PackageJson;
+		const packageJson = JSON.parse(
+			await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
+		) as PackageJson;
+		packageJson.vscodeCommitId = monacoEditorCorePackageJson.vscodeCommitId;
+		packageJson.monacoCommitId = await gitCommitId(rootPath);
+		await writeJsonFile(monacoEditorPackageJsonPath, packageJson);
+	});
+
+	await group('Building & Testing', async () => {
+		await run(resolve(selfPath, './monaco-editor.sh'), { cwd: rootPath });
+	});
+}
+
+prepareMonacoEditorReleaseStableOrNightly();

+ 28 - 0
scripts/ci/monaco-editor.sh

@@ -0,0 +1,28 @@
+#!/bin/bash
+set -e
+
+# Install OS Dependencies for Playwright
+sudo npm run playwright-install-deps
+# Check prettier
+npm run prettier-check
+# Build
+npm run build-monaco-editor
+
+# Run unit tests
+npm test
+
+# Compile webpack plugin
+npm run compile --prefix webpack-plugin
+# Package using webpack plugin
+npm run package-for-smoketest-webpack
+# Package using esbuild
+npm run package-for-smoketest-esbuild
+# Package using vite
+npm run package-for-smoketest-vite
+# Package using parcel
+npm run package-for-smoketest-parcel --prefix test/smoke/parcel
+
+# Run smoke test
+npm run smoketest
+
+# npm package is now ready to be published in ./out/monaco-editor

+ 92 - 0
scripts/lib/index.ts

@@ -0,0 +1,92 @@
+import { spawn } from 'child_process';
+import { mkdir, writeFile } from 'fs/promises';
+
+export interface RunOptions {
+	cwd: string;
+}
+
+export async function run(command: string, options: RunOptions) {
+	console.log(`Running ${command} in ${options.cwd}`);
+	const process = spawn(command, { shell: true, cwd: options.cwd, stdio: 'inherit' });
+	return new Promise<void>((resolve, reject) => {
+		process.on('exit', (code) => {
+			if (code !== 0) {
+				reject(new Error(`Command ${command} exited with code ${code}`));
+			} else {
+				resolve();
+			}
+		});
+	});
+}
+
+export async function runGetOutput(command: string, options: RunOptions): Promise<string> {
+	console.log(`Running ${command} in ${options.cwd}`);
+	return new Promise<string>((resolve, reject) => {
+		const process = spawn(command, { shell: true, cwd: options.cwd, stdio: 'pipe' });
+		let output = '';
+		process.stdout.on('data', (data) => {
+			output += data;
+		});
+		process.on('exit', (code) => {
+			if (code !== 0) {
+				reject(new Error(`Command ${command} exited with code ${code}`));
+			} else {
+				resolve(output);
+			}
+		});
+	});
+}
+
+export async function gitCommitId(repositoryPath: string): Promise<string> {
+	const commitId = (await runGetOutput('git rev-parse HEAD', { cwd: repositoryPath })).trim();
+	return commitId;
+}
+
+export async function gitShallowClone(
+	targetPath: string,
+	repositoryUrl: string,
+	ref: string
+): Promise<{ commitId: string }> {
+	await mkdir(targetPath, { recursive: true });
+	const options: RunOptions = { cwd: targetPath };
+	await run('git init', options);
+	await run(`git remote add origin ${repositoryUrl}`, options);
+	await run(`git fetch --depth 1 origin ${ref}`, options);
+	await run(`git checkout ${ref}`, options);
+	const commitId = await gitCommitId(targetPath);
+	return { commitId };
+}
+
+export async function group(name: string, body: () => Promise<void>): Promise<void> {
+	console.log(`##[group]${name}`);
+	try {
+		await body();
+	} catch (e) {
+		console.error(e);
+		throw e;
+	} finally {
+		console.log('##[endgroup]');
+	}
+}
+
+export async function writeJsonFile(filePath: string, jsonData: unknown): Promise<void> {
+	await writeFile(filePath, JSON.stringify(jsonData, null, '\t') + '\n');
+}
+
+export function getNightlyVersion(version: string): string {
+	const pieces = version.split('.');
+	const minor = parseInt(pieces[1], 10);
+	const date = new Date();
+	const yyyy = date.getUTCFullYear();
+	const mm = String(date.getUTCMonth() + 1).padStart(2, '0');
+	const dd = String(date.getUTCDate()).padStart(2, '0');
+	return `0.${minor + 1}.0-dev.${yyyy}${mm}${dd}`;
+}
+
+export interface PackageJson {
+	version: string;
+	vscodeRef?: string;
+	vscodeCommitId?: string;
+	monacoCommitId?: string;
+	devDependencies: Record<string, string>;
+}

+ 4 - 1
src/basic-languages/cpp/cpp.ts

@@ -197,6 +197,9 @@ export const language = <languages.IMonarchLanguage>{
 		'__m256',
 		'__m256d',
 		'__m256i',
+		'__m512',
+		'__m512d',
+		'__m512i',
 		'__m64',
 		'__multiple_inheritance',
 		'__newslot',
@@ -272,7 +275,7 @@ export const language = <languages.IMonarchLanguage>{
 
 	// we include these common regular expressions
 	symbols: /[=><!~?:&|+\-*\/\^%]+/,
-	escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
+	escapes: /\\(?:[0abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
 	integersuffix: /([uU](ll|LL|l|L)|(ll|LL|l|L)?[uU]?)/,
 	floatsuffix: /[fFlL]?/,
 	encoding: /u|u8|U|L/,

+ 27 - 0
src/basic-languages/elixir/elixir.test.ts

@@ -383,5 +383,32 @@ testTokenization('elixir', [
 				{ startIndex: 15, type: 'delimiter.square.elixir' }
 			]
 		}
+	],
+	// Bitstrings
+	[
+		{
+			line: '<<height::32-integer, width::32-integer, data::binary>>',
+			tokens: [
+				{ startIndex: 0, type: 'delimiter.angle.special.elixir' },
+				{ startIndex: 2, type: 'identifier.elixir' },
+				{ startIndex: 8, type: 'operator.elixir' },
+				{ startIndex: 10, type: 'number.elixir' },
+				{ startIndex: 12, type: 'operator.elixir' },
+				{ startIndex: 13, type: 'identifier.elixir' },
+				{ startIndex: 20, type: 'punctuation.elixir' },
+				{ startIndex: 21, type: 'white.elixir' },
+				{ startIndex: 22, type: 'identifier.elixir' },
+				{ startIndex: 27, type: 'operator.elixir' },
+				{ startIndex: 29, type: 'number.elixir' },
+				{ startIndex: 31, type: 'operator.elixir' },
+				{ startIndex: 32, type: 'identifier.elixir' },
+				{ startIndex: 39, type: 'punctuation.elixir' },
+				{ startIndex: 40, type: 'white.elixir' },
+				{ startIndex: 41, type: 'identifier.elixir' },
+				{ startIndex: 45, type: 'operator.elixir' },
+				{ startIndex: 47, type: 'identifier.elixir' },
+				{ startIndex: 53, type: 'delimiter.angle.special.elixir' }
+			]
+		}
 	]
 ]);

+ 25 - 1
src/basic-languages/elixir/elixir.ts

@@ -167,7 +167,7 @@ export const language = <languages.IMonarchLanguage>{
 		// Keyword list shorthand
 
 		keywordsShorthand: [
-			[/(@atomName)(:)/, ['constant', 'constant.punctuation']],
+			[/(@atomName)(:)(\s+)/, ['constant', 'constant.punctuation', 'white']],
 			// Use positive look-ahead to ensure the string is followed by :
 			// and should be considered a keyword.
 			[
@@ -532,6 +532,13 @@ export const language = <languages.IMonarchLanguage>{
 					next: '@doubleQuotedHeredocDocstring'
 				}
 			],
+			[
+				/\@(module|type)?doc (~[sS])?'''/,
+				{
+					token: 'comment.block.documentation',
+					next: '@singleQuotedHeredocDocstring'
+				}
+			],
 			[
 				/\@(module|type)?doc (~[sS])?"/,
 				{
@@ -539,6 +546,13 @@ export const language = <languages.IMonarchLanguage>{
 					next: '@doubleQuotedStringDocstring'
 				}
 			],
+			[
+				/\@(module|type)?doc (~[sS])?'/,
+				{
+					token: 'comment.block.documentation',
+					next: '@singleQuotedStringDocstring'
+				}
+			],
 			[/\@(module|type)?doc false/, 'comment.block.documentation'],
 			// Module attributes
 			[/\@(@variableName)/, 'variable']
@@ -549,11 +563,21 @@ export const language = <languages.IMonarchLanguage>{
 			{ include: '@docstringContent' }
 		],
 
+		singleQuotedHeredocDocstring: [
+			[/'''/, { token: 'comment.block.documentation', next: '@pop' }],
+			{ include: '@docstringContent' }
+		],
+
 		doubleQuotedStringDocstring: [
 			[/"/, { token: 'comment.block.documentation', next: '@pop' }],
 			{ include: '@docstringContent' }
 		],
 
+		singleQuotedStringDocstring: [
+			[/'/, { token: 'comment.block.documentation', next: '@pop' }],
+			{ include: '@docstringContent' }
+		],
+
 		// Operators, punctuation, brackets
 
 		symbols: [

+ 26 - 0
src/basic-languages/html/html.test.ts

@@ -396,6 +396,32 @@ testTokenization(
 			}
 		],
 
+		// Embedded Content #10
+		[
+			{
+				line: '<script type="module">var i= 10;</script>',
+				tokens: [
+					{ startIndex: 0, type: 'delimiter.html' },
+					{ startIndex: 1, type: 'tag.html' },
+					{ startIndex: 7, type: '' },
+					{ startIndex: 8, type: 'attribute.name.html' },
+					{ startIndex: 12, type: 'delimiter.html' },
+					{ startIndex: 13, type: 'attribute.value.html' },
+					{ startIndex: 21, type: 'delimiter.html' },
+					{ startIndex: 22, type: 'keyword.js' },
+					{ startIndex: 25, type: '' },
+					{ startIndex: 26, type: 'identifier.js' },
+					{ startIndex: 27, type: 'delimiter.js' },
+					{ startIndex: 28, type: '' },
+					{ startIndex: 29, type: 'number.js' },
+					{ startIndex: 31, type: 'delimiter.js' },
+					{ startIndex: 32, type: 'delimiter.html' },
+					{ startIndex: 34, type: 'tag.html' },
+					{ startIndex: 40, type: 'delimiter.html' }
+				]
+			}
+		],
+
 		// Tag with Attribute
 		[
 			{

+ 14 - 0
src/basic-languages/html/html.ts

@@ -160,6 +160,20 @@ export const language = <languages.IMonarchLanguage>{
 
 		// After <script ... type =
 		scriptAfterTypeEquals: [
+			[
+				/"module"/,
+				{
+					token: 'attribute.value',
+					switchTo: '@scriptWithCustomType.text/javascript'
+				}
+			],
+			[
+				/'module'/,
+				{
+					token: 'attribute.value',
+					switchTo: '@scriptWithCustomType.text/javascript'
+				}
+			],
 			[
 				/"([^"]*)"/,
 				{

+ 1 - 1
src/basic-languages/kotlin/kotlin.contribution.ts

@@ -10,7 +10,7 @@ declare var require: any;
 
 registerLanguage({
 	id: 'kotlin',
-	extensions: ['.kt'],
+	extensions: ['.kt', '.kts'],
 	aliases: ['Kotlin', 'kotlin'],
 	mimetypes: ['text/x-kotlin-source', 'text/x-kotlin'],
 	loader: () => {

+ 1 - 0
src/basic-languages/mysql/mysql.ts

@@ -862,6 +862,7 @@ export const language = <languages.IMonarchLanguage>{
 			[/"/, { token: 'string.double', next: '@stringDouble' }]
 		],
 		string: [
+			[/\\'/, 'string'],
 			[/[^']+/, 'string'],
 			[/''/, 'string'],
 			[/'/, { token: 'string', next: '@pop' }]

+ 1 - 1
src/basic-languages/perl/perl.contribution.ts

@@ -10,7 +10,7 @@ declare var require: any;
 
 registerLanguage({
 	id: 'perl',
-	extensions: ['.pl'],
+	extensions: ['.pl', '.pm'],
 	aliases: ['Perl', 'pl'],
 	loader: () => {
 		if (AMD) {

+ 4 - 0
src/basic-languages/pgsql/pgsql.ts

@@ -627,11 +627,15 @@ export const language = <languages.IMonarchLanguage>{
 		'range_intersect_agg',
 		'range_merge',
 		'rank',
+		'regexp_count',
+		'regexp_instr',
+		'regexp_like',
 		'regexp_match',
 		'regexp_matches',
 		'regexp_replace',
 		'regexp_split_to_array',
 		'regexp_split_to_table',
+		'regexp_substr',
 		'regr_avgx',
 		'regr_avgy',
 		'regr_count',

+ 6 - 2
src/basic-languages/python/python.ts

@@ -32,7 +32,7 @@ export const conf: languages.LanguageConfiguration = {
 	onEnterRules: [
 		{
 			beforeText: new RegExp(
-				'^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$'
+				'^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async|match|case).*?:\\s*$'
 			),
 			action: { indentAction: languages.IndentAction.Indent }
 		}
@@ -52,18 +52,21 @@ export const language = <languages.IMonarchLanguage>{
 
 	keywords: [
 		// This section is the result of running
-		// `for k in keyword.kwlist: print('  "' + k + '",')` in a Python REPL,
+		// `import keyword; for k in sorted(keyword.kwlist + keyword.softkwlist): print("  '" + k + "',")`
+		// in a Python REPL,
 		// though note that the output from Python 3 is not a strict superset of the
 		// output from Python 2.
 		'False', // promoted to keyword.kwlist in Python 3
 		'None', // promoted to keyword.kwlist in Python 3
 		'True', // promoted to keyword.kwlist in Python 3
+		'_', // new in Python 3.10
 		'and',
 		'as',
 		'assert',
 		'async', // new in Python 3
 		'await', // new in Python 3
 		'break',
+		'case', // new in Python 3.10
 		'class',
 		'continue',
 		'def',
@@ -81,6 +84,7 @@ export const language = <languages.IMonarchLanguage>{
 		'in',
 		'is',
 		'lambda',
+		'match', // new in Python 3.10
 		'nonlocal', // new in Python 3
 		'not',
 		'or',

+ 2 - 1
src/basic-languages/qsharp/qsharp.ts

@@ -74,7 +74,8 @@ export const language = <languages.IMonarchLanguage>{
 		'borrow',
 		'using',
 		'borrowing',
-		'mutable'
+		'mutable',
+		'internal'
 	],
 
 	typeKeywords: [

+ 1 - 1
src/basic-languages/typescript/typescript.contribution.ts

@@ -10,7 +10,7 @@ declare var require: any;
 
 registerLanguage({
 	id: 'typescript',
-	extensions: ['.ts', '.tsx'],
+	extensions: ['.ts', '.tsx', '.cts', '.mts'],
 	aliases: ['TypeScript', 'ts', 'typescript'],
 	mimetypes: ['text/typescript'],
 	loader: (): Promise<any> => {

+ 1 - 0
src/basic-languages/typescript/typescript.ts

@@ -137,6 +137,7 @@ export const language = {
 		'require',
 		'global',
 		'return',
+		'satisfies',
 		'set',
 		'static',
 		'string',

+ 2 - 0
src/basic-languages/xml/xml.contribution.ts

@@ -16,6 +16,8 @@ registerLanguage({
 		'.ascx',
 		'.csproj',
 		'.config',
+		'.props',
+		'.targets',
 		'.wxi',
 		'.wxl',
 		'.wxs',

+ 193 - 0
src/basic-languages/yaml/yaml.test.ts

@@ -458,6 +458,7 @@ testTokenization('yaml', [
 				{ startIndex: 4, type: 'operators.yaml' },
 				{ startIndex: 5, type: 'white.yaml' },
 				{ startIndex: 6, type: 'string.yaml' },
+				{ startIndex: 28, type: 'white.yaml' },
 				{ startIndex: 29, type: 'comment.yaml' }
 			]
 		}
@@ -470,8 +471,200 @@ testTokenization('yaml', [
 				{ startIndex: 6, type: 'operators.yaml' },
 				{ startIndex: 7, type: 'white.yaml' },
 				{ startIndex: 8, type: 'string.yaml' },
+				{ startIndex: 9, type: 'white.yaml' },
 				{ startIndex: 10, type: 'comment.yaml' }
 			]
 		}
+	],
+
+	// ': ' in double-quoted Value
+	[
+		{
+			line: 'key: "va: lue"',
+			tokens: [
+				{
+					startIndex: 0,
+					type: 'type.yaml'
+				},
+				{
+					startIndex: 3,
+					type: 'operators.yaml'
+				},
+				{
+					startIndex: 4,
+					type: 'white.yaml'
+				},
+				{
+					startIndex: 5,
+					type: 'string.yaml'
+				}
+			]
+		}
+	],
+
+	// ': ' in single-quoted Value
+	[
+		{
+			line: "key: 'va: lue'",
+			tokens: [
+				{
+					startIndex: 0,
+					type: 'type.yaml'
+				},
+				{
+					startIndex: 3,
+					type: 'operators.yaml'
+				},
+				{
+					startIndex: 4,
+					type: 'white.yaml'
+				},
+				{
+					startIndex: 5,
+					type: 'string.yaml'
+				}
+			]
+		}
+	],
+
+	// '#' in single-quoted Value
+	[
+		{
+			line: "key: 'va#lue'",
+			tokens: [
+				{
+					startIndex: 0,
+					type: 'type.yaml'
+				},
+				{
+					startIndex: 3,
+					type: 'operators.yaml'
+				},
+				{
+					startIndex: 4,
+					type: 'white.yaml'
+				},
+				{
+					startIndex: 5,
+					type: 'string.yaml'
+				}
+			]
+		}
+	],
+
+	// '#' in double-quoted Value
+	[
+		{
+			line: 'key: "va#lue"',
+			tokens: [
+				{
+					startIndex: 0,
+					type: 'type.yaml'
+				},
+				{
+					startIndex: 3,
+					type: 'operators.yaml'
+				},
+				{
+					startIndex: 4,
+					type: 'white.yaml'
+				},
+				{
+					startIndex: 5,
+					type: 'string.yaml'
+				}
+			]
+		}
+	],
+
+	// '#' in  Value
+	[
+		{
+			line: 'key: va#lue',
+			tokens: [
+				{
+					startIndex: 0,
+					type: 'type.yaml'
+				},
+				{
+					startIndex: 3,
+					type: 'operators.yaml'
+				},
+				{
+					startIndex: 4,
+					type: 'white.yaml'
+				},
+				{
+					startIndex: 5,
+					type: 'string.yaml'
+				}
+			]
+		}
+	],
+
+	// Comment following Value
+	[
+		{
+			line: 'key: value #comment',
+			tokens: [
+				{
+					startIndex: 0,
+					type: 'type.yaml'
+				},
+				{
+					startIndex: 3,
+					type: 'operators.yaml'
+				},
+				{
+					startIndex: 4,
+					type: 'white.yaml'
+				},
+				{
+					startIndex: 5,
+					type: 'string.yaml'
+				},
+				{
+					startIndex: 10,
+					type: 'white.yaml'
+				},
+				{
+					startIndex: 11,
+					type: 'comment.yaml'
+				}
+			]
+		}
+	],
+
+	// ': ' in Comment following Value
+	[
+		{
+			line: 'key: value #comment: also comment',
+			tokens: [
+				{
+					startIndex: 0,
+					type: 'type.yaml'
+				},
+				{
+					startIndex: 3,
+					type: 'operators.yaml'
+				},
+				{
+					startIndex: 4,
+					type: 'white.yaml'
+				},
+				{
+					startIndex: 5,
+					type: 'string.yaml'
+				},
+				{
+					startIndex: 10,
+					type: 'white.yaml'
+				},
+				{
+					startIndex: 11,
+					type: 'comment.yaml'
+				}
+			]
+		}
 	]
 ]);

+ 2 - 2
src/basic-languages/yaml/yaml.ts

@@ -86,13 +86,13 @@ export const language = <languages.IMonarchLanguage>{
 			[/@numberDate(?![ \t]*\S+)/, 'number.date'],
 
 			// Key:Value pair
-			[/(".*?"|'.*?'|.*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']],
+			[/(".*?"|'.*?'|[^#'"]*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']],
 
 			{ include: '@flowScalars' },
 
 			// String nodes
 			[
-				/[^#]+/,
+				/.+?(?=(\s+#|$))/,
 				{
 					cases: {
 						'@keywords': 'keyword',

+ 29 - 29
src/language/typescript/languageFeatures.ts

@@ -474,7 +474,7 @@ export class SuggestAdapter extends Adapter implements languages.CompletionItemP
 			}
 
 			const tags: languages.CompletionItemTag[] = [];
-			if (entry.kindModifiers?.indexOf('deprecated') !== -1) {
+			if (entry.kindModifiers !== undefined && entry.kindModifiers.indexOf('deprecated') !== -1) {
 				tags.push(languages.CompletionItemTag.Deprecated);
 			}
 
@@ -715,7 +715,10 @@ export class QuickInfoAdapter extends Adapter implements languages.HoverProvider
 
 // --- occurrences ------
 
-export class OccurrencesAdapter extends Adapter implements languages.DocumentHighlightProvider {
+export class DocumentHighlightAdapter
+	extends Adapter
+	implements languages.DocumentHighlightProvider
+{
 	public async provideDocumentHighlights(
 		model: editor.ITextModel,
 		position: Position,
@@ -729,19 +732,24 @@ export class OccurrencesAdapter extends Adapter implements languages.DocumentHig
 			return;
 		}
 
-		const entries = await worker.getOccurrencesAtPosition(resource.toString(), offset);
+		const entries = await worker.getDocumentHighlights(resource.toString(), offset, [
+			resource.toString()
+		]);
 
 		if (!entries || model.isDisposed()) {
 			return;
 		}
 
-		return entries.map((entry) => {
-			return <languages.DocumentHighlight>{
-				range: this._textSpanToRange(model, entry.textSpan),
-				kind: entry.isWriteAccess
-					? languages.DocumentHighlightKind.Write
-					: languages.DocumentHighlightKind.Text
-			};
+		return entries.flatMap((entry) => {
+			return entry.highlightSpans.map((highlightSpans) => {
+				return <languages.DocumentHighlight>{
+					range: this._textSpanToRange(model, highlightSpans.textSpan),
+					kind:
+						highlightSpans.kind === 'writtenReference'
+							? languages.DocumentHighlightKind.Write
+							: languages.DocumentHighlightKind.Text
+				};
+			});
 		});
 	}
 }
@@ -865,39 +873,31 @@ export class OutlineAdapter extends Adapter implements languages.DocumentSymbolP
 			return;
 		}
 
-		const items = await worker.getNavigationBarItems(resource.toString());
+		const root = await worker.getNavigationTree(resource.toString());
 
-		if (!items || model.isDisposed()) {
+		if (!root || model.isDisposed()) {
 			return;
 		}
 
 		const convert = (
-			bucket: languages.DocumentSymbol[],
-			item: ts.NavigationBarItem,
+			item: ts.NavigationTree,
 			containerLabel?: string
-		): void => {
-			let result: languages.DocumentSymbol = {
+		): languages.DocumentSymbol => {
+			const result: languages.DocumentSymbol = {
 				name: item.text,
 				detail: '',
 				kind: <languages.SymbolKind>(outlineTypeTable[item.kind] || languages.SymbolKind.Variable),
 				range: this._textSpanToRange(model, item.spans[0]),
 				selectionRange: this._textSpanToRange(model, item.spans[0]),
-				tags: []
+				tags: [],
+				children: item.childItems?.map((child) => convert(child, result.name)),
+				containerName: containerLabel
 			};
-
-			if (containerLabel) result.containerName = containerLabel;
-
-			if (item.childItems && item.childItems.length > 0) {
-				for (let child of item.childItems) {
-					convert(bucket, child, result.name);
-				}
-			}
-
-			bucket.push(result);
+			return result;
 		};
 
-		let result: languages.DocumentSymbol[] = [];
-		items.forEach((item) => convert(result, item));
+		// Exclude the root node, as it alwas spans the entire document.
+		const result = root.childItems ? root.childItems.map((item) => convert(item)) : [];
 		return result;
 	}
 }

+ 17 - 3
src/language/typescript/lib/lib.index.ts

@@ -10,6 +10,8 @@
 /** Contains all the lib files */
 export const libFileSet: Record<string, boolean> = {}
 libFileSet['lib.d.ts'] = true;
+libFileSet['lib.decorators.d.ts'] = true;
+libFileSet['lib.decorators.legacy.d.ts'] = true;
 libFileSet['lib.dom.d.ts'] = true;
 libFileSet['lib.dom.iterable.d.ts'] = true;
 libFileSet['lib.es2015.collection.d.ts'] = true;
@@ -42,13 +44,16 @@ libFileSet['lib.es2018.regexp.d.ts'] = true;
 libFileSet['lib.es2019.array.d.ts'] = true;
 libFileSet['lib.es2019.d.ts'] = true;
 libFileSet['lib.es2019.full.d.ts'] = true;
+libFileSet['lib.es2019.intl.d.ts'] = true;
 libFileSet['lib.es2019.object.d.ts'] = true;
 libFileSet['lib.es2019.string.d.ts'] = true;
 libFileSet['lib.es2019.symbol.d.ts'] = true;
 libFileSet['lib.es2020.bigint.d.ts'] = true;
 libFileSet['lib.es2020.d.ts'] = true;
+libFileSet['lib.es2020.date.d.ts'] = true;
 libFileSet['lib.es2020.full.d.ts'] = true;
 libFileSet['lib.es2020.intl.d.ts'] = true;
+libFileSet['lib.es2020.number.d.ts'] = true;
 libFileSet['lib.es2020.promise.d.ts'] = true;
 libFileSet['lib.es2020.sharedmemory.d.ts'] = true;
 libFileSet['lib.es2020.string.d.ts'] = true;
@@ -59,14 +64,23 @@ libFileSet['lib.es2021.intl.d.ts'] = true;
 libFileSet['lib.es2021.promise.d.ts'] = true;
 libFileSet['lib.es2021.string.d.ts'] = true;
 libFileSet['lib.es2021.weakref.d.ts'] = true;
+libFileSet['lib.es2022.array.d.ts'] = true;
+libFileSet['lib.es2022.d.ts'] = true;
+libFileSet['lib.es2022.error.d.ts'] = true;
+libFileSet['lib.es2022.full.d.ts'] = true;
+libFileSet['lib.es2022.intl.d.ts'] = true;
+libFileSet['lib.es2022.object.d.ts'] = true;
+libFileSet['lib.es2022.regexp.d.ts'] = true;
+libFileSet['lib.es2022.sharedmemory.d.ts'] = true;
+libFileSet['lib.es2022.string.d.ts'] = true;
+libFileSet['lib.es2023.array.d.ts'] = true;
+libFileSet['lib.es2023.d.ts'] = true;
+libFileSet['lib.es2023.full.d.ts'] = true;
 libFileSet['lib.es5.d.ts'] = true;
 libFileSet['lib.es6.d.ts'] = true;
 libFileSet['lib.esnext.d.ts'] = true;
 libFileSet['lib.esnext.full.d.ts'] = true;
 libFileSet['lib.esnext.intl.d.ts'] = true;
-libFileSet['lib.esnext.promise.d.ts'] = true;
-libFileSet['lib.esnext.string.d.ts'] = true;
-libFileSet['lib.esnext.weakref.d.ts'] = true;
 libFileSet['lib.scripthost.d.ts'] = true;
 libFileSet['lib.webworker.d.ts'] = true;
 libFileSet['lib.webworker.importscripts.d.ts'] = true;

文件差異過大導致無法顯示
+ 0 - 1
src/language/typescript/lib/lib.ts


文件差異過大導致無法顯示
+ 0 - 9385
src/language/typescript/lib/typescriptServices-amd.js


文件差異過大導致無法顯示
+ 246 - 308
src/language/typescript/lib/typescriptServices.d.ts


文件差異過大導致無法顯示
+ 2240 - 555
src/language/typescript/lib/typescriptServices.js


+ 1 - 1
src/language/typescript/lib/typescriptServicesMetadata.ts

@@ -2,4 +2,4 @@
 // **NOTE**: Do not edit directly! This file is generated using `npm run import-typescript`
 //
 
-export const typescriptVersion = "4.5.5";
+export const typescriptVersion = "5.0.2";

+ 108 - 11
src/language/typescript/monaco.contribution.ts

@@ -226,6 +226,73 @@ interface OutputFile {
 	text: string;
 }
 
+export interface ModeConfiguration {
+	/**
+	 * Defines whether the built-in completionItemProvider is enabled.
+	 */
+	readonly completionItems?: boolean;
+
+	/**
+	 * Defines whether the built-in hoverProvider is enabled.
+	 */
+	readonly hovers?: boolean;
+
+	/**
+	 * Defines whether the built-in documentSymbolProvider is enabled.
+	 */
+	readonly documentSymbols?: boolean;
+
+	/**
+	 * Defines whether the built-in definitions provider is enabled.
+	 */
+	readonly definitions?: boolean;
+
+	/**
+	 * Defines whether the built-in references provider is enabled.
+	 */
+	readonly references?: boolean;
+
+	/**
+	 * Defines whether the built-in references provider is enabled.
+	 */
+	readonly documentHighlights?: boolean;
+
+	/**
+	 * Defines whether the built-in rename provider is enabled.
+	 */
+	readonly rename?: boolean;
+
+	/**
+	 * Defines whether the built-in diagnostic provider is enabled.
+	 */
+	readonly diagnostics?: boolean;
+
+	/**
+	 * Defines whether the built-in document formatting range edit provider is enabled.
+	 */
+	readonly documentRangeFormattingEdits?: boolean;
+
+	/**
+	 * Defines whether the built-in signature help provider is enabled.
+	 */
+	readonly signatureHelp?: boolean;
+
+	/**
+	 * Defines whether the built-in onType formatting edit provider is enabled.
+	 */
+	readonly onTypeFormattingEdits?: boolean;
+
+	/**
+	 * Defines whether the built-in code actions provider is enabled.
+	 */
+	readonly codeActions?: boolean;
+
+	/**
+	 * Defines whether the built-in inlay hints provider is enabled.
+	 */
+	readonly inlayHints?: boolean;
+}
+
 export interface LanguageServiceDefaults {
 	/**
 	 * Event fired when compiler options or diagnostics options are changed.
@@ -241,6 +308,9 @@ export interface LanguageServiceDefaults {
 
 	readonly inlayHintsOptions: InlayHintsOptions;
 
+	readonly modeConfiguration: ModeConfiguration;
+	setModeConfiguration(modeConfiguration: ModeConfiguration): void;
+
 	/**
 	 * Get the current extra libs registered with the language service.
 	 */
@@ -370,13 +440,10 @@ export interface TypeScriptWorker {
 	 */
 	getQuickInfoAtPosition(fileName: string, position: number): Promise<any | undefined>;
 
-	/**
-	 * Get other ranges which are related to the item at the given position in the file (often used for highlighting).
-	 * @returns `Promise<ReadonlyArray<typescript.ReferenceEntry> | undefined>`
-	 */
-	getOccurrencesAtPosition(
+	getDocumentHighlights(
 		fileName: string,
-		position: number
+		position: number,
+		filesToSearch: string[]
 	): Promise<ReadonlyArray<any> | undefined>;
 
 	/**
@@ -396,9 +463,9 @@ export interface TypeScriptWorker {
 
 	/**
 	 * Get outline entries for the item at the given position in the file.
-	 * @returns `Promise<typescript.NavigationBarItem[]>`
+	 * @returns `Promise<typescript.NavigationTree | undefined>`
 	 */
-	getNavigationBarItems(fileName: string): Promise<any[]>;
+	getNavigationTree(fileName: string): Promise<any | undefined>;
 
 	/**
 	 * Get changes which should be applied to format the given file.
@@ -491,12 +558,14 @@ class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
 	private _workerOptions!: WorkerOptions;
 	private _onDidExtraLibsChangeTimeout: number;
 	private _inlayHintsOptions!: InlayHintsOptions;
+	private _modeConfiguration!: ModeConfiguration;
 
 	constructor(
 		compilerOptions: CompilerOptions,
 		diagnosticsOptions: DiagnosticsOptions,
 		workerOptions: WorkerOptions,
-		inlayHintsOptions: InlayHintsOptions
+		inlayHintsOptions: InlayHintsOptions,
+		modeConfiguration: ModeConfiguration
 	) {
 		this._extraLibs = Object.create(null);
 		this._removedExtraLibs = Object.create(null);
@@ -505,6 +574,7 @@ class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
 		this.setDiagnosticsOptions(diagnosticsOptions);
 		this.setWorkerOptions(workerOptions);
 		this.setInlayHintsOptions(inlayHintsOptions);
+		this.setModeConfiguration(modeConfiguration);
 		this._onDidExtraLibsChangeTimeout = -1;
 	}
 
@@ -516,6 +586,10 @@ class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
 		return this._onDidExtraLibsChange.event;
 	}
 
+	get modeConfiguration(): ModeConfiguration {
+		return this._modeConfiguration;
+	}
+
 	get workerOptions(): WorkerOptions {
 		return this._workerOptions;
 	}
@@ -650,22 +724,45 @@ class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
 	getEagerModelSync() {
 		return this._eagerModelSync;
 	}
+
+	setModeConfiguration(modeConfiguration: ModeConfiguration): void {
+		this._modeConfiguration = modeConfiguration || Object.create(null);
+		this._onDidChange.fire(undefined);
+	}
 }
 
 export const typescriptVersion: string = tsversion;
 
+const modeConfigurationDefault: Required<ModeConfiguration> = {
+	completionItems: true,
+	hovers: true,
+	documentSymbols: true,
+	definitions: true,
+	references: true,
+	documentHighlights: true,
+	rename: true,
+	diagnostics: true,
+	documentRangeFormattingEdits: true,
+	signatureHelp: true,
+	onTypeFormattingEdits: true,
+	codeActions: true,
+	inlayHints: true
+};
+
 export const typescriptDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl(
 	{ allowNonTsExtensions: true, target: ScriptTarget.Latest },
 	{ noSemanticValidation: false, noSyntaxValidation: false, onlyVisible: false },
 	{},
-	{}
+	{},
+	modeConfigurationDefault
 );
 
 export const javascriptDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl(
 	{ allowNonTsExtensions: true, allowJs: true, target: ScriptTarget.Latest },
 	{ noSemanticValidation: true, noSyntaxValidation: false, onlyVisible: false },
 	{},
-	{}
+	{},
+	modeConfigurationDefault
 );
 
 export const getTypeScriptWorker = (): Promise<(...uris: Uri[]) => Promise<TypeScriptWorker>> => {

+ 119 - 32
src/language/typescript/tsMode.ts

@@ -7,7 +7,7 @@ import { WorkerManager } from './workerManager';
 import type { TypeScriptWorker } from './tsWorker';
 import { LanguageServiceDefaults } from './monaco.contribution';
 import * as languageFeatures from './languageFeatures';
-import { languages, Uri } from '../../fillers/monaco-editor-core';
+import { languages, IDisposable, Uri } from '../../fillers/monaco-editor-core';
 
 let javaScriptWorker: (...uris: Uri[]) => Promise<TypeScriptWorker>;
 let typeScriptWorker: (...uris: Uri[]) => Promise<TypeScriptWorker>;
@@ -44,46 +44,133 @@ function setupMode(
 	defaults: LanguageServiceDefaults,
 	modeId: string
 ): (...uris: Uri[]) => Promise<TypeScriptWorker> {
+	const disposables: IDisposable[] = [];
+	const providers: IDisposable[] = [];
+
 	const client = new WorkerManager(modeId, defaults);
+	disposables.push(client);
+
 	const worker = (...uris: Uri[]): Promise<TypeScriptWorker> => {
 		return client.getLanguageServiceWorker(...uris);
 	};
 
 	const libFiles = new languageFeatures.LibFiles(worker);
 
-	languages.registerCompletionItemProvider(modeId, new languageFeatures.SuggestAdapter(worker));
-	languages.registerSignatureHelpProvider(
-		modeId,
-		new languageFeatures.SignatureHelpAdapter(worker)
-	);
-	languages.registerHoverProvider(modeId, new languageFeatures.QuickInfoAdapter(worker));
-	languages.registerDocumentHighlightProvider(
-		modeId,
-		new languageFeatures.OccurrencesAdapter(worker)
-	);
-	languages.registerDefinitionProvider(
-		modeId,
-		new languageFeatures.DefinitionAdapter(libFiles, worker)
-	);
-	languages.registerReferenceProvider(
-		modeId,
-		new languageFeatures.ReferenceAdapter(libFiles, worker)
-	);
-	languages.registerDocumentSymbolProvider(modeId, new languageFeatures.OutlineAdapter(worker));
-	languages.registerDocumentRangeFormattingEditProvider(
-		modeId,
-		new languageFeatures.FormatAdapter(worker)
-	);
-	languages.registerOnTypeFormattingEditProvider(
-		modeId,
-		new languageFeatures.FormatOnTypeAdapter(worker)
-	);
-	languages.registerCodeActionProvider(modeId, new languageFeatures.CodeActionAdaptor(worker));
-	languages.registerRenameProvider(modeId, new languageFeatures.RenameAdapter(libFiles, worker));
-	languages.registerInlayHintsProvider(modeId, new languageFeatures.InlayHintsAdapter(worker));
-	new languageFeatures.DiagnosticsAdapter(libFiles, defaults, modeId, worker);
+	function registerProviders(): void {
+		const { modeConfiguration } = defaults;
+
+		disposeAll(providers);
+
+		if (modeConfiguration.completionItems) {
+			providers.push(
+				languages.registerCompletionItemProvider(
+					modeId,
+					new languageFeatures.SuggestAdapter(worker)
+				)
+			);
+		}
+		if (modeConfiguration.signatureHelp) {
+			providers.push(
+				languages.registerSignatureHelpProvider(
+					modeId,
+					new languageFeatures.SignatureHelpAdapter(worker)
+				)
+			);
+		}
+		if (modeConfiguration.hovers) {
+			providers.push(
+				languages.registerHoverProvider(modeId, new languageFeatures.QuickInfoAdapter(worker))
+			);
+		}
+		if (modeConfiguration.documentHighlights) {
+			providers.push(
+				languages.registerDocumentHighlightProvider(
+					modeId,
+					new languageFeatures.DocumentHighlightAdapter(worker)
+				)
+			);
+		}
+		if (modeConfiguration.definitions) {
+			providers.push(
+				languages.registerDefinitionProvider(
+					modeId,
+					new languageFeatures.DefinitionAdapter(libFiles, worker)
+				)
+			);
+		}
+		if (modeConfiguration.references) {
+			providers.push(
+				languages.registerReferenceProvider(
+					modeId,
+					new languageFeatures.ReferenceAdapter(libFiles, worker)
+				)
+			);
+		}
+		if (modeConfiguration.documentSymbols) {
+			providers.push(
+				languages.registerDocumentSymbolProvider(
+					modeId,
+					new languageFeatures.OutlineAdapter(worker)
+				)
+			);
+		}
+		if (modeConfiguration.rename) {
+			providers.push(
+				languages.registerRenameProvider(
+					modeId,
+					new languageFeatures.RenameAdapter(libFiles, worker)
+				)
+			);
+		}
+		if (modeConfiguration.documentRangeFormattingEdits) {
+			providers.push(
+				languages.registerDocumentRangeFormattingEditProvider(
+					modeId,
+					new languageFeatures.FormatAdapter(worker)
+				)
+			);
+		}
+		if (modeConfiguration.onTypeFormattingEdits) {
+			providers.push(
+				languages.registerOnTypeFormattingEditProvider(
+					modeId,
+					new languageFeatures.FormatOnTypeAdapter(worker)
+				)
+			);
+		}
+		if (modeConfiguration.codeActions) {
+			providers.push(
+				languages.registerCodeActionProvider(modeId, new languageFeatures.CodeActionAdaptor(worker))
+			);
+		}
+		if (modeConfiguration.inlayHints) {
+			providers.push(
+				languages.registerInlayHintsProvider(modeId, new languageFeatures.InlayHintsAdapter(worker))
+			);
+		}
+		if (modeConfiguration.diagnostics) {
+			providers.push(new languageFeatures.DiagnosticsAdapter(libFiles, defaults, modeId, worker));
+		}
+	}
+
+	registerProviders();
+
+	disposables.push(asDisposable(providers));
+
+	//return asDisposable(disposables);
+
 	return worker;
 }
 
+function asDisposable(disposables: IDisposable[]): IDisposable {
+	return { dispose: () => disposeAll(disposables) };
+}
+
+function disposeAll(disposables: IDisposable[]) {
+	while (disposables.length) {
+		disposables.pop()!.dispose();
+	}
+}
+
 export { WorkerManager } from './workerManager';
 export * from './languageFeatures';

+ 14 - 12
src/language/typescript/tsWorker.ts

@@ -38,7 +38,7 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
 	private _extraLibs: IExtraLibs = Object.create(null);
 	private _languageService = ts.createLanguageService(this);
 	private _compilerOptions: ts.CompilerOptions;
-	private _inlayHintsOptions?: ts.InlayHintsOptions;
+	private _inlayHintsOptions?: ts.UserPreferences;
 
 	constructor(ctx: worker.IWorkerContext, createData: ICreateData) {
 		this._ctx = ctx;
@@ -70,7 +70,8 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
 	private _getModel(fileName: string): worker.IMirrorModel | null {
 		let models = this._ctx.getMirrorModels();
 		for (let i = 0; i < models.length; i++) {
-			if (models[i].uri.toString() === fileName) {
+			const uri = models[i].uri;
+			if (uri.toString() === fileName || uri.toString(true) === fileName) {
 				return models[i];
 			}
 		}
@@ -298,14 +299,15 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
 		return this._languageService.getQuickInfoAtPosition(fileName, position);
 	}
 
-	async getOccurrencesAtPosition(
+	async getDocumentHighlights(
 		fileName: string,
-		position: number
-	): Promise<ReadonlyArray<ts.ReferenceEntry> | undefined> {
+		position: number,
+		filesToSearch: string[]
+	): Promise<ReadonlyArray<ts.DocumentHighlights> | undefined> {
 		if (fileNameIsLib(fileName)) {
 			return undefined;
 		}
-		return this._languageService.getOccurrencesAtPosition(fileName, position);
+		return this._languageService.getDocumentHighlights(fileName, position, filesToSearch);
 	}
 
 	async getDefinitionAtPosition(
@@ -328,11 +330,11 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
 		return this._languageService.getReferencesAtPosition(fileName, position);
 	}
 
-	async getNavigationBarItems(fileName: string): Promise<ts.NavigationBarItem[]> {
+	async getNavigationTree(fileName: string): Promise<ts.NavigationTree | undefined> {
 		if (fileNameIsLib(fileName)) {
-			return [];
+			return undefined;
 		}
-		return this._languageService.getNavigationBarItems(fileName);
+		return this._languageService.getNavigationTree(fileName);
 	}
 
 	async getFormattingEditsForDocument(
@@ -443,7 +445,7 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
 		if (fileNameIsLib(fileName)) {
 			return [];
 		}
-		const preferences: ts.InlayHintsOptions = this._inlayHintsOptions ?? {};
+		const preferences: ts.UserPreferences = this._inlayHintsOptions ?? {};
 		const span: ts.TextSpan = {
 			start,
 			length: end - start
@@ -461,7 +463,7 @@ export interface ICreateData {
 	compilerOptions: ts.CompilerOptions;
 	extraLibs: IExtraLibs;
 	customWorkerPath?: string;
-	inlayHintsOptions?: ts.InlayHintsOptions;
+	inlayHintsOptions?: ts.UserPreferences;
 }
 
 /** The shape of the factory */
@@ -486,7 +488,7 @@ export function create(ctx: worker.IWorkerContext, createData: ICreateData): Typ
 				'Monaco is not using webworkers for background tasks, and that is needed to support the customWorkerPath flag'
 			);
 		} else {
-			importScripts(createData.customWorkerPath);
+			self.importScripts(createData.customWorkerPath);
 
 			const workerFactoryFunc: CustomTSWebWorkerFactory | undefined = self.customTSWorkerFactory;
 			if (!workerFactoryFunc) {

+ 39 - 51
src/language/typescript/workerManager.ts

@@ -8,8 +8,6 @@ import type { TypeScriptWorker } from './tsWorker';
 import { editor, Uri, IDisposable } from '../../fillers/monaco-editor-core';
 
 export class WorkerManager {
-	private _modeId: string;
-	private _defaults: LanguageServiceDefaults;
 	private _configChangeListener: IDisposable;
 	private _updateExtraLibsToken: number;
 	private _extraLibsChangeListener: IDisposable;
@@ -17,9 +15,10 @@ export class WorkerManager {
 	private _worker: editor.MonacoWebWorker<TypeScriptWorker> | null;
 	private _client: Promise<TypeScriptWorker> | null;
 
-	constructor(modeId: string, defaults: LanguageServiceDefaults) {
-		this._modeId = modeId;
-		this._defaults = defaults;
+	constructor(
+		private readonly _modeId: string,
+		private readonly _defaults: LanguageServiceDefaults
+	) {
 		this._worker = null;
 		this._client = null;
 		this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker());
@@ -29,6 +28,12 @@ export class WorkerManager {
 		);
 	}
 
+	dispose(): void {
+		this._configChangeListener.dispose();
+		this._extraLibsChangeListener.dispose();
+		this._stopWorker();
+	}
+
 	private _stopWorker(): void {
 		if (this._worker) {
 			this._worker.dispose();
@@ -37,12 +42,6 @@ export class WorkerManager {
 		this._client = null;
 	}
 
-	dispose(): void {
-		this._configChangeListener.dispose();
-		this._extraLibsChangeListener.dispose();
-		this._stopWorker();
-	}
-
 	private async _updateExtraLibs(): Promise<void> {
 		if (!this._worker) {
 			return;
@@ -58,56 +57,45 @@ export class WorkerManager {
 
 	private _getClient(): Promise<TypeScriptWorker> {
 		if (!this._client) {
-			this._worker = editor.createWebWorker<TypeScriptWorker>({
-				// module that exports the create() method and returns a `TypeScriptWorker` instance
-				moduleId: 'vs/language/typescript/tsWorker',
-
-				label: this._modeId,
+			this._client = (async () => {
+				this._worker = editor.createWebWorker<TypeScriptWorker>({
+					// module that exports the create() method and returns a `TypeScriptWorker` instance
+					moduleId: 'vs/language/typescript/tsWorker',
 
-				keepIdleModels: true,
-
-				// passed in to the create() method
-				createData: {
-					compilerOptions: this._defaults.getCompilerOptions(),
-					extraLibs: this._defaults.getExtraLibs(),
-					customWorkerPath: this._defaults.workerOptions.customWorkerPath,
-					inlayHintsOptions: this._defaults.inlayHintsOptions
-				}
-			});
+					label: this._modeId,
 
-			let p = <Promise<TypeScriptWorker>>this._worker.getProxy();
+					keepIdleModels: true,
 
-			if (this._defaults.getEagerModelSync()) {
-				p = p.then((worker) => {
-					if (this._worker) {
-						return this._worker.withSyncedResources(
-							editor
-								.getModels()
-								.filter((model) => model.getLanguageId() === this._modeId)
-								.map((model) => model.uri)
-						);
+					// passed in to the create() method
+					createData: {
+						compilerOptions: this._defaults.getCompilerOptions(),
+						extraLibs: this._defaults.getExtraLibs(),
+						customWorkerPath: this._defaults.workerOptions.customWorkerPath,
+						inlayHintsOptions: this._defaults.inlayHintsOptions
 					}
-					return worker;
 				});
-			}
 
-			this._client = p;
+				if (this._defaults.getEagerModelSync()) {
+					return await this._worker.withSyncedResources(
+						editor
+							.getModels()
+							.filter((model) => model.getLanguageId() === this._modeId)
+							.map((model) => model.uri)
+					);
+				}
+
+				return await this._worker.getProxy();
+			})();
 		}
 
 		return this._client;
 	}
 
-	getLanguageServiceWorker(...resources: Uri[]): Promise<TypeScriptWorker> {
-		let _client: TypeScriptWorker;
-		return this._getClient()
-			.then((client) => {
-				_client = client;
-			})
-			.then((_) => {
-				if (this._worker) {
-					return this._worker.withSyncedResources(resources);
-				}
-			})
-			.then((_) => _client);
+	async getLanguageServiceWorker(...resources: Uri[]): Promise<TypeScriptWorker> {
+		const client = await this._getClient();
+		if (this._worker) {
+			await this._worker.withSyncedResources(resources);
+		}
+		return client;
 	}
 }

+ 5 - 2
src/tsconfig.json

@@ -4,8 +4,11 @@
 		"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"],
 		"module": "amd",
 		"moduleResolution": "node",
-		"outDir": "../out/amd",
+		"outDir": "../out/languages/amd-tsc",
 		"strict": true,
-		"target": "es5"
+		"target": "es5",
+		"sourceMap": true,
+		"allowJs": true,
+		"checkJs": false
 	}
 }

+ 2 - 2
test/smoke/amd.html → test/smoke/amd/index.html

@@ -5,11 +5,11 @@
 	</head>
 	<body>
 		<div id="editor-container" style="position: absolute; width: 500px; height: 400px"></div>
-		<script src="../../release/dev/vs/loader.js"></script>
+		<script src="../../../out/monaco-editor/dev/vs/loader.js"></script>
 		<script>
 			require.config({
 				paths: {
-					vs: '../../release/dev/vs'
+					vs: '../../../out/monaco-editor/dev/vs'
 				}
 			});
 			require(['vs/editor/editor.main'], () => {

+ 6 - 1
test/smoke/common.js

@@ -3,4 +3,9 @@
  *  Licensed under the MIT License. See License.txt in the project root for license information.
  *--------------------------------------------------------------------------------------------*/
 
-exports.PORT = 8563;
+/* keeping TS happy */
+exports.__nothing = undefined;
+
+/** @typedef {'chromium'|'firefox'|'webkit'} BrowserKind */
+/** @typedef {'amd'|'webpack'|'esbuild'|'vite'|'parcel'} PackagerKind */
+/** @typedef {{browser:BrowserKind; packager:PackagerKind; debugTests:boolean; port:number;}} TestInfo */

+ 0 - 0
test/smoke/esbuild/esbuild.html → test/smoke/esbuild/index.html


+ 6 - 1
test/smoke/esbuild/index.js

@@ -1,4 +1,9 @@
-import * as monaco from '../../../release/esm/vs/editor/editor.main.js';
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+
+import * as monaco from '../../../out/monaco-editor/esm/vs/editor/editor.main.js';
 
 self.MonacoEnvironment = {
 	getWorkerUrl: function (moduleId, label) {

+ 5 - 3
test/smoke/package-esbuild.ts

@@ -7,7 +7,7 @@ import * as esbuild from 'esbuild';
 import * as path from 'path';
 import { removeDir } from '../../build/fs';
 
-removeDir('test/smoke/esbuild/out', (entry) => /esbuild.html$/.test(entry));
+removeDir('test/smoke/esbuild/out');
 
 const workerEntryPoints = [
 	'vs/language/json/json.worker.js',
@@ -18,11 +18,13 @@ const workerEntryPoints = [
 ];
 
 build({
-	entryPoints: workerEntryPoints.map((entry) => path.join(__dirname, `../../release/esm/${entry}`)),
+	entryPoints: workerEntryPoints.map((entry) =>
+		path.join(__dirname, `../../out/monaco-editor/esm/${entry}`)
+	),
 	bundle: true,
 	format: 'iife',
 	logLevel: 'silent',
-	outbase: path.join(__dirname, '../../release/esm/'),
+	outbase: path.join(__dirname, '../../out/monaco-editor/esm/'),
 	outdir: path.join(__dirname, 'esbuild/out')
 });
 

+ 19 - 0
test/smoke/package-vite.ts

@@ -0,0 +1,19 @@
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+
+import * as vite from 'vite';
+import * as path from 'path';
+
+async function main() {
+	await vite.build({
+		root: path.resolve(__dirname, './vite/'),
+		base: '/test/smoke/vite/dist/',
+		build: {
+			minify: false
+		}
+	});
+}
+
+main();

+ 56 - 0
test/smoke/package-webpack.ts

@@ -0,0 +1,56 @@
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+
+import webpack from 'webpack';
+import MonacoWebpackPlugin from '../../webpack-plugin/out/index.js';
+import * as path from 'path';
+
+const REPO_ROOT = path.join(__dirname, '../../');
+const CROSS_ORIGIN_ASSETS = process.argv.includes('--cross-origin');
+
+webpack(
+	{
+		mode: 'development',
+		entry: './index.js',
+		context: path.join(__dirname, 'webpack'),
+		output: {
+			path: path.resolve(REPO_ROOT, 'test/smoke/webpack/out'),
+			filename: 'app.js',
+			publicPath: CROSS_ORIGIN_ASSETS
+				? 'http://localhost:8088/monaco-editor/test/smoke/webpack/out/'
+				: undefined
+		},
+		resolve: {
+			alias: {
+				'monaco-editor': path.resolve(REPO_ROOT, 'out/monaco-editor')
+			}
+		},
+		module: {
+			rules: [
+				{
+					test: /\.css$/,
+					use: ['style-loader', 'css-loader']
+				},
+				{
+					test: /\.ttf$/,
+					use: ['file-loader']
+				}
+			]
+		},
+		plugins: [<any>new MonacoWebpackPlugin({
+				monacoEditorPath: path.resolve(REPO_ROOT, 'out/monaco-editor')
+			})]
+	},
+	(err: Error | undefined, stats: webpack.Stats | undefined) => {
+		if (err) {
+			console.error(err);
+			process.exit(1);
+		}
+		if (stats && stats.hasErrors()) {
+			console.log(stats.compilation.errors);
+			process.exit(1);
+		}
+	}
+);

+ 11 - 0
test/smoke/parcel/index.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+	</head>
+	<body>
+		<div id="editor-container" style="width: 800px; height: 600px; border: 1px solid #ccc"></div>
+
+		<script type="module" src="index.js"></script>
+	</body>
+</html>

+ 41 - 0
test/smoke/parcel/index.js

@@ -0,0 +1,41 @@
+import * as monaco from '../../../out/monaco-editor/esm/vs/editor/editor.main.js';
+
+self.MonacoEnvironment = {
+	getWorker: function (moduleId, label) {
+		if (label === 'json') {
+			return new Worker(
+				new URL('../../../out/monaco-editor/esm/vs/language/json/json.worker.js', import.meta.url),
+				{ type: 'module' }
+			);
+		}
+		if (label === 'css' || label === 'scss' || label === 'less') {
+			return new Worker(
+				new URL('../../../out/monaco-editor/esm/vs/language/css/css.worker.js', import.meta.url),
+				{ type: 'module' }
+			);
+		}
+		if (label === 'html' || label === 'handlebars' || label === 'razor') {
+			return new Worker(
+				new URL('../../../out/monaco-editor/esm/vs/language/html/html.worker.js', import.meta.url),
+				{ type: 'module' }
+			);
+		}
+		if (label === 'typescript' || label === 'javascript') {
+			return new Worker(
+				new URL(
+					'../../../out/monaco-editor/esm/vs/language/typescript/ts.worker.js',
+					import.meta.url
+				),
+				{ type: 'module' }
+			);
+		}
+		return new Worker(
+			new URL('../../../out/monaco-editor/esm/vs/editor/editor.worker.js', import.meta.url),
+			{
+				type: 'module'
+			}
+		);
+	}
+};
+
+window.monacoAPI = monaco;

+ 6 - 0
test/smoke/parcel/package.json

@@ -0,0 +1,6 @@
+{
+	"name": "parcel-smoketest",
+	"scripts": {
+		"package-for-smoketest-parcel": "parcel build ./index.html --cache-dir ./.cache --public-url /test/smoke/parcel/dist/ --no-optimize"
+	}
+}

+ 22 - 12
test/smoke/runner.js

@@ -9,10 +9,14 @@ const yaserver = require('yaserver');
 const http = require('http');
 const cp = require('child_process');
 const path = require('path');
-const { PORT } = require('./common');
-const DEBUG_TESTS = process.argv.includes('--debug-tests');
 
+/** @typedef {import('./common').BrowserKind} BrowserKind */
+/** @typedef {import('./common').PackagerKind} PackagerKind */
+/** @typedef {import('./common').TestInfo} TestInfo */
+
+const DEBUG_TESTS = process.argv.includes('--debug-tests');
 const REPO_ROOT = path.join(__dirname, '../../');
+const PORT = 8563;
 
 yaserver
 	.createServer({
@@ -37,25 +41,31 @@ yaserver
 async function runTests() {
 	// uncomment to shortcircuit and run a specific combo
 	// await runTest('webpack', 'chromium'); return;
+	/** @type {PackagerKind[]} */
+	const testTypes = ['amd', 'webpack', 'esbuild', 'vite', 'parcel'];
 
-	for (const type of ['amd', 'webpack' /*, 'esbuild'*/]) {
+	for (const type of testTypes) {
 		await runTest(type, 'chromium');
 		await runTest(type, 'firefox');
-		// await runTest(type, 'webkit');
+		await runTest(type, 'webkit');
 	}
 }
 
 /**
- * @param {string} type
- * @param {'chromium'|'firefox'|'webkit'} browser
+ * @param {PackagerKind} packager
+ * @param {BrowserKind} browser
  * @returns
  */
-function runTest(type, browser) {
+function runTest(packager, browser) {
 	return new Promise((resolve, reject) => {
-		const env = { BROWSER: browser, TESTS_TYPE: type, ...process.env };
-		if (DEBUG_TESTS) {
-			env['DEBUG_TESTS'] = 'true';
-		}
+		/** @type TestInfo */
+		const testInfo = {
+			browser,
+			packager,
+			debugTests: DEBUG_TESTS,
+			port: PORT
+		};
+		const env = { MONACO_TEST_INFO: JSON.stringify(testInfo), ...process.env };
 		const proc = cp.spawn(
 			'node',
 			[
@@ -74,7 +84,7 @@ function runTest(type, browser) {
 		proc.on('error', reject);
 		proc.on('exit', (code) => {
 			if (code === 0) {
-				resolve();
+				resolve(undefined);
 			} else {
 				reject(code);
 			}

+ 64 - 41
test/smoke/smoke.test.js

@@ -7,20 +7,24 @@
 
 const playwright = require('playwright');
 const { assert } = require('chai');
-const { PORT } = require('./common');
 
-const browserType = process.env.BROWSER || 'chromium';
-const DEBUG_TESTS = Boolean(process.env.DEBUG_TESTS || false);
-const TESTS_TYPE = process.env.TESTS_TYPE || 'amd';
+/** @typedef {import('./common').BrowserKind} BrowserKind */
+/** @typedef {import('./common').PackagerKind} PackagerKind */
+/** @typedef {import('./common').TestInfo} TestInfo */
 
-const URL =
-	TESTS_TYPE === 'amd'
-		? `http://127.0.0.1:${PORT}/test/smoke/amd.html`
-		: TESTS_TYPE === 'webpack'
-		? `http://127.0.0.1:${PORT}/test/smoke/webpack/webpack.html`
-		: `http://127.0.0.1:${PORT}/test/smoke/esbuild/esbuild.html`;
+/** @type TestInfo */
+const testInfo = JSON.parse(process.env.MONACO_TEST_INFO || '');
 
-suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
+const URLS = {
+	amd: `http://127.0.0.1:${testInfo.port}/test/smoke/amd/index.html`,
+	webpack: `http://127.0.0.1:${testInfo.port}/test/smoke/webpack/index.html`,
+	esbuild: `http://127.0.0.1:${testInfo.port}/test/smoke/esbuild/index.html`,
+	vite: `http://127.0.0.1:${testInfo.port}/test/smoke/vite/dist/index.html`,
+	parcel: `http://127.0.0.1:${testInfo.port}/test/smoke/parcel/dist/index.html`
+};
+const URL = URLS[testInfo.packager];
+
+suite(`Smoke Test '${testInfo.packager}' on '${testInfo.browser}'`, () => {
 	/** @type {playwright.Browser} */
 	let browser;
 
@@ -28,10 +32,10 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
 	let page;
 
 	suiteSetup(async () => {
-		browser = await playwright[browserType].launch({
-			headless: !DEBUG_TESTS,
-			devtools: DEBUG_TESTS && browserType === 'chromium'
-			// slowMo: DEBUG_TESTS ? 2000 : 0
+		browser = await playwright[testInfo.browser].launch({
+			headless: !testInfo.debugTests,
+			devtools: testInfo.debugTests && testInfo.browser === 'chromium'
+			// slowMo: testInfo.debugTests ? 2000 : 0
 		});
 	});
 
@@ -54,7 +58,9 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
 			pageErrors.push(e);
 		});
 		const response = await page.goto(URL);
-		assert.ok(!!response);
+		if (!response) {
+			assert.fail('Failed to load page');
+		}
 		assert.strictEqual(response.status(), 200);
 	});
 
@@ -89,7 +95,7 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
 
 	/**
 	 * @param {string} commandId
-	 * @param {any} args
+	 * @param {any} [args]
 	 * @returns Promise<void>
 	 */
 	async function triggerEditorCommand(commandId, args) {
@@ -102,11 +108,11 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
 		await page.evaluate(`window.ed.focus();`);
 	}
 
-	test('`monacoAPI` is exposed as global', async () => {
+	test('`monacoAPI` is exposed as global', async function () {
 		assert.strictEqual(await page.evaluate(`typeof monacoAPI`), 'object');
 	});
 
-	test('should be able to create plaintext editor', async () => {
+	test('should be able to create plaintext editor', async function () {
 		await createEditor('hello world', 'plaintext');
 
 		// type a link in it
@@ -117,45 +123,60 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
 		await page.waitForSelector('.detected-link');
 	});
 
-	test('css smoke test', async () => {
+	test('css smoke test', async function () {
 		await createEditor('.sel1 { background: red; }\\n.sel2 {}', 'css');
 
 		// check that a squiggle appears, which indicates that the language service is up and running
 		await page.waitForSelector('.squiggly-warning');
 	});
 
-	test('html smoke test', async () => {
+	test('html smoke test', async function () {
 		await createEditor('<title>hi</title>', 'html');
 
-		// trigger hover
-		await focusEditor();
-		await setEditorPosition(1, 3);
-		await page.keyboard.press('F1');
-		await page.keyboard.type('Show Hover');
-		await page.keyboard.press('Enter');
-
-		// check that a hover explaining the `<title>` element appears, which indicates that the language service is up and running
-		await page.waitForSelector(`text=The title element represents the document's title or name`);
+		// we need to try this a couple of times because the web worker might not be ready yet
+		for (let attempt = 1; attempt <= 2; attempt++) {
+			// trigger hover
+			await focusEditor();
+			await setEditorPosition(1, 3);
+			await page.keyboard.press('F1');
+			await page.keyboard.type('Show Hover');
+			await page.keyboard.press('Enter');
+
+			// check that a hover explaining the `<title>` element appears, which indicates that the language service is up and running
+			try {
+				await page.waitForSelector(
+					`text=The title element represents the document's title or name`,
+					{ timeout: 5000 }
+				);
+			} catch (err) {}
+		}
 	});
 
-	test('json smoke test', async () => {
+	test('json smoke test', async function () {
 		await createEditor('{}', 'json');
 
-		// trigger suggestions
-		await focusEditor();
-		await setEditorPosition(1, 2);
-		await triggerEditorCommand('editor.action.triggerSuggest');
-
-		// check that a suggestion item for `$schema` appears, which indicates that the language service is up and running
-		await page.waitForSelector(`text=$schema`);
+		// we need to try this a couple of times because the web worker might not be ready yet
+		for (let attempt = 1; attempt <= 2; attempt++) {
+			// trigger suggestions
+			await focusEditor();
+			await setEditorPosition(1, 2);
+			await triggerEditorCommand('editor.action.triggerSuggest');
+
+			// check that a suggestion item for `$schema` appears, which indicates that the language service is up and running
+			try {
+				await page.waitForSelector(`text=$schema`, { timeout: 5000 });
+			} catch (err) {}
+		}
 	});
 
-	test('typescript smoke test', async () => {
+	test('typescript smoke test', async function () {
 		await createEditor('window.add', 'typescript');
 
 		// check that a squiggle appears, which indicates that the language service is up and running
 		await page.waitForSelector('.squiggly-error');
 
+		// at this point we know that the web worker is healthy, so we can trigger suggestions
+
 		// trigger suggestions
 		await focusEditor();
 		await setEditorPosition(1, 11);
@@ -167,9 +188,11 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
 		// find the TypeScript worker
 		const tsWorker = page.workers().find((worker) => {
 			const url = worker.url();
-			return /ts\.worker\.js$/.test(url) || /workerMain.js#typescript$/.test(url);
+			return /ts\.worker(\.[a-f0-9]+)?\.js$/.test(url) || /workerMain.js#typescript$/.test(url);
 		});
-		assert.ok(!!tsWorker);
+		if (!tsWorker) {
+			assert.fail('Could not find TypeScript worker');
+		}
 
 		// check that the TypeScript worker exposes `ts` as a global
 		assert.strictEqual(await tsWorker.evaluate(`typeof ts`), 'object');

+ 10 - 0
test/smoke/vite/index.html

@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+	</head>
+	<body>
+		<div id="editor-container" style="position: absolute; width: 500px; height: 400px"></div>
+		<script type="module" src="index.js"></script>
+	</body>
+</html>

+ 31 - 0
test/smoke/vite/index.js

@@ -0,0 +1,31 @@
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+
+import * as monaco from '../../../out/monaco-editor/esm/vs/editor/editor.main';
+import editorWorker from '../../../out/monaco-editor/esm/vs/editor/editor.worker?worker';
+import jsonWorker from '../../../out/monaco-editor/esm/vs/language/json/json.worker?worker';
+import cssWorker from '../../../out/monaco-editor/esm/vs/language/css/css.worker?worker';
+import htmlWorker from '../../../out/monaco-editor/esm/vs/language/html/html.worker?worker';
+import tsWorker from '../../../out/monaco-editor/esm/vs/language/typescript/ts.worker?worker';
+
+self.MonacoEnvironment = {
+	getWorker(moduleId, label) {
+		if (label === 'json') {
+			return new jsonWorker();
+		}
+		if (label === 'css' || label === 'scss' || label === 'less') {
+			return new cssWorker();
+		}
+		if (label === 'html' || label === 'handlebars' || label === 'razor') {
+			return new htmlWorker();
+		}
+		if (label === 'typescript' || label === 'javascript') {
+			return new tsWorker();
+		}
+		return new editorWorker();
+	}
+};
+
+window.monacoAPI = monaco;

+ 0 - 0
test/smoke/webpack/webpack.html → test/smoke/webpack/index.html


+ 0 - 0
webpack-plugin/smoketest/index.js → test/smoke/webpack/index.js


+ 6 - 4
test/unit/all.js

@@ -6,8 +6,8 @@ const path = require('path');
 requirejs.config({
 	baseUrl: '',
 	paths: {
-		'vs/fillers/monaco-editor-core': 'out/amd/fillers/monaco-editor-core-amd',
-		'vs/basic-languages': 'out/amd/basic-languages',
+		'vs/fillers/monaco-editor-core': 'out/languages/amd-tsc/fillers/monaco-editor-core-amd',
+		'vs/basic-languages': 'out/languages/amd-tsc/basic-languages',
 		vs: './node_modules/monaco-editor-core/dev/vs'
 	},
 	nodeRequire: require
@@ -21,6 +21,7 @@ global.self = global;
 global.document.queryCommandSupported = function () {
 	return false;
 };
+global.UIEvent = tmp.window.UIEvent;
 
 global.window = {
 	location: {},
@@ -37,7 +38,7 @@ requirejs(
 	['test/unit/setup'],
 	function () {
 		glob(
-			'out/amd/basic-languages/*/*.test.js',
+			'out/languages/amd-tsc/basic-languages/*/*.test.js',
 			{ cwd: path.join(__dirname, '../../') },
 			function (err, files) {
 				if (err) {
@@ -45,7 +46,7 @@ requirejs(
 					return;
 				}
 				requirejs(
-					files.map((f) => f.replace(/^out\/amd/, 'vs').replace(/\.js$/, '')),
+					files.map((f) => f.replace(/^out\/languages\/amd-tsc/, 'vs').replace(/\.js$/, '')),
 					function () {
 						run(); // We can launch the tests!
 					},
@@ -58,5 +59,6 @@ requirejs(
 	},
 	function (err) {
 		console.log(err);
+		process.exit(1);
 	}
 );

部分文件因文件數量過多而無法顯示