Restructures out and release folders.

out/amd -> out/languages/amd-tsc
out/release -> out/languages/bundled
release -> out/monaco-editor
This commit is contained in:
Henning Dieterichs 2023-02-22 17:39:35 +01:00
parent fb0d6bada1
commit 5ccfdf7c02
No known key found for this signature in database
GPG Key ID: 771381EFFDB9EC06
33 changed files with 131 additions and 199 deletions

View File

@ -42,7 +42,7 @@ extends:
publishRequiresApproval: false
- name: monaco-editor
workingDirectory: $(Build.SourcesDirectory)/release
workingDirectory: $(Build.SourcesDirectory)/out/monaco-editor
testPlatforms: []
buildSteps:
- script: npm ci

View File

@ -44,7 +44,7 @@ extends:
publishRequiresApproval: false
- name: monaco-editor
workingDirectory: $(Build.SourcesDirectory)/release
workingDirectory: $(Build.SourcesDirectory)/out/monaco-editor
testPlatforms: []
buildSteps:
- script: npm ci

View File

@ -39,7 +39,7 @@ jobs:
run: npm run prettier-check
- name: Build
run: npm run release
run: npm run build-monaco-editor
- name: Run unit tests
run: npm test

View File

@ -31,7 +31,7 @@ jobs:
run: npm ci
- name: Build
run: npm run release
run: npm run build-monaco-editor
- name: Install website node modules
working-directory: website

3
.gitignore vendored
View File

@ -1,9 +1,8 @@
**/node_modules/
**/out/
**/release/
**/dependencies/
/test/manual/generated/**
/test/smoke/vite/dist/**
/test/smoke/parcel/dist/**
/test/smoke/parcel/.cache/**
**/dist/
**/out/

View File

@ -1,6 +1,6 @@
**/node_modules/
**/dist/
**/out/
**/release/
/samples/browser-esm-parcel/.parcel-cache/
/samples/browser-esm-parcel/dist/
/samples/browser-esm-vite-react/dist/**/*.js

22
.vscode/launch.json vendored
View File

@ -8,7 +8,7 @@
"name": "Monaco Editor Playground",
"type": "chrome",
"request": "launch",
"url": "https://microsoft.github.io/monaco-editor/playground.html?sourceLanguages=http%3A%2F%2Flocalhost%3A5002%2Fout%2Famd",
"url": "https://microsoft.github.io/monaco-editor/playground.html?sourceLanguages=http%3A%2F%2Flocalhost%3A5002%2Fdist%2Flanguages%2Famd-tsc",
"preLaunchTask": "Launch Http Server",
"presentation": {
"group": "monaco",
@ -22,7 +22,7 @@
"name": "Monaco Editor Playground (Load From VS Code Http Server)",
"type": "chrome",
"request": "launch",
"url": "https://microsoft.github.io/monaco-editor/playground.html?sourceLanguages=http%3A%2F%2Flocalhost%3A5002%2Fout%2Famd&source=http%3A%2F%2Flocalhost%3A5001%2Fout%2Fvs",
"url": "https://microsoft.github.io/monaco-editor/playground.html?sourceLanguages=http%3A%2F%2Flocalhost%3A5002%2Fdist%2Flanguages%2Famd-tsc&source=http%3A%2F%2Flocalhost%3A5001%2Fout%2Fvs",
"preLaunchTask": "Launch Http Server",
"presentation": {
"group": "monaco",
@ -38,24 +38,6 @@
"args": ["-r", "test/unit/all.js"],
"outFiles": ["${workspaceFolder}/**/*.js"]
},
{
"type": "node",
"request": "launch",
"name": "release",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/build/release.js",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",
"name": "website",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/build/website.js",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",

View File

@ -6,7 +6,7 @@
"files.trimTrailingWhitespace": true,
"search.exclude": {
"**/node_modules": true,
"**/release": true,
"**/dist": true,
"**/out": true
},
"typescript.tsdk": "./node_modules/typescript/lib",

View File

@ -27,77 +27,30 @@ import './{myLang}/{myLang}.contribution';
## Debugging / Developing The Core Editor
TODO
## Debugging / Developing Language Support
TODO
## Running the editor from source
You need to have all the build setup of VS Code to be able to build the Monaco Editor.
- Install all the [prerequisites](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites)
```bash
# clone vscode-loc repository for localized string resources
/src> git clone https://github.com/microsoft/vscode-loc
# clone VS Code repository
/src> git clone https://github.com/microsoft/vscode
/src> cd vscode
# install npm deps for vscode
/src/vscode> yarn
# start the compiler in the background
/src/vscode> yarn watch
```
- For the monaco editor test pages:
```bash
# clone monaco-editor (note the folders must be siblings!)
/src> git clone https://github.com/microsoft/monaco-editor
# install npm deps for monaco-editor
/src/monaco-editor> npm install .
# compile and bundle all plugins
/src/monaco-editor> npm run release
# start a local http server in the background
/src/monaco-editor> npm run simpleserver
```
Open [http://localhost:8080/monaco-editor/test/manual/?editor=src](http://localhost:8080/monaco-editor/test/manual/?editor=src) to run.
TODO
## Running the editor tests
```bash
# create a local release
/src/monaco-editor> npm run release
> npm run build-monaco-editor
> npm run test
> npm run compile --prefix webpack-plugin
# run unit tests
/src/monaco-editor> npm run test
# compile the webpack plugin
/src/monaco-editor> npm run compile --prefix webpack-plugin
# package using the 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
> npm run package-for-smoketest-webpack
> npm run package-for-smoketest-esbuild
> npm run package-for-smoketest-vite
> npm run package-for-smoketest-parcel --prefix test/smoke/parcel
> npm run smoketest-debug
```
> Tip: All folders must be cloned as siblings.
> Tip: When running the test pages, use the control panel in the top right corner to switch between running from source, running from npm or running from the local release:
> ![image](https://cloud.githubusercontent.com/assets/5047891/19599080/eb0d7622-979e-11e6-96ce-dde98cd95dc1.png)
## Running the website locally
TOD

View File

@ -4,33 +4,33 @@
*--------------------------------------------------------------------------------------------*/
import glob from 'glob';
import { tsc, dts, buildESM, buildAMD } from './utils';
import { runTsc, massageAndCopyDts, buildESM, buildAMD } from './utils';
import { copyFile, removeDir } from './fs';
removeDir(`out`);
removeDir(`out/languages`);
tsc(`src/tsconfig.json`);
runTsc(`src/tsconfig.json`);
//#region Type Defintion
dts(
`out/amd/language/css/monaco.contribution.d.ts`,
`out/release/css.d.ts`,
massageAndCopyDts(
`out/languages/amd-tsc/language/css/monaco.contribution.d.ts`,
`out/languages/bundled/css.d.ts`,
'monaco.languages.css'
);
dts(
`out/amd/language/html/monaco.contribution.d.ts`,
`out/release/html.d.ts`,
massageAndCopyDts(
`out/languages/amd-tsc/language/html/monaco.contribution.d.ts`,
`out/languages/bundled/html.d.ts`,
'monaco.languages.html'
);
dts(
`out/amd/language/json/monaco.contribution.d.ts`,
`out/release/json.d.ts`,
massageAndCopyDts(
`out/languages/amd-tsc/language/json/monaco.contribution.d.ts`,
`out/languages/bundled/json.d.ts`,
'monaco.languages.json'
);
dts(
`out/amd/language/typescript/monaco.contribution.d.ts`,
`out/release/typescript.d.ts`,
massageAndCopyDts(
`out/languages/amd-tsc/language/typescript/monaco.contribution.d.ts`,
`out/languages/bundled/typescript.d.ts`,
'monaco.languages.typescript'
);
@ -133,7 +133,7 @@ buildAMD({
copyFile(
`src/language/typescript/lib/typescriptServices-amd.js`,
`out/amd/language/typescript/lib/typescriptServices.js`
`out/languages/amd-tsc/language/typescript/lib/typescriptServices.js`
);
buildESM({

View File

@ -10,7 +10,7 @@ import { removeDir } from '../build/fs';
import ts = require('typescript');
import { generateMetadata } from './releaseMetadata';
removeDir(`release`);
removeDir(`out/monaco-editor`);
// dev folder
AMD_releaseOne('dev');
@ -39,7 +39,7 @@ generateMetadata();
delete json.scripts['postinstall'];
packageJSON.contents = Buffer.from(JSON.stringify(json, null, ' '));
writeFiles([packageJSON], `release`);
writeFiles([packageJSON], `out/monaco-editor`);
})();
(() => {
@ -59,7 +59,7 @@ generateMetadata();
})
);
writeFiles(otherFiles, `release`);
writeFiles(otherFiles, `out/monaco-editor`);
})();
/**
@ -70,13 +70,13 @@ function AMD_releaseOne(type: 'dev' | 'min') {
base: `node_modules/monaco-editor-core/${type}`
});
AMD_addPluginContribs(type, coreFiles);
writeFiles(coreFiles, `release/${type}`);
writeFiles(coreFiles, `out/monaco-editor/${type}`);
const pluginFiles = readFiles(`out/release/${type}/**/*`, {
base: `out/release/${type}`,
const pluginFiles = readFiles(`out/languages/bundled/amd-${type}/**/*`, {
base: `out/languages/bundled/amd-${type}`,
ignore: ['**/monaco.contribution.js']
});
writeFiles(pluginFiles, `release/${type}`);
writeFiles(pluginFiles, `out/monaco-editor/${type}`);
}
/**
@ -96,8 +96,8 @@ function AMD_addPluginContribs(type: 'dev' | 'min', files: IFile[]) {
// Rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main'
contents = contents.replace(/"vs\/editor\/editor\.main\"/, '"vs/editor/edcore.main"');
const pluginFiles = readFiles(`out/release/${type}/**/monaco.contribution.js`, {
base: `out/release/${type}`
const pluginFiles = readFiles(`out/languages/bundled/amd-${type}/**/monaco.contribution.js`, {
base: `out/languages/bundled/amd-${type}`
});
const extraContent = pluginFiles.map((file) => {
@ -141,7 +141,7 @@ function ESM_release() {
});
ESM_addImportSuffix(coreFiles);
ESM_addPluginContribs(coreFiles);
writeFiles(coreFiles, `release/esm`);
writeFiles(coreFiles, `out/monaco-editor/esm`);
ESM_releasePlugins();
}
@ -152,7 +152,7 @@ function ESM_release() {
* Rewrites imports for 'monaco-editor-core/**'
*/
function ESM_releasePlugins() {
const files = readFiles(`out/release/esm/**/*`, { base: 'out/release/esm/' });
const files = readFiles(`out/languages/bundled/esm/**/*`, { base: 'out/languages/bundled/esm/' });
for (const file of files) {
if (!/(\.js$)|(\.ts$)/.test(file.path)) {
@ -210,7 +210,7 @@ function ESM_releasePlugins() {
}
ESM_addImportSuffix(files);
writeFiles(files, `release/esm`);
writeFiles(files, `out/monaco-editor/esm`);
}
/**
@ -256,8 +256,8 @@ function ESM_addPluginContribs(files: IFile[]) {
const mainFileDestPath = 'vs/editor/editor.main.js';
const mainFileImports = readFiles(`out/release/esm/**/monaco.contribution.js`, {
base: `out/release/esm`
const mainFileImports = readFiles(`out/languages/bundled/esm/**/monaco.contribution.js`, {
base: `out/languages/bundled/esm`
}).map((file) => {
let relativePath = path
.relative(path.dirname(mainFileDestPath), file.path)
@ -292,8 +292,8 @@ function releaseDTS() {
let contents = monacodts.contents.toString();
const extraContent = readFiles('out/release/*.d.ts', {
base: 'out/release/'
const extraContent = readFiles('out/languages/bundled/*.d.ts', {
base: 'out/languages/bundled/'
}).map((file) => {
return file.contents.toString().replace(/\/\/\/ <reference.*\n/m, '');
});
@ -321,7 +321,7 @@ function releaseDTS() {
contents: Buffer.from(toExternalDTS(contents))
};
writeFiles([monacodts, editorapidts], `release`);
writeFiles([monacodts, editorapidts], `out/monaco-editor`);
// fs.writeFileSync('website/typedoc/monaco.d.ts', contents);
}
@ -422,5 +422,5 @@ function releaseThirdPartyNotices() {
contents += '\n' + thirdPartyNoticeContent;
tpn.contents = Buffer.from(contents);
writeFiles([tpn], `release`);
writeFiles([tpn], `out/monaco-editor`);
}

View File

@ -37,7 +37,7 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n`
let tsServices = fs.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescript.js')).toString();
// The output from this build will only be accessible via AMD or ESM; rather than removing
// The output from this build will only be accessible via 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 =
@ -48,21 +48,6 @@ var module = { exports: {} };
/* END MONACOCHANGE */
` + tsServices;
const tsServices_amd =
generatedNote +
tsServices +
`
// MONACOCHANGE
// Defining the entire module name because r.js has an issue and cannot bundle this file
// correctly with an anonymous define call
define("vs/language/typescript/lib/typescriptServices", [], function() { return ts; });
// END MONACOCHANGE
`;
fs.writeFileSync(
path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices-amd.js'),
stripSourceMaps(tsServices_amd)
);
const tsServices_esm =
generatedNote +
tsServices +

View File

@ -12,7 +12,7 @@ import { REPO_ROOT } from '../utils';
const files = glob.sync('**/package.json', {
cwd: REPO_ROOT,
ignore: ['**/node_modules/**', '**/out/**', '**/release/**']
ignore: ['**/node_modules/**', '**/dist/**', '**/out/**']
});
for (const file of files) {

View File

@ -10,7 +10,7 @@ import { REPO_ROOT } from '../utils';
const files = glob.sync('**/package-lock.json', {
cwd: REPO_ROOT,
ignore: ['**/node_modules/**', '**/out/**', '**/release/**']
ignore: ['**/node_modules/**', '**/out/**']
});
for (const file of files) {

View File

@ -26,7 +26,7 @@ const customFeatureLabels = {
function getBasicLanguages(): Promise<{ label: string; entry: string }[]> {
return new Promise((resolve, reject) => {
glob(
'./release/esm/vs/basic-languages/*/*.contribution.js',
'./out/monaco-editor/esm/vs/basic-languages/*/*.contribution.js',
{ cwd: path.dirname(__dirname) },
(err, files) => {
if (err) {
@ -36,7 +36,7 @@ function getBasicLanguages(): Promise<{ label: string; entry: string }[]> {
resolve(
files.map((file) => {
const entry = file.substring('./release/esm/'.length).replace(/\.js$/, '');
const entry = file.substring('./out/monaco-editor/esm/'.length).replace(/\.js$/, '');
const label = path.basename(file).replace(/\.contribution\.js$/, '');
return {
label: label,
@ -52,7 +52,7 @@ function getBasicLanguages(): Promise<{ label: string; entry: string }[]> {
function readAdvancedLanguages(): Promise<string[]> {
return new Promise((resolve, reject) => {
glob(
'./release/esm/vs/language/*/monaco.contribution.js',
'./out/monaco-editor/esm/vs/language/*/monaco.contribution.js',
{ cwd: path.dirname(__dirname) },
(err, files) => {
if (err) {
@ -62,7 +62,7 @@ function readAdvancedLanguages(): Promise<string[]> {
resolve(
files
.map((file) => file.substring('./release/esm/vs/language/'.length))
.map((file) => file.substring('./out/monaco-editor/esm/vs/language/'.length))
.map((file) => file.substring(0, file.length - '/monaco.contribution.js'.length))
);
}
@ -95,7 +95,7 @@ function getAdvancedLanguages(): Promise<
});
function checkFileExists(moduleName) {
const filePath = path.join(REPO_ROOT, 'release/esm', `${moduleName}.js`);
const filePath = path.join(REPO_ROOT, 'out/monaco-editor/esm', `${moduleName}.js`);
if (!fs.existsSync(filePath)) {
console.error(`Could not find ${filePath}.`);
process.exit(1);
@ -174,7 +174,7 @@ export type EditorFeature = ${features.map((el) => `'${el.label}'`).join(' | ')}
export type NegatedEditorFeature = ${features.map((el) => `'!${el.label}'`).join(' | ')};
`;
const dtsDestination = path.join(REPO_ROOT, 'release/esm/metadata.d.ts');
const dtsDestination = path.join(REPO_ROOT, 'out/monaco-editor/esm/metadata.d.ts');
ensureDir(path.dirname(dtsDestination));
fs.writeFileSync(dtsDestination, dtsContents.replace(/\r\n/g, '\n'));
@ -182,7 +182,7 @@ export type NegatedEditorFeature = ${features.map((el) => `'!${el.label}'`).join
exports.features = ${JSON.stringify(features, null, ' ')};
exports.languages = ${JSON.stringify(languages, null, ' ')};
`;
const jsDestination = path.join(REPO_ROOT, 'release/esm/metadata.js');
const jsDestination = path.join(REPO_ROOT, 'out/monaco-editor/esm/metadata.js');
ensureDir(path.dirname(jsDestination));
fs.writeFileSync(jsDestination, jsContents.replace(/\r\n/g, '\n'));
}
@ -213,8 +213,12 @@ function getFeatures(): { label: string; entry: string | string[] }[] {
let features: string[] = [];
const files =
fs.readFileSync(path.join(REPO_ROOT, 'release/esm/vs/editor/edcore.main.js')).toString() +
fs.readFileSync(path.join(REPO_ROOT, 'release/esm/vs/editor/editor.all.js')).toString();
fs
.readFileSync(path.join(REPO_ROOT, 'out/monaco-editor/esm/vs/editor/edcore.main.js'))
.toString() +
fs
.readFileSync(path.join(REPO_ROOT, 'out/monaco-editor/esm/vs/editor/editor.all.js'))
.toString();
files.split(/\r\n|\n/).forEach((line) => {
const m = line.match(/import '([^']+)'/);
if (m) {

View File

@ -16,7 +16,7 @@ export const REPO_ROOT = path.join(__dirname, '../');
/**
* Launch the typescript compiler synchronously over a project.
*/
export function tsc(_projectPath: string) {
export function runTsc(_projectPath: string) {
const projectPath = path.join(REPO_ROOT, _projectPath);
console.log(`Launching compiler at ${_projectPath}...`);
const res = cp.spawnSync(
@ -47,12 +47,12 @@ export function prettier(_filePath: string) {
/**
* Transform an external .d.ts file to an internal .d.ts file
*/
export function dts(_source: string, _destination: string, namespace: string) {
const source = path.join(REPO_ROOT, _source);
const destination = path.join(REPO_ROOT, _destination);
export function massageAndCopyDts(source: string, destination: string, namespace: string) {
const absoluteSource = path.join(REPO_ROOT, source);
const absoluteDestination = path.join(REPO_ROOT, destination);
const lines = fs
.readFileSync(source)
.readFileSync(absoluteSource)
.toString()
.split(/\r\n|\r|\n/);
@ -81,10 +81,10 @@ export function dts(_source: string, _destination: string, namespace: string) {
result.push(`}`);
result.push(``);
ensureDir(path.dirname(destination));
fs.writeFileSync(destination, result.join('\n'));
ensureDir(path.dirname(absoluteDestination));
fs.writeFileSync(absoluteDestination, result.join('\n'));
prettier(_destination);
prettier(destination);
}
export function build(options: import('esbuild').BuildOptions) {
@ -113,7 +113,7 @@ export function buildESM(options: { base: string; entryPoints: string[]; externa
},
external: options.external,
outbase: `src/${options.base}`,
outdir: `out/release/esm/vs/${options.base}/`,
outdir: `out/languages/bundled/esm/vs/${options.base}/`,
plugins: [
alias({
'vscode-nls': path.join(__dirname, 'fillers/vscode-nls.ts')
@ -156,7 +156,7 @@ function buildOneAMD(
js: 'return moduleExports;\n});'
},
outbase: `src/${options.base}`,
outdir: `out/release/${type}/vs/${options.base}/`,
outdir: `out/languages/bundled/amd-${type}/vs/${options.base}/`,
plugins: [
alias({
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),

View File

@ -15,7 +15,6 @@
"prettier-check": "prettier --check .",
"prettier": "prettier --write .",
"pretty-quick": "pretty-quick --staged",
"release": "ts-node ./build/build && ts-node ./build/release",
"simpleserver": "ts-node ./build/simpleserver",
"package-for-smoketest-webpack": "ts-node ./test/smoke/package-webpack",
"package-for-smoketest-webpack-cross-origin": "ts-node ./test/smoke/package-webpack --cross-origin",
@ -26,8 +25,10 @@
"test": "mocha test/unit/all.js && ts-node ./build/check-samples",
"deps-all-remove": "ts-node ./build/npm/removeAll",
"deps-all-install": "ts-node ./build/npm/installAll",
"update-actions": "pin-github-action ./.github/workflows/website.yml",
"watch": "tsc -w -p ./src",
"update-actions": "pin-github-action ./.github/workflows/website.yml"
"build": "ts-node ./build/build-languages",
"build-monaco-editor": "npm run build && ts-node ./build/build-monaco-editor"
},
"typings": "./esm/vs/editor/editor.api.d.ts",
"module": "./esm/vs/editor/editor.main.js",

View File

@ -30,7 +30,7 @@ async function prepareMonacoEditorReleaseStableOrNightly() {
await prepareMonacoEditorRelease(version);
// npm package is now in ./release, ready to be published
// npm package is now in ./out/monaco-editor, ready to be published
}
async function prepareMonacoEditorRelease(monacoEditorCoreVersion: string) {

View File

@ -6,7 +6,7 @@ sudo npm run playwright-install-deps
# Check prettier
npm run prettier-check
# Build
npm run release
npm run build-monaco-editor
# Run unit tests
npm test
@ -25,4 +25,4 @@ npm run package-for-smoketest-parcel --prefix test/smoke/parcel
# Run smoke test
npm run smoketest
# npm package is now ready to be published in ./release
# npm package is now ready to be published in ./out/monaco-editor

View File

@ -4,7 +4,7 @@
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"],
"module": "amd",
"moduleResolution": "node",
"outDir": "../out/amd",
"outDir": "../out/languages/amd-tsc",
"strict": true,
"target": "es5",
"sourceMap": true

View File

@ -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="../../../out/monaco-editor/dev/vs/loader.js"></script>
<script>
require.config({
paths: {
vs: '../../../release/dev/vs'
vs: '../../../out/monaco-editor/dev/vs'
}
});
require(['vs/editor/editor.main'], () => {

View File

@ -3,7 +3,7 @@
* 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';
import * as monaco from '../../../out/monaco-editor/esm/vs/editor/editor.main.js';
self.MonacoEnvironment = {
getWorkerUrl: function (moduleId, label) {

View File

@ -18,11 +18,13 @@ const workerEntryPoints = [
];
build({
entryPoints: workerEntryPoints.map((entry) => path.join(__dirname, `../../release/esm/${entry}`)),
entryPoints: workerEntryPoints.map((entry) =>
path.join(__dirname, `../../out/monaco-editor/esm/${entry}`)
),
bundle: true,
format: 'iife',
logLevel: 'silent',
outbase: path.join(__dirname, '../../release/esm/'),
outbase: path.join(__dirname, '../../out/monaco-editor/esm/'),
outdir: path.join(__dirname, 'esbuild/out')
});

View File

@ -24,7 +24,7 @@ webpack(
},
resolve: {
alias: {
'monaco-editor': path.resolve(REPO_ROOT, 'release')
'monaco-editor': path.resolve(REPO_ROOT, 'out/monaco-editor')
}
},
module: {
@ -40,7 +40,7 @@ webpack(
]
},
plugins: [<any>new MonacoWebpackPlugin({
monacoEditorPath: path.resolve(REPO_ROOT, 'release')
monacoEditorPath: path.resolve(REPO_ROOT, 'out/monaco-editor')
})]
},
(err: Error | undefined, stats: webpack.Stats | undefined) => {

View File

@ -1,34 +1,40 @@
import * as monaco from '../../../release/esm/vs/editor/editor.main.js';
import * as monaco from '../../../out/monaco-editor/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),
new URL('../../../out/monaco-editor/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),
new URL('../../../out/monaco-editor/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),
new URL('../../../out/monaco-editor/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),
new URL(
'../../../out/monaco-editor/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'
});
return new Worker(
new URL('../../../out/monaco-editor/esm/vs/editor/editor.worker.js', import.meta.url),
{
type: 'module'
}
);
}
};

View File

@ -3,12 +3,12 @@
* 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';
import * as monaco from '../../../out/monaco-editor/esm/vs/editor/editor.main';
import editorWorker from '../../../out/monaco-editor/esm/vs/editor/editor.worker?worker';
import jsonWorker from '../../../out/monaco-editor/esm/vs/language/json/json.worker?worker';
import cssWorker from '../../../out/monaco-editor/esm/vs/language/css/css.worker?worker';
import htmlWorker from '../../../out/monaco-editor/esm/vs/language/html/html.worker?worker';
import tsWorker from '../../../out/monaco-editor/esm/vs/language/typescript/ts.worker?worker';
self.MonacoEnvironment = {
getWorker(moduleId, label) {

View File

@ -6,8 +6,8 @@ const path = require('path');
requirejs.config({
baseUrl: '',
paths: {
'vs/fillers/monaco-editor-core': 'out/amd/fillers/monaco-editor-core-amd',
'vs/basic-languages': 'out/amd/basic-languages',
'vs/fillers/monaco-editor-core': 'out/languages/amd-tsc/fillers/monaco-editor-core-amd',
'vs/basic-languages': 'out/languages/amd-tsc/basic-languages',
vs: './node_modules/monaco-editor-core/dev/vs'
},
nodeRequire: require
@ -38,7 +38,7 @@ requirejs(
['test/unit/setup'],
function () {
glob(
'out/amd/basic-languages/*/*.test.js',
'out/languages/amd-tsc/basic-languages/*/*.test.js',
{ cwd: path.join(__dirname, '../../') },
function (err, files) {
if (err) {
@ -46,7 +46,7 @@ requirejs(
return;
}
requirejs(
files.map((f) => f.replace(/^out\/amd/, 'vs').replace(/\.js$/, '')),
files.map((f) => f.replace(/^out\/languages\/amd-tsc/, 'vs').replace(/\.js$/, '')),
function () {
run(); // We can launch the tests!
},

View File

@ -6,7 +6,7 @@ import { getMonaco, loadMonaco } from "../../../monaco-loader";
*/
export class MonacoLoader extends React.Component<
{ children: (m: typeof monaco) => React.ReactChild },
{ monaco: typeof monaco | undefined }
{ monaco?: typeof monaco }
> {
constructor(props: any) {
super(props);

View File

@ -115,10 +115,10 @@ export function toLoaderConfig(settings: Settings): IMonacoSetup {
let languagesUrl: string;
switch (settings.languagesSource) {
case "latest":
languagesUrl = `${root}/out/release/${settings.latestLanguagesStability}/vs`;
languagesUrl = `${root}/out/languages/bundled/amd-${settings.latestLanguagesStability}/vs`;
break;
case "source":
languagesUrl = `${root}/out/amd`;
languagesUrl = `${root}/out/languages/amd-tsc`;
break;
case "url":
languagesUrl = settings.languagesUrl;
@ -156,11 +156,11 @@ export function getDefaultSettings(): Settings {
coreSource: "latest",
latestCoreStability: "dev",
coreUrl: "http://localhost:5000/out/vs",
coreUrl: "http://localhost:5001/out/vs",
languagesSource: "latest",
latestLanguagesStability: "dev",
languagesUrl: "http://localhost:8080/out",
languagesUrl: "http://localhost:5002/out/languages/amd-tsc",
customConfig: JSON.stringify({
loaderUrl: "",
codiconUrl: "",

View File

@ -14,5 +14,5 @@
// to enable mobx decorators
"useDefineForClassFields": false
},
"include": ["src/**/*", "../release/monaco.d.ts"]
"include": ["src/**/*", "./node_modules/monaco-editor/monaco.d.ts"]
}

View File

@ -3,6 +3,6 @@
"module": "CommonJS",
"skipLibCheck": true
},
"include": ["../../release/esm/vs/editor/editor.api.d.ts"],
"include": ["../../out/monaco-editor/esm/vs/editor/editor.api.d.ts"],
"exclude": ["theme"]
}

View File

@ -1,6 +1,6 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["../../release/esm/vs/editor/editor.api.d.ts"],
"entryPoints": ["../../out/monaco-editor/esm/vs/editor/editor.api.d.ts"],
"out": "dist",
"theme": "default",

View File

@ -131,7 +131,7 @@ module.exports = {
],
}),
new CopyPlugin({
patterns: [{ from: "../out/", to: "./out/" }],
patterns: [{ from: "../out/languages/", to: "./out/languages/" }],
}),
],
} as webpack.Configuration;