Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code splitting #416

Merged
merged 12 commits into from
Apr 29, 2024
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"api": "always",
"all": "always",
"main": "always",
"save": "always"
"save": "always",
"service": "always"
}
],
"@typescript-eslint/no-unused-vars": [
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ npm install -D @types/vscode

## Troubleshooting

### `process` node builtin

Since v1.86, VSCode detects its running environment by checking if a global variable `process` exists.
For backward compatibility reasons or to be able to use node libraries in the browser, bundlers can be configured to inject a polyfill for it.
Doing so may create unexpected behaviors and crashes.

Make sure `typeof process === 'undefined'` returns true when using this library.

### If you use Webpack

Starting from v2, [monaco-editor-webpack-plugin](https://www.npmjs.com/package/monaco-editor-webpack-plugin) can't be used
Expand Down Expand Up @@ -119,6 +111,8 @@ Additionally, several packages that include the VSCode version of some services

- **Base** (included by default): `@codingame/monaco-vscode-base-service-override`
- Contains some general-use services that are mandatory to most of the other features
- **Monarch**:
- When textmate and theme service overrides are not used, it allows to restore some standalone features (Token inspection and toggle high contrast commands)
- **Host** (included by default): `@codingame/monaco-vscode-host-service-override`
- Interaction with the host/browser (shutdown veto, focus/active management, window opening, fullscreen...)
- **Extensions** (included by default): `@codingame/monaco-vscode-extensions-service-override`
Expand Down
18 changes: 15 additions & 3 deletions demo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"commit": "e170252f762678dec6ca2cc69aba1570769a5d39"
},
"monaco": {
"ref": "v0.47.0",
"version": "0.47.0"
"ref": "v0.48.0",
"version": "0.48.0"
}
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions rollup/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ export default (args: Record<string, string>): rollup.RollupOptions[] => {
VSCODE_VERSION: JSON.stringify(vscodeVersion),
VSCODE_REF: JSON.stringify(vscodeRef),
VSCODE_COMMIT: JSON.stringify(vscodeCommit),
'globalThis.require': 'undefined',
preventAssignment: true
}),
(() => {
Expand Down
3 changes: 3 additions & 0 deletions scripts/install-vscode
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ cd build
yarn install --ignore-engines
cd ..

echo "Extracting service identifiers"
node build/lib/extractServices.js

## Change shake level from ClassMembers to Files to speed up build
sed -i'' -e 's/shakeLevel: 2/shakeLevel: 0/g' build/gulpfile.editor.js
## build editor just to get the editor.api.d.ts file compiled
Expand Down
1 change: 0 additions & 1 deletion src/contributions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch'
import 'vs/workbench/contrib/codeEditor/browser/menuPreventer'
import 'vs/workbench/contrib/codeEditor/browser/diffEditorHelper'
import 'vs/workbench/contrib/codeEditor/browser/largeFileOptimizations'
import 'vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens'
import 'vs/workbench/contrib/codeEditor/browser/saveParticipants'
import 'vs/workbench/contrib/codeEditor/browser/toggleMinimap'
import 'vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier'
Expand Down
8 changes: 4 additions & 4 deletions src/extensions.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type * as vscode from 'vscode'
import { ExtensionType, IExtension, IExtensionContributions, IExtensionManifest, TargetPlatform } from 'vs/platform/extensions/common/extensions'
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions.service'
import { URI } from 'vs/base/common/uri'
import { getExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil'
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle'
import { ITranslations } from 'vs/platform/extensionManagement/common/extensionNls'
import { joinPath } from 'vs/base/common/resources'
import { FileAccess, Schemas } from 'vs/base/common/network'
import { ExtensionHostKind } from 'vs/workbench/services/extensions/common/extensionHostKind'
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService.service'
import { parse } from 'vs/base/common/json'
import { IFileService } from 'vs/platform/files/common/files'
import { IFileService } from 'vs/platform/files/common/files.service'
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'
import { IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'
import { IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement.service'
import { StandaloneServices } from 'vs/editor/standalone/browser/standaloneServices'
import { IExtensionWithExtHostKind, ExtensionServiceOverride } from './service-override/extensions'
import { CustomSchemas, registerExtensionFile } from './service-override/files'
Expand Down
5 changes: 3 additions & 2 deletions src/lifecycle.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Registry } from 'vs/platform/registry/common/platform'
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'
import { ILifecycleService, LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'
import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle.service'
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'
import { Barrier, RunOnceScheduler, _runWhenIdle, timeout } from 'vs/base/common/async'
import { Emitter } from 'vs/base/common/event'
import { EditorExtensions, IEditorFactoryRegistry } from 'vs/workbench/common/editor'
import { StandaloneServices } from 'vs/editor/standalone/browser/standaloneServices'
import { Disposable } from 'vs/base/common/lifecycle'
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService.service'

const layoutEmitter = new Emitter<ServicesAccessor>()
export const onLayout = layoutEmitter.event
Expand Down
18 changes: 10 additions & 8 deletions src/localExtensionHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ import * as platform from 'vs/base/common/platform'
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc'
import { LocalProcessRunningLocation } from 'vs/workbench/services/extensions/common/extensionRunningLocation'
import { IExtHostExtensionService, IHostUtils } from 'vs/workbench/api/common/extHostExtensionService'
import { ExtensionHostExtensions, ExtensionHostStartup, IExtensionHost, IExtensionService, nullExtensionDescription } from 'vs/workbench/services/extensions/common/extensions'
import { ExtensionHostExtensions, ExtensionHostStartup, IExtensionHost, nullExtensionDescription } from 'vs/workbench/services/extensions/common/extensions'
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions.service'
import { IWebWorkerExtensionHostDataProvider } from 'vs/workbench/services/extensions/browser/webWorkerExtensionHost'
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'
import { ILabelService } from 'vs/platform/label/common/label'
import { ILogService, ILoggerService } from 'vs/platform/log/common/log'
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService'
import { IProductService } from 'vs/platform/product/common/productService'
import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry.service'
import { WorkbenchState } from 'vs/platform/workspace/common/workspace'
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace.service'
import { ILabelService } from 'vs/platform/label/common/label.service'
import { ILogService, ILoggerService } from 'vs/platform/log/common/log.service'
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService.service'
import { IProductService } from 'vs/platform/product/common/productService.service'
import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile.service'
import { URI } from 'vs/base/common/uri'
import { Event } from 'vs/base/common/event'
import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions'
Expand Down
Loading