Commit Graph

142 Commits

Author SHA1 Message Date
Matt Bierner
1eee7ae230 Switch monaco to off of moduleResolution: classic
Fixes #270408

Trying to move some of the monaco related checks/tconfigs off of `moduleResolution: classic`. This legacy config is causing a lot of pain while trying to update the trusted-types typings, which is itself blocking picking up the latest dompurify

I initially tried a more scoped change but just could not get it working. So instead I ended up trying to rework our `LanguageServiceHost` to be more standard
2025-10-10 16:02:03 -07:00
Henning Dieterichs
9989579497 Add marked/dompurify dependencies to monaco-editor-core dependencies to allow for downstream dependency tracking. (#266213) 2025-09-11 15:25:52 +00:00
Remco Haszing
c2f435a9bb Fix global access of MonacoEnvironment (#248075)
Fix global access of MonacoEnvironment

There are 3 ways to declare global variables in TypeScript.

1. A global `declare let`.
2. A global `declare var`.
3. Augmenting the global `Window`.

There are 4 ways to access global variables in the browser.

1. Using a global identifier.
2. Using the `globalThis` object.
3. Using the `window` object.
4. Using the `self` object.

Not all 3 types of global declarations work for all methods to access a
global.

|              | `let` | `var` | `Window` |
| ------------ | ----- | ----- | -------- |
| global       |   ✓   |   ✓   |          |
| `globalThis` |       |   ✓   |          |
| `window`     |       |   ✓   |    ✓     |
| `self`       |       |   ✓   |    ✓     |

So the proper way to declare the global `MonacoEnvironment`, is:

```ts
declare global var MonacoEnvironment: Environment | undefined
```

https://www.typescriptlang.org/play/?#code/PQgEB4CcFMDNpgOwMbVAGwJYCMC8AiAEwHsBbfUYAPgFgAoew6ZdAQxlAHN1jtX1QAb3qhRGaABdQAGUkAuUAGcJkTIk4ixAN3agAauwXLV6+ptFqJCWK1SgA6mpIB3IebGjHiIyrUa6HgC+9MEMdGDcvPygtqiKivSyEvQGkPReZuHAoM5OxK6ckvS5iC4AdEnFec5lqVWl+WUZYWAlLkpFdG2NSaC4oADkA-XlqX2Dw13VTWrjQ5kRPHzoACoAFpiKXJ2Ry+ubFTtL-PuKtez0uycbZ830i1GrNx3JdFdPB73982-HH2djb6Td6nGaIOaTe7ZRTQdCwbavGFww6I2Gwc5pOhI9F3LIdOEvejYlEQolojGkrHkryU+jQAAeAAdiJApIJAkA

---------

Co-authored-by: Henning Dieterichs <hdieterichs@microsoft.com>
2025-08-04 13:23:01 +00:00
Alex Dima
c36caf1bf7 EditorSimpleWorker -> EditorWebWorker 2025-03-21 10:13:39 +01:00
Alex Dima
46035d0296 Split up the editor's worker and the editor worker helper scripts, remove AMD support 2025-03-20 18:37:55 +01:00
Alex Dima
91f0cb7b90 Add nls info to monaco-editor-core and remove left-over AMD tasks 2025-03-20 14:53:50 +01:00
Alex Ross
39cf1ffb98 Adopt Tree-Sitter 0.25.1 (#239683)
* Adopt Tree-Sitter 0.25.1

* Update @vscode/tree-sitter-wasm

* Fix incorrect redirect
2025-02-05 17:58:39 +00:00
Matt Bierner
e2e048ded8 Merge pull request #230345 from microsoft/dev/eslint-9
Eslint 9 migration
2024-10-07 09:15:12 -07:00
Benjamin Pasero
dc265add0b esm - drop need for manual concat (#230571) 2024-10-06 14:12:20 +02:00
Matt Bierner
f22a1167e4 More fixes 2024-10-02 17:22:33 -07:00
Benjamin Pasero
c7caef00ea esm - make optimize.ts ESM only 2024-09-27 08:05:06 +02:00
Benjamin Pasero
b544846460 esm - further cleanup build scripts 2024-09-27 08:04:56 +02:00
Benjamin Pasero
eed219db5f ESM: figure out the monaco-standalone ESM build story (fix #227192) (#227536) 2024-09-06 18:26:40 +02:00
Robo
b5a6aa14a8 feat: switch to npm as default package manager (#226927)
* feat: move from yarn to npm

* chore: skip yarn.lock files

* fix: playwright download

* chore: fix compile and hygiene

* chore: bump vsce@2.17.0

Refs 8b49e9dfdf

* test: update results for bat and sh colorizer tests

* fix: add missing lock files for windows

* fix: switch to legacy-peer-deps

* chore: update markdown-it@14.1.0

Refs 737c95a129

esbuild step in extensions-ci-pr was previously using markdown-it
from root which had userland punycode and was able to compile successfully.

* ci: increase pr timeout for windows integration tests

* chore: fix product build

* build: ignore extension dev dependency for rcedit

* build: fix working directory inside container

* build: fix dependency generation

* npm: update dependencies

* ci: use global npmrc

* ci: update cache

* ci: setup global npmrc for private npm auth

* build: fix extension bundling

* chore: sync npm dependencies

* ci: debug env variables for container

* ci: fix win32 cli pipeline

* build: fix npmrc config usage for build/ and remote/ dirs

* fix: windows build

* fix: container builds

* fix: markdown-language-features tests and bundling

```
[03:58:22] Error: Command failed: /Users/demohan/.nvm/versions/node/v20.15.1/bin/node /Users/demohan/github/vscode/extensions/markdown-language-features/esbuild-notebook.js --outputRoot /Users/demohan/github/vscode/.build/extensions/markdown-language-features
✘ [ERROR] Could not resolve "punycode"

    extensions/markdown-language-features/node_modules/markdown-it/lib/index.js:14:27:
      14 │ var punycode     = require('punycode');
         ╵                            ~~~~~~~~~~

  The package "punycode" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
```

Adds userland package based on beed9aee2c

* fix: container builds for distro

* chore: update yarn occurrences

* fixup! chore: bump vsce@2.17.0

Uses the closest version to `main` branch that does not
include d3cc84cdec
while still having the fix 8b49e9dfdf

* chore: sync npm dependencies

* chore: sync npm dependencies

* chore: sync npm dependencies

* chore: throw error when yarn is used for installation

* chore: add review feedback

* chore: switch exec => run where needed

* chore: npm sync dependencies

* fix: markdown-language-features bundling

```
✘ [ERROR] Could not resolve "punycode"

    extensions/markdown-language-features/node_modules/markdown-it/lib/index.js:14:27:
      14 │ var punycode     = require('punycode');
         ╵                            ~~~~~~~~~~

  The package "punycode" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
```

Adds missing userland package based on markdown-it/markdown-it@beed9ae,
can be removed once we update markdown-it >= 14.1.0

* ci: rename no-yarn-lock-changes.yml

* chore: sync npm dependencies

* ci: restore no-yarn-lock-changes.yml

We can disable it in a separate PR to keep the required
checks happy and also need workflow edit perms.

* chore: sync npm dependencies

* ci: rebuild cache

* ci: fix no-package-lock-changes.yml

* chore: bump distro

* chore: rm yarn.lock files

* chore: rm yarn.lock files without dependencies

* chore: add vscode-selfhost-import-aid to postinstall dirs

* chore: bump distro
2024-09-06 22:18:02 +09:00
Alex Ross
977f832a30 Simple tree sitter based syntax highlighting for typescript (#225252)
* Simple tree sitter based syntax highlighting for typescript

Part of #210475

* Implement onceIf using filter

* Mix monaco

* Fix tests

* Switch back to classic

* PR feedback

* Fix bug causing test failure

* Update tree-sitter-wasm

* Fix monaco editor tree shaking

* Fix running monaco checks on Windows

* Use dummy tree sitter service in standalone

* PR feedback
2024-08-19 21:56:31 +02:00
Benjamin Pasero
d65fd5ba2e nls follow up debt work (#219265) 2024-07-01 11:44:19 +02:00
Benjamin Pasero
2014f1ddb2 nls - removal of loader plugin (#219098) 2024-06-28 15:45:52 +02:00
Benjamin Pasero
f6f90e0163 Implement NLS without AMD loader (#214588) 2024-06-28 11:55:48 +02:00
Henning Dieterichs
f26376f1f5 Removes unneeded monaco-editor-esm-bundle 2023-11-15 19:41:53 +01:00
Henning Dieterichs
ebe458556d Don't mangle fields for the monaco editor, FYI @jrieken (#177223) 2023-03-15 14:46:23 +01:00
Connor Peet
18f743d534 address pr comments 2022-10-05 12:56:07 -07:00
Benjamin Pasero
9db57e76e9 Build: bundle / concat entry points (#161161)
* perf - concatenate windows main files

* Revert "Revert "Use `esbuild` to bundle some CommonJS main files (#160957)" (#161118)"

This reverts commit 84c46b71a5.

* build - exclude server main files

* build - make concat a task that runs like the others

* some renames

* Avoid overwriting the nodejs closure require

* Revert "build - exclude server main files"

This reverts commit 736516624e.

Co-authored-by: Alex Dima <alexdima@microsoft.com>
2022-09-21 00:38:44 -07:00
Benjamin Pasero
84c46b71a5 Revert "Use esbuild to bundle some CommonJS main files (#160957)" (#161118)
This reverts commit 2179e52fb9.
2022-09-16 09:31:44 -07:00
Benjamin Pasero
2179e52fb9 Use esbuild to bundle some CommonJS main files (#160957)
* ensure node.js `require` is captured

* optimize `main.js` and `cli.js`

* cleanup

* leave out bundled files

* drop package.json from userdata paths

* fix web task

* fix editor distro

* inline version into `product.json`

* also bundle server

* t

* actually do server too

* Keep bundling nls in editor worker

Co-authored-by: Alex Dima <alexdima@microsoft.com>
2022-09-16 05:24:23 -07:00
Johannes
214e276bd5 have compilation#transpileTask as a separate place for tweaks 2022-06-23 17:32:20 +02:00
Tyler James Leonhardt
bce2e61e04 Allow nls in the base worker (#152887)
* Add localize call to platform

* Allow to use nls in the base worker

Co-authored-by: Alex Dima <alexdima@microsoft.com>
2022-06-22 12:30:09 -07:00
Alexandru Dima
252c65540d Adopt the same export patterns in vs/css as in vs/nls and bring over tests (#152396)
* Adopt the same export patterns in `vs/css` as in `vs/nls` and bring over tests

* Fix problem with loading nodejs modules
2022-06-17 17:12:27 +02:00
Alexandru Dima
9db5a3674e Bring the nls loader plugin into our sources (#152338) 2022-06-16 22:01:19 +02:00
Alexandru Dima
d132489cd0 Bring the css loader plugin into our sources (#152205) 2022-06-15 16:53:02 +02:00
Johannes Rieken
9e21aff42e joh/ts transpile (#152199)
transpile-only tasks for client and extensions

* extract transpile into its own file
* add transpile-client task, polish transpiler
* add transpile-extensions, improve transpile logic
* move declaration of "const enum" above it usage so that it can be used with const-enum-inlining
* (ugly) make d.ts transpilation configurable because it is needed for extensions but a problem for client
* hack my way around so that `getOwnEmitOutputFilePath` is reusable by our transpile
* honor `noEmit` flag
2022-06-15 16:52:48 +02:00
Alexandru Dima
5e7d488b7c Improve error message when a module cannot be bundled and exclude vs/nls from bundles (#152188) 2022-06-15 12:51:27 +00:00
Johannes
0656d21d11 auto-fixed prefer-const violation 2022-06-08 17:49:21 +02:00
Matt Bierner
f71bd27ec9 Adding type annotations 2022-02-28 14:32:12 -08:00
Alex Dima
bd369c638e Add check that the editor's ESM JS files can be loaded in a browser 2022-01-25 15:19:30 +01:00
Alex Dima
3860b772e4 Revert "Simplify external .d.ts"
This reverts commit 65b10df98f.

See https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require
2021-10-08 16:58:02 +02:00
Alex Dima
65b10df98f Simplify external .d.ts 2021-10-08 08:51:26 +02:00
Alex Dima
96353e2bcf Fix typo 2021-09-28 14:14:06 +02:00
Alex Dima
8d3ce8d7f5 Fix the transformation to an external module .d.ts 2021-09-21 17:20:30 +02:00
João Moreno
980becda8d main rename
fixes #116341
2021-02-14 20:10:24 +01:00
Alexandru Dima
c1eb24b027 Load expensive node modules lazily 2020-12-22 19:55:56 +01:00
Martin Aeschlimann
542a82754c yarn watch: save errors in separate files, make error regex multiline aware 2020-11-20 14:06:42 +01:00
Alex Dima
dd6bd3ae6a Reduce the number of folders where we use TS 2020-09-24 17:39:48 +02:00
ChaseKnowlden
e8760a5d6c Fix capitalization of GitHub org 2020-09-17 11:43:03 +02:00
Alex Dima
4578463f90 Do not tree shake interfaces or classes that extend or inherit from symbols defined in the default library 2020-05-08 14:41:03 +02:00
Martin Aeschlimann
ec02bcd1cc codicon definitions in browser/ui/codicon/codicon 2020-04-17 13:39:54 +02:00
Matt Bierner
273a4a389d Convert most ts-ignore-calls to ts-expect-error (#93617)
Changes over to use ts-expect-error: https://devblogs.microsoft.com/typescript/announcing-typescript-3-9-beta/#ts-expect-error-comments

This revealed a number of places where we no longer need to supress errors
2020-03-30 17:31:37 -07:00
Alex Dima
ee64b77af9 Reduce noise in diff and use files with the same absolute imports when troubleshooting treeshaking 2020-03-05 10:25:06 +01:00
Alex Dima
58bdc8aecb Improve troubleshooting treeshaking failures 2020-03-05 10:25:06 +01:00
Johannes Rieken
02f23e5680 remove polyfill promise 2020-03-02 15:30:43 +01:00
Johannes Rieken
27bc032975 nuke special lib options and use compiler option's lib instead 2020-03-02 13:44:22 +01:00