Move json sources to /src/

This commit is contained in:
Alex Dima 2021-11-13 19:46:33 +01:00
parent a8df4018f1
commit c41a5ce8aa
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
15 changed files with 39 additions and 184 deletions

View file

@ -12,8 +12,6 @@
/monaco-editor/typedoc/monaco.d.ts /monaco-editor/typedoc/monaco.d.ts
/monaco-editor/website/lib/ /monaco-editor/website/lib/
/monaco-editor-webpack-plugin/test/dist/*.js /monaco-editor-webpack-plugin/test/dist/*.js
/monaco-json/out/
/monaco-json/release/
/monaco-languages/out/ /monaco-languages/out/
/monaco-languages/release/ /monaco-languages/release/
/monaco-typescript/out/ /monaco-typescript/out/

View file

@ -17,6 +17,11 @@ dts(
`out/release/html/monaco.d.ts`, `out/release/html/monaco.d.ts`,
'monaco.languages.html' 'monaco.languages.html'
); );
dts(
`out/amd/json/monaco.contribution.d.ts`,
`out/release/json/monaco.d.ts`,
'monaco.languages.json'
);
buildESM2({ buildESM2({
base: 'css', base: 'css',
@ -65,3 +70,25 @@ buildAMD2({
entryPoint: 'src/html/htmlWorker.ts', entryPoint: 'src/html/htmlWorker.ts',
amdModuleId: 'vs/language/html/htmlWorker' 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'
});

View file

@ -39,12 +39,12 @@
name: 'monaco-json', name: 'monaco-json',
contrib: 'vs/language/json/monaco.contribution', contrib: 'vs/language/json/monaco.contribution',
modulePrefix: 'vs/language/json', modulePrefix: 'vs/language/json',
rootPath: './monaco-json', rootPath: './out/release/json',
paths: { paths: {
// use ./ to indicate it is relative to the `rootPath` // use ./ to indicate it is relative to the `rootPath`
dev: './release/dev', dev: './dev',
min: './release/min', min: './min',
esm: './release/esm' esm: './esm'
} }
}, },
{ {

View file

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

View file

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

View file

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

View file

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

View file

@ -9,15 +9,13 @@
"simpleserver": "gulp simpleserver", "simpleserver": "gulp simpleserver",
"import-typescript": "node ./monaco-typescript/importTypescript", "import-typescript": "node ./monaco-typescript/importTypescript",
"watch-src": "tsc -w -p ./src", "watch-src": "tsc -w -p ./src",
"watch-json": "tsc -w -p ./monaco-json/src",
"watch-languages": "tsc -w -p ./monaco-languages/src", "watch-languages": "tsc -w -p ./monaco-languages/src",
"watch-typescript": "tsc -w -p ./monaco-typescript/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-src": "node ./build/build",
"release-json": "node ./monaco-json/build",
"release-languages": "node ./monaco-languages/build", "release-languages": "node ./monaco-languages/build",
"release-typescript": "node ./monaco-typescript/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", "test": "node ./monaco-languages/test/all.js",
"gulp-release": "gulp release", "gulp-release": "gulp release",
"release": "npm-run-all -ls release-plugins gulp-release", "release": "npm-run-all -ls release-plugins gulp-release",

View file

@ -8,7 +8,7 @@ import type { JSONWorker } from './jsonWorker';
import { LanguageServiceDefaults } from './monaco.contribution'; import { LanguageServiceDefaults } from './monaco.contribution';
import * as languageFeatures from './languageFeatures'; import * as languageFeatures from './languageFeatures';
import { createTokenizationSupport } from './tokenization'; 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 { export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
const disposables: IDisposable[] = []; const disposables: IDisposable[] = [];

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import * as jsonService from 'vscode-json-languageservice'; 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 { URI } from 'vscode-uri';
import { DiagnosticsOptions } from './monaco.contribution'; import { DiagnosticsOptions } from './monaco.contribution';

View file

@ -16,7 +16,7 @@ import {
languages, languages,
MarkerSeverity, MarkerSeverity,
IMarkdownString IMarkdownString
} from './fillers/monaco-editor-core'; } from '../fillers/monaco-editor-core';
import * as lsTypes from 'vscode-languageserver-types'; import * as lsTypes from 'vscode-languageserver-types';
export interface WorkerAccessor { export interface WorkerAccessor {

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import * as mode from './jsonMode'; 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 --------- // --- JSON configuration and defaults ---------

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import * as json from 'jsonc-parser'; 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 { export function createTokenizationSupport(supportComments: boolean): languages.TokensProvider {
return { return {

View file

@ -5,7 +5,7 @@
import { LanguageServiceDefaults } from './monaco.contribution'; import { LanguageServiceDefaults } from './monaco.contribution';
import type { JSONWorker } from './jsonWorker'; 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 const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min