diff --git a/.prettierignore b/.prettierignore index 670c09cc..9981429a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,8 +12,6 @@ /monaco-editor/typedoc/monaco.d.ts /monaco-editor/website/lib/ /monaco-editor-webpack-plugin/test/dist/*.js -/monaco-json/out/ -/monaco-json/release/ /monaco-languages/out/ /monaco-languages/release/ /monaco-typescript/out/ diff --git a/build/build.js b/build/build.js index 45d0f415..734158d6 100644 --- a/build/build.js +++ b/build/build.js @@ -17,6 +17,11 @@ dts( `out/release/html/monaco.d.ts`, 'monaco.languages.html' ); +dts( + `out/amd/json/monaco.contribution.d.ts`, + `out/release/json/monaco.d.ts`, + 'monaco.languages.json' +); buildESM2({ base: 'css', @@ -65,3 +70,25 @@ buildAMD2({ entryPoint: 'src/html/htmlWorker.ts', amdModuleId: 'vs/language/html/htmlWorker' }); + +buildESM2({ + base: 'json', + entryPoints: ['src/json/monaco.contribution.ts', 'src/json/jsonMode.ts', 'src/json/json.worker.ts'], + external: ['monaco-editor-core', '*/jsonMode'] +}); +buildAMD2({ + base: 'json', + entryPoint: 'src/json/monaco.contribution.ts', + amdModuleId: 'vs/language/json/monaco.contribution', + amdDependencies: ['vs/editor/editor.api'] +}); +buildAMD2({ + base: 'json', + entryPoint: 'src/json/jsonMode.ts', + amdModuleId: 'vs/language/json/jsonMode' +}); +buildAMD2({ + base: 'json', + entryPoint: 'src/json/jsonWorker.ts', + amdModuleId: 'vs/language/json/jsonWorker' +}); diff --git a/monaco-editor/metadata.js b/monaco-editor/metadata.js index 7d971078..9786f69d 100644 --- a/monaco-editor/metadata.js +++ b/monaco-editor/metadata.js @@ -39,12 +39,12 @@ name: 'monaco-json', contrib: 'vs/language/json/monaco.contribution', modulePrefix: 'vs/language/json', - rootPath: './monaco-json', + rootPath: './out/release/json', paths: { // use ./ to indicate it is relative to the `rootPath` - dev: './release/dev', - min: './release/min', - esm: './release/esm' + dev: './dev', + min: './min', + esm: './esm' } }, { diff --git a/monaco-json/build.js b/monaco-json/build.js deleted file mode 100644 index 148d259d..00000000 --- a/monaco-json/build.js +++ /dev/null @@ -1,41 +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 { removeDir, tsc, dts, buildESM, buildAMD } = require('../build/utils'); - -removeDir(`monaco-json/release`); -removeDir(`monaco-json/out`); - -tsc(`monaco-json/src/tsconfig.json`); - -dts( - `monaco-json/out/amd/monaco.contribution.d.ts`, - `monaco-json/monaco.d.ts`, - 'monaco.languages.json' -); - -buildESM({ - base: 'monaco-json', - entryPoints: ['src/monaco.contribution.ts', 'src/jsonMode.ts', 'src/json.worker.ts'], - external: ['monaco-editor-core', '*/jsonMode'] -}); -buildAMD({ - base: 'monaco-json', - entryPoint: 'src/monaco.contribution.ts', - amdModuleId: 'vs/language/json/monaco.contribution', - amdDependencies: ['vs/editor/editor.api'] -}); -buildAMD({ - base: 'monaco-json', - entryPoint: 'src/jsonMode.ts', - amdModuleId: 'vs/language/json/jsonMode' -}); -buildAMD({ - base: 'monaco-json', - entryPoint: 'src/jsonWorker.ts', - amdModuleId: 'vs/language/json/jsonWorker' -}); diff --git a/monaco-json/monaco.d.ts b/monaco-json/monaco.d.ts deleted file mode 100644 index ca459ec6..00000000 --- a/monaco-json/monaco.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare namespace monaco.languages.json { - export interface DiagnosticsOptions { - /** - * If set, the validator will be enabled and perform syntax and schema based validation, - * unless `DiagnosticsOptions.schemaValidation` is set to `ignore`. - */ - readonly validate?: boolean; - /** - * If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. - * `DiagnosticsOptions.allowComments` will override this setting. - */ - readonly allowComments?: boolean; - /** - * A list of known schemas and/or associations of schemas to file names. - */ - readonly schemas?: { - /** - * The URI of the schema, which is also the identifier of the schema. - */ - readonly uri: string; - /** - * A list of glob patterns that describe for which file URIs the JSON schema will be used. - * '*' and '**' wildcards are supported. Exclusion patterns start with '!'. - * For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'. - * A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'. - */ - readonly fileMatch?: string[]; - /** - * The schema for the given URI. - */ - readonly schema?: any; - }[]; - /** - * If set, the schema service would load schema content on-demand with 'fetch' if available - */ - readonly enableSchemaRequest?: boolean; - /** - * The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used. - */ - readonly schemaValidation?: SeverityLevel; - /** - * The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used. - */ - readonly schemaRequest?: SeverityLevel; - /** - * The severity of reported trailing commas. If not set, trailing commas will be reported as errors. - */ - readonly trailingCommas?: SeverityLevel; - /** - * The severity of reported comments. If not set, 'DiagnosticsOptions.allowComments' defines whether comments are ignored or reported as errors. - */ - readonly comments?: SeverityLevel; - } - export type SeverityLevel = 'error' | 'warning' | 'ignore'; - export interface ModeConfiguration { - /** - * Defines whether the built-in documentFormattingEdit provider is enabled. - */ - readonly documentFormattingEdits?: boolean; - /** - * Defines whether the built-in documentRangeFormattingEdit provider is enabled. - */ - readonly documentRangeFormattingEdits?: boolean; - /** - * Defines whether the built-in completionItemProvider is enabled. - */ - readonly completionItems?: boolean; - /** - * Defines whether the built-in hoverProvider is enabled. - */ - readonly hovers?: boolean; - /** - * Defines whether the built-in documentSymbolProvider is enabled. - */ - readonly documentSymbols?: boolean; - /** - * Defines whether the built-in tokens provider is enabled. - */ - readonly tokens?: boolean; - /** - * Defines whether the built-in color provider is enabled. - */ - readonly colors?: boolean; - /** - * Defines whether the built-in foldingRange provider is enabled. - */ - readonly foldingRanges?: boolean; - /** - * Defines whether the built-in diagnostic provider is enabled. - */ - readonly diagnostics?: boolean; - /** - * Defines whether the built-in selection range provider is enabled. - */ - readonly selectionRanges?: boolean; - } - export interface LanguageServiceDefaults { - readonly languageId: string; - readonly onDidChange: IEvent; - readonly diagnosticsOptions: DiagnosticsOptions; - readonly modeConfiguration: ModeConfiguration; - setDiagnosticsOptions(options: DiagnosticsOptions): void; - setModeConfiguration(modeConfiguration: ModeConfiguration): void; - } - export const jsonDefaults: LanguageServiceDefaults; -} diff --git a/monaco-json/src/fillers/monaco-editor-core.ts b/monaco-json/src/fillers/monaco-editor-core.ts deleted file mode 100644 index cd996aa7..00000000 --- a/monaco-json/src/fillers/monaco-editor-core.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -export * from 'monaco-editor-core'; diff --git a/monaco-json/src/tsconfig.json b/monaco-json/src/tsconfig.json deleted file mode 100644 index 707f714d..00000000 --- a/monaco-json/src/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compilerOptions": { - "module": "amd", - "moduleResolution": "node", - "outDir": "../out/amd", - "declaration": true, - "target": "es5", - "lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"] - } -} diff --git a/package.json b/package.json index 8269dca6..5f1b5038 100644 --- a/package.json +++ b/package.json @@ -9,15 +9,13 @@ "simpleserver": "gulp simpleserver", "import-typescript": "node ./monaco-typescript/importTypescript", "watch-src": "tsc -w -p ./src", - "watch-json": "tsc -w -p ./monaco-json/src", "watch-languages": "tsc -w -p ./monaco-languages/src", "watch-typescript": "tsc -w -p ./monaco-typescript/src", - "watch": "npm-run-all -lp watch-src watch-json watch-languages watch-typescript", + "watch": "npm-run-all -lp watch-src watch-languages watch-typescript", "release-src": "node ./build/build", - "release-json": "node ./monaco-json/build", "release-languages": "node ./monaco-languages/build", "release-typescript": "node ./monaco-typescript/build", - "release-plugins": "npm-run-all -lp release-src release-json release-languages release-typescript", + "release-plugins": "npm-run-all -lp release-src release-languages release-typescript", "test": "node ./monaco-languages/test/all.js", "gulp-release": "gulp release", "release": "npm-run-all -ls release-plugins gulp-release", diff --git a/monaco-json/src/json.worker.ts b/src/json/json.worker.ts similarity index 100% rename from monaco-json/src/json.worker.ts rename to src/json/json.worker.ts diff --git a/monaco-json/src/jsonMode.ts b/src/json/jsonMode.ts similarity index 98% rename from monaco-json/src/jsonMode.ts rename to src/json/jsonMode.ts index 7d66f6a0..84254c58 100644 --- a/monaco-json/src/jsonMode.ts +++ b/src/json/jsonMode.ts @@ -8,7 +8,7 @@ import type { JSONWorker } from './jsonWorker'; import { LanguageServiceDefaults } from './monaco.contribution'; import * as languageFeatures from './languageFeatures'; import { createTokenizationSupport } from './tokenization'; -import { Uri, IDisposable, languages } from './fillers/monaco-editor-core'; +import { Uri, IDisposable, languages } from '../fillers/monaco-editor-core'; export function setupMode(defaults: LanguageServiceDefaults): IDisposable { const disposables: IDisposable[] = []; diff --git a/monaco-json/src/jsonWorker.ts b/src/json/jsonWorker.ts similarity index 99% rename from monaco-json/src/jsonWorker.ts rename to src/json/jsonWorker.ts index 781b58e2..8df3fee2 100644 --- a/monaco-json/src/jsonWorker.ts +++ b/src/json/jsonWorker.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as jsonService from 'vscode-json-languageservice'; -import type { worker } from './fillers/monaco-editor-core'; +import type { worker } from '../fillers/monaco-editor-core'; import { URI } from 'vscode-uri'; import { DiagnosticsOptions } from './monaco.contribution'; diff --git a/monaco-json/src/languageFeatures.ts b/src/json/languageFeatures.ts similarity index 99% rename from monaco-json/src/languageFeatures.ts rename to src/json/languageFeatures.ts index cc6391a0..a26bd236 100644 --- a/monaco-json/src/languageFeatures.ts +++ b/src/json/languageFeatures.ts @@ -16,7 +16,7 @@ import { languages, MarkerSeverity, IMarkdownString -} from './fillers/monaco-editor-core'; +} from '../fillers/monaco-editor-core'; import * as lsTypes from 'vscode-languageserver-types'; export interface WorkerAccessor { diff --git a/monaco-json/src/monaco.contribution.ts b/src/json/monaco.contribution.ts similarity index 98% rename from monaco-json/src/monaco.contribution.ts rename to src/json/monaco.contribution.ts index 572d7afb..4487061a 100644 --- a/monaco-json/src/monaco.contribution.ts +++ b/src/json/monaco.contribution.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as mode from './jsonMode'; -import { Emitter, IEvent, languages } from './fillers/monaco-editor-core'; +import { Emitter, IEvent, languages } from '../fillers/monaco-editor-core'; // --- JSON configuration and defaults --------- diff --git a/monaco-json/src/tokenization.ts b/src/json/tokenization.ts similarity index 99% rename from monaco-json/src/tokenization.ts rename to src/json/tokenization.ts index bb8d7ad2..61925359 100644 --- a/monaco-json/src/tokenization.ts +++ b/src/json/tokenization.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as json from 'jsonc-parser'; -import { languages } from './fillers/monaco-editor-core'; +import { languages } from '../fillers/monaco-editor-core'; export function createTokenizationSupport(supportComments: boolean): languages.TokensProvider { return { diff --git a/monaco-json/src/workerManager.ts b/src/json/workerManager.ts similarity index 97% rename from monaco-json/src/workerManager.ts rename to src/json/workerManager.ts index 6c32e001..fcb3e77c 100644 --- a/monaco-json/src/workerManager.ts +++ b/src/json/workerManager.ts @@ -5,7 +5,7 @@ import { LanguageServiceDefaults } from './monaco.contribution'; import type { JSONWorker } from './jsonWorker'; -import { IDisposable, Uri, editor } from './fillers/monaco-editor-core'; +import { IDisposable, Uri, editor } from '../fillers/monaco-editor-core'; const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min