mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 17:25:39 +01:00
Merge branch 'main' into main
This commit is contained in:
commit
9e0662ad3e
84 changed files with 12776 additions and 4858 deletions
56
.azure-pipelines/publish-nightly.yml
Normal file
56
.azure-pipelines/publish-nightly.yml
Normal file
|
|
@ -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.
|
||||
###############################################################################################
|
||||
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/prepare-monaco-editor-core nightly
|
||||
displayName: Setup, Build & Test monaco-editor-core
|
||||
|
||||
tag: next
|
||||
publishPackage: true
|
||||
publishRequiresApproval: false
|
||||
|
||||
- name: monaco-editor
|
||||
workingDirectory: $(Build.SourcesDirectory)/release
|
||||
testPlatforms: []
|
||||
buildSteps:
|
||||
- script: npm ci
|
||||
displayName: Install NPM dependencies
|
||||
|
||||
- script: yarn ts-node ./scripts/ci/prepare-monaco-editor nightly
|
||||
displayName: Setup, Build & Test monaco-editor
|
||||
|
||||
tag: next
|
||||
publishPackage: true
|
||||
publishRequiresApproval: false
|
||||
58
.azure-pipelines/publish-stable.yml
Normal file
58
.azure-pipelines/publish-stable.yml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
###############################################################################################
|
||||
# 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
|
||||
|
||||
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/prepare-monaco-editor-core stable
|
||||
displayName: Setup, Build & Test monaco-editor-core
|
||||
|
||||
tag: latest
|
||||
publishPackage: ${{ parameters.publishMonacoEditorCore }}
|
||||
publishRequiresApproval: false
|
||||
|
||||
- name: monaco-editor
|
||||
workingDirectory: $(Build.SourcesDirectory)/release
|
||||
testPlatforms: []
|
||||
buildSteps:
|
||||
- script: npm ci
|
||||
displayName: Install NPM dependencies
|
||||
|
||||
- script: yarn ts-node ./scripts/ci/prepare-monaco-editor stable
|
||||
displayName: Setup, Build & Test monaco-editor
|
||||
|
||||
tag: latest
|
||||
publishPackage: ${{ parameters.publishMonacoEditor }}
|
||||
publishRequiresApproval: false
|
||||
9
.github/ISSUE_TEMPLATE/1_bug_report.yaml
vendored
9
.github/ISSUE_TEMPLATE/1_bug_report.yaml
vendored
|
|
@ -27,11 +27,16 @@ body:
|
|||
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)
|
||||
render: typescript
|
||||
- type: textarea
|
||||
id: steps
|
||||
attributes:
|
||||
label: Reproduction Steps
|
||||
description: Please describe the steps (in the playground) that lead to the problematic behavior
|
||||
- type: textarea
|
||||
id: actual-behavior
|
||||
attributes:
|
||||
label: Actual Behavior
|
||||
description: Please describe the actual behavior, as observed in the playground.
|
||||
label: Actual (Problematic) Behavior
|
||||
description: Please describe the actual (problematic) behavior, as observed in the playground.
|
||||
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
|
|
|
|||
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
|
|
@ -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
|
||||
|
||||
|
|
@ -48,11 +48,17 @@ 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
|
||||
|
||||
|
|
|
|||
25
.github/workflows/pr-chat.yml
vendored
25
.github/workflows/pr-chat.yml
vendored
|
|
@ -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
|
||||
235
.github/workflows/publish.yml
vendored
235
.github/workflows/publish.yml
vendored
|
|
@ -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
|
||||
4
.github/workflows/publish/computeState.js
vendored
4
.github/workflows/publish/computeState.js
vendored
|
|
@ -90,10 +90,14 @@ function npmGetLatestVersion(packageName) {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
function npmExists(packageName, version) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
17
.github/workflows/publish/setVersion.js
vendored
17
.github/workflows/publish/setVersion.js
vendored
|
|
@ -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');
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,4 +1,8 @@
|
|||
**/node_modules/
|
||||
**/out/
|
||||
**/release/
|
||||
**/dependencies/
|
||||
/test/manual/generated/**
|
||||
/test/smoke/vite/dist/**
|
||||
/test/smoke/parcel/dist/**
|
||||
/test/smoke/parcel/.cache/**
|
||||
|
|
|
|||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
|
|
@ -9,5 +9,8 @@
|
|||
"**/release": 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
|
||||
}
|
||||
|
|
|
|||
45
CHANGELOG.md
45
CHANGELOG.md
|
|
@ -1,5 +1,50 @@
|
|||
# Monaco Editor Changelog
|
||||
|
||||
## [0.35.1]
|
||||
|
||||
- Adds sticky scrolling
|
||||
- Renamed the option `enableDropIntoEditor` to `dropIntoEditor`
|
||||
|
||||
## [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
|
||||
- Support for light high contrast theme
|
||||
- Introduction of `BracketPairColorizationOptions.independentColorPoolPerBracketType`
|
||||
- Introduction of `PositionAffinity.LeftOfInjectedText` and `PositionAffinity.RightOfInjectedText`
|
||||
- Introduction of `IEditorOptions.showFoldingControls: 'never'`
|
||||
- Introduction of `IDiffEditorBaseOptions.renderMarginRevertIcon: boolean`
|
||||
- Inline Quick Suggestions
|
||||
- Introduction of `IContentWidgetPosition.positionAffinity`
|
||||
- Provider can now be registered for a `LanguageSelector`
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- `IEditorInlayHintsOptions` tweaks
|
||||
- Iteration on `InlineCompletion` API
|
||||
- `WorkspaceFileEdit` -> `IWorkspaceFileEdit`
|
||||
- `oldUri` -> `oldResource`
|
||||
- `newUri` -> `newResource`
|
||||
- `WorkspaceTextEdit` -> `IWorkspaceTextEdit`
|
||||
- `edit` -> `textEdit` (now supports `insertAsSnippet`)
|
||||
- `modelVersionId?: number` -> `versionId: number | undefined`
|
||||
- `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`
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ Please understand that we only bundle languages with the monaco editor that have
|
|||
- create `$/src/basic-languages/{myLang}/{myLang}.ts`
|
||||
- create `$/src/basic-languages/{myLang}/{myLang}.test.ts`
|
||||
- edit `$/src/basic-languages/monaco.contribution.ts` and register your new language
|
||||
- create `$/website/index/samples/sample.{myLang}.txt`
|
||||
|
||||
```js
|
||||
import './{myLang}/{myLang}.contribution';
|
||||
|
|
@ -73,7 +74,16 @@ Open [http://localhost:8080/monaco-editor/test/manual/?editor=src](http://localh
|
|||
/src/monaco-editor> npm run compile --prefix webpack-plugin
|
||||
|
||||
# package using the webpack plugin
|
||||
/src/monaco-editor> npm run package-for-smoketest --prefix webpack-plugin
|
||||
/src/monaco-editor> npm run package-for-smoketest-webpack
|
||||
|
||||
# package using esbuild
|
||||
/src/monaco-editor> npm run package-for-smoketest-esbuild
|
||||
|
||||
# package using vite
|
||||
/src/monaco-editor> npm run package-for-smoketest-vite
|
||||
|
||||
# package using parcel
|
||||
/src/monaco-editor> npm run package-for-smoketest-parcel --prefix test/smoke/parcel
|
||||
|
||||
# run the smoketest
|
||||
/src/monaco-editor> npm run smoketest-debug
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
(For maintainers)
|
||||
|
||||
- [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
|
||||
|
||||
- change typescript's version in `package.json`.
|
||||
|
|
|
|||
|
|
@ -35,73 +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);
|
||||
}
|
||||
// The output from this build will only be accessible via AMD or 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 */
|
||||
var require = undefined;
|
||||
var module = { exports: {} };
|
||||
/* END MONACOCHANGE */
|
||||
` + tsServices;
|
||||
|
||||
const tsServices_amd =
|
||||
generatedNote +
|
||||
|
|
@ -118,15 +63,6 @@ define("vs/language/typescript/lib/typescriptServices", [], function() { return
|
|||
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 =');
|
||||
|
||||
const tsServices_esm =
|
||||
generatedNote +
|
||||
tsServices +
|
||||
|
|
@ -149,14 +85,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
|
||||
|
|
|
|||
|
|
@ -364,7 +364,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;`;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"module": "CommonJS",
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": ["./**/*"]
|
||||
"include": ["./**/*"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ export function buildESM(options: { base: string; entryPoints: string[]; externa
|
|||
bundle: true,
|
||||
target: 'esnext',
|
||||
format: 'esm',
|
||||
drop: ['debugger'],
|
||||
define: {
|
||||
AMD: 'false'
|
||||
},
|
||||
|
|
@ -141,6 +142,7 @@ function buildOneAMD(
|
|||
bundle: true,
|
||||
target: 'esnext',
|
||||
format: 'iife',
|
||||
drop: ['debugger'],
|
||||
define: {
|
||||
AMD: 'true'
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
7027
package-lock.json
generated
7027
package-lock.json
generated
File diff suppressed because it is too large
Load diff
27
package.json
27
package.json
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "monaco-editor",
|
||||
"version": "0.33.0",
|
||||
"vscode": "c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1",
|
||||
"version": "0.34.1",
|
||||
"vscodeRef": "0316a754aa4c25208bef91937efbce2ab1e3ce37",
|
||||
"private": true,
|
||||
"description": "A browser based code editor",
|
||||
"author": "Microsoft Corporation",
|
||||
|
|
@ -9,7 +9,6 @@
|
|||
"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",
|
||||
|
|
@ -18,8 +17,12 @@
|
|||
"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",
|
||||
"smoketest-debug": "node ./test/smoke/runner.js --debug-tests",
|
||||
"test": "mocha test/unit/all.js",
|
||||
"deps-all-remove": "ts-node ./build/npm/removeAll",
|
||||
"deps-all-install": "ts-node ./build/npm/installAll",
|
||||
|
|
@ -37,28 +40,38 @@
|
|||
"@typescript/vfs": "^1.3.5",
|
||||
"chai": "^4.3.6",
|
||||
"clean-css": "^5.2.4",
|
||||
"esbuild": "^0.14.18",
|
||||
"css-loader": "^6.7.1",
|
||||
"esbuild": "^0.14.49",
|
||||
"esbuild-plugin-alias": "^0.2.1",
|
||||
"file-loader": "^6.2.0",
|
||||
"glob": "^7.2.0",
|
||||
"husky": "^7.0.4",
|
||||
"jsdom": "^19.0.0",
|
||||
"jsonc-parser": "^3.0.0",
|
||||
"mocha": "^9.2.0",
|
||||
"monaco-editor-core": "0.33.0-dev.20220214",
|
||||
"monaco-editor-core": "0.35.0-dev.20221208",
|
||||
"parcel": "^2.7.0",
|
||||
"playwright": "^1.18.1",
|
||||
"prettier": "^2.5.1",
|
||||
"pretty-quick": "^3.1.3",
|
||||
"requirejs": "^2.3.6",
|
||||
"terser": "^5.10.0",
|
||||
"style-loader": "^3.3.1",
|
||||
"terser": "^5.14.2",
|
||||
"ts-node": "^10.6.0",
|
||||
"typedoc": "^0.22.11",
|
||||
"typescript": "4.5.5",
|
||||
"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.74.0",
|
||||
"yaserver": "^0.4.0"
|
||||
},
|
||||
"alias": {
|
||||
"process": false,
|
||||
"buffer": false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
138
samples/browser-esm-parcel/package-lock.json
generated
138
samples/browser-esm-parcel/package-lock.json
generated
|
|
@ -107,6 +107,64 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
|
||||
"integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/set-array": "^1.0.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
|
||||
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/set-array": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
||||
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/source-map": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
|
||||
"integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz",
|
||||
"integrity": "sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/bundler-default": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/bundler-default/-/bundler-default-2.4.0.tgz",
|
||||
|
|
@ -2250,14 +2308,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/terser": {
|
||||
"version": "5.12.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.12.1.tgz",
|
||||
"integrity": "sha512-NXbs+7nisos5E+yXwAD+y7zrcTkMqb0dEJxIGtSKPdCBzopf7ni4odPul2aechpV7EXNvOudYOX2bb5tln1jbQ==",
|
||||
"version": "5.14.2",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz",
|
||||
"integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
"acorn": "^8.5.0",
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.20"
|
||||
},
|
||||
"bin": {
|
||||
|
|
@ -2273,15 +2331,6 @@
|
|||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/terser/node_modules/source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/timsort": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
|
||||
|
|
@ -2416,6 +2465,55 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@jridgewell/gen-mapping": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
|
||||
"integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/set-array": "^1.0.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
},
|
||||
"@jridgewell/resolve-uri": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
|
||||
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/set-array": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
||||
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/source-map": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
|
||||
"integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/gen-mapping": "^0.3.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
},
|
||||
"@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/trace-mapping": {
|
||||
"version": "0.3.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz",
|
||||
"integrity": "sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"@parcel/bundler-default": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/bundler-default/-/bundler-default-2.4.0.tgz",
|
||||
|
|
@ -3790,14 +3888,14 @@
|
|||
"dev": true
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.12.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.12.1.tgz",
|
||||
"integrity": "sha512-NXbs+7nisos5E+yXwAD+y7zrcTkMqb0dEJxIGtSKPdCBzopf7ni4odPul2aechpV7EXNvOudYOX2bb5tln1jbQ==",
|
||||
"version": "5.14.2",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz",
|
||||
"integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
"acorn": "^8.5.0",
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.20"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
@ -3806,12 +3904,6 @@
|
|||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
50
samples/browser-esm-vite-react/package-lock.json
generated
50
samples/browser-esm-vite-react/package-lock.json
generated
|
|
@ -13,7 +13,7 @@
|
|||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"typescript": "^4.5.5",
|
||||
"vite": "^2.7.13"
|
||||
"vite": "^2.9.13"
|
||||
}
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
|
|
@ -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"
|
||||
},
|
||||
|
|
@ -1372,13 +1372,13 @@
|
|||
}
|
||||
},
|
||||
"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"
|
||||
},
|
||||
|
|
@ -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"
|
||||
}
|
||||
|
|
@ -2298,14 +2298,14 @@
|
|||
"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"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@
|
|||
"@types/react-dom": "^17.0.11",
|
||||
"@vitejs/plugin-react": "^1.1.4",
|
||||
"typescript": "^4.5.5",
|
||||
"vite": "^2.7.13"
|
||||
"vite": "^2.9.13"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1736,6 +1736,21 @@
|
|||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
|
||||
"integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/set-array": "^1.0.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz",
|
||||
|
|
@ -1745,6 +1760,27 @@
|
|||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/set-array": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
||||
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/source-map": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
|
||||
"integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.11",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz",
|
||||
|
|
@ -1752,9 +1788,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.4.tgz",
|
||||
"integrity": "sha512-vFv9ttIedivx0ux3QSjhgtCVjPZd5l46ZOMDSCwnH1yUO2e964gO8LZGyv2QkqcgR6TnBU1v+1IFqmeoG+0UJQ==",
|
||||
"version": "0.3.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz",
|
||||
"integrity": "sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
|
|
@ -2808,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",
|
||||
|
|
@ -3351,15 +3387,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/terser": {
|
||||
"version": "5.12.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.12.1.tgz",
|
||||
"integrity": "sha512-NXbs+7nisos5E+yXwAD+y7zrcTkMqb0dEJxIGtSKPdCBzopf7ni4odPul2aechpV7EXNvOudYOX2bb5tln1jbQ==",
|
||||
"version": "5.14.2",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz",
|
||||
"integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
"acorn": "^8.5.0",
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.20"
|
||||
},
|
||||
"bin": {
|
||||
|
|
@ -3414,16 +3450,6 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/terser/node_modules/source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/to-fast-properties": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
||||
|
|
@ -4753,12 +4779,42 @@
|
|||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"@jridgewell/gen-mapping": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
|
||||
"integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@jridgewell/set-array": "^1.0.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
},
|
||||
"@jridgewell/resolve-uri": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz",
|
||||
"integrity": "sha512-VPeQ7+wH0itvQxnG+lIzWgkysKIr3L9sslimFW55rHMdGu/qCQ5z5h9zq4gI8uBtqkpHhsF4Z/OwExufUCThew==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/set-array": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
||||
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
"@jridgewell/source-map": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
|
||||
"integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@jridgewell/gen-mapping": "^0.3.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
},
|
||||
"@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.11",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz",
|
||||
|
|
@ -4766,9 +4822,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@jridgewell/trace-mapping": {
|
||||
"version": "0.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.4.tgz",
|
||||
"integrity": "sha512-vFv9ttIedivx0ux3QSjhgtCVjPZd5l46ZOMDSCwnH1yUO2e964gO8LZGyv2QkqcgR6TnBU1v+1IFqmeoG+0UJQ==",
|
||||
"version": "0.3.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz",
|
||||
"integrity": "sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
|
|
@ -5596,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",
|
||||
|
|
@ -6015,25 +6071,16 @@
|
|||
"peer": true
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.12.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.12.1.tgz",
|
||||
"integrity": "sha512-NXbs+7nisos5E+yXwAD+y7zrcTkMqb0dEJxIGtSKPdCBzopf7ni4odPul2aechpV7EXNvOudYOX2bb5tln1jbQ==",
|
||||
"version": "5.14.2",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz",
|
||||
"integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
"acorn": "^8.5.0",
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.20"
|
||||
},
|
||||
"dependencies": {
|
||||
"source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"terser-webpack-plugin": {
|
||||
|
|
|
|||
|
|
@ -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`);
|
||||
|
|
|
|||
5
samples/electron-esm-webpack/.gitignore
vendored
5
samples/electron-esm-webpack/.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
/dist/*.js
|
||||
/dist/*.ttf
|
||||
dist/*.js
|
||||
dist/*.txt
|
||||
dist/*.ttf
|
||||
|
|
|
|||
5299
samples/package-lock.json
generated
5299
samples/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -10,8 +10,8 @@
|
|||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"css-loader": "^6.6.0",
|
||||
"electron": "^17.0.0",
|
||||
"css-loader": "^5.2.7",
|
||||
"electron": "^19.1.8",
|
||||
"file-loader": "^6.2.0",
|
||||
"glob": "^7.2.0",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
|
|
@ -25,5 +25,8 @@
|
|||
"webpack-dev-server": "^4.7.4",
|
||||
"webpack": "^5.68.0",
|
||||
"yaserver": "^0.4.0"
|
||||
},
|
||||
"overrides": {
|
||||
"@electron/get": "2.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
34
scripts/ci/monaco-editor-core.sh
Executable file
34
scripts/ci/monaco-editor-core.sh
Executable file
|
|
@ -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
|
||||
33
scripts/ci/monaco-editor.sh
Executable file
33
scripts/ci/monaco-editor.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# execute `npm install` to pick up local monaco-editor-core
|
||||
npm install
|
||||
# Install OS Dependencies for Playwright
|
||||
sudo npm run playwright-install-deps
|
||||
# Check prettier
|
||||
npm run prettier-check
|
||||
# Build
|
||||
npm run release
|
||||
|
||||
# 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
|
||||
|
||||
# Build website
|
||||
npm run build-website
|
||||
|
||||
# npm package is now ready to be published in ./release
|
||||
67
scripts/ci/prepare-monaco-editor-core.ts
Normal file
67
scripts/ci/prepare-monaco-editor-core.ts
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import { mkdir, rm } from 'fs/promises';
|
||||
import { join, resolve } from 'path';
|
||||
import { 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 });
|
||||
|
||||
await group('Checkout vscode', async () => {
|
||||
await gitShallowClone(vscodePath, 'https://github.com/microsoft/vscode.git', vscodeRef);
|
||||
});
|
||||
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 { version: string };
|
||||
packageJson.version = version;
|
||||
await writeJsonFile(monacoEditorCorePackageJsonSourcePath, packageJson);
|
||||
});
|
||||
|
||||
await group('Building & Testing', async () => {
|
||||
await run(resolve(selfPath, './monaco-editor-core.sh'), { cwd: vscodePath });
|
||||
});
|
||||
}
|
||||
|
||||
prepareMonacoEditorCoreReleaseStableOrNightly();
|
||||
50
scripts/ci/prepare-monaco-editor.ts
Normal file
50
scripts/ci/prepare-monaco-editor.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { readFile } from 'fs/promises';
|
||||
import { join, resolve } from 'path';
|
||||
import { getNightlyVersion, group, run, writeJsonFile } from '../lib';
|
||||
|
||||
const selfPath = __dirname;
|
||||
const rootPath = join(selfPath, '..', '..');
|
||||
const monacoEditorPackageJsonPath = resolve(rootPath, 'package.json');
|
||||
|
||||
async function prepareMonacoEditorReleaseStableOrNightly() {
|
||||
const monacoEditorPackageJson = JSON.parse(
|
||||
await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
|
||||
) as { version: string };
|
||||
|
||||
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 ./release, ready to be published
|
||||
}
|
||||
|
||||
async function prepareMonacoEditorRelease(version: string) {
|
||||
await group('npm ci', async () => {
|
||||
await run('npm ci', { cwd: resolve(rootPath, 'webpack-plugin') });
|
||||
});
|
||||
|
||||
await group('Set Version', async () => {
|
||||
const packageJson = JSON.parse(
|
||||
await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
|
||||
) as { version: string; devDependencies: Record<string, string> };
|
||||
packageJson.version = version;
|
||||
packageJson.devDependencies['monaco-editor-core'] = version;
|
||||
|
||||
await writeJsonFile(monacoEditorPackageJsonPath, packageJson);
|
||||
});
|
||||
|
||||
await group('Building & Testing', async () => {
|
||||
await run(resolve(selfPath, './monaco-editor.sh'), { cwd: rootPath });
|
||||
});
|
||||
}
|
||||
|
||||
prepareMonacoEditorReleaseStableOrNightly();
|
||||
55
scripts/lib/index.ts
Normal file
55
scripts/lib/index.ts
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
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 gitShallowClone(targetPath: string, repositoryUrl: string, ref: 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);
|
||||
}
|
||||
|
||||
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}`;
|
||||
}
|
||||
24
src/basic-languages/cypher/cypher.contribution.ts
Normal file
24
src/basic-languages/cypher/cypher.contribution.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { registerLanguage } from '../_.contribution';
|
||||
|
||||
declare var AMD: any;
|
||||
declare var require: any;
|
||||
|
||||
registerLanguage({
|
||||
id: 'cypher',
|
||||
extensions: ['.cypher', '.cyp'],
|
||||
aliases: ['Cypher', 'OpenCypher'],
|
||||
loader: () => {
|
||||
if (AMD) {
|
||||
return new Promise((resolve, reject) => {
|
||||
require(['vs/basic-languages/cypher/cypher'], resolve, reject);
|
||||
});
|
||||
} else {
|
||||
return import('./cypher');
|
||||
}
|
||||
}
|
||||
});
|
||||
327
src/basic-languages/cypher/cypher.test.ts
Normal file
327
src/basic-languages/cypher/cypher.test.ts
Normal file
|
|
@ -0,0 +1,327 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { testTokenization } from '../test/testRunner';
|
||||
|
||||
testTokenization('cypher', [
|
||||
// Comments
|
||||
[
|
||||
{
|
||||
line: '// Single line comment',
|
||||
tokens: [{ startIndex: 0, type: 'comment.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: 'MATCH /* comment part */ xyz',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'keyword.cypher' },
|
||||
{ startIndex: 5, type: 'white.cypher' },
|
||||
{ startIndex: 6, type: 'comment.cypher' },
|
||||
{ startIndex: 24, type: 'white.cypher' },
|
||||
{ startIndex: 25, type: 'identifier.cypher' }
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '/* multi line comment',
|
||||
tokens: [{ startIndex: 0, type: 'comment.cypher' }]
|
||||
},
|
||||
{
|
||||
line: 'comment continues MATCH // not done yet',
|
||||
tokens: [{ startIndex: 0, type: 'comment.cypher' }]
|
||||
},
|
||||
{
|
||||
line: 'comment ends */ MATCH',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'comment.cypher' },
|
||||
{ startIndex: 15, type: 'white.cypher' },
|
||||
{ startIndex: 16, type: 'keyword.cypher' }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
// Numbers: A decimal (integer or float) literal:
|
||||
[
|
||||
{
|
||||
line: '13',
|
||||
tokens: [{ startIndex: 0, type: 'number.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '-40000',
|
||||
tokens: [{ startIndex: 0, type: 'number.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '3.14',
|
||||
tokens: [{ startIndex: 0, type: 'number.float.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '.314',
|
||||
tokens: [{ startIndex: 0, type: 'number.float.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '-.314',
|
||||
tokens: [{ startIndex: 0, type: 'number.float.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '6.022E23',
|
||||
tokens: [{ startIndex: 0, type: 'number.float.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '-6.022e23',
|
||||
tokens: [{ startIndex: 0, type: 'number.float.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '12E10',
|
||||
tokens: [{ startIndex: 0, type: 'number.float.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '12e10',
|
||||
tokens: [{ startIndex: 0, type: 'number.float.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '12e-10',
|
||||
tokens: [{ startIndex: 0, type: 'number.float.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '12E-10',
|
||||
tokens: [{ startIndex: 0, type: 'number.float.cypher' }]
|
||||
}
|
||||
],
|
||||
|
||||
// Numbers: A hexadecimal integer literal (starting with 0x)
|
||||
[
|
||||
{
|
||||
line: '0x13af',
|
||||
tokens: [{ startIndex: 0, type: 'number.hex.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '0xFC3A9',
|
||||
tokens: [{ startIndex: 0, type: 'number.hex.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '-0x66eff',
|
||||
tokens: [{ startIndex: 0, type: 'number.hex.cypher' }]
|
||||
}
|
||||
],
|
||||
|
||||
// Numbers: An octal integer literal (starting with 0)
|
||||
[
|
||||
{
|
||||
line: '01372',
|
||||
tokens: [{ startIndex: 0, type: 'number.octal.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '02127',
|
||||
tokens: [{ startIndex: 0, type: 'number.octal.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '-05671',
|
||||
tokens: [{ startIndex: 0, type: 'number.octal.cypher' }]
|
||||
}
|
||||
],
|
||||
|
||||
// Strings: A String literal ('', ""), escaped and non-escaped
|
||||
[
|
||||
{
|
||||
line: '"two \'words\'"',
|
||||
tokens: [{ startIndex: 0, type: 'string.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '"two \\"words\\""',
|
||||
tokens: [{ startIndex: 0, type: 'string.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '\'two "words"\'',
|
||||
tokens: [{ startIndex: 0, type: 'string.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: "'two \\'words\\''",
|
||||
tokens: [{ startIndex: 0, type: 'string.cypher' }]
|
||||
}
|
||||
],
|
||||
|
||||
// Identifiers wrapped with backtick (``)
|
||||
[
|
||||
{
|
||||
line: '`variable`',
|
||||
tokens: [{ startIndex: 0, type: 'identifier.escape.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '`A variable with weird stuff in it[]!`',
|
||||
tokens: [{ startIndex: 0, type: 'identifier.escape.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '`Escaped \\`variable\\``',
|
||||
tokens: [{ startIndex: 0, type: 'identifier.escape.cypher' }]
|
||||
}
|
||||
],
|
||||
|
||||
// Operators
|
||||
[
|
||||
{
|
||||
line: '1+2',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'number.cypher' },
|
||||
{ startIndex: 1, type: 'delimiter.cypher' },
|
||||
{ startIndex: 2, type: 'number.cypher' }
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: '1++2',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'number.cypher' },
|
||||
{ startIndex: 1, type: '' },
|
||||
{ startIndex: 3, type: 'number.cypher' }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
// Builtin literals: A boolean literal (true | false)
|
||||
[
|
||||
{
|
||||
line: 'true',
|
||||
tokens: [{ startIndex: 0, type: 'predefined.literal.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: 'false',
|
||||
tokens: [{ startIndex: 0, type: 'predefined.literal.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: 'TRUE',
|
||||
tokens: [{ startIndex: 0, type: 'predefined.literal.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: 'FALSE',
|
||||
tokens: [{ startIndex: 0, type: 'predefined.literal.cypher' }]
|
||||
}
|
||||
],
|
||||
|
||||
// Builtin literals: A null literal
|
||||
[
|
||||
{
|
||||
line: 'null',
|
||||
tokens: [{ startIndex: 0, type: 'predefined.literal.cypher' }]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: 'NULL',
|
||||
tokens: [{ startIndex: 0, type: 'predefined.literal.cypher' }]
|
||||
}
|
||||
],
|
||||
|
||||
// Builtin functions
|
||||
[
|
||||
{
|
||||
line: 'properties(node)',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'predefined.function.cypher' },
|
||||
{ startIndex: 10, type: 'delimiter.parenthesis.cypher' },
|
||||
{ startIndex: 11, type: 'identifier.cypher' },
|
||||
{ startIndex: 15, type: 'delimiter.parenthesis.cypher' }
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
line: 'left(right("Hello Cypher"))',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'predefined.function.cypher' },
|
||||
{ startIndex: 4, type: 'delimiter.parenthesis.cypher' },
|
||||
{ startIndex: 5, type: 'predefined.function.cypher' },
|
||||
{ startIndex: 10, type: 'delimiter.parenthesis.cypher' },
|
||||
{ startIndex: 11, type: 'string.cypher' },
|
||||
{ startIndex: 25, type: 'delimiter.parenthesis.cypher' }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
// Keywords
|
||||
[
|
||||
{
|
||||
line: 'MATCH (n) RETURN n',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'keyword.cypher' },
|
||||
{ startIndex: 5, type: 'white.cypher' },
|
||||
{ startIndex: 6, type: 'delimiter.parenthesis.cypher' },
|
||||
{ startIndex: 7, type: 'identifier.cypher' },
|
||||
{ startIndex: 8, type: 'delimiter.parenthesis.cypher' },
|
||||
{ startIndex: 9, type: 'white.cypher' },
|
||||
{ startIndex: 10, type: 'keyword.cypher' },
|
||||
{ startIndex: 16, type: 'white.cypher' },
|
||||
{ startIndex: 17, type: 'identifier.cypher' }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
// Labels on nodes and relationships
|
||||
[
|
||||
{
|
||||
line: '(n:NodeLabel1)-[:RelationshipType]->(:NodeLabel2:NodeLabel3)',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'delimiter.parenthesis.cypher' },
|
||||
{ startIndex: 1, type: 'identifier.cypher' },
|
||||
{ startIndex: 2, type: 'type.identifier.cypher' },
|
||||
{ startIndex: 13, type: 'delimiter.parenthesis.cypher' },
|
||||
{ startIndex: 14, type: 'delimiter.cypher' },
|
||||
{ startIndex: 15, type: 'delimiter.bracket.cypher' },
|
||||
{ startIndex: 16, type: 'type.identifier.cypher' },
|
||||
{ startIndex: 33, type: 'delimiter.bracket.cypher' },
|
||||
{ startIndex: 34, type: 'delimiter.cypher' },
|
||||
{ startIndex: 36, type: 'delimiter.parenthesis.cypher' },
|
||||
{ startIndex: 37, type: 'type.identifier.cypher' },
|
||||
{ startIndex: 59, type: 'delimiter.parenthesis.cypher' }
|
||||
]
|
||||
}
|
||||
]
|
||||
]);
|
||||
274
src/basic-languages/cypher/cypher.ts
Normal file
274
src/basic-languages/cypher/cypher.ts
Normal file
|
|
@ -0,0 +1,274 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { languages } from '../../fillers/monaco-editor-core';
|
||||
|
||||
export const conf: languages.LanguageConfiguration = {
|
||||
comments: {
|
||||
lineComment: '//',
|
||||
blockComment: ['/*', '*/']
|
||||
},
|
||||
brackets: [
|
||||
['{', '}'],
|
||||
['[', ']'],
|
||||
['(', ')']
|
||||
],
|
||||
autoClosingPairs: [
|
||||
{ open: '{', close: '}' },
|
||||
{ open: '[', close: ']' },
|
||||
{ open: '(', close: ')' },
|
||||
{ open: '"', close: '"' },
|
||||
{ open: "'", close: "'" },
|
||||
{ open: '`', close: '`' }
|
||||
],
|
||||
surroundingPairs: [
|
||||
{ open: '{', close: '}' },
|
||||
{ open: '[', close: ']' },
|
||||
{ open: '(', close: ')' },
|
||||
{ open: '"', close: '"' },
|
||||
{ open: "'", close: "'" },
|
||||
{ open: '`', close: '`' }
|
||||
]
|
||||
};
|
||||
|
||||
// Ref: Cypher Query Language Reference, Version 9 (https://opencypher.org/resources/)
|
||||
export const language = <languages.IMonarchLanguage>{
|
||||
defaultToken: '',
|
||||
tokenPostfix: `.cypher`,
|
||||
ignoreCase: true,
|
||||
|
||||
brackets: [
|
||||
{ open: '{', close: '}', token: 'delimiter.curly' },
|
||||
{ open: '[', close: ']', token: 'delimiter.bracket' },
|
||||
{ open: '(', close: ')', token: 'delimiter.parenthesis' }
|
||||
],
|
||||
|
||||
keywords: [
|
||||
'ALL',
|
||||
'AND',
|
||||
'AS',
|
||||
'ASC',
|
||||
'ASCENDING',
|
||||
'BY',
|
||||
'CALL',
|
||||
'CASE',
|
||||
'CONTAINS',
|
||||
'CREATE',
|
||||
'DELETE',
|
||||
'DESC',
|
||||
'DESCENDING',
|
||||
'DETACH',
|
||||
'DISTINCT',
|
||||
'ELSE',
|
||||
'END',
|
||||
'ENDS',
|
||||
'EXISTS',
|
||||
'IN',
|
||||
'IS',
|
||||
'LIMIT',
|
||||
'MANDATORY',
|
||||
'MATCH',
|
||||
'MERGE',
|
||||
'NOT',
|
||||
'ON',
|
||||
'ON',
|
||||
'OPTIONAL',
|
||||
'OR',
|
||||
'ORDER',
|
||||
'REMOVE',
|
||||
'RETURN',
|
||||
'SET',
|
||||
'SKIP',
|
||||
'STARTS',
|
||||
'THEN',
|
||||
'UNION',
|
||||
'UNWIND',
|
||||
'WHEN',
|
||||
'WHERE',
|
||||
'WITH',
|
||||
'XOR',
|
||||
'YIELD'
|
||||
],
|
||||
builtinLiterals: ['true', 'TRUE', 'false', 'FALSE', 'null', 'NULL'],
|
||||
builtinFunctions: [
|
||||
'abs',
|
||||
'acos',
|
||||
'asin',
|
||||
'atan',
|
||||
'atan2',
|
||||
'avg',
|
||||
'ceil',
|
||||
'coalesce',
|
||||
'collect',
|
||||
'cos',
|
||||
'cot',
|
||||
'count',
|
||||
'degrees',
|
||||
'e',
|
||||
'endNode',
|
||||
'exists',
|
||||
'exp',
|
||||
'floor',
|
||||
'head',
|
||||
'id',
|
||||
'keys',
|
||||
'labels',
|
||||
'last',
|
||||
'left',
|
||||
'length',
|
||||
'log',
|
||||
'log10',
|
||||
'lTrim',
|
||||
'max',
|
||||
'min',
|
||||
'nodes',
|
||||
'percentileCont',
|
||||
'percentileDisc',
|
||||
'pi',
|
||||
'properties',
|
||||
'radians',
|
||||
'rand',
|
||||
'range',
|
||||
'relationships',
|
||||
'replace',
|
||||
'reverse',
|
||||
'right',
|
||||
'round',
|
||||
'rTrim',
|
||||
'sign',
|
||||
'sin',
|
||||
'size',
|
||||
'split',
|
||||
'sqrt',
|
||||
'startNode',
|
||||
'stDev',
|
||||
'stDevP',
|
||||
'substring',
|
||||
'sum',
|
||||
'tail',
|
||||
'tan',
|
||||
'timestamp',
|
||||
'toBoolean',
|
||||
'toFloat',
|
||||
'toInteger',
|
||||
'toLower',
|
||||
'toString',
|
||||
'toUpper',
|
||||
'trim',
|
||||
'type'
|
||||
],
|
||||
|
||||
operators: [
|
||||
// Math operators
|
||||
'+',
|
||||
'-',
|
||||
'*',
|
||||
'/',
|
||||
'%',
|
||||
'^',
|
||||
// Comparison operators
|
||||
'=',
|
||||
'<>',
|
||||
'<',
|
||||
'>',
|
||||
'<=',
|
||||
'>=',
|
||||
// Pattern operators
|
||||
'->',
|
||||
'<-',
|
||||
'-->',
|
||||
'<--'
|
||||
],
|
||||
|
||||
escapes: /\\(?:[tbnrf\\"'`]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
||||
digits: /\d+/,
|
||||
octaldigits: /[0-7]+/,
|
||||
hexdigits: /[0-9a-fA-F]+/,
|
||||
|
||||
tokenizer: {
|
||||
root: [[/[{}[\]()]/, '@brackets'], { include: 'common' }],
|
||||
common: [
|
||||
{ include: '@whitespace' },
|
||||
{ include: '@numbers' },
|
||||
{ include: '@strings' },
|
||||
|
||||
// Cypher labels on nodes/relationships, e.g. (n:NodeLabel)-[e:RelationshipLabel]
|
||||
[/:[a-zA-Z_][\w]*/, 'type.identifier'],
|
||||
[
|
||||
/[a-zA-Z_][\w]*(?=\()/,
|
||||
{
|
||||
cases: {
|
||||
'@builtinFunctions': 'predefined.function'
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
/[a-zA-Z_$][\w$]*/,
|
||||
{
|
||||
cases: {
|
||||
'@keywords': 'keyword',
|
||||
'@builtinLiterals': 'predefined.literal',
|
||||
'@default': 'identifier'
|
||||
}
|
||||
}
|
||||
],
|
||||
[/`/, 'identifier.escape', '@identifierBacktick'],
|
||||
|
||||
// delimiter and operator after number because of `.\d` floats and `:` in labels
|
||||
[/[;,.:|]/, 'delimiter'],
|
||||
[
|
||||
/[<>=%+\-*/^]+/,
|
||||
{
|
||||
cases: {
|
||||
'@operators': 'delimiter',
|
||||
'@default': ''
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
numbers: [
|
||||
[/-?(@digits)[eE](-?(@digits))?/, 'number.float'],
|
||||
[/-?(@digits)?\.(@digits)([eE]-?(@digits))?/, 'number.float'],
|
||||
[/-?0x(@hexdigits)/, 'number.hex'],
|
||||
[/-?0(@octaldigits)/, 'number.octal'],
|
||||
[/-?(@digits)/, 'number']
|
||||
],
|
||||
strings: [
|
||||
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
|
||||
[/'([^'\\]|\\.)*$/, 'string.invalid'], // non-teminated string
|
||||
[/"/, 'string', '@stringDouble'],
|
||||
[/'/, 'string', '@stringSingle']
|
||||
],
|
||||
whitespace: [
|
||||
[/[ \t\r\n]+/, 'white'],
|
||||
[/\/\*/, 'comment', '@comment'],
|
||||
[/\/\/.*$/, 'comment']
|
||||
],
|
||||
comment: [
|
||||
[/\/\/.*/, 'comment'],
|
||||
[/[^/*]+/, 'comment'],
|
||||
[/\*\//, 'comment', '@pop'],
|
||||
[/[/*]/, 'comment']
|
||||
],
|
||||
stringDouble: [
|
||||
[/[^\\"]+/, 'string'],
|
||||
[/@escapes/, 'string'],
|
||||
[/\\./, 'string.invalid'],
|
||||
[/"/, 'string', '@pop']
|
||||
],
|
||||
stringSingle: [
|
||||
[/[^\\']+/, 'string'],
|
||||
[/@escapes/, 'string'],
|
||||
[/\\./, 'string.invalid'],
|
||||
[/'/, 'string', '@pop']
|
||||
],
|
||||
identifierBacktick: [
|
||||
[/[^\\`]+/, 'identifier.escape'],
|
||||
[/@escapes/, 'identifier.escape'],
|
||||
[/\\./, 'identifier.escape.invalid'],
|
||||
[/`/, 'identifier.escape', '@pop']
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
@ -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' }
|
||||
]
|
||||
}
|
||||
]
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -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: [
|
||||
|
|
|
|||
|
|
@ -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
|
||||
[
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
}
|
||||
],
|
||||
[
|
||||
/"([^"]*)"/,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import './cpp/cpp.contribution';
|
|||
import './csharp/csharp.contribution';
|
||||
import './csp/csp.contribution';
|
||||
import './css/css.contribution';
|
||||
import './cypher/cypher.contribution';
|
||||
import './dart/dart.contribution';
|
||||
import './dockerfile/dockerfile.contribution';
|
||||
import './ecl/ecl.contribution';
|
||||
|
|
|
|||
|
|
@ -385,41 +385,6 @@ testTokenization('mysql', [
|
|||
}
|
||||
],
|
||||
|
||||
[
|
||||
{
|
||||
line: 'declare `abc 321`;',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'keyword.sql' },
|
||||
{ startIndex: 7, type: 'white.sql' },
|
||||
{ startIndex: 8, type: 'identifier.quote.sql' },
|
||||
{ startIndex: 9, type: 'identifier.sql' },
|
||||
{ startIndex: 16, type: 'identifier.quote.sql' },
|
||||
{ startIndex: 17, type: 'delimiter.sql' }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
[
|
||||
{
|
||||
line: '`abc`` 321 `` xyz`',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'identifier.quote.sql' },
|
||||
{ startIndex: 1, type: 'identifier.sql' },
|
||||
{ startIndex: 17, type: 'identifier.quote.sql' }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
[
|
||||
{
|
||||
line: '`abc',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'identifier.quote.sql' },
|
||||
{ startIndex: 1, type: 'identifier.sql' }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
[
|
||||
{
|
||||
line: 'int',
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ export const language = <languages.IMonarchLanguage>{
|
|||
'borrow',
|
||||
'using',
|
||||
'borrowing',
|
||||
'mutable'
|
||||
'mutable',
|
||||
'internal'
|
||||
],
|
||||
|
||||
typeKeywords: [
|
||||
|
|
|
|||
|
|
@ -627,13 +627,14 @@ function toWorkspaceEdit(edit: lsTypes.WorkspaceEdit | null): languages.Workspac
|
|||
if (!edit || !edit.changes) {
|
||||
return void 0;
|
||||
}
|
||||
let resourceEdits: languages.WorkspaceTextEdit[] = [];
|
||||
let resourceEdits: languages.IWorkspaceTextEdit[] = [];
|
||||
for (let uri in edit.changes) {
|
||||
const _uri = Uri.parse(uri);
|
||||
for (let e of edit.changes[uri]) {
|
||||
resourceEdits.push({
|
||||
resource: _uri,
|
||||
edit: {
|
||||
versionId: undefined,
|
||||
textEdit: {
|
||||
range: toRange(e.range),
|
||||
text: e.newText
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1124,12 +1124,13 @@ export class CodeActionAdaptor extends FormatHelper implements languages.CodeAct
|
|||
context: languages.CodeActionContext,
|
||||
codeFix: ts.CodeFixAction
|
||||
): languages.CodeAction {
|
||||
const edits: languages.WorkspaceTextEdit[] = [];
|
||||
const edits: languages.IWorkspaceTextEdit[] = [];
|
||||
for (const change of codeFix.changes) {
|
||||
for (const textChange of change.textChanges) {
|
||||
edits.push({
|
||||
resource: model.uri,
|
||||
edit: {
|
||||
versionId: undefined,
|
||||
textEdit: {
|
||||
range: this._textSpanToRange(model, textChange.span),
|
||||
text: textChange.newText
|
||||
}
|
||||
|
|
@ -1197,13 +1198,14 @@ export class RenameAdapter extends Adapter implements languages.RenameProvider {
|
|||
return;
|
||||
}
|
||||
|
||||
const edits: languages.WorkspaceTextEdit[] = [];
|
||||
const edits: languages.IWorkspaceTextEdit[] = [];
|
||||
for (const renameLocation of renameLocations) {
|
||||
const model = this._libFiles.getOrCreateModel(renameLocation.fileName);
|
||||
if (model) {
|
||||
edits.push({
|
||||
resource: model.uri,
|
||||
edit: {
|
||||
versionId: undefined,
|
||||
textEdit: {
|
||||
range: this._textSpanToRange(model, renameLocation.textSpan),
|
||||
text: newName
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
//
|
||||
// **NOTE**: Do not edit directly! This file is generated using `npm run import-typescript`
|
||||
//
|
||||
|
||||
/* MONACOCHANGE */
|
||||
var require = undefined;
|
||||
var module = { exports: {} };
|
||||
/* END MONACOCHANGE */
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
|
|
@ -2554,9 +2559,7 @@ var ts;
|
|||
return true;
|
||||
}
|
||||
function fail(message, stackCrawlMark) {
|
||||
// MONACOCHANGE
|
||||
// debugger;
|
||||
// END MONACOCHANGE
|
||||
debugger;
|
||||
var e = new Error(message ? "Debug Failure. ".concat(message) : "Debug Failure.");
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(e, stackCrawlMark || fail);
|
||||
|
|
@ -3058,9 +3061,7 @@ var ts;
|
|||
try {
|
||||
if (ts.sys && ts.sys.require) {
|
||||
var basePath = ts.getDirectoryPath(ts.resolvePath(ts.sys.getExecutingFilePath()));
|
||||
// MONACOCHANGE
|
||||
var result = undefined;
|
||||
// END MONACOCHANGE
|
||||
var result = ts.sys.require(basePath, "./compiler-debug");
|
||||
if (!result.error) {
|
||||
result.module.init(ts);
|
||||
extendedDebugModule = result.module;
|
||||
|
|
@ -3512,10 +3513,10 @@ var ts;
|
|||
}
|
||||
}
|
||||
function tryGetNodePerformanceHooks() {
|
||||
if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && /* MONACOCHANGE */false/* END MONACOCHANGE */) {
|
||||
if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && typeof require === "function") {
|
||||
try {
|
||||
var performance_1;
|
||||
var _a /* MONACOCHANGE */= {}/* END MONACOCHANGE */, nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver;
|
||||
var _a = require("perf_hooks"), nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver;
|
||||
if (hasRequiredAPI(nodePerformance_1, PerformanceObserver_1)) {
|
||||
performance_1 = nodePerformance_1;
|
||||
// There is a bug in Node's performance.measure prior to 12.16.3/13.13.0 that does not
|
||||
|
|
@ -3746,9 +3747,7 @@ var ts;
|
|||
var etwModulePath = (_a = process.env.TS_ETW_MODULE_PATH) !== null && _a !== void 0 ? _a : "./node_modules/@microsoft/typescript-etw";
|
||||
// require() will throw an exception if the module is not found
|
||||
// It may also return undefined if not installed properly
|
||||
// MONACOCHANGE
|
||||
etwModule = undefined;
|
||||
// END MONACOCHANGE
|
||||
etwModule = require(etwModulePath);
|
||||
}
|
||||
catch (e) {
|
||||
etwModule = undefined;
|
||||
|
|
@ -3777,9 +3776,7 @@ var ts;
|
|||
ts.Debug.assert(!ts.tracing, "Tracing already started");
|
||||
if (fs === undefined) {
|
||||
try {
|
||||
// MONACOCHANGE
|
||||
fs = undefined;
|
||||
// END MONACOCHANGE
|
||||
fs = require("fs");
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error("tracing requires having fs\n(original error: ".concat(e.message || e, ")"));
|
||||
|
|
@ -7463,9 +7460,596 @@ var ts;
|
|||
ts.getNodeMajorVersion = getNodeMajorVersion;
|
||||
// TODO: GH#18217 this is used as if it's certainly defined in many places.
|
||||
// eslint-disable-next-line prefer-const
|
||||
// MONACOCHANGE
|
||||
ts.sys = undefined;
|
||||
// END MONACOCHANGE
|
||||
ts.sys = (function () {
|
||||
// NodeJS detects "\uFEFF" at the start of the string and *replaces* it with the actual
|
||||
// byte order mark from the specified encoding. Using any other byte order mark does
|
||||
// not actually work.
|
||||
var byteOrderMarkIndicator = "\uFEFF";
|
||||
function getNodeSystem() {
|
||||
var _a;
|
||||
var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
|
||||
var _fs = require("fs");
|
||||
var _path = require("path");
|
||||
var _os = require("os");
|
||||
// crypto can be absent on reduced node installations
|
||||
var _crypto;
|
||||
try {
|
||||
_crypto = require("crypto");
|
||||
}
|
||||
catch (_b) {
|
||||
_crypto = undefined;
|
||||
}
|
||||
var activeSession;
|
||||
var profilePath = "./profile.cpuprofile";
|
||||
var hitSystemWatcherLimit = false;
|
||||
var Buffer = require("buffer").Buffer;
|
||||
var nodeVersion = getNodeMajorVersion();
|
||||
var isNode4OrLater = nodeVersion >= 4;
|
||||
var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
||||
var platform = _os.platform();
|
||||
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
||||
var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync;
|
||||
var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
|
||||
var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
|
||||
var _c = createSystemWatchFunctions({
|
||||
pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
|
||||
getModifiedTime: getModifiedTime,
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout,
|
||||
fsWatch: fsWatch,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
getCurrentDirectory: getCurrentDirectory,
|
||||
fileExists: fileExists,
|
||||
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
||||
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
||||
fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
|
||||
directoryExists: directoryExists,
|
||||
getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
|
||||
realpath: realpath,
|
||||
tscWatchFile: process.env.TSC_WATCHFILE,
|
||||
useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
|
||||
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
||||
defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
||||
}), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
write: function (s) {
|
||||
process.stdout.write(s);
|
||||
},
|
||||
getWidthOfTerminal: function () {
|
||||
return process.stdout.columns;
|
||||
},
|
||||
writeOutputIsTTY: function () {
|
||||
return process.stdout.isTTY;
|
||||
},
|
||||
readFile: readFile,
|
||||
writeFile: writeFile,
|
||||
watchFile: watchFile,
|
||||
watchDirectory: watchDirectory,
|
||||
resolvePath: function (path) { return _path.resolve(path); },
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
// Wrapped in a try-catch to prevent crashing if we are in a race
|
||||
// with another copy of ourselves to create the same directory
|
||||
try {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code !== "EEXIST") {
|
||||
// Failed for some other reason (access denied?); still throw
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getExecutingFilePath: function () {
|
||||
return __filename;
|
||||
},
|
||||
getCurrentDirectory: getCurrentDirectory,
|
||||
getDirectories: getDirectories,
|
||||
getEnvironmentVariable: function (name) {
|
||||
return process.env[name] || "";
|
||||
},
|
||||
readDirectory: readDirectory,
|
||||
getModifiedTime: getModifiedTime,
|
||||
setModifiedTime: setModifiedTime,
|
||||
deleteFile: deleteFile,
|
||||
createHash: _crypto ? createSHA256Hash : generateDjb2Hash,
|
||||
createSHA256Hash: _crypto ? createSHA256Hash : undefined,
|
||||
getMemoryUsage: function () {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
}
|
||||
return process.memoryUsage().heapUsed;
|
||||
},
|
||||
getFileSize: function (path) {
|
||||
try {
|
||||
var stat = statSync(path);
|
||||
if (stat === null || stat === void 0 ? void 0 : stat.isFile()) {
|
||||
return stat.size;
|
||||
}
|
||||
}
|
||||
catch ( /*ignore*/_a) { /*ignore*/ }
|
||||
return 0;
|
||||
},
|
||||
exit: function (exitCode) {
|
||||
disableCPUProfiler(function () { return process.exit(exitCode); });
|
||||
},
|
||||
enableCPUProfiler: enableCPUProfiler,
|
||||
disableCPUProfiler: disableCPUProfiler,
|
||||
cpuProfilingEnabled: function () { return !!activeSession || ts.contains(process.execArgv, "--cpu-prof") || ts.contains(process.execArgv, "--prof"); },
|
||||
realpath: realpath,
|
||||
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || ts.some(process.execArgv, function (arg) { return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg); }),
|
||||
tryEnableSourceMapsForHost: function () {
|
||||
try {
|
||||
require("source-map-support").install();
|
||||
}
|
||||
catch (_a) {
|
||||
// Could not enable source maps.
|
||||
}
|
||||
},
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout,
|
||||
clearScreen: function () {
|
||||
process.stdout.write("\x1Bc");
|
||||
},
|
||||
setBlocking: function () {
|
||||
if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) {
|
||||
process.stdout._handle.setBlocking(true);
|
||||
}
|
||||
},
|
||||
bufferFrom: bufferFrom,
|
||||
base64decode: function (input) { return bufferFrom(input, "base64").toString("utf8"); },
|
||||
base64encode: function (input) { return bufferFrom(input).toString("base64"); },
|
||||
require: function (baseDir, moduleName) {
|
||||
try {
|
||||
var modulePath = ts.resolveJSModule(moduleName, baseDir, nodeSystem);
|
||||
return { module: require(modulePath), modulePath: modulePath, error: undefined };
|
||||
}
|
||||
catch (error) {
|
||||
return { module: undefined, modulePath: undefined, error: error };
|
||||
}
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
/**
|
||||
* `throwIfNoEntry` was added so recently that it's not in the node types.
|
||||
* This helper encapsulates the mitigating usage of `any`.
|
||||
* See https://github.com/nodejs/node/pull/33716
|
||||
*/
|
||||
function statSync(path) {
|
||||
// throwIfNoEntry will be ignored by older versions of node
|
||||
return _fs.statSync(path, { throwIfNoEntry: false });
|
||||
}
|
||||
/**
|
||||
* Uses the builtin inspector APIs to capture a CPU profile
|
||||
* See https://nodejs.org/api/inspector.html#inspector_example_usage for details
|
||||
*/
|
||||
function enableCPUProfiler(path, cb) {
|
||||
if (activeSession) {
|
||||
cb();
|
||||
return false;
|
||||
}
|
||||
var inspector = require("inspector");
|
||||
if (!inspector || !inspector.Session) {
|
||||
cb();
|
||||
return false;
|
||||
}
|
||||
var session = new inspector.Session();
|
||||
session.connect();
|
||||
session.post("Profiler.enable", function () {
|
||||
session.post("Profiler.start", function () {
|
||||
activeSession = session;
|
||||
profilePath = path;
|
||||
cb();
|
||||
});
|
||||
});
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Strips non-TS paths from the profile, so users with private projects shouldn't
|
||||
* need to worry about leaking paths by submitting a cpu profile to us
|
||||
*/
|
||||
function cleanupPaths(profile) {
|
||||
var externalFileCounter = 0;
|
||||
var remappedPaths = new ts.Map();
|
||||
var normalizedDir = ts.normalizeSlashes(__dirname);
|
||||
// Windows rooted dir names need an extra `/` prepended to be valid file:/// urls
|
||||
var fileUrlRoot = "file://".concat(ts.getRootLength(normalizedDir) === 1 ? "" : "/").concat(normalizedDir);
|
||||
for (var _i = 0, _a = profile.nodes; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
if (node.callFrame.url) {
|
||||
var url = ts.normalizeSlashes(node.callFrame.url);
|
||||
if (ts.containsPath(fileUrlRoot, url, useCaseSensitiveFileNames)) {
|
||||
node.callFrame.url = ts.getRelativePathToDirectoryOrUrl(fileUrlRoot, url, fileUrlRoot, ts.createGetCanonicalFileName(useCaseSensitiveFileNames), /*isAbsolutePathAnUrl*/ true);
|
||||
}
|
||||
else if (!nativePattern.test(url)) {
|
||||
node.callFrame.url = (remappedPaths.has(url) ? remappedPaths : remappedPaths.set(url, "external".concat(externalFileCounter, ".js"))).get(url);
|
||||
externalFileCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
function disableCPUProfiler(cb) {
|
||||
if (activeSession && activeSession !== "stopping") {
|
||||
var s_1 = activeSession;
|
||||
activeSession.post("Profiler.stop", function (err, _a) {
|
||||
var _b;
|
||||
var profile = _a.profile;
|
||||
if (!err) {
|
||||
try {
|
||||
if ((_b = statSync(profilePath)) === null || _b === void 0 ? void 0 : _b.isDirectory()) {
|
||||
profilePath = _path.join(profilePath, "".concat((new Date()).toISOString().replace(/:/g, "-"), "+P").concat(process.pid, ".cpuprofile"));
|
||||
}
|
||||
}
|
||||
catch (_c) {
|
||||
// do nothing and ignore fallible fs operation
|
||||
}
|
||||
try {
|
||||
_fs.mkdirSync(_path.dirname(profilePath), { recursive: true });
|
||||
}
|
||||
catch (_d) {
|
||||
// do nothing and ignore fallible fs operation
|
||||
}
|
||||
_fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile)));
|
||||
}
|
||||
activeSession = undefined;
|
||||
s_1.disconnect();
|
||||
cb();
|
||||
});
|
||||
activeSession = "stopping";
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
cb();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function bufferFrom(input, encoding) {
|
||||
// See https://github.com/Microsoft/TypeScript/issues/25652
|
||||
return Buffer.from && Buffer.from !== Int8Array.from
|
||||
? Buffer.from(input, encoding)
|
||||
: new Buffer(input, encoding);
|
||||
}
|
||||
function isFileSystemCaseSensitive() {
|
||||
// win32\win64 are case insensitive platforms
|
||||
if (platform === "win32" || platform === "win64") {
|
||||
return false;
|
||||
}
|
||||
// If this file exists under a different case, we must be case-insensitve.
|
||||
return !fileExists(swapCase(__filename));
|
||||
}
|
||||
/** Convert all lowercase chars to uppercase, and vice-versa */
|
||||
function swapCase(s) {
|
||||
return s.replace(/\w/g, function (ch) {
|
||||
var up = ch.toUpperCase();
|
||||
return ch === up ? ch.toLowerCase() : up;
|
||||
});
|
||||
}
|
||||
function fsWatchFileWorker(fileName, callback, pollingInterval) {
|
||||
_fs.watchFile(fileName, { persistent: true, interval: pollingInterval }, fileChanged);
|
||||
var eventKind;
|
||||
return {
|
||||
close: function () { return _fs.unwatchFile(fileName, fileChanged); }
|
||||
};
|
||||
function fileChanged(curr, prev) {
|
||||
// previous event kind check is to ensure we recongnize the file as previously also missing when it is restored or renamed twice (that is it disappears and reappears)
|
||||
// In such case, prevTime returned is same as prev time of event when file was deleted as per node documentation
|
||||
var isPreviouslyDeleted = +prev.mtime === 0 || eventKind === FileWatcherEventKind.Deleted;
|
||||
if (+curr.mtime === 0) {
|
||||
if (isPreviouslyDeleted) {
|
||||
// Already deleted file, no need to callback again
|
||||
return;
|
||||
}
|
||||
eventKind = FileWatcherEventKind.Deleted;
|
||||
}
|
||||
else if (isPreviouslyDeleted) {
|
||||
eventKind = FileWatcherEventKind.Created;
|
||||
}
|
||||
// If there is no change in modified time, ignore the event
|
||||
else if (+curr.mtime === +prev.mtime) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// File changed
|
||||
eventKind = FileWatcherEventKind.Changed;
|
||||
}
|
||||
callback(fileName, eventKind);
|
||||
}
|
||||
}
|
||||
function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
|
||||
var options;
|
||||
var lastDirectoryPartWithDirectorySeparator;
|
||||
var lastDirectoryPart;
|
||||
if (isLinuxOrMacOs) {
|
||||
lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
|
||||
lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
|
||||
}
|
||||
/** Watcher for the file system entry depending on whether it is missing or present */
|
||||
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
|
||||
watchMissingFileSystemEntry() :
|
||||
watchPresentFileSystemEntry();
|
||||
return {
|
||||
close: function () {
|
||||
// Close the watcher (either existing file system entry watcher or missing file system entry watcher)
|
||||
watcher.close();
|
||||
watcher = undefined;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Invoke the callback with rename and update the watcher if not closed
|
||||
* @param createWatcher
|
||||
*/
|
||||
function invokeCallbackAndUpdateWatcher(createWatcher) {
|
||||
ts.sysLog("sysLog:: ".concat(fileOrDirectory, ":: Changing watcher to ").concat(createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing", "FileSystemEntryWatcher"));
|
||||
// Call the callback for current directory
|
||||
callback("rename", "");
|
||||
// If watcher is not closed, update it
|
||||
if (watcher) {
|
||||
watcher.close();
|
||||
watcher = createWatcher();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Watch the file or directory that is currently present
|
||||
* and when the watched file or directory is deleted, switch to missing file system entry watcher
|
||||
*/
|
||||
function watchPresentFileSystemEntry() {
|
||||
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
||||
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
||||
if (options === undefined) {
|
||||
if (fsSupportsRecursiveFsWatch) {
|
||||
options = { persistent: true, recursive: !!recursive };
|
||||
}
|
||||
else {
|
||||
options = { persistent: true };
|
||||
}
|
||||
}
|
||||
if (hitSystemWatcherLimit) {
|
||||
ts.sysLog("sysLog:: ".concat(fileOrDirectory, ":: Defaulting to fsWatchFile"));
|
||||
return watchPresentFileSystemEntryWithFsWatchFile();
|
||||
}
|
||||
try {
|
||||
var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
|
||||
callbackChangingToMissingFileSystemEntry :
|
||||
callback);
|
||||
// Watch the missing file or directory or error
|
||||
presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
|
||||
return presentWatcher;
|
||||
}
|
||||
catch (e) {
|
||||
// Catch the exception and use polling instead
|
||||
// Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
|
||||
// so instead of throwing error, use fs.watchFile
|
||||
hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
|
||||
ts.sysLog("sysLog:: ".concat(fileOrDirectory, ":: Changing to fsWatchFile"));
|
||||
return watchPresentFileSystemEntryWithFsWatchFile();
|
||||
}
|
||||
}
|
||||
function callbackChangingToMissingFileSystemEntry(event, relativeName) {
|
||||
// because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
|
||||
// Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
|
||||
return event === "rename" &&
|
||||
(!relativeName ||
|
||||
relativeName === lastDirectoryPart ||
|
||||
(relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
|
||||
!fileSystemEntryExists(fileOrDirectory, entryKind) ?
|
||||
invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
|
||||
callback(event, relativeName);
|
||||
}
|
||||
/**
|
||||
* Watch the file or directory using fs.watchFile since fs.watch threw exception
|
||||
* Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
|
||||
*/
|
||||
function watchPresentFileSystemEntryWithFsWatchFile() {
|
||||
return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
|
||||
}
|
||||
/**
|
||||
* Watch the file or directory that is missing
|
||||
* and switch to existing file or directory when the missing filesystem entry is created
|
||||
*/
|
||||
function watchMissingFileSystemEntry() {
|
||||
return watchFile(fileOrDirectory, function (_fileName, eventKind) {
|
||||
if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
|
||||
// Call the callback for current file or directory
|
||||
// For now it could be callback for the inner directory creation,
|
||||
// but just return current directory, better than current no-op
|
||||
invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
|
||||
}
|
||||
}, fallbackPollingInterval, fallbackOptions);
|
||||
}
|
||||
}
|
||||
function readFileWorker(fileName, _encoding) {
|
||||
var buffer;
|
||||
try {
|
||||
buffer = _fs.readFileSync(fileName);
|
||||
}
|
||||
catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
var len = buffer.length;
|
||||
if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) {
|
||||
// Big endian UTF-16 byte order mark detected. Since big endian is not supported by node.js,
|
||||
// flip all byte pairs and treat as little endian.
|
||||
len &= ~1; // Round down to a multiple of 2
|
||||
for (var i = 0; i < len; i += 2) {
|
||||
var temp = buffer[i];
|
||||
buffer[i] = buffer[i + 1];
|
||||
buffer[i + 1] = temp;
|
||||
}
|
||||
return buffer.toString("utf16le", 2);
|
||||
}
|
||||
if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) {
|
||||
// Little endian UTF-16 byte order mark detected
|
||||
return buffer.toString("utf16le", 2);
|
||||
}
|
||||
if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
|
||||
// UTF-8 byte order mark detected
|
||||
return buffer.toString("utf8", 3);
|
||||
}
|
||||
// Default is UTF-8 with no byte order mark
|
||||
return buffer.toString("utf8");
|
||||
}
|
||||
function readFile(fileName, _encoding) {
|
||||
ts.perfLogger.logStartReadFile(fileName);
|
||||
var file = readFileWorker(fileName, _encoding);
|
||||
ts.perfLogger.logStopReadFile();
|
||||
return file;
|
||||
}
|
||||
function writeFile(fileName, data, writeByteOrderMark) {
|
||||
ts.perfLogger.logEvent("WriteFile: " + fileName);
|
||||
// If a BOM is required, emit one
|
||||
if (writeByteOrderMark) {
|
||||
data = byteOrderMarkIndicator + data;
|
||||
}
|
||||
var fd;
|
||||
try {
|
||||
fd = _fs.openSync(fileName, "w");
|
||||
_fs.writeSync(fd, data, /*position*/ undefined, "utf8");
|
||||
}
|
||||
finally {
|
||||
if (fd !== undefined) {
|
||||
_fs.closeSync(fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getAccessibleFileSystemEntries(path) {
|
||||
ts.perfLogger.logEvent("ReadDir: " + (path || "."));
|
||||
try {
|
||||
var entries = _fs.readdirSync(path || ".", { withFileTypes: true });
|
||||
var files = [];
|
||||
var directories = [];
|
||||
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
||||
var dirent = entries_1[_i];
|
||||
// withFileTypes is not supported before Node 10.10.
|
||||
var entry = typeof dirent === "string" ? dirent : dirent.name;
|
||||
// This is necessary because on some file system node fails to exclude
|
||||
// "." and "..". See https://github.com/nodejs/node/issues/4002
|
||||
if (entry === "." || entry === "..") {
|
||||
continue;
|
||||
}
|
||||
var stat = void 0;
|
||||
if (typeof dirent === "string" || dirent.isSymbolicLink()) {
|
||||
var name = ts.combinePaths(path, entry);
|
||||
try {
|
||||
stat = statSync(name);
|
||||
if (!stat) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
stat = dirent;
|
||||
}
|
||||
if (stat.isFile()) {
|
||||
files.push(entry);
|
||||
}
|
||||
else if (stat.isDirectory()) {
|
||||
directories.push(entry);
|
||||
}
|
||||
}
|
||||
files.sort();
|
||||
directories.sort();
|
||||
return { files: files, directories: directories };
|
||||
}
|
||||
catch (e) {
|
||||
return ts.emptyFileSystemEntries;
|
||||
}
|
||||
}
|
||||
function readDirectory(path, extensions, excludes, includes, depth) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
||||
}
|
||||
function fileSystemEntryExists(path, entryKind) {
|
||||
// Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
|
||||
// the CPU time performance.
|
||||
var originalStackTraceLimit = Error.stackTraceLimit;
|
||||
Error.stackTraceLimit = 0;
|
||||
try {
|
||||
var stat = statSync(path);
|
||||
if (!stat) {
|
||||
return false;
|
||||
}
|
||||
switch (entryKind) {
|
||||
case 0 /* File */: return stat.isFile();
|
||||
case 1 /* Directory */: return stat.isDirectory();
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
Error.stackTraceLimit = originalStackTraceLimit;
|
||||
}
|
||||
}
|
||||
function fileExists(path) {
|
||||
return fileSystemEntryExists(path, 0 /* File */);
|
||||
}
|
||||
function directoryExists(path) {
|
||||
return fileSystemEntryExists(path, 1 /* Directory */);
|
||||
}
|
||||
function getDirectories(path) {
|
||||
return getAccessibleFileSystemEntries(path).directories.slice();
|
||||
}
|
||||
function realpath(path) {
|
||||
try {
|
||||
return realpathSync(path);
|
||||
}
|
||||
catch (_a) {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
function getModifiedTime(path) {
|
||||
var _a;
|
||||
try {
|
||||
return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
|
||||
}
|
||||
catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function setModifiedTime(path, time) {
|
||||
try {
|
||||
_fs.utimesSync(path, time, time);
|
||||
}
|
||||
catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
function deleteFile(path) {
|
||||
try {
|
||||
return _fs.unlinkSync(path);
|
||||
}
|
||||
catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
function createSHA256Hash(data) {
|
||||
var hash = _crypto.createHash("sha256");
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
}
|
||||
var sys;
|
||||
if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") {
|
||||
// process and process.nextTick checks if current environment is node-like
|
||||
// process.browser check excludes webpack and browserify
|
||||
sys = getNodeSystem();
|
||||
}
|
||||
if (sys) {
|
||||
// patch writefile to create folder before writing the file
|
||||
patchWriteFileEnsuringDirectory(sys);
|
||||
}
|
||||
return sys;
|
||||
})();
|
||||
/*@internal*/
|
||||
function setSys(s) {
|
||||
ts.sys = s;
|
||||
|
|
@ -162604,7 +163188,7 @@ if (typeof process === "undefined" || process.browser) {
|
|||
globalThis.toolsVersion = ts.versionMajorMinor;
|
||||
}
|
||||
if (typeof module !== "undefined" && module.exports) {
|
||||
/* MONACOCHANGE */ /*module.exports = ts;*/ /* END MONACOCHANGE */
|
||||
module.exports = ts;
|
||||
}
|
||||
var ts;
|
||||
(function (ts) {
|
||||
|
|
@ -163529,6 +164113,7 @@ var ts;
|
|||
|
||||
|
||||
|
||||
|
||||
// MONACOCHANGE
|
||||
// Defining the entire module name because r.js has an issue and cannot bundle this file
|
||||
// correctly with an anonymous define call
|
||||
|
|
|
|||
|
|
@ -7594,6 +7594,4 @@ declare namespace ts {
|
|||
const isIdentifierOrPrivateIdentifier: (node: Node) => node is MemberName;
|
||||
}
|
||||
|
||||
// MONACOCHANGE
|
||||
export = ts;
|
||||
// END MONACOCHANGE
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
//
|
||||
// **NOTE**: Do not edit directly! This file is generated using `npm run import-typescript`
|
||||
//
|
||||
|
||||
/* MONACOCHANGE */
|
||||
var require = undefined;
|
||||
var module = { exports: {} };
|
||||
/* END MONACOCHANGE */
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
|
|
@ -17,7 +22,7 @@ and limitations under the License.
|
|||
***************************************************************************** */
|
||||
|
||||
"use strict";
|
||||
var __spreadArray = function (to, from, pack) {
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
|
|
@ -26,7 +31,7 @@ var __spreadArray = function (to, from, pack) {
|
|||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
var __assign = function () {
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
|
|
@ -37,11 +42,11 @@ var __assign = function () {
|
|||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __makeTemplateObject = function (cooked, raw) {
|
||||
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
var __generator = function (thisArg, body) {
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
|
|
@ -68,7 +73,7 @@ var __generator = function (thisArg, body) {
|
|||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __rest = function (s, e) {
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
|
|
@ -79,7 +84,7 @@ var __rest = function (s, e) {
|
|||
}
|
||||
return t;
|
||||
};
|
||||
var __extends = (function () {
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
|
|
@ -2554,9 +2559,7 @@ var ts;
|
|||
return true;
|
||||
}
|
||||
function fail(message, stackCrawlMark) {
|
||||
// MONACOCHANGE
|
||||
// debugger;
|
||||
// END MONACOCHANGE
|
||||
debugger;
|
||||
var e = new Error(message ? "Debug Failure. ".concat(message) : "Debug Failure.");
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(e, stackCrawlMark || fail);
|
||||
|
|
@ -3058,9 +3061,7 @@ var ts;
|
|||
try {
|
||||
if (ts.sys && ts.sys.require) {
|
||||
var basePath = ts.getDirectoryPath(ts.resolvePath(ts.sys.getExecutingFilePath()));
|
||||
// MONACOCHANGE
|
||||
var result = undefined;
|
||||
// END MONACOCHANGE
|
||||
var result = ts.sys.require(basePath, "./compiler-debug");
|
||||
if (!result.error) {
|
||||
result.module.init(ts);
|
||||
extendedDebugModule = result.module;
|
||||
|
|
@ -3512,10 +3513,10 @@ var ts;
|
|||
}
|
||||
}
|
||||
function tryGetNodePerformanceHooks() {
|
||||
if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && /* MONACOCHANGE */false/* END MONACOCHANGE */) {
|
||||
if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && typeof require === "function") {
|
||||
try {
|
||||
var performance_1;
|
||||
var _a /* MONACOCHANGE */= {}/* END MONACOCHANGE */, nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver;
|
||||
var _a = require("perf_hooks"), nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver;
|
||||
if (hasRequiredAPI(nodePerformance_1, PerformanceObserver_1)) {
|
||||
performance_1 = nodePerformance_1;
|
||||
// There is a bug in Node's performance.measure prior to 12.16.3/13.13.0 that does not
|
||||
|
|
@ -3746,9 +3747,7 @@ var ts;
|
|||
var etwModulePath = (_a = process.env.TS_ETW_MODULE_PATH) !== null && _a !== void 0 ? _a : "./node_modules/@microsoft/typescript-etw";
|
||||
// require() will throw an exception if the module is not found
|
||||
// It may also return undefined if not installed properly
|
||||
// MONACOCHANGE
|
||||
etwModule = undefined;
|
||||
// END MONACOCHANGE
|
||||
etwModule = require(etwModulePath);
|
||||
}
|
||||
catch (e) {
|
||||
etwModule = undefined;
|
||||
|
|
@ -3777,9 +3776,7 @@ var ts;
|
|||
ts.Debug.assert(!ts.tracing, "Tracing already started");
|
||||
if (fs === undefined) {
|
||||
try {
|
||||
// MONACOCHANGE
|
||||
fs = undefined;
|
||||
// END MONACOCHANGE
|
||||
fs = require("fs");
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error("tracing requires having fs\n(original error: ".concat(e.message || e, ")"));
|
||||
|
|
@ -7463,9 +7460,596 @@ var ts;
|
|||
ts.getNodeMajorVersion = getNodeMajorVersion;
|
||||
// TODO: GH#18217 this is used as if it's certainly defined in many places.
|
||||
// eslint-disable-next-line prefer-const
|
||||
// MONACOCHANGE
|
||||
ts.sys = undefined;
|
||||
// END MONACOCHANGE
|
||||
ts.sys = (function () {
|
||||
// NodeJS detects "\uFEFF" at the start of the string and *replaces* it with the actual
|
||||
// byte order mark from the specified encoding. Using any other byte order mark does
|
||||
// not actually work.
|
||||
var byteOrderMarkIndicator = "\uFEFF";
|
||||
function getNodeSystem() {
|
||||
var _a;
|
||||
var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
|
||||
var _fs = require("fs");
|
||||
var _path = require("path");
|
||||
var _os = require("os");
|
||||
// crypto can be absent on reduced node installations
|
||||
var _crypto;
|
||||
try {
|
||||
_crypto = require("crypto");
|
||||
}
|
||||
catch (_b) {
|
||||
_crypto = undefined;
|
||||
}
|
||||
var activeSession;
|
||||
var profilePath = "./profile.cpuprofile";
|
||||
var hitSystemWatcherLimit = false;
|
||||
var Buffer = require("buffer").Buffer;
|
||||
var nodeVersion = getNodeMajorVersion();
|
||||
var isNode4OrLater = nodeVersion >= 4;
|
||||
var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
||||
var platform = _os.platform();
|
||||
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
||||
var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync;
|
||||
var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
|
||||
var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
|
||||
var _c = createSystemWatchFunctions({
|
||||
pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
|
||||
getModifiedTime: getModifiedTime,
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout,
|
||||
fsWatch: fsWatch,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
getCurrentDirectory: getCurrentDirectory,
|
||||
fileExists: fileExists,
|
||||
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
||||
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
||||
fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
|
||||
directoryExists: directoryExists,
|
||||
getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
|
||||
realpath: realpath,
|
||||
tscWatchFile: process.env.TSC_WATCHFILE,
|
||||
useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
|
||||
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
||||
defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
||||
}), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
|
||||
var nodeSystem = {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
write: function (s) {
|
||||
process.stdout.write(s);
|
||||
},
|
||||
getWidthOfTerminal: function () {
|
||||
return process.stdout.columns;
|
||||
},
|
||||
writeOutputIsTTY: function () {
|
||||
return process.stdout.isTTY;
|
||||
},
|
||||
readFile: readFile,
|
||||
writeFile: writeFile,
|
||||
watchFile: watchFile,
|
||||
watchDirectory: watchDirectory,
|
||||
resolvePath: function (path) { return _path.resolve(path); },
|
||||
fileExists: fileExists,
|
||||
directoryExists: directoryExists,
|
||||
createDirectory: function (directoryName) {
|
||||
if (!nodeSystem.directoryExists(directoryName)) {
|
||||
// Wrapped in a try-catch to prevent crashing if we are in a race
|
||||
// with another copy of ourselves to create the same directory
|
||||
try {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code !== "EEXIST") {
|
||||
// Failed for some other reason (access denied?); still throw
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getExecutingFilePath: function () {
|
||||
return __filename;
|
||||
},
|
||||
getCurrentDirectory: getCurrentDirectory,
|
||||
getDirectories: getDirectories,
|
||||
getEnvironmentVariable: function (name) {
|
||||
return process.env[name] || "";
|
||||
},
|
||||
readDirectory: readDirectory,
|
||||
getModifiedTime: getModifiedTime,
|
||||
setModifiedTime: setModifiedTime,
|
||||
deleteFile: deleteFile,
|
||||
createHash: _crypto ? createSHA256Hash : generateDjb2Hash,
|
||||
createSHA256Hash: _crypto ? createSHA256Hash : undefined,
|
||||
getMemoryUsage: function () {
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
}
|
||||
return process.memoryUsage().heapUsed;
|
||||
},
|
||||
getFileSize: function (path) {
|
||||
try {
|
||||
var stat = statSync(path);
|
||||
if (stat === null || stat === void 0 ? void 0 : stat.isFile()) {
|
||||
return stat.size;
|
||||
}
|
||||
}
|
||||
catch ( /*ignore*/_a) { /*ignore*/ }
|
||||
return 0;
|
||||
},
|
||||
exit: function (exitCode) {
|
||||
disableCPUProfiler(function () { return process.exit(exitCode); });
|
||||
},
|
||||
enableCPUProfiler: enableCPUProfiler,
|
||||
disableCPUProfiler: disableCPUProfiler,
|
||||
cpuProfilingEnabled: function () { return !!activeSession || ts.contains(process.execArgv, "--cpu-prof") || ts.contains(process.execArgv, "--prof"); },
|
||||
realpath: realpath,
|
||||
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || ts.some(process.execArgv, function (arg) { return /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg); }),
|
||||
tryEnableSourceMapsForHost: function () {
|
||||
try {
|
||||
require("source-map-support").install();
|
||||
}
|
||||
catch (_a) {
|
||||
// Could not enable source maps.
|
||||
}
|
||||
},
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout,
|
||||
clearScreen: function () {
|
||||
process.stdout.write("\x1Bc");
|
||||
},
|
||||
setBlocking: function () {
|
||||
if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) {
|
||||
process.stdout._handle.setBlocking(true);
|
||||
}
|
||||
},
|
||||
bufferFrom: bufferFrom,
|
||||
base64decode: function (input) { return bufferFrom(input, "base64").toString("utf8"); },
|
||||
base64encode: function (input) { return bufferFrom(input).toString("base64"); },
|
||||
require: function (baseDir, moduleName) {
|
||||
try {
|
||||
var modulePath = ts.resolveJSModule(moduleName, baseDir, nodeSystem);
|
||||
return { module: require(modulePath), modulePath: modulePath, error: undefined };
|
||||
}
|
||||
catch (error) {
|
||||
return { module: undefined, modulePath: undefined, error: error };
|
||||
}
|
||||
}
|
||||
};
|
||||
return nodeSystem;
|
||||
/**
|
||||
* `throwIfNoEntry` was added so recently that it's not in the node types.
|
||||
* This helper encapsulates the mitigating usage of `any`.
|
||||
* See https://github.com/nodejs/node/pull/33716
|
||||
*/
|
||||
function statSync(path) {
|
||||
// throwIfNoEntry will be ignored by older versions of node
|
||||
return _fs.statSync(path, { throwIfNoEntry: false });
|
||||
}
|
||||
/**
|
||||
* Uses the builtin inspector APIs to capture a CPU profile
|
||||
* See https://nodejs.org/api/inspector.html#inspector_example_usage for details
|
||||
*/
|
||||
function enableCPUProfiler(path, cb) {
|
||||
if (activeSession) {
|
||||
cb();
|
||||
return false;
|
||||
}
|
||||
var inspector = require("inspector");
|
||||
if (!inspector || !inspector.Session) {
|
||||
cb();
|
||||
return false;
|
||||
}
|
||||
var session = new inspector.Session();
|
||||
session.connect();
|
||||
session.post("Profiler.enable", function () {
|
||||
session.post("Profiler.start", function () {
|
||||
activeSession = session;
|
||||
profilePath = path;
|
||||
cb();
|
||||
});
|
||||
});
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Strips non-TS paths from the profile, so users with private projects shouldn't
|
||||
* need to worry about leaking paths by submitting a cpu profile to us
|
||||
*/
|
||||
function cleanupPaths(profile) {
|
||||
var externalFileCounter = 0;
|
||||
var remappedPaths = new ts.Map();
|
||||
var normalizedDir = ts.normalizeSlashes(__dirname);
|
||||
// Windows rooted dir names need an extra `/` prepended to be valid file:/// urls
|
||||
var fileUrlRoot = "file://".concat(ts.getRootLength(normalizedDir) === 1 ? "" : "/").concat(normalizedDir);
|
||||
for (var _i = 0, _a = profile.nodes; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
if (node.callFrame.url) {
|
||||
var url = ts.normalizeSlashes(node.callFrame.url);
|
||||
if (ts.containsPath(fileUrlRoot, url, useCaseSensitiveFileNames)) {
|
||||
node.callFrame.url = ts.getRelativePathToDirectoryOrUrl(fileUrlRoot, url, fileUrlRoot, ts.createGetCanonicalFileName(useCaseSensitiveFileNames), /*isAbsolutePathAnUrl*/ true);
|
||||
}
|
||||
else if (!nativePattern.test(url)) {
|
||||
node.callFrame.url = (remappedPaths.has(url) ? remappedPaths : remappedPaths.set(url, "external".concat(externalFileCounter, ".js"))).get(url);
|
||||
externalFileCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
function disableCPUProfiler(cb) {
|
||||
if (activeSession && activeSession !== "stopping") {
|
||||
var s_1 = activeSession;
|
||||
activeSession.post("Profiler.stop", function (err, _a) {
|
||||
var _b;
|
||||
var profile = _a.profile;
|
||||
if (!err) {
|
||||
try {
|
||||
if ((_b = statSync(profilePath)) === null || _b === void 0 ? void 0 : _b.isDirectory()) {
|
||||
profilePath = _path.join(profilePath, "".concat((new Date()).toISOString().replace(/:/g, "-"), "+P").concat(process.pid, ".cpuprofile"));
|
||||
}
|
||||
}
|
||||
catch (_c) {
|
||||
// do nothing and ignore fallible fs operation
|
||||
}
|
||||
try {
|
||||
_fs.mkdirSync(_path.dirname(profilePath), { recursive: true });
|
||||
}
|
||||
catch (_d) {
|
||||
// do nothing and ignore fallible fs operation
|
||||
}
|
||||
_fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile)));
|
||||
}
|
||||
activeSession = undefined;
|
||||
s_1.disconnect();
|
||||
cb();
|
||||
});
|
||||
activeSession = "stopping";
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
cb();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function bufferFrom(input, encoding) {
|
||||
// See https://github.com/Microsoft/TypeScript/issues/25652
|
||||
return Buffer.from && Buffer.from !== Int8Array.from
|
||||
? Buffer.from(input, encoding)
|
||||
: new Buffer(input, encoding);
|
||||
}
|
||||
function isFileSystemCaseSensitive() {
|
||||
// win32\win64 are case insensitive platforms
|
||||
if (platform === "win32" || platform === "win64") {
|
||||
return false;
|
||||
}
|
||||
// If this file exists under a different case, we must be case-insensitve.
|
||||
return !fileExists(swapCase(__filename));
|
||||
}
|
||||
/** Convert all lowercase chars to uppercase, and vice-versa */
|
||||
function swapCase(s) {
|
||||
return s.replace(/\w/g, function (ch) {
|
||||
var up = ch.toUpperCase();
|
||||
return ch === up ? ch.toLowerCase() : up;
|
||||
});
|
||||
}
|
||||
function fsWatchFileWorker(fileName, callback, pollingInterval) {
|
||||
_fs.watchFile(fileName, { persistent: true, interval: pollingInterval }, fileChanged);
|
||||
var eventKind;
|
||||
return {
|
||||
close: function () { return _fs.unwatchFile(fileName, fileChanged); }
|
||||
};
|
||||
function fileChanged(curr, prev) {
|
||||
// previous event kind check is to ensure we recongnize the file as previously also missing when it is restored or renamed twice (that is it disappears and reappears)
|
||||
// In such case, prevTime returned is same as prev time of event when file was deleted as per node documentation
|
||||
var isPreviouslyDeleted = +prev.mtime === 0 || eventKind === FileWatcherEventKind.Deleted;
|
||||
if (+curr.mtime === 0) {
|
||||
if (isPreviouslyDeleted) {
|
||||
// Already deleted file, no need to callback again
|
||||
return;
|
||||
}
|
||||
eventKind = FileWatcherEventKind.Deleted;
|
||||
}
|
||||
else if (isPreviouslyDeleted) {
|
||||
eventKind = FileWatcherEventKind.Created;
|
||||
}
|
||||
// If there is no change in modified time, ignore the event
|
||||
else if (+curr.mtime === +prev.mtime) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// File changed
|
||||
eventKind = FileWatcherEventKind.Changed;
|
||||
}
|
||||
callback(fileName, eventKind);
|
||||
}
|
||||
}
|
||||
function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
|
||||
var options;
|
||||
var lastDirectoryPartWithDirectorySeparator;
|
||||
var lastDirectoryPart;
|
||||
if (isLinuxOrMacOs) {
|
||||
lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
|
||||
lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
|
||||
}
|
||||
/** Watcher for the file system entry depending on whether it is missing or present */
|
||||
var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
|
||||
watchMissingFileSystemEntry() :
|
||||
watchPresentFileSystemEntry();
|
||||
return {
|
||||
close: function () {
|
||||
// Close the watcher (either existing file system entry watcher or missing file system entry watcher)
|
||||
watcher.close();
|
||||
watcher = undefined;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Invoke the callback with rename and update the watcher if not closed
|
||||
* @param createWatcher
|
||||
*/
|
||||
function invokeCallbackAndUpdateWatcher(createWatcher) {
|
||||
ts.sysLog("sysLog:: ".concat(fileOrDirectory, ":: Changing watcher to ").concat(createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing", "FileSystemEntryWatcher"));
|
||||
// Call the callback for current directory
|
||||
callback("rename", "");
|
||||
// If watcher is not closed, update it
|
||||
if (watcher) {
|
||||
watcher.close();
|
||||
watcher = createWatcher();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Watch the file or directory that is currently present
|
||||
* and when the watched file or directory is deleted, switch to missing file system entry watcher
|
||||
*/
|
||||
function watchPresentFileSystemEntry() {
|
||||
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
||||
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
||||
if (options === undefined) {
|
||||
if (fsSupportsRecursiveFsWatch) {
|
||||
options = { persistent: true, recursive: !!recursive };
|
||||
}
|
||||
else {
|
||||
options = { persistent: true };
|
||||
}
|
||||
}
|
||||
if (hitSystemWatcherLimit) {
|
||||
ts.sysLog("sysLog:: ".concat(fileOrDirectory, ":: Defaulting to fsWatchFile"));
|
||||
return watchPresentFileSystemEntryWithFsWatchFile();
|
||||
}
|
||||
try {
|
||||
var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
|
||||
callbackChangingToMissingFileSystemEntry :
|
||||
callback);
|
||||
// Watch the missing file or directory or error
|
||||
presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
|
||||
return presentWatcher;
|
||||
}
|
||||
catch (e) {
|
||||
// Catch the exception and use polling instead
|
||||
// Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
|
||||
// so instead of throwing error, use fs.watchFile
|
||||
hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
|
||||
ts.sysLog("sysLog:: ".concat(fileOrDirectory, ":: Changing to fsWatchFile"));
|
||||
return watchPresentFileSystemEntryWithFsWatchFile();
|
||||
}
|
||||
}
|
||||
function callbackChangingToMissingFileSystemEntry(event, relativeName) {
|
||||
// because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
|
||||
// Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
|
||||
return event === "rename" &&
|
||||
(!relativeName ||
|
||||
relativeName === lastDirectoryPart ||
|
||||
(relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
|
||||
!fileSystemEntryExists(fileOrDirectory, entryKind) ?
|
||||
invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
|
||||
callback(event, relativeName);
|
||||
}
|
||||
/**
|
||||
* Watch the file or directory using fs.watchFile since fs.watch threw exception
|
||||
* Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
|
||||
*/
|
||||
function watchPresentFileSystemEntryWithFsWatchFile() {
|
||||
return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
|
||||
}
|
||||
/**
|
||||
* Watch the file or directory that is missing
|
||||
* and switch to existing file or directory when the missing filesystem entry is created
|
||||
*/
|
||||
function watchMissingFileSystemEntry() {
|
||||
return watchFile(fileOrDirectory, function (_fileName, eventKind) {
|
||||
if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
|
||||
// Call the callback for current file or directory
|
||||
// For now it could be callback for the inner directory creation,
|
||||
// but just return current directory, better than current no-op
|
||||
invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
|
||||
}
|
||||
}, fallbackPollingInterval, fallbackOptions);
|
||||
}
|
||||
}
|
||||
function readFileWorker(fileName, _encoding) {
|
||||
var buffer;
|
||||
try {
|
||||
buffer = _fs.readFileSync(fileName);
|
||||
}
|
||||
catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
var len = buffer.length;
|
||||
if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) {
|
||||
// Big endian UTF-16 byte order mark detected. Since big endian is not supported by node.js,
|
||||
// flip all byte pairs and treat as little endian.
|
||||
len &= ~1; // Round down to a multiple of 2
|
||||
for (var i = 0; i < len; i += 2) {
|
||||
var temp = buffer[i];
|
||||
buffer[i] = buffer[i + 1];
|
||||
buffer[i + 1] = temp;
|
||||
}
|
||||
return buffer.toString("utf16le", 2);
|
||||
}
|
||||
if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) {
|
||||
// Little endian UTF-16 byte order mark detected
|
||||
return buffer.toString("utf16le", 2);
|
||||
}
|
||||
if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
|
||||
// UTF-8 byte order mark detected
|
||||
return buffer.toString("utf8", 3);
|
||||
}
|
||||
// Default is UTF-8 with no byte order mark
|
||||
return buffer.toString("utf8");
|
||||
}
|
||||
function readFile(fileName, _encoding) {
|
||||
ts.perfLogger.logStartReadFile(fileName);
|
||||
var file = readFileWorker(fileName, _encoding);
|
||||
ts.perfLogger.logStopReadFile();
|
||||
return file;
|
||||
}
|
||||
function writeFile(fileName, data, writeByteOrderMark) {
|
||||
ts.perfLogger.logEvent("WriteFile: " + fileName);
|
||||
// If a BOM is required, emit one
|
||||
if (writeByteOrderMark) {
|
||||
data = byteOrderMarkIndicator + data;
|
||||
}
|
||||
var fd;
|
||||
try {
|
||||
fd = _fs.openSync(fileName, "w");
|
||||
_fs.writeSync(fd, data, /*position*/ undefined, "utf8");
|
||||
}
|
||||
finally {
|
||||
if (fd !== undefined) {
|
||||
_fs.closeSync(fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getAccessibleFileSystemEntries(path) {
|
||||
ts.perfLogger.logEvent("ReadDir: " + (path || "."));
|
||||
try {
|
||||
var entries = _fs.readdirSync(path || ".", { withFileTypes: true });
|
||||
var files = [];
|
||||
var directories = [];
|
||||
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
||||
var dirent = entries_1[_i];
|
||||
// withFileTypes is not supported before Node 10.10.
|
||||
var entry = typeof dirent === "string" ? dirent : dirent.name;
|
||||
// This is necessary because on some file system node fails to exclude
|
||||
// "." and "..". See https://github.com/nodejs/node/issues/4002
|
||||
if (entry === "." || entry === "..") {
|
||||
continue;
|
||||
}
|
||||
var stat = void 0;
|
||||
if (typeof dirent === "string" || dirent.isSymbolicLink()) {
|
||||
var name = ts.combinePaths(path, entry);
|
||||
try {
|
||||
stat = statSync(name);
|
||||
if (!stat) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
stat = dirent;
|
||||
}
|
||||
if (stat.isFile()) {
|
||||
files.push(entry);
|
||||
}
|
||||
else if (stat.isDirectory()) {
|
||||
directories.push(entry);
|
||||
}
|
||||
}
|
||||
files.sort();
|
||||
directories.sort();
|
||||
return { files: files, directories: directories };
|
||||
}
|
||||
catch (e) {
|
||||
return ts.emptyFileSystemEntries;
|
||||
}
|
||||
}
|
||||
function readDirectory(path, extensions, excludes, includes, depth) {
|
||||
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
||||
}
|
||||
function fileSystemEntryExists(path, entryKind) {
|
||||
// Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
|
||||
// the CPU time performance.
|
||||
var originalStackTraceLimit = Error.stackTraceLimit;
|
||||
Error.stackTraceLimit = 0;
|
||||
try {
|
||||
var stat = statSync(path);
|
||||
if (!stat) {
|
||||
return false;
|
||||
}
|
||||
switch (entryKind) {
|
||||
case 0 /* File */: return stat.isFile();
|
||||
case 1 /* Directory */: return stat.isDirectory();
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
Error.stackTraceLimit = originalStackTraceLimit;
|
||||
}
|
||||
}
|
||||
function fileExists(path) {
|
||||
return fileSystemEntryExists(path, 0 /* File */);
|
||||
}
|
||||
function directoryExists(path) {
|
||||
return fileSystemEntryExists(path, 1 /* Directory */);
|
||||
}
|
||||
function getDirectories(path) {
|
||||
return getAccessibleFileSystemEntries(path).directories.slice();
|
||||
}
|
||||
function realpath(path) {
|
||||
try {
|
||||
return realpathSync(path);
|
||||
}
|
||||
catch (_a) {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
function getModifiedTime(path) {
|
||||
var _a;
|
||||
try {
|
||||
return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
|
||||
}
|
||||
catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function setModifiedTime(path, time) {
|
||||
try {
|
||||
_fs.utimesSync(path, time, time);
|
||||
}
|
||||
catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
function deleteFile(path) {
|
||||
try {
|
||||
return _fs.unlinkSync(path);
|
||||
}
|
||||
catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
function createSHA256Hash(data) {
|
||||
var hash = _crypto.createHash("sha256");
|
||||
hash.update(data);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
}
|
||||
var sys;
|
||||
if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") {
|
||||
// process and process.nextTick checks if current environment is node-like
|
||||
// process.browser check excludes webpack and browserify
|
||||
sys = getNodeSystem();
|
||||
}
|
||||
if (sys) {
|
||||
// patch writefile to create folder before writing the file
|
||||
patchWriteFileEnsuringDirectory(sys);
|
||||
}
|
||||
return sys;
|
||||
})();
|
||||
/*@internal*/
|
||||
function setSys(s) {
|
||||
ts.sys = s;
|
||||
|
|
@ -162604,7 +163188,7 @@ if (typeof process === "undefined" || process.browser) {
|
|||
globalThis.toolsVersion = ts.versionMajorMinor;
|
||||
}
|
||||
if (typeof module !== "undefined" && module.exports) {
|
||||
/* MONACOCHANGE */ /*module.exports = ts;*/ /* END MONACOCHANGE */
|
||||
module.exports = ts;
|
||||
}
|
||||
var ts;
|
||||
(function (ts) {
|
||||
|
|
@ -163529,6 +164113,7 @@ var ts;
|
|||
|
||||
|
||||
|
||||
|
||||
// MONACOCHANGE
|
||||
export var createClassifier = ts.createClassifier;
|
||||
export var createLanguageService = ts.createLanguageService;
|
||||
|
|
|
|||
|
|
@ -63,14 +63,15 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
|
|||
|
||||
getScriptFileNames(): string[] {
|
||||
const allModels = this._ctx.getMirrorModels().map((model) => model.uri);
|
||||
const models = allModels.filter((uri) => !fileNameIsLib(uri)).map((uri) => uri.toString());
|
||||
const models = allModels.filter((uri) => !fileNameIsLib(uri)).map((uri) => uri.toString(true));
|
||||
return models.concat(Object.keys(this._extraLibs));
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
|
@ -486,7 +487,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) {
|
||||
|
|
|
|||
|
|
@ -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,6 +57,7 @@ export class WorkerManager {
|
|||
|
||||
private _getClient(): Promise<TypeScriptWorker> {
|
||||
if (!this._client) {
|
||||
this._client = (async () => {
|
||||
this._worker = editor.createWebWorker<TypeScriptWorker>({
|
||||
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
||||
moduleId: 'vs/language/typescript/tsWorker',
|
||||
|
|
@ -75,39 +75,27 @@ export class WorkerManager {
|
|||
}
|
||||
});
|
||||
|
||||
let p = <Promise<TypeScriptWorker>>this._worker.getProxy();
|
||||
|
||||
if (this._defaults.getEagerModelSync()) {
|
||||
p = p.then((worker) => {
|
||||
if (this._worker) {
|
||||
return this._worker.withSyncedResources(
|
||||
return await this._worker.withSyncedResources(
|
||||
editor
|
||||
.getModels()
|
||||
.filter((model) => model.getLanguageId() === this._modeId)
|
||||
.map((model) => model.uri)
|
||||
);
|
||||
}
|
||||
return worker;
|
||||
});
|
||||
}
|
||||
|
||||
this._client = p;
|
||||
return await this._worker.getProxy();
|
||||
})();
|
||||
}
|
||||
|
||||
return this._client;
|
||||
}
|
||||
|
||||
getLanguageServiceWorker(...resources: Uri[]): Promise<TypeScriptWorker> {
|
||||
let _client: TypeScriptWorker;
|
||||
return this._getClient()
|
||||
.then((client) => {
|
||||
_client = client;
|
||||
})
|
||||
.then((_) => {
|
||||
async getLanguageServiceWorker(...resources: Uri[]): Promise<TypeScriptWorker> {
|
||||
const client = await this._getClient();
|
||||
if (this._worker) {
|
||||
return this._worker.withSyncedResources(resources);
|
||||
await this._worker.withSyncedResources(resources);
|
||||
}
|
||||
})
|
||||
.then((_) => _client);
|
||||
return client;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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="../../../release/dev/vs/loader.js"></script>
|
||||
<script>
|
||||
require.config({
|
||||
paths: {
|
||||
vs: '../../release/dev/vs'
|
||||
vs: '../../../release/dev/vs'
|
||||
}
|
||||
});
|
||||
require(['vs/editor/editor.main'], () => {
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* 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 '../../../release/esm/vs/editor/editor.main.js';
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
19
test/smoke/package-vite.ts
Normal file
19
test/smoke/package-vite.ts
Normal file
|
|
@ -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
test/smoke/package-webpack.ts
Normal file
56
test/smoke/package-webpack.ts
Normal file
|
|
@ -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, 'release')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [<any>new MonacoWebpackPlugin({
|
||||
monacoEditorPath: path.resolve(REPO_ROOT, 'release')
|
||||
})]
|
||||
},
|
||||
(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
test/smoke/parcel/index.html
Normal file
11
test/smoke/parcel/index.html
Normal file
|
|
@ -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>
|
||||
35
test/smoke/parcel/index.js
Normal file
35
test/smoke/parcel/index.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import * as monaco from '../../../release/esm/vs/editor/editor.main.js';
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorker: function (moduleId, label) {
|
||||
if (label === 'json') {
|
||||
return new Worker(
|
||||
new URL('../../../release/esm/vs/language/json/json.worker.js', import.meta.url),
|
||||
{ type: 'module' }
|
||||
);
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
return new Worker(
|
||||
new URL('../../../release/esm/vs/language/css/css.worker.js', import.meta.url),
|
||||
{ type: 'module' }
|
||||
);
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
return new Worker(
|
||||
new URL('../../../release/esm/vs/language/html/html.worker.js', import.meta.url),
|
||||
{ type: 'module' }
|
||||
);
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
return new Worker(
|
||||
new URL('../../../release/esm/vs/language/typescript/ts.worker.js', import.meta.url),
|
||||
{ type: 'module' }
|
||||
);
|
||||
}
|
||||
return new Worker(new URL('../../../release/esm/vs/editor/editor.worker.js', import.meta.url), {
|
||||
type: 'module'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
window.monacoAPI = monaco;
|
||||
6
test/smoke/parcel/package.json
Normal file
6
test/smoke/parcel/package.json
Normal file
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,16 +123,18 @@ 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');
|
||||
|
||||
// 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);
|
||||
|
|
@ -135,27 +143,40 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
|
|||
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`);
|
||||
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');
|
||||
|
||||
// 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
|
||||
await page.waitForSelector(`text=$schema`);
|
||||
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
test/smoke/vite/index.html
Normal file
10
test/smoke/vite/index.html
Normal file
|
|
@ -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
test/smoke/vite/index.js
Normal file
31
test/smoke/vite/index.js
Normal file
|
|
@ -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 '../../../release/esm/vs/editor/editor.main';
|
||||
import editorWorker from '../../../release/esm/vs/editor/editor.worker?worker';
|
||||
import jsonWorker from '../../../release/esm/vs/language/json/json.worker?worker';
|
||||
import cssWorker from '../../../release/esm/vs/language/css/css.worker?worker';
|
||||
import htmlWorker from '../../../release/esm/vs/language/html/html.worker?worker';
|
||||
import tsWorker from '../../../release/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;
|
||||
|
|
@ -21,6 +21,7 @@ global.self = global;
|
|||
global.document.queryCommandSupported = function () {
|
||||
return false;
|
||||
};
|
||||
global.UIEvent = tmp.window.UIEvent;
|
||||
|
||||
global.window = {
|
||||
location: {},
|
||||
|
|
@ -58,5 +59,6 @@ requirejs(
|
|||
},
|
||||
function (err) {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ define('vs/nls', [], {
|
|||
return {
|
||||
localize: function () {
|
||||
return 'NO_LOCALIZATION_FOR_YOU';
|
||||
},
|
||||
getConfiguredDefaultLocale: function () {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
|
|
|||
|
|
@ -78,8 +78,12 @@ Options can be passed in to `MonacoWebpackPlugin`. They can be used to generate
|
|||
| handlebars | html |
|
||||
| scss, less | css |
|
||||
|
||||
To view a list of all available languages, you can run `import metadata from 'monaco-editor/esm/metadata'; console.log(metadata.languages);`.
|
||||
|
||||
- `features` (`string[]`) - include only a subset of the editor features. By default, all features shipped with the `monaco-editor` will be included. Instead of enumerating included features, it is also possible to exclude certain default features prefixing them with an exclamation mark '!'.
|
||||
|
||||
To view a list of all available features, you can run `import metadata from 'monaco-editor/esm/metadata'; console.log(metadata.features);`.
|
||||
|
||||
- `globalAPI` (`boolean`) - specify whether the editor API should be exposed through a global `monaco` object or not. This option is applicable to `0.22.0` and newer version of `monaco-editor`. Since `0.22.0`, the ESM version of the monaco editor does no longer define a global `monaco` object unless `global.MonacoEnvironment = { globalAPI: true }` is set ([change log](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md#0220-29012021)).
|
||||
- default value: `false`.
|
||||
|
||||
|
|
|
|||
152
webpack-plugin/package-lock.json
generated
152
webpack-plugin/package-lock.json
generated
|
|
@ -35,6 +35,64 @@
|
|||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
|
||||
"integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/set-array": "^1.0.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
|
||||
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/set-array": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
||||
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/source-map": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
|
||||
"integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz",
|
||||
"integrity": "sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/eslint": {
|
||||
"version": "8.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.1.tgz",
|
||||
|
|
@ -910,9 +968,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==",
|
||||
"dependencies": {
|
||||
"big.js": "^5.2.2",
|
||||
"emojis-list": "^3.0.0",
|
||||
|
|
@ -1508,14 +1566,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/terser": {
|
||||
"version": "5.12.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.12.1.tgz",
|
||||
"integrity": "sha512-NXbs+7nisos5E+yXwAD+y7zrcTkMqb0dEJxIGtSKPdCBzopf7ni4odPul2aechpV7EXNvOudYOX2bb5tln1jbQ==",
|
||||
"version": "5.14.2",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz",
|
||||
"integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
"acorn": "^8.5.0",
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.20"
|
||||
},
|
||||
"bin": {
|
||||
|
|
@ -1559,15 +1617,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/terser/node_modules/source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.6.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz",
|
||||
|
|
@ -1771,6 +1820,55 @@
|
|||
"integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/gen-mapping": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
|
||||
"integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/set-array": "^1.0.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
},
|
||||
"@jridgewell/resolve-uri": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
|
||||
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/set-array": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
||||
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/source-map": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
|
||||
"integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/gen-mapping": "^0.3.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
},
|
||||
"@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/trace-mapping": {
|
||||
"version": "0.3.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz",
|
||||
"integrity": "sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"@types/eslint": {
|
||||
"version": "8.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.1.tgz",
|
||||
|
|
@ -2450,9 +2548,9 @@
|
|||
"dev": 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==",
|
||||
"requires": {
|
||||
"big.js": "^5.2.2",
|
||||
"emojis-list": "^3.0.0",
|
||||
|
|
@ -2862,23 +2960,15 @@
|
|||
"dev": true
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.12.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.12.1.tgz",
|
||||
"integrity": "sha512-NXbs+7nisos5E+yXwAD+y7zrcTkMqb0dEJxIGtSKPdCBzopf7ni4odPul2aechpV7EXNvOudYOX2bb5tln1jbQ==",
|
||||
"version": "5.14.2",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz",
|
||||
"integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
"acorn": "^8.5.0",
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.20"
|
||||
},
|
||||
"dependencies": {
|
||||
"source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"terser-webpack-plugin": {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
"main": "out/index.js",
|
||||
"typings": "./out/index.d.ts",
|
||||
"scripts": {
|
||||
"package-for-smoketest": "node ./node_modules/webpack/bin/webpack.js --config smoketest/webpack.config.js --progress",
|
||||
"smoketest-cross-origin": "node ./node_modules/webpack/bin/webpack.js --config smoketest/webpack-cross-origin.config.js --progress",
|
||||
"watch": "tsc -w -p tsconfig.json",
|
||||
"compile": "tsc -p tsconfig.json",
|
||||
"import-editor": "node ./scripts/import-editor.js",
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
const MonacoWebpackPlugin = require('../out/index.js');
|
||||
const path = require('path');
|
||||
|
||||
const ASSET_PATH = 'http://localhost:8088/monaco-editor/test/smoke/webpack/out/';
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../../');
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: './index.js',
|
||||
context: __dirname,
|
||||
output: {
|
||||
path: path.resolve(REPO_ROOT, 'test/smoke/webpack/out'),
|
||||
filename: 'app.js',
|
||||
publicPath: ASSET_PATH
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'monaco-editor': path.resolve(REPO_ROOT, 'release')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new MonacoWebpackPlugin({
|
||||
monacoEditorPath: path.resolve(REPO_ROOT, 'release')
|
||||
})
|
||||
]
|
||||
};
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
const MonacoWebpackPlugin = require('../out/index.js');
|
||||
const path = require('path');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../../');
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: './index.js',
|
||||
context: __dirname,
|
||||
output: {
|
||||
path: path.resolve(REPO_ROOT, 'test/smoke/webpack/out'),
|
||||
filename: 'app.js'
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'monaco-editor': path.resolve(REPO_ROOT, 'release')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new MonacoWebpackPlugin({
|
||||
monacoEditorPath: path.resolve(REPO_ROOT, 'release')
|
||||
})
|
||||
]
|
||||
};
|
||||
3
website/index/samples/sample.cypher.txt
Normal file
3
website/index/samples/sample.cypher.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
MATCH (nicole:Actor {name: 'Nicole Kidman'})-[:ACTED_IN]->(movie:Movie)
|
||||
WHERE movie.year < $yearParameter
|
||||
RETURN movie
|
||||
|
|
@ -1,21 +1,24 @@
|
|||
import 'dart:async';
|
||||
import 'dart:math' show Random;
|
||||
main() async {
|
||||
|
||||
void main() async {
|
||||
print('Compute π using the Monte Carlo method.');
|
||||
await for (var estimate in computePi().take(100)) {
|
||||
await for (final estimate in computePi().take(100)) {
|
||||
print('π ≅ $estimate');
|
||||
}
|
||||
}
|
||||
|
||||
/// Generates a stream of increasingly accurate estimates of π.
|
||||
Stream<double> computePi({int batch: 100000}) async* {
|
||||
var total = 0;
|
||||
Stream<double> computePi({int batch = 100000}) async* {
|
||||
var total = 0; // Inferred to be of type int
|
||||
var count = 0;
|
||||
while (true) {
|
||||
var points = generateRandom().take(batch);
|
||||
var inside = points.where((p) => p.isInsideUnitCircle);
|
||||
final points = generateRandom().take(batch);
|
||||
final inside = points.where((p) => p.isInsideUnitCircle);
|
||||
|
||||
total += batch;
|
||||
count += inside.length;
|
||||
var ratio = count / total;
|
||||
final ratio = count / total;
|
||||
|
||||
// Area of a circle is A = π⋅r², therefore π = A/r².
|
||||
// So, when given random points with x ∈ <0,1>,
|
||||
// y ∈ <0,1>, the ratio of those inside a unit circle
|
||||
|
|
@ -24,14 +27,19 @@ Stream<double> computePi({int batch: 100000}) async* {
|
|||
yield ratio * 4;
|
||||
}
|
||||
}
|
||||
Iterable<Point> generateRandom([int seed]) sync* {
|
||||
|
||||
Iterable<Point> generateRandom([int? seed]) sync* {
|
||||
final random = Random(seed);
|
||||
while (true) {
|
||||
yield Point(random.nextDouble(), random.nextDouble());
|
||||
}
|
||||
}
|
||||
|
||||
class Point {
|
||||
final double x, y;
|
||||
final double x;
|
||||
final double y;
|
||||
|
||||
const Point(this.x, this.y);
|
||||
|
||||
bool get isInsideUnitCircle => x * x + y * y <= 1;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -156,6 +156,12 @@
|
|||
id: 'extending-language-services-hover-provider-example',
|
||||
path: 'extending-language-services/hover-provider-example'
|
||||
},
|
||||
{
|
||||
chapter: 'Extending Language Services',
|
||||
name: 'Model markers example',
|
||||
id: 'extending-language-services-model-markers-example',
|
||||
path: 'extending-language-services/model-markers-example'
|
||||
},
|
||||
{
|
||||
chapter: 'Extending Language Services',
|
||||
name: 'Semantic tokens provider example',
|
||||
|
|
|
|||
|
|
@ -34,27 +34,27 @@ monaco.languages.registerColorProvider('colorLanguage', {
|
|||
color: { red: 1, blue: 0, green: 0, alpha: 1 },
|
||||
range: {
|
||||
startLineNumber: 1,
|
||||
startColumn: 0,
|
||||
startColumn: 1,
|
||||
endLineNumber: 1,
|
||||
endColumn: 0
|
||||
endColumn: 4
|
||||
}
|
||||
},
|
||||
{
|
||||
color: { red: 0, blue: 1, green: 0, alpha: 1 },
|
||||
range: {
|
||||
startLineNumber: 2,
|
||||
startColumn: 0,
|
||||
startColumn: 1,
|
||||
endLineNumber: 2,
|
||||
endColumn: 0
|
||||
endColumn: 5
|
||||
}
|
||||
},
|
||||
{
|
||||
color: { red: 0, blue: 0, green: 1, alpha: 1 },
|
||||
range: {
|
||||
startLineNumber: 3,
|
||||
startColumn: 0,
|
||||
startColumn: 1,
|
||||
endLineNumber: 3,
|
||||
endColumn: 0
|
||||
endColumn: 6
|
||||
}
|
||||
}
|
||||
];
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
<div id="container" style="height: 100%"></div>
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
function validate(model) {
|
||||
const markers = [];
|
||||
// lines start at 1
|
||||
for (let i = 1; i < model.getLineCount() + 1; i++) {
|
||||
const range = {
|
||||
startLineNumber: i,
|
||||
startColumn: 1,
|
||||
endLineNumber: i,
|
||||
endColumn: model.getLineLength(i) + 1
|
||||
};
|
||||
const content = model.getValueInRange(range).trim();
|
||||
const number = Number(content);
|
||||
if (Number.isNaN(number)) {
|
||||
markers.push({
|
||||
message: 'not a number',
|
||||
severity: monaco.MarkerSeverity.Error,
|
||||
startLineNumber: range.startLineNumber,
|
||||
startColumn: range.startColumn,
|
||||
endLineNumber: range.endLineNumber,
|
||||
endColumn: range.endColumn
|
||||
});
|
||||
} else if (!Number.isInteger(number)) {
|
||||
markers.push({
|
||||
message: 'not an integer',
|
||||
severity: monaco.MarkerSeverity.Warning,
|
||||
startLineNumber: range.startLineNumber,
|
||||
startColumn: range.startColumn,
|
||||
endLineNumber: range.endLineNumber,
|
||||
endColumn: range.endColumn
|
||||
});
|
||||
}
|
||||
}
|
||||
monaco.editor.setModelMarkers(model, 'owner', markers);
|
||||
}
|
||||
|
||||
const value = `12345
|
||||
abcd
|
||||
234.56
|
||||
12345
|
||||
abcd
|
||||
234.56`;
|
||||
const uri = monaco.Uri.parse('inmemory://test');
|
||||
const model = monaco.editor.createModel(value, 'demoLanguage', uri);
|
||||
editor = monaco.editor.create(document.getElementById('container'), { model });
|
||||
validate(model);
|
||||
model.onDidChangeContent(() => {
|
||||
validate(model);
|
||||
});
|
||||
647
website/typedoc/monaco.d.ts
vendored
647
website/typedoc/monaco.d.ts
vendored
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue