1
0
Эх сурвалжийг харах

Move json sources to `/src/`

Alex Dima 3 жил өмнө
parent
commit
c41a5ce8aa

+ 0 - 2
.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/

+ 27 - 0
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'
+});

+ 4 - 4
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'
 				}
 			},
 			{

+ 0 - 41
monaco-json/build.js

@@ -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'
-});

+ 0 - 111
monaco-json/monaco.d.ts

@@ -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<LanguageServiceDefaults>;
-		readonly diagnosticsOptions: DiagnosticsOptions;
-		readonly modeConfiguration: ModeConfiguration;
-		setDiagnosticsOptions(options: DiagnosticsOptions): void;
-		setModeConfiguration(modeConfiguration: ModeConfiguration): void;
-	}
-	export const jsonDefaults: LanguageServiceDefaults;
-}

+ 0 - 6
monaco-json/src/fillers/monaco-editor-core.ts

@@ -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';

+ 0 - 10
monaco-json/src/tsconfig.json

@@ -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"]
-	}
-}

+ 2 - 4
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",

+ 0 - 0
monaco-json/src/json.worker.ts → src/json/json.worker.ts


+ 1 - 1
monaco-json/src/jsonMode.ts → 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[] = [];

+ 1 - 1
monaco-json/src/jsonWorker.ts → 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';
 

+ 1 - 1
monaco-json/src/languageFeatures.ts → 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 {

+ 1 - 1
monaco-json/src/monaco.contribution.ts → 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 ---------
 

+ 1 - 1
monaco-json/src/tokenization.ts → 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 {

+ 1 - 1
monaco-json/src/workerManager.ts → 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