Move basic languages sources to /src/

This commit is contained in:
Alex Dima 2021-11-13 20:29:32 +01:00
parent d5e3af3744
commit 0f7286cf55
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
247 changed files with 138 additions and 210 deletions

View file

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

View file

@ -11,10 +11,10 @@ This repository contains source code only for Monaco Editor Languages, the core
## Contributing a new tokenizer / a new language
- create `$/monaco-languages/src/myLang/myLang.contribution.ts`
- create `$/monaco-languages/src/myLang/myLang.ts`
- create `$/monaco-languages/src/myLang/myLang.test.ts`
- edit `$/monaco-languages/src/monaco.contribution.ts` and register your new language
- create `$/src/basic-languages/myLang/myLang.contribution.ts`
- 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
```js
import './myLang/myLang.contribution';

View file

@ -5,6 +5,7 @@
//@ts-check
const glob = require('glob');
const { copyFile, removeDir, tsc, dts, buildESM2, buildAMD2 } = require('../build/utils');
removeDir(`out`);
@ -152,3 +153,51 @@ buildAMD2({
});
//#endregion
//#region basic-languages
glob('../src/basic-languages/*/*.contribution.ts', { cwd: __dirname }, function (err, files) {
if (err) {
console.error(err);
return;
}
const languages = files.map((file) => file.split('/')[3]);
// ESM
{
/** @type {string[]} */
const entryPoints = ['src/basic-languages/monaco.contribution.ts', 'src/basic-languages/_.contribution.ts'];
const external = ['monaco-editor-core', '*/_.contribution'];
for (const language of languages) {
entryPoints.push(`src/basic-languages/${language}/${language}.contribution.ts`);
entryPoints.push(`src/basic-languages/${language}/${language}.ts`);
external.push(`*/${language}.contribution`);
external.push(`*/${language}`);
}
buildESM2({
base: 'basic-languages',
entryPoints,
external
});
}
// AMD
{
buildAMD2({
base: 'basic-languages',
entryPoint: 'src/basic-languages/monaco.contribution.ts',
amdModuleId: 'vs/basic-languages/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
for (const language of languages) {
buildAMD2({
base: 'basic-languages',
entryPoint: `src/basic-languages/${language}/${language}.ts`,
amdModuleId: `vs/basic-languages/${language}/${language}`
});
}
}
});
//#endregion

View file

@ -63,12 +63,12 @@
name: 'monaco-languages',
contrib: 'vs/basic-languages/monaco.contribution',
modulePrefix: 'vs/basic-languages',
rootPath: './monaco-languages',
rootPath: './out/release/basic-languages',
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'
}
}
]

View file

@ -859,8 +859,8 @@ embedded: [
<p>
Additional examples can be found in the
<code class="dt">src</code> folder of the
<a href="https://github.com/microsoft/monaco-languages">monaco-languages</a>
<code class="dt">src/basic-languages</code> folder of the
<a href="https://github.com/microsoft/monaco-editor">monaco-editor</a>
repo.
</p>
</div>

View file

@ -1,25 +0,0 @@
name: CI
on: [push, pull_request]
jobs:
ci:
name: CI
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: npm install
run: npm install
- name: Compile
run: npm run compile
- name: Test
run: npm test

View file

@ -1,58 +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 glob = require('glob');
const { removeDir, tsc, buildESM, buildAMD } = require('../build/utils');
removeDir(`monaco-languages/release`);
removeDir(`monaco-languages/out`);
tsc(`monaco-languages/src/tsconfig.json`);
glob('src/*/*.contribution.ts', { cwd: __dirname }, function (err, files) {
if (err) {
console.error(err);
return;
}
const languages = files.map((file) => file.split('/')[1]);
// ESM
{
/** @type {string[]} */
const entryPoints = ['src/monaco.contribution.ts', 'src/_.contribution.ts'];
const external = ['monaco-editor-core', '*/_.contribution'];
for (const language of languages) {
entryPoints.push(`src/${language}/${language}.contribution.ts`);
entryPoints.push(`src/${language}/${language}.ts`);
external.push(`*/${language}.contribution`);
external.push(`*/${language}`);
}
buildESM({
base: 'monaco-languages',
entryPoints,
external
});
}
// AMD
{
buildAMD({
base: 'monaco-languages',
entryPoint: 'src/monaco.contribution.ts',
amdModuleId: 'vs/basic-languages/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
for (const language of languages) {
buildAMD({
base: 'monaco-languages',
entryPoint: `src/${language}/${language}.ts`,
amdModuleId: `vs/basic-languages/${language}/${language}`
});
}
}
});

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,13 +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 function run(): void;
declare function suite(name: string, fn: (err?: any) => void): void;
declare function test(name: string, fn: (done: (err?: any) => void) => void): void;
declare function suiteSetup(fn: (done: (err?: any) => void) => void): void;
declare function suiteTeardown(fn: (done: (err?: any) => void) => void): void;
declare function setup(fn: (done: (err?: any) => void) => void): void;
declare function teardown(fn: (done: (err?: any) => void) => void): void;

View file

@ -1,10 +0,0 @@
{
"compilerOptions": {
"module": "amd",
"moduleResolution": "node",
"outDir": "../out/amd",
"target": "es5",
"strict": true,
"lib": ["dom", "es5", "es2015.collection", "es2015.iterable", "es2015.promise"]
}
}

View file

@ -8,12 +8,8 @@
"scripts": {
"simpleserver": "gulp simpleserver",
"import-typescript": "node ./build/importTypescript",
"watch-src": "tsc -w -p ./src",
"watch-languages": "tsc -w -p ./monaco-languages/src",
"watch": "npm-run-all -lp watch-src watch-languages",
"release-src": "node ./build/build",
"release-languages": "node ./monaco-languages/build",
"release-plugins": "npm-run-all -lp release-src release-languages",
"watch": "tsc -w -p ./src",
"release-plugins": "node ./build/build",
"test": "node ./monaco-languages/test/all.js",
"gulp-release": "gulp release",
"release": "npm-run-all -ls release-plugins gulp-release",

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { languages } from './fillers/monaco-editor-core';
import { languages } from '../fillers/monaco-editor-core';
interface ILang extends languages.ILanguageExtensionPoint {
loader: () => Promise<ILangImpl>;

View file

@ -8,9 +8,6 @@
*
* Based on SAP ABAP Application Server 7.55
*
* Definition:
* https://github.com/microsoft/monaco-languages/blob/master/src/abap/abap.ts
*
* Reference:
* https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm?file=abenabap_words.htm
* https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm?file=abenabap_index.htm
@ -22,7 +19,7 @@
* https://github.com/Microsoft/vscode/blob/master/src/vs/editor/standalone/common/themes.ts
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
// the default separators except `@$`

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
const bounded = (text: string) => `\\b${text}\\b`;

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
wordPattern:

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
wordPattern:

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
brackets: [],

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
wordPattern: /(#?-?\d*\.\d\w*%?)|((::|[@#.!:])?[\w-?]+%?)|::|[@#.!:]/g,

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
brackets: [

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { languages } from '../fillers/monaco-editor-core';
import { languages } from '../../fillers/monaco-editor-core';
const EMPTY_ELEMENTS: string[] = [
'area',

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { languages } from '../fillers/monaco-editor-core';
import { languages } from '../../fillers/monaco-editor-core';
const EMPTY_ELEMENTS: string[] = [
'area',

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
// the default separators except `@$`

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { conf as tsConf, language as tsLanguage } from '../typescript/typescript';
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = tsConf;

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
brackets: [

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
// the default separators except `@$`

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { languages } from '../fillers/monaco-editor-core';
import type { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
wordPattern: /(#?-?\d*\.\d\w*%?)|([@#!.:]?[\w-?]+%?)|[@#!.]/g,

Some files were not shown because too many files have changed in this diff Show more