mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 18:32:56 +01:00
esm progress
This commit is contained in:
parent
f420968fc9
commit
c38e22c86b
31 changed files with 521 additions and 370 deletions
|
|
@ -57,7 +57,7 @@ extends:
|
||||||
- script: npm ci
|
- script: npm ci
|
||||||
displayName: Install NPM dependencies
|
displayName: Install NPM dependencies
|
||||||
|
|
||||||
- script: yarn ts-node ./scripts/ci/monaco-editor-core-prepare nightly
|
- script: yarn ts-node ./scripts/ci/build-monaco-editor-core-pkg nightly
|
||||||
env:
|
env:
|
||||||
VSCODE_REF: ${{ parameters.vscodeRef }}
|
VSCODE_REF: ${{ parameters.vscodeRef }}
|
||||||
PRERELEASE_VERSION: ${{ parameters.prereleaseVersion }}
|
PRERELEASE_VERSION: ${{ parameters.prereleaseVersion }}
|
||||||
|
|
@ -78,7 +78,7 @@ extends:
|
||||||
- script: npm ci
|
- script: npm ci
|
||||||
displayName: Install NPM dependencies
|
displayName: Install NPM dependencies
|
||||||
|
|
||||||
- script: yarn ts-node ./scripts/ci/monaco-editor-prepare nightly
|
- script: yarn ts-node ./scripts/ci/build-monaco-editor-pkg nightly
|
||||||
env:
|
env:
|
||||||
VSCODE_REF: ${{ parameters.vscodeRef }}
|
VSCODE_REF: ${{ parameters.vscodeRef }}
|
||||||
PRERELEASE_VERSION: ${{ parameters.prereleaseVersion }}
|
PRERELEASE_VERSION: ${{ parameters.prereleaseVersion }}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ extends:
|
||||||
- script: npm ci
|
- script: npm ci
|
||||||
displayName: Install NPM dependencies
|
displayName: Install NPM dependencies
|
||||||
|
|
||||||
- script: yarn ts-node ./scripts/ci/monaco-editor-core-prepare stable
|
- script: yarn ts-node ./scripts/ci/build-monaco-editor-core-pkg stable
|
||||||
displayName: Setup, Build & Test monaco-editor-core
|
displayName: Setup, Build & Test monaco-editor-core
|
||||||
|
|
||||||
tag: latest
|
tag: latest
|
||||||
|
|
@ -62,7 +62,7 @@ extends:
|
||||||
- script: npm ci
|
- script: npm ci
|
||||||
displayName: Install NPM dependencies
|
displayName: Install NPM dependencies
|
||||||
|
|
||||||
- script: yarn ts-node ./scripts/ci/monaco-editor-prepare stable
|
- script: yarn ts-node ./scripts/ci/build-monaco-editor-pkg stable
|
||||||
displayName: Setup, Build & Test monaco-editor
|
displayName: Setup, Build & Test monaco-editor
|
||||||
|
|
||||||
tag: latest
|
tag: latest
|
||||||
|
|
|
||||||
62
.github/workflows/ci.yml
vendored
62
.github/workflows/ci.yml
vendored
|
|
@ -5,13 +5,15 @@ on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: CI
|
name: CI
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # pin@v2
|
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
persist-credentials: false
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
|
||||||
- name: Cache node modules
|
- name: Cache node modules
|
||||||
id: cacheNodeModules
|
id: cacheNodeModules
|
||||||
|
|
@ -21,22 +23,42 @@ jobs:
|
||||||
key: ${{ runner.os }}-cacheNodeModules2-${{ hashFiles('**/package-lock.json', '**/package.json') }}
|
key: ${{ runner.os }}-cacheNodeModules2-${{ hashFiles('**/package-lock.json', '**/package.json') }}
|
||||||
restore-keys: ${{ runner.os }}-cacheNodeModules2-
|
restore-keys: ${{ runner.os }}-cacheNodeModules2-
|
||||||
|
|
||||||
|
- name: Install build tools
|
||||||
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
sudo apt update -y
|
||||||
|
sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev
|
||||||
|
|
||||||
- name: execute `npm ci` (1)
|
- name: execute `npm ci` (1)
|
||||||
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
|
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
|
||||||
run: npm ci
|
env:
|
||||||
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
|
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||||
|
run: |
|
||||||
|
npm ci
|
||||||
|
|
||||||
|
- name: Download Playwright
|
||||||
|
run: npx playwright install --with-deps
|
||||||
|
|
||||||
- name: execute `npm ci` (2)
|
- name: execute `npm ci` (2)
|
||||||
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
|
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
|
||||||
run: npm ci --prefix webpack-plugin
|
run: npm ci --prefix webpack-plugin
|
||||||
|
|
||||||
- name: Install Playwright
|
- name: Setup, Build & Test monaco-editor-core
|
||||||
run: npm run playwright-install
|
run: yarn ts-node ./scripts/ci/build-monaco-editor-core-pkg nightly
|
||||||
|
env:
|
||||||
|
VSCODE_REF: 'main'
|
||||||
|
PRERELEASE_VERSION: 'dev-${today}'
|
||||||
|
|
||||||
- name: Install OS Dependencies for Playwright
|
- name: Link monaco-editor-core
|
||||||
run: sudo npm run playwright-install-deps
|
run: npm link
|
||||||
|
working-directory: ./dependencies/vscode/out-monaco-editor-core
|
||||||
|
|
||||||
- name: Check prettier
|
- name: Link monaco-editor-core
|
||||||
run: npm run prettier-check
|
run: npm link monaco-editor-core
|
||||||
|
|
||||||
|
# - name: Check prettier
|
||||||
|
# run: npm run prettier-check
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build-monaco-editor
|
run: npm run build-monaco-editor
|
||||||
|
|
@ -63,14 +85,14 @@ jobs:
|
||||||
- name: Run smoke test
|
- name: Run smoke test
|
||||||
run: npm run smoketest
|
run: npm run smoketest
|
||||||
|
|
||||||
- name: Install website node modules
|
# - name: Install website node modules
|
||||||
working-directory: website
|
# working-directory: website
|
||||||
run: yarn install --frozen-lockfile
|
# run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build website
|
# - name: Build website
|
||||||
working-directory: website
|
# working-directory: website
|
||||||
run: yarn run build
|
# run: yarn run build
|
||||||
|
|
||||||
- name: Test website
|
# - name: Test website
|
||||||
working-directory: website
|
# working-directory: website
|
||||||
run: yarn test
|
# run: yarn test
|
||||||
|
|
|
||||||
2
.nvmrc
2
.nvmrc
|
|
@ -1 +1 @@
|
||||||
20.14.0
|
22.17.0
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import glob from 'glob';
|
import glob from 'glob';
|
||||||
import { runTsc, massageAndCopyDts, buildESM, buildAMD } from './utils';
|
import { runTsc, massageAndCopyDts, buildESM } from './utils';
|
||||||
import { copyFile, removeDir } from './fs';
|
import { removeDir } from './fs';
|
||||||
|
|
||||||
removeDir(`out/languages`);
|
removeDir(`out/languages`);
|
||||||
|
|
||||||
|
|
@ -14,22 +14,22 @@ runTsc(`src/tsconfig.json`);
|
||||||
//#region Type Defintion
|
//#region Type Defintion
|
||||||
|
|
||||||
massageAndCopyDts(
|
massageAndCopyDts(
|
||||||
`out/languages/amd-tsc/language/css/monaco.contribution.d.ts`,
|
`out/languages/tsc/language/css/monaco.contribution.d.ts`,
|
||||||
`out/languages/bundled/css.d.ts`,
|
`out/languages/bundled/css.d.ts`,
|
||||||
'monaco.languages.css'
|
'monaco.languages.css'
|
||||||
);
|
);
|
||||||
massageAndCopyDts(
|
massageAndCopyDts(
|
||||||
`out/languages/amd-tsc/language/html/monaco.contribution.d.ts`,
|
`out/languages/tsc/language/html/monaco.contribution.d.ts`,
|
||||||
`out/languages/bundled/html.d.ts`,
|
`out/languages/bundled/html.d.ts`,
|
||||||
'monaco.languages.html'
|
'monaco.languages.html'
|
||||||
);
|
);
|
||||||
massageAndCopyDts(
|
massageAndCopyDts(
|
||||||
`out/languages/amd-tsc/language/json/monaco.contribution.d.ts`,
|
`out/languages/tsc/language/json/monaco.contribution.d.ts`,
|
||||||
`out/languages/bundled/json.d.ts`,
|
`out/languages/bundled/json.d.ts`,
|
||||||
'monaco.languages.json'
|
'monaco.languages.json'
|
||||||
);
|
);
|
||||||
massageAndCopyDts(
|
massageAndCopyDts(
|
||||||
`out/languages/amd-tsc/language/typescript/monaco.contribution.d.ts`,
|
`out/languages/tsc/language/typescript/monaco.contribution.d.ts`,
|
||||||
`out/languages/bundled/typescript.d.ts`,
|
`out/languages/bundled/typescript.d.ts`,
|
||||||
'monaco.languages.typescript'
|
'monaco.languages.typescript'
|
||||||
);
|
);
|
||||||
|
|
@ -47,23 +47,24 @@ buildESM({
|
||||||
],
|
],
|
||||||
external: ['monaco-editor-core', '*/cssMode', '*/monaco.contribution']
|
external: ['monaco-editor-core', '*/cssMode', '*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
|
||||||
base: 'language/css',
|
// buildAMD({
|
||||||
entryPoint: 'src/language/css/monaco.contribution.ts',
|
// base: 'language/css',
|
||||||
amdModuleId: 'vs/language/css/monaco.contribution',
|
// entryPoint: 'src/language/css/monaco.contribution.ts',
|
||||||
amdDependencies: ['vs/editor/editor.api']
|
// amdModuleId: 'vs/language/css/monaco.contribution',
|
||||||
});
|
// amdDependencies: ['vs/editor/editor.api']
|
||||||
buildAMD({
|
// });
|
||||||
base: 'language/css',
|
// buildAMD({
|
||||||
entryPoint: 'src/language/css/cssMode.ts',
|
// base: 'language/css',
|
||||||
amdModuleId: 'vs/language/css/cssMode',
|
// entryPoint: 'src/language/css/cssMode.ts',
|
||||||
external: ['*/monaco.contribution']
|
// amdModuleId: 'vs/language/css/cssMode',
|
||||||
});
|
// external: ['*/monaco.contribution']
|
||||||
buildAMD({
|
// });
|
||||||
base: 'language/css',
|
// buildAMD({
|
||||||
entryPoint: 'src/language/css/cssWorker.ts',
|
// base: 'language/css',
|
||||||
amdModuleId: 'vs/language/css/cssWorker'
|
// entryPoint: 'src/language/css/cssWorker.ts',
|
||||||
});
|
// amdModuleId: 'vs/language/css/cssWorker'
|
||||||
|
// });
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
@ -78,23 +79,23 @@ buildESM({
|
||||||
],
|
],
|
||||||
external: ['monaco-editor-core', '*/htmlMode', '*/monaco.contribution']
|
external: ['monaco-editor-core', '*/htmlMode', '*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'language/html',
|
// base: 'language/html',
|
||||||
entryPoint: 'src/language/html/monaco.contribution.ts',
|
// entryPoint: 'src/language/html/monaco.contribution.ts',
|
||||||
amdModuleId: 'vs/language/html/monaco.contribution',
|
// amdModuleId: 'vs/language/html/monaco.contribution',
|
||||||
amdDependencies: ['vs/editor/editor.api']
|
// amdDependencies: ['vs/editor/editor.api']
|
||||||
});
|
// });
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'language/html',
|
// base: 'language/html',
|
||||||
entryPoint: 'src/language/html/htmlMode.ts',
|
// entryPoint: 'src/language/html/htmlMode.ts',
|
||||||
amdModuleId: 'vs/language/html/htmlMode',
|
// amdModuleId: 'vs/language/html/htmlMode',
|
||||||
external: ['*/monaco.contribution']
|
// external: ['*/monaco.contribution']
|
||||||
});
|
// });
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'language/html',
|
// base: 'language/html',
|
||||||
entryPoint: 'src/language/html/htmlWorker.ts',
|
// entryPoint: 'src/language/html/htmlWorker.ts',
|
||||||
amdModuleId: 'vs/language/html/htmlWorker'
|
// amdModuleId: 'vs/language/html/htmlWorker'
|
||||||
});
|
// });
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
@ -109,23 +110,23 @@ buildESM({
|
||||||
],
|
],
|
||||||
external: ['monaco-editor-core', '*/jsonMode', '*/monaco.contribution']
|
external: ['monaco-editor-core', '*/jsonMode', '*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'language/json',
|
// base: 'language/json',
|
||||||
entryPoint: 'src/language/json/monaco.contribution.ts',
|
// entryPoint: 'src/language/json/monaco.contribution.ts',
|
||||||
amdModuleId: 'vs/language/json/monaco.contribution',
|
// amdModuleId: 'vs/language/json/monaco.contribution',
|
||||||
amdDependencies: ['vs/editor/editor.api']
|
// amdDependencies: ['vs/editor/editor.api']
|
||||||
});
|
// });
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'language/json',
|
// base: 'language/json',
|
||||||
entryPoint: 'src/language/json/jsonMode.ts',
|
// entryPoint: 'src/language/json/jsonMode.ts',
|
||||||
amdModuleId: 'vs/language/json/jsonMode',
|
// amdModuleId: 'vs/language/json/jsonMode',
|
||||||
external: ['*/monaco.contribution']
|
// external: ['*/monaco.contribution']
|
||||||
});
|
// });
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'language/json',
|
// base: 'language/json',
|
||||||
entryPoint: 'src/language/json/jsonWorker.ts',
|
// entryPoint: 'src/language/json/jsonWorker.ts',
|
||||||
amdModuleId: 'vs/language/json/jsonWorker'
|
// amdModuleId: 'vs/language/json/jsonWorker'
|
||||||
});
|
// });
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
@ -140,23 +141,23 @@ buildESM({
|
||||||
],
|
],
|
||||||
external: ['monaco-editor-core', '*/tsMode', '*/monaco.contribution']
|
external: ['monaco-editor-core', '*/tsMode', '*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'language/typescript',
|
// base: 'language/typescript',
|
||||||
entryPoint: 'src/language/typescript/monaco.contribution.ts',
|
// entryPoint: 'src/language/typescript/monaco.contribution.ts',
|
||||||
amdModuleId: 'vs/language/typescript/monaco.contribution',
|
// amdModuleId: 'vs/language/typescript/monaco.contribution',
|
||||||
amdDependencies: ['vs/editor/editor.api']
|
// amdDependencies: ['vs/editor/editor.api']
|
||||||
});
|
// });
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'language/typescript',
|
// base: 'language/typescript',
|
||||||
entryPoint: 'src/language/typescript/tsMode.ts',
|
// entryPoint: 'src/language/typescript/tsMode.ts',
|
||||||
amdModuleId: 'vs/language/typescript/tsMode',
|
// amdModuleId: 'vs/language/typescript/tsMode',
|
||||||
external: ['*/monaco.contribution']
|
// external: ['*/monaco.contribution']
|
||||||
});
|
// });
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'language/typescript',
|
// base: 'language/typescript',
|
||||||
entryPoint: 'src/language/typescript/tsWorker.ts',
|
// entryPoint: 'src/language/typescript/tsWorker.ts',
|
||||||
amdModuleId: 'vs/language/typescript/tsWorker'
|
// amdModuleId: 'vs/language/typescript/tsWorker'
|
||||||
});
|
// });
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
@ -192,21 +193,21 @@ glob('../src/basic-languages/*/*.contribution.ts', { cwd: __dirname }, function
|
||||||
}
|
}
|
||||||
|
|
||||||
// AMD
|
// AMD
|
||||||
{
|
// {
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'basic-languages',
|
// base: 'basic-languages',
|
||||||
entryPoint: 'src/basic-languages/monaco.contribution.ts',
|
// entryPoint: 'src/basic-languages/monaco.contribution.ts',
|
||||||
amdModuleId: 'vs/basic-languages/monaco.contribution',
|
// amdModuleId: 'vs/basic-languages/monaco.contribution',
|
||||||
amdDependencies: ['vs/editor/editor.api']
|
// amdDependencies: ['vs/editor/editor.api']
|
||||||
});
|
// });
|
||||||
for (const language of languages) {
|
// for (const language of languages) {
|
||||||
buildAMD({
|
// buildAMD({
|
||||||
base: 'basic-languages',
|
// base: 'basic-languages',
|
||||||
entryPoint: `src/basic-languages/${language}/${language}.ts`,
|
// entryPoint: `src/basic-languages/${language}/${language}.ts`,
|
||||||
amdModuleId: `vs/basic-languages/${language}/${language}`
|
// amdModuleId: `vs/basic-languages/${language}/${language}`
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
|
||||||
|
|
@ -5,18 +5,26 @@
|
||||||
|
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import { REPO_ROOT, readFiles, writeFiles, IFile, readFile } from '../build/utils';
|
import {
|
||||||
|
REPO_ROOT,
|
||||||
|
readFiles,
|
||||||
|
writeFiles,
|
||||||
|
IFile,
|
||||||
|
readFile,
|
||||||
|
build,
|
||||||
|
bundledFileHeader
|
||||||
|
} from '../build/utils';
|
||||||
import { removeDir } from '../build/fs';
|
import { removeDir } from '../build/fs';
|
||||||
import ts = require('typescript');
|
|
||||||
import { generateMetadata } from './releaseMetadata';
|
import { generateMetadata } from './releaseMetadata';
|
||||||
|
import ts = require('typescript');
|
||||||
|
|
||||||
removeDir(`out/monaco-editor`);
|
removeDir(`out/monaco-editor`);
|
||||||
|
|
||||||
// dev folder
|
// // dev folder
|
||||||
AMD_releaseOne('dev');
|
// AMD_releaseOne('dev');
|
||||||
|
|
||||||
// min folder
|
// // min folder
|
||||||
AMD_releaseOne('min');
|
// AMD_releaseOne('min');
|
||||||
|
|
||||||
// esm folder
|
// esm folder
|
||||||
ESM_release();
|
ESM_release();
|
||||||
|
|
@ -181,6 +189,47 @@ function ESM_release() {
|
||||||
writeFiles(coreFiles, `out/monaco-editor/esm`);
|
writeFiles(coreFiles, `out/monaco-editor/esm`);
|
||||||
|
|
||||||
ESM_releasePlugins();
|
ESM_releasePlugins();
|
||||||
|
|
||||||
|
build({
|
||||||
|
entryPoints: ['src/editor/editor.main.ts', 'src/editor/editor.worker.ts'],
|
||||||
|
bundle: true,
|
||||||
|
target: 'esnext',
|
||||||
|
format: 'esm',
|
||||||
|
drop: ['debugger'],
|
||||||
|
define: {
|
||||||
|
AMD: 'false'
|
||||||
|
},
|
||||||
|
banner: {
|
||||||
|
js: bundledFileHeader
|
||||||
|
},
|
||||||
|
external: [
|
||||||
|
/*'./src/language/*', */ './src/basic-languages/*',
|
||||||
|
'./edcore.main.js',
|
||||||
|
'./editor.worker',
|
||||||
|
'./editor.worker.start',
|
||||||
|
'./out/*'
|
||||||
|
],
|
||||||
|
alias: {
|
||||||
|
'monaco-editor-core/language/common/services/editorWebWorkerMain': './editor.worker',
|
||||||
|
'monaco-editor-core/esm/vs/editor/editor.worker.start': './editor.worker.start',
|
||||||
|
'monaco-editor-core': './edcore.main.js'
|
||||||
|
},
|
||||||
|
outbase: `src/`,
|
||||||
|
outdir: `out/monaco-editor/esm/vs/`,
|
||||||
|
plugins: [
|
||||||
|
{
|
||||||
|
name: 'example',
|
||||||
|
setup(build) {
|
||||||
|
build.onResolve({ filter: /\/language\/|\/basic-languages\// }, (args) => {
|
||||||
|
if (args.path.includes('monaco-editor-core')) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return { external: true };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -290,32 +339,6 @@ function ESM_addPluginContribs(files: IFile[]) {
|
||||||
}
|
}
|
||||||
file.path = file.path.replace(/editor\.main/, 'edcore.main');
|
file.path = file.path.replace(/editor\.main/, 'edcore.main');
|
||||||
}
|
}
|
||||||
|
|
||||||
const mainFileDestPath = 'vs/editor/editor.main.js';
|
|
||||||
|
|
||||||
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)
|
|
||||||
.replace(/\\/g, '/')
|
|
||||||
.replace(/\.js$/, '');
|
|
||||||
|
|
||||||
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
|
|
||||||
relativePath = './' + relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
return relativePath;
|
|
||||||
});
|
|
||||||
|
|
||||||
const mainFileContents =
|
|
||||||
mainFileImports.map((name) => `import '${name}';`).join('\n') +
|
|
||||||
`\n\nexport * from './edcore.main';`;
|
|
||||||
|
|
||||||
files.push({
|
|
||||||
path: mainFileDestPath,
|
|
||||||
contents: Buffer.from(mainFileContents)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -329,6 +352,31 @@ function releaseDTS() {
|
||||||
|
|
||||||
let contents = monacodts.contents.toString();
|
let contents = monacodts.contents.toString();
|
||||||
|
|
||||||
|
const additionalDtsFiles: Record<string, string> = {
|
||||||
|
'out/languages/tsc/common/workers.d.ts': 'editor'
|
||||||
|
};
|
||||||
|
Object.entries(additionalDtsFiles).forEach(([filePath, namespace]) => {
|
||||||
|
try {
|
||||||
|
const dtsFile = readFile(filePath);
|
||||||
|
let dtsContent = dtsFile.contents.toString();
|
||||||
|
|
||||||
|
// Remove imports
|
||||||
|
dtsContent = dtsContent.replace(/import .*\n/gm, '');
|
||||||
|
|
||||||
|
// Wrap in namespace if specified
|
||||||
|
if (namespace) {
|
||||||
|
dtsContent = `declare namespace ${namespace} {\n${dtsContent
|
||||||
|
.split('\n')
|
||||||
|
.map((line) => (line ? ` ${line}` : line))
|
||||||
|
.join('\n')}\n}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
contents += '\n' + dtsContent;
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(`Could not read d.ts file: ${filePath}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const extraContent = readFiles('out/languages/bundled/*.d.ts', {
|
const extraContent = readFiles('out/languages/bundled/*.d.ts', {
|
||||||
base: 'out/languages/bundled/'
|
base: 'out/languages/bundled/'
|
||||||
}).map((file) => {
|
}).map((file) => {
|
||||||
|
|
|
||||||
81
package-lock.json
generated
81
package-lock.json
generated
|
|
@ -9,7 +9,11 @@
|
||||||
"version": "0.52.0",
|
"version": "0.52.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/trusted-types": "^1.0.6"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@playwright/test": "^1.53.2",
|
||||||
"@types/mocha": "^9.1.0",
|
"@types/mocha": "^9.1.0",
|
||||||
"@types/shelljs": "^0.8.11",
|
"@types/shelljs": "^0.8.11",
|
||||||
"@typescript/vfs": "^1.3.5",
|
"@typescript/vfs": "^1.3.5",
|
||||||
|
|
@ -28,7 +32,6 @@
|
||||||
"monaco-editor-core": "0.52.0-rc2",
|
"monaco-editor-core": "0.52.0-rc2",
|
||||||
"parcel": "^2.7.0",
|
"parcel": "^2.7.0",
|
||||||
"pin-github-action": "^1.8.0",
|
"pin-github-action": "^1.8.0",
|
||||||
"playwright": "^1.32.2",
|
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"pretty-quick": "^3.1.3",
|
"pretty-quick": "^3.1.3",
|
||||||
"requirejs": "^2.3.7",
|
"requirejs": "^2.3.7",
|
||||||
|
|
@ -2187,6 +2190,22 @@
|
||||||
"@parcel/core": "^2.8.1"
|
"@parcel/core": "^2.8.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@playwright/test": {
|
||||||
|
"version": "1.54.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.54.2.tgz",
|
||||||
|
"integrity": "sha512-A+znathYxPf+72riFd1r1ovOLqsIIB0jKIoPjyK2kqEIe30/6jF6BC7QNluHuwUmsD2tv1XZVugN8GqfTMOxsA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"playwright": "1.54.2"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"playwright": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@swc/helpers": {
|
"node_modules/@swc/helpers": {
|
||||||
"version": "0.4.14",
|
"version": "0.4.14",
|
||||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz",
|
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz",
|
||||||
|
|
@ -2308,6 +2327,11 @@
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/trusted-types": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-1.0.6.tgz",
|
||||||
|
"integrity": "sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw=="
|
||||||
|
},
|
||||||
"node_modules/@typescript/vfs": {
|
"node_modules/@typescript/vfs": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.3.5.tgz",
|
||||||
|
|
@ -5867,31 +5891,35 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/playwright": {
|
"node_modules/playwright": {
|
||||||
"version": "1.32.2",
|
"version": "1.54.2",
|
||||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.32.2.tgz",
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.54.2.tgz",
|
||||||
"integrity": "sha512-jHVnXJke0PXpuPszKtk9y1zZSlzO5+2a+aockT/AND0oeXx46FiJEFrafthurglLygVZA+1gEbtUM1C7qtTV+Q==",
|
"integrity": "sha512-Hu/BMoA1NAdRUuulyvQC0pEqZ4vQbGfn8f7wPXcnqQmM+zct9UliKxsIkLNmz/ku7LElUNqmaiv1TG/aL5ACsw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"playwright-core": "1.32.2"
|
"playwright-core": "1.54.2"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14"
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "2.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/playwright-core": {
|
"node_modules/playwright-core": {
|
||||||
"version": "1.32.2",
|
"version": "1.54.2",
|
||||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.32.2.tgz",
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.54.2.tgz",
|
||||||
"integrity": "sha512-zD7aonO+07kOTthsrCR3YCVnDcqSHIJpdFUtZEMOb6//1Rc7/6mZDRdw+nlzcQiQltOOsiqI3rrSyn/SlyjnJQ==",
|
"integrity": "sha512-n5r4HFbMmWsB4twG7tJLDN9gmBUeSPcsBZiWSE4DnYz9mJMAFqr2ID7+eGC9kpEnxExJ1epttwR59LEWCk8mtA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright-core": "cli.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/portfinder": {
|
"node_modules/portfinder": {
|
||||||
|
|
@ -8896,6 +8924,15 @@
|
||||||
"nullthrows": "^1.1.1"
|
"nullthrows": "^1.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@playwright/test": {
|
||||||
|
"version": "1.54.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.54.2.tgz",
|
||||||
|
"integrity": "sha512-A+znathYxPf+72riFd1r1ovOLqsIIB0jKIoPjyK2kqEIe30/6jF6BC7QNluHuwUmsD2tv1XZVugN8GqfTMOxsA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"playwright": "1.54.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@swc/helpers": {
|
"@swc/helpers": {
|
||||||
"version": "0.4.14",
|
"version": "0.4.14",
|
||||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz",
|
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz",
|
||||||
|
|
@ -9011,6 +9048,11 @@
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/trusted-types": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-1.0.6.tgz",
|
||||||
|
"integrity": "sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw=="
|
||||||
|
},
|
||||||
"@typescript/vfs": {
|
"@typescript/vfs": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.3.5.tgz",
|
||||||
|
|
@ -11503,18 +11545,19 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"playwright": {
|
"playwright": {
|
||||||
"version": "1.32.2",
|
"version": "1.54.2",
|
||||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.32.2.tgz",
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.54.2.tgz",
|
||||||
"integrity": "sha512-jHVnXJke0PXpuPszKtk9y1zZSlzO5+2a+aockT/AND0oeXx46FiJEFrafthurglLygVZA+1gEbtUM1C7qtTV+Q==",
|
"integrity": "sha512-Hu/BMoA1NAdRUuulyvQC0pEqZ4vQbGfn8f7wPXcnqQmM+zct9UliKxsIkLNmz/ku7LElUNqmaiv1TG/aL5ACsw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"playwright-core": "1.32.2"
|
"fsevents": "2.3.2",
|
||||||
|
"playwright-core": "1.54.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"playwright-core": {
|
"playwright-core": {
|
||||||
"version": "1.32.2",
|
"version": "1.54.2",
|
||||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.32.2.tgz",
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.54.2.tgz",
|
||||||
"integrity": "sha512-zD7aonO+07kOTthsrCR3YCVnDcqSHIJpdFUtZEMOb6//1Rc7/6mZDRdw+nlzcQiQltOOsiqI3rrSyn/SlyjnJQ==",
|
"integrity": "sha512-n5r4HFbMmWsB4twG7tJLDN9gmBUeSPcsBZiWSE4DnYz9mJMAFqr2ID7+eGC9kpEnxExJ1epttwR59LEWCk8mtA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"portfinder": {
|
"portfinder": {
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"import-typescript": "ts-node ./build/importTypescript",
|
"import-typescript": "ts-node ./build/importTypescript",
|
||||||
"playwright-install": "node ./node_modules/playwright/install.js",
|
|
||||||
"playwright-install-deps": "playwright install-deps",
|
|
||||||
"postinstall": "ts-node ./build/postinstall",
|
"postinstall": "ts-node ./build/postinstall",
|
||||||
"prettier-check": "prettier --check .",
|
"prettier-check": "prettier --check .",
|
||||||
"prettier": "prettier --write .",
|
"prettier": "prettier --write .",
|
||||||
|
|
@ -22,7 +20,7 @@
|
||||||
"package-for-smoketest-vite": "ts-node ./test/smoke/package-vite",
|
"package-for-smoketest-vite": "ts-node ./test/smoke/package-vite",
|
||||||
"smoketest": "node ./test/smoke/runner.js",
|
"smoketest": "node ./test/smoke/runner.js",
|
||||||
"smoketest-debug": "node ./test/smoke/runner.js --debug-tests",
|
"smoketest-debug": "node ./test/smoke/runner.js --debug-tests",
|
||||||
"test": "mocha test/unit/all.js && ts-node ./build/check-samples",
|
"test": "ts-node ./build/check-samples",
|
||||||
"deps-all-remove": "ts-node ./build/npm/removeAll",
|
"deps-all-remove": "ts-node ./build/npm/removeAll",
|
||||||
"deps-all-install": "ts-node ./build/npm/installAll",
|
"deps-all-install": "ts-node ./build/npm/installAll",
|
||||||
"update-actions": "pin-github-action ./.github/workflows/website.yml",
|
"update-actions": "pin-github-action ./.github/workflows/website.yml",
|
||||||
|
|
@ -55,7 +53,7 @@
|
||||||
"monaco-editor-core": "0.52.0-rc2",
|
"monaco-editor-core": "0.52.0-rc2",
|
||||||
"parcel": "^2.7.0",
|
"parcel": "^2.7.0",
|
||||||
"pin-github-action": "^1.8.0",
|
"pin-github-action": "^1.8.0",
|
||||||
"playwright": "^1.32.2",
|
"@playwright/test": "^1.53.2",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"pretty-quick": "^3.1.3",
|
"pretty-quick": "^3.1.3",
|
||||||
"requirejs": "^2.3.7",
|
"requirejs": "^2.3.7",
|
||||||
|
|
@ -77,5 +75,8 @@
|
||||||
"alias": {
|
"alias": {
|
||||||
"process": false,
|
"process": false,
|
||||||
"buffer": false
|
"buffer": false
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/trusted-types": "^1.0.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
import { mkdir, rm } from 'fs/promises';
|
import { rm } from 'fs/promises';
|
||||||
import { join, resolve } from 'path';
|
import { join } from 'path';
|
||||||
import { PackageJson, group, gitShallowClone, run, writeJsonFile, getNightlyVersion } from '../lib';
|
import { PackageJson, group, gitShallowClone, run, writeJsonFile, getNightlyVersion } from '../lib';
|
||||||
import { getNightlyEnv } from './env';
|
import { getNightlyEnv } from './env';
|
||||||
|
|
||||||
const selfPath = __dirname;
|
const selfPath = __dirname;
|
||||||
const rootPath = join(selfPath, '..', '..');
|
const rootPath = join(selfPath, '..', '..');
|
||||||
const dependenciesPath = join(rootPath, 'dependencies');
|
const dependenciesPath = join(rootPath, 'dependencies');
|
||||||
const vscodePath = resolve(dependenciesPath, 'vscode');
|
const vscodePath = join(dependenciesPath, 'vscode');
|
||||||
const monacoEditorPackageJsonPath = resolve(rootPath, 'package.json');
|
const monacoEditorPackageJsonPath = join(rootPath, 'package.json');
|
||||||
|
|
||||||
async function prepareMonacoEditorCoreReleaseStableOrNightly() {
|
async function prepareMonacoEditorCoreReleaseStableOrNightly() {
|
||||||
const monacoEditorPackageJson = require(monacoEditorPackageJsonPath) as {
|
const monacoEditorPackageJson = require(monacoEditorPackageJsonPath) as {
|
||||||
|
|
@ -37,8 +37,6 @@ async function prepareMonacoEditorCoreReleaseStableOrNightly() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string) {
|
async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string) {
|
||||||
await mkdir(vscodePath, { recursive: true });
|
|
||||||
|
|
||||||
await rm(dependenciesPath, { force: true, recursive: true });
|
await rm(dependenciesPath, { force: true, recursive: true });
|
||||||
|
|
||||||
let vscodeCommitId: string;
|
let vscodeCommitId: string;
|
||||||
|
|
@ -62,10 +60,7 @@ async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string
|
||||||
});
|
});
|
||||||
|
|
||||||
await group('Set Version', async () => {
|
await group('Set Version', async () => {
|
||||||
const monacoEditorCorePackageJsonSourcePath = resolve(
|
const monacoEditorCorePackageJsonSourcePath = join(vscodePath, './build/monaco/package.json');
|
||||||
vscodePath,
|
|
||||||
'./build/monaco/package.json'
|
|
||||||
);
|
|
||||||
const packageJson = require(monacoEditorCorePackageJsonSourcePath) as PackageJson;
|
const packageJson = require(monacoEditorCorePackageJsonSourcePath) as PackageJson;
|
||||||
packageJson.version = version;
|
packageJson.version = version;
|
||||||
// This ensures we can always figure out which commit monaco-editor-core was built from
|
// This ensures we can always figure out which commit monaco-editor-core was built from
|
||||||
|
|
@ -74,8 +69,47 @@ async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string
|
||||||
});
|
});
|
||||||
|
|
||||||
await group('Building & Testing', async () => {
|
await group('Building & Testing', async () => {
|
||||||
await run(resolve(selfPath, './monaco-editor-core.sh'), { cwd: vscodePath });
|
// Install dependencies
|
||||||
|
await buildAndTest();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function buildAndTest() {
|
||||||
|
await run('npm install', { cwd: vscodePath });
|
||||||
|
await run('npm run playwright-install', { cwd: vscodePath });
|
||||||
|
|
||||||
|
// Run checks and compilation
|
||||||
|
await run('npm run gulp hygiene', { cwd: vscodePath });
|
||||||
|
await run('npm run valid-layers-check', { cwd: vscodePath });
|
||||||
|
await run('npm run compile', { cwd: join(vscodePath, 'build') });
|
||||||
|
await run('npm run eslint', { cwd: vscodePath });
|
||||||
|
await run('npm run monaco-compile-check', { cwd: vscodePath });
|
||||||
|
await run('npm run --max_old_space_size=4095 compile', { cwd: vscodePath });
|
||||||
|
|
||||||
|
// Build editor distribution
|
||||||
|
await run('npm run gulp editor-distro', { cwd: vscodePath });
|
||||||
|
|
||||||
|
return; // To save CI time.
|
||||||
|
|
||||||
|
// Run browser tests
|
||||||
|
await run('npm run test-browser --browser chromium', { cwd: vscodePath });
|
||||||
|
|
||||||
|
// TypeScript typings test
|
||||||
|
await run('mkdir typings-test', { cwd: vscodePath });
|
||||||
|
const typingsTestDir = join(vscodePath, 'typings-test');
|
||||||
|
await run('npm init -yp', { cwd: typingsTestDir });
|
||||||
|
await run('../node_modules/.bin/tsc --init', { cwd: typingsTestDir });
|
||||||
|
await run('echo "import \'../out-monaco-editor-core\';" > a.ts', { cwd: typingsTestDir });
|
||||||
|
await run('../node_modules/.bin/tsc --noEmit', { cwd: typingsTestDir });
|
||||||
|
|
||||||
|
// Monaco tests
|
||||||
|
const testMonacoDir = join(vscodePath, 'test/monaco');
|
||||||
|
await run('npm run esm-check', { cwd: testMonacoDir });
|
||||||
|
await run('npm run bundle-webpack', { cwd: testMonacoDir });
|
||||||
|
await run('npm run compile', { cwd: testMonacoDir });
|
||||||
|
await run('npm test', { cwd: testMonacoDir });
|
||||||
|
}
|
||||||
|
|
||||||
|
//buildAndTest();
|
||||||
|
//prepareMonacoEditorCoreRelease('0.99.0', 'main');
|
||||||
prepareMonacoEditorCoreReleaseStableOrNightly();
|
prepareMonacoEditorCoreReleaseStableOrNightly();
|
||||||
|
|
@ -68,7 +68,15 @@ async function prepareMonacoEditorRelease(monacoEditorCoreVersion: string) {
|
||||||
});
|
});
|
||||||
|
|
||||||
await group('Building & Testing', async () => {
|
await group('Building & Testing', async () => {
|
||||||
await run(resolve(selfPath, './monaco-editor.sh'), { cwd: rootPath });
|
//await run('npm run prettier-check', { cwd: rootPath });
|
||||||
|
await run('npm run build-monaco-editor', { cwd: rootPath });
|
||||||
|
await run('npm test', { cwd: rootPath });
|
||||||
|
await run('npm run compile', { cwd: resolve(rootPath, 'webpack-plugin') });
|
||||||
|
await run('npm run package-for-smoketest-webpack', { cwd: rootPath });
|
||||||
|
await run('npm run package-for-smoketest-esbuild', { cwd: rootPath });
|
||||||
|
await run('npm run package-for-smoketest-vite', { cwd: rootPath });
|
||||||
|
await run('npm run smoketest', { cwd: rootPath });
|
||||||
|
// npm package is now ready to be published in ./out/monaco-editor
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# cwd must be the vscode repository.
|
|
||||||
|
|
||||||
yarn --frozen-lockfile --network-timeout 180000
|
|
||||||
yarn playwright-install
|
|
||||||
yarn gulp hygiene
|
|
||||||
yarn valid-layers-check
|
|
||||||
yarn --cwd build compile
|
|
||||||
yarn eslint
|
|
||||||
yarn monaco-compile-check
|
|
||||||
yarn --max_old_space_size=4095 compile
|
|
||||||
|
|
||||||
yarn test-browser --browser chromium
|
|
||||||
|
|
||||||
yarn gulp editor-distro
|
|
||||||
mkdir typings-test
|
|
||||||
|
|
||||||
cd typings-test
|
|
||||||
yarn init -yp
|
|
||||||
../node_modules/.bin/tsc --init
|
|
||||||
echo "import '../out-monaco-editor-core';" > a.ts
|
|
||||||
../node_modules/.bin/tsc --noEmit
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
cd test/monaco
|
|
||||||
yarn run esm-check
|
|
||||||
yarn run bundle-webpack
|
|
||||||
yarn run compile
|
|
||||||
yarn test
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
# npm package is now in dependencies/vscode/out-monaco-editor-core, ready to be published
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Install OS Dependencies for Playwright
|
|
||||||
sudo npm run playwright-install-deps
|
|
||||||
# Check prettier
|
|
||||||
npm run prettier-check
|
|
||||||
# Build
|
|
||||||
npm run build-monaco-editor
|
|
||||||
|
|
||||||
# Run unit tests
|
|
||||||
npm test
|
|
||||||
|
|
||||||
# Compile webpack plugin
|
|
||||||
npm run compile --prefix webpack-plugin
|
|
||||||
# Package using webpack plugin
|
|
||||||
npm run package-for-smoketest-webpack
|
|
||||||
# Package using esbuild
|
|
||||||
npm run package-for-smoketest-esbuild
|
|
||||||
# Package using vite
|
|
||||||
npm run package-for-smoketest-vite
|
|
||||||
# Package using parcel
|
|
||||||
# npm run package-for-smoketest-parcel --prefix test/smoke/parcel
|
|
||||||
# Disabled for now, as the parcel bundler cannot deal with VS Code process variable
|
|
||||||
|
|
||||||
# Run smoke test
|
|
||||||
npm run smoketest
|
|
||||||
|
|
||||||
# npm package is now ready to be published in ./out/monaco-editor
|
|
||||||
7
src/common/initialize.ts
Normal file
7
src/common/initialize.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
import * as worker from 'monaco-editor-core/esm/vs/editor/editor.worker.start';
|
||||||
|
|
||||||
|
export function initialize(callback: (ctx: any, createData: any) => any): void {
|
||||||
|
self.onmessage = (m) => {
|
||||||
|
worker.start((ctx) => callback(ctx, m.data));
|
||||||
|
};
|
||||||
|
}
|
||||||
131
src/common/workers.ts
Normal file
131
src/common/workers.ts
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
import { editor } from '../fillers/monaco-editor-core';
|
||||||
|
|
||||||
|
function createTrustedTypesPolicy<Options extends TrustedTypePolicyOptions>(
|
||||||
|
policyName: string,
|
||||||
|
policyOptions?: Options
|
||||||
|
):
|
||||||
|
| undefined
|
||||||
|
| Pick<
|
||||||
|
TrustedTypePolicy<Options>,
|
||||||
|
'name' | Extract<keyof Options, keyof TrustedTypePolicyOptions>
|
||||||
|
> {
|
||||||
|
interface IMonacoEnvironment {
|
||||||
|
createTrustedTypesPolicy<Options extends TrustedTypePolicyOptions>(
|
||||||
|
policyName: string,
|
||||||
|
policyOptions?: Options
|
||||||
|
):
|
||||||
|
| undefined
|
||||||
|
| Pick<
|
||||||
|
TrustedTypePolicy<Options>,
|
||||||
|
'name' | Extract<keyof Options, keyof TrustedTypePolicyOptions>
|
||||||
|
>;
|
||||||
|
}
|
||||||
|
const monacoEnvironment: IMonacoEnvironment | undefined = (globalThis as any).MonacoEnvironment;
|
||||||
|
|
||||||
|
if (monacoEnvironment?.createTrustedTypesPolicy) {
|
||||||
|
try {
|
||||||
|
return monacoEnvironment.createTrustedTypesPolicy(policyName, policyOptions);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return (globalThis as any).trustedTypes?.createPolicy(policyName, policyOptions);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let ttPolicy: ReturnType<typeof createTrustedTypesPolicy>;
|
||||||
|
if (
|
||||||
|
typeof self === 'object' &&
|
||||||
|
self.constructor &&
|
||||||
|
self.constructor.name === 'DedicatedWorkerGlobalScope' &&
|
||||||
|
(globalThis as any).workerttPolicy !== undefined
|
||||||
|
) {
|
||||||
|
ttPolicy = (globalThis as any).workerttPolicy;
|
||||||
|
} else {
|
||||||
|
ttPolicy = createTrustedTypesPolicy('defaultWorkerFactory', {
|
||||||
|
createScriptURL: (value) => value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWorker(descriptor: { label: string; moduleId: string }): Worker | Promise<Worker> {
|
||||||
|
const label = descriptor.label;
|
||||||
|
// Option for hosts to overwrite the worker script (used in the standalone editor)
|
||||||
|
interface IMonacoEnvironment {
|
||||||
|
getWorker?(moduleId: string, label: string): Worker | Promise<Worker>;
|
||||||
|
getWorkerUrl?(moduleId: string, label: string): string;
|
||||||
|
}
|
||||||
|
const monacoEnvironment: IMonacoEnvironment | undefined = (globalThis as any).MonacoEnvironment;
|
||||||
|
if (monacoEnvironment) {
|
||||||
|
if (typeof monacoEnvironment.getWorker === 'function') {
|
||||||
|
return monacoEnvironment.getWorker('workerMain.js', label);
|
||||||
|
}
|
||||||
|
if (typeof monacoEnvironment.getWorkerUrl === 'function') {
|
||||||
|
const workerUrl = monacoEnvironment.getWorkerUrl('workerMain.js', label);
|
||||||
|
return new Worker(
|
||||||
|
ttPolicy ? (ttPolicy.createScriptURL(workerUrl) as unknown as string) : workerUrl,
|
||||||
|
{ name: label, type: 'module' }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// const esmWorkerLocation = descriptor.esmModuleLocation;
|
||||||
|
// if (esmWorkerLocation) {
|
||||||
|
// const workerUrl = getWorkerBootstrapUrl(label, esmWorkerLocation.toString(true));
|
||||||
|
// const worker = new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) as unknown as string : workerUrl, { name: label, type: 'module' });
|
||||||
|
// return whenESMWorkerReady(worker);
|
||||||
|
// }
|
||||||
|
|
||||||
|
throw new Error(
|
||||||
|
`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createWebWorker<T extends object>(
|
||||||
|
opts: IWebWorkerOptions
|
||||||
|
): editor.MonacoWebWorker<T> {
|
||||||
|
const worker = Promise.resolve(
|
||||||
|
getWorker({
|
||||||
|
label: opts.label ?? 'monaco-editor-worker',
|
||||||
|
moduleId: opts.moduleId
|
||||||
|
})
|
||||||
|
).then((w) => {
|
||||||
|
w.postMessage('ignore');
|
||||||
|
w.postMessage(opts.createData);
|
||||||
|
return w;
|
||||||
|
});
|
||||||
|
return editor.createWebWorker<T>({
|
||||||
|
worker,
|
||||||
|
host: opts.host,
|
||||||
|
keepIdleModels: opts.keepIdleModels
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IWebWorkerOptions {
|
||||||
|
/**
|
||||||
|
* The AMD moduleId to load.
|
||||||
|
* It should export a function `create` that should return the exported proxy.
|
||||||
|
*/
|
||||||
|
moduleId: string;
|
||||||
|
/**
|
||||||
|
* The data to send over when calling create on the module.
|
||||||
|
*/
|
||||||
|
createData?: any;
|
||||||
|
/**
|
||||||
|
* A label to be used to identify the web worker for debugging purposes.
|
||||||
|
*/
|
||||||
|
label?: string;
|
||||||
|
/**
|
||||||
|
* An object that can be used by the web worker to make calls back to the main thread.
|
||||||
|
*/
|
||||||
|
host?: any;
|
||||||
|
/**
|
||||||
|
* Keep idle models.
|
||||||
|
* Defaults to false, which means that idle models will stop syncing after a while.
|
||||||
|
*/
|
||||||
|
keepIdleModels?: boolean;
|
||||||
|
}
|
||||||
1
src/editor/edcore.main.ts
Normal file
1
src/editor/edcore.main.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export * from 'monaco-editor-core';
|
||||||
13
src/editor/editor.main.ts
Normal file
13
src/editor/editor.main.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
// @ and monaco-editor-core will not get bundled (because these dependencies get bundled on their own). Instead, the path gets rewritten.
|
||||||
|
|
||||||
|
import { createWebWorker } from '../common/workers';
|
||||||
|
import '../basic-languages/monaco.contribution';
|
||||||
|
import '../language/css/monaco.contribution';
|
||||||
|
import '../language/html/monaco.contribution';
|
||||||
|
import '../language/json/monaco.contribution';
|
||||||
|
import '../language/typescript/monaco.contribution';
|
||||||
|
import * as core from 'monaco-editor-core';
|
||||||
|
|
||||||
|
export * from './edcore.main';
|
||||||
|
|
||||||
|
(core.editor as any).createWebWorker = createWebWorker;
|
||||||
|
|
@ -3,9 +3,7 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// Resolves with the global monaco API
|
import { initialize } from '../common/initialize';
|
||||||
|
import 'monaco-editor-core/language/common/services/editorWebWorkerMain';
|
||||||
|
|
||||||
/// <reference path="./editor.api.d.ts" />
|
export { initialize };
|
||||||
import * as api from 'vs/editor/editor.api';
|
|
||||||
|
|
||||||
export = api;
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as worker from 'monaco-editor-core/esm/vs/editor/editor.worker';
|
import { initialize } from '../../common/initialize';
|
||||||
import { CSSWorker } from './cssWorker';
|
import { CSSWorker } from './cssWorker';
|
||||||
|
|
||||||
self.onmessage = () => {
|
self.onmessage = () => {
|
||||||
// ignore the first message
|
// ignore the first message
|
||||||
worker.initialize((ctx, createData) => {
|
initialize((ctx, createData) => {
|
||||||
return new CSSWorker(ctx, createData);
|
return new CSSWorker(ctx, createData);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import type { CSSWorker } from './cssWorker';
|
import type { CSSWorker } from './cssWorker';
|
||||||
import { editor, IDisposable, Uri } from '../../fillers/monaco-editor-core';
|
import { editor, IDisposable, Uri } from '../../fillers/monaco-editor-core';
|
||||||
|
import { createWebWorker } from '../../common/workers';
|
||||||
|
|
||||||
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
||||||
|
|
||||||
|
|
@ -55,7 +56,7 @@ export class WorkerManager {
|
||||||
this._lastUsedTime = Date.now();
|
this._lastUsedTime = Date.now();
|
||||||
|
|
||||||
if (!this._client) {
|
if (!this._client) {
|
||||||
this._worker = editor.createWebWorker<CSSWorker>({
|
this._worker = createWebWorker<CSSWorker>({
|
||||||
// module that exports the create() method and returns a `CSSWorker` instance
|
// module that exports the create() method and returns a `CSSWorker` instance
|
||||||
moduleId: 'vs/language/css/cssWorker',
|
moduleId: 'vs/language/css/cssWorker',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as worker from 'monaco-editor-core/esm/vs/editor/editor.worker';
|
import * as worker from '../../common/initialize';
|
||||||
import { HTMLWorker } from './htmlWorker';
|
import { HTMLWorker } from './htmlWorker';
|
||||||
|
|
||||||
self.onmessage = () => {
|
self.onmessage = () => {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import type { HTMLWorker } from './htmlWorker';
|
import type { HTMLWorker } from './htmlWorker';
|
||||||
import { Uri, IDisposable, editor } from '../../fillers/monaco-editor-core';
|
import { Uri, IDisposable, editor } from '../../fillers/monaco-editor-core';
|
||||||
|
import { createWebWorker } from '../../common/workers';
|
||||||
|
|
||||||
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
||||||
|
|
||||||
|
|
@ -55,7 +56,7 @@ export class WorkerManager {
|
||||||
this._lastUsedTime = Date.now();
|
this._lastUsedTime = Date.now();
|
||||||
|
|
||||||
if (!this._client) {
|
if (!this._client) {
|
||||||
this._worker = editor.createWebWorker<HTMLWorker>({
|
this._worker = createWebWorker<HTMLWorker>({
|
||||||
// module that exports the create() method and returns a `HTMLWorker` instance
|
// module that exports the create() method and returns a `HTMLWorker` instance
|
||||||
moduleId: 'vs/language/html/htmlWorker',
|
moduleId: 'vs/language/html/htmlWorker',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as worker from 'monaco-editor-core/esm/vs/editor/editor.worker';
|
import * as worker from '../../common/initialize';
|
||||||
import { JSONWorker } from './jsonWorker';
|
import { JSONWorker } from './jsonWorker';
|
||||||
|
|
||||||
self.onmessage = () => {
|
self.onmessage = () => {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,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';
|
||||||
|
import { createWebWorker } from '../../common/workers';
|
||||||
|
|
||||||
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
||||||
|
|
||||||
|
|
@ -55,7 +56,7 @@ export class WorkerManager {
|
||||||
this._lastUsedTime = Date.now();
|
this._lastUsedTime = Date.now();
|
||||||
|
|
||||||
if (!this._client) {
|
if (!this._client) {
|
||||||
this._worker = editor.createWebWorker<JSONWorker>({
|
this._worker = createWebWorker<JSONWorker>({
|
||||||
// module that exports the create() method and returns a `JSONWorker` instance
|
// module that exports the create() method and returns a `JSONWorker` instance
|
||||||
moduleId: 'vs/language/json/jsonWorker',
|
moduleId: 'vs/language/json/jsonWorker',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
declare module 'monaco-editor-core/esm/vs/editor/editor.worker' {
|
declare module 'monaco-editor-core/esm/vs/editor/editor.worker.start' {
|
||||||
export function initialize(callback: (ctx: any, createData: any) => any): void;
|
import type { worker } from 'monaco-editor-core';
|
||||||
|
|
||||||
|
export function start<THost extends object, TClient extends object>(createClient: (ctx: worker.IWorkerContext<THost>) => TClient): TClient;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { initialize } from 'monaco-editor-core/esm/vs/editor/editor.worker';
|
import { initialize } from '../../common/initialize';
|
||||||
import * as ts from './lib/typescriptServices';
|
import * as ts from './lib/typescriptServices';
|
||||||
import { ICreateData, TypeScriptWorker, create } from './tsWorker';
|
import { ICreateData, TypeScriptWorker, create } from './tsWorker';
|
||||||
import { worker } from '../../fillers/monaco-editor-core';
|
import { worker } from '../../fillers/monaco-editor-core';
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import type { TypeScriptWorker } from './tsWorker';
|
import type { TypeScriptWorker } from './tsWorker';
|
||||||
import { editor, Uri, IDisposable } from '../../fillers/monaco-editor-core';
|
import { editor, Uri, IDisposable } from '../../fillers/monaco-editor-core';
|
||||||
|
import { createWebWorker } from '../../common/workers';
|
||||||
|
|
||||||
export class WorkerManager {
|
export class WorkerManager {
|
||||||
private _configChangeListener: IDisposable;
|
private _configChangeListener: IDisposable;
|
||||||
|
|
@ -58,7 +59,7 @@ export class WorkerManager {
|
||||||
private _getClient(): Promise<TypeScriptWorker> {
|
private _getClient(): Promise<TypeScriptWorker> {
|
||||||
if (!this._client) {
|
if (!this._client) {
|
||||||
this._client = (async () => {
|
this._client = (async () => {
|
||||||
this._worker = editor.createWebWorker<TypeScriptWorker>({
|
this._worker = createWebWorker<TypeScriptWorker>({
|
||||||
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
||||||
moduleId: 'vs/language/typescript/tsWorker',
|
moduleId: 'vs/language/typescript/tsWorker',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,12 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"],
|
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"],
|
||||||
"module": "amd",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"outDir": "../out/languages/amd-tsc",
|
"outDir": "../out/languages/tsc",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./*"]
|
||||||
|
},
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,13 @@ async function runTests() {
|
||||||
// uncomment to shortcircuit and run a specific combo
|
// uncomment to shortcircuit and run a specific combo
|
||||||
// await runTest('webpack', 'chromium'); return;
|
// await runTest('webpack', 'chromium'); return;
|
||||||
/** @type {PackagerKind[]} */
|
/** @type {PackagerKind[]} */
|
||||||
const testTypes = ['amd', 'webpack', 'esbuild', 'vite'];
|
const testTypes = ['webpack', 'esbuild', 'vite'];
|
||||||
// TODO: add parcel! (this currently fails because parcel replaces process with {})
|
// TODO: add parcel! (this currently fails because parcel replaces process with {})
|
||||||
|
|
||||||
for (const type of testTypes) {
|
for (const type of testTypes) {
|
||||||
await runTest(type, 'chromium');
|
await runTest(type, 'chromium');
|
||||||
await runTest(type, 'firefox');
|
// await runTest(type, 'firefox');
|
||||||
await runTest(type, 'webkit');
|
// await runTest(type, 'webkit');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ suite(`Smoke Test '${testInfo.packager}' on '${testInfo.browser}'`, () => {
|
||||||
assert.fail('Failed to load page');
|
assert.fail('Failed to load page');
|
||||||
}
|
}
|
||||||
assert.strictEqual(response.status(), 200);
|
assert.strictEqual(response.status(), 200);
|
||||||
|
await timeout(1000000);
|
||||||
});
|
});
|
||||||
|
|
||||||
teardown(async () => {
|
teardown(async () => {
|
||||||
|
|
@ -77,6 +78,7 @@ suite(`Smoke Test '${testInfo.packager}' on '${testInfo.browser}'`, () => {
|
||||||
* @returns Promise<void>
|
* @returns Promise<void>
|
||||||
*/
|
*/
|
||||||
async function createEditor(text, language) {
|
async function createEditor(text, language) {
|
||||||
|
await timeout(1000000);
|
||||||
return await page.evaluate(
|
return await page.evaluate(
|
||||||
`window.ed = monacoAPI.editor.create(document.getElementById('editor-container'), { value: '${text}', language: '${language}' })`
|
`window.ed = monacoAPI.editor.create(document.getElementById('editor-container'), { value: '${text}', language: '${language}' })`
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
const requirejs = require('requirejs');
|
|
||||||
const jsdom = require('jsdom');
|
|
||||||
const glob = require('glob');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
requirejs.config({
|
|
||||||
baseUrl: '',
|
|
||||||
paths: {
|
|
||||||
'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
|
|
||||||
});
|
|
||||||
|
|
||||||
const tmp = new jsdom.JSDOM('<!DOCTYPE html><html><body></body></html>');
|
|
||||||
global.AMD = true;
|
|
||||||
global.document = tmp.window.document;
|
|
||||||
global.navigator = tmp.window.navigator;
|
|
||||||
global.self = global;
|
|
||||||
global.document.queryCommandSupported = function () {
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
global.UIEvent = tmp.window.UIEvent;
|
|
||||||
|
|
||||||
global.window = {
|
|
||||||
location: {},
|
|
||||||
navigator: tmp.window.navigator,
|
|
||||||
document: {
|
|
||||||
body: tmp.window.document.body,
|
|
||||||
addEventListener: (...args) => tmp.window.document.addEventListener(...args)
|
|
||||||
},
|
|
||||||
matchMedia: function () {
|
|
||||||
return {
|
|
||||||
matches: false,
|
|
||||||
addEventListener: function () {}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
setInterval: function () {},
|
|
||||||
setTimeout: function () {}
|
|
||||||
};
|
|
||||||
|
|
||||||
requirejs(
|
|
||||||
['test/unit/setup'],
|
|
||||||
function () {
|
|
||||||
glob(
|
|
||||||
'out/languages/amd-tsc/basic-languages/*/*.test.js',
|
|
||||||
{ cwd: path.join(__dirname, '../../') },
|
|
||||||
function (err, files) {
|
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
requirejs(
|
|
||||||
files.map((f) => f.replace(/^out\/languages\/amd-tsc/, 'vs').replace(/\.js$/, '')),
|
|
||||||
function () {
|
|
||||||
run(); // We can launch the tests!
|
|
||||||
},
|
|
||||||
function (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
function (err) {
|
|
||||||
console.log(err);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
define('vs/css', [], {
|
|
||||||
load: function (name, req, load) {
|
|
||||||
load({});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
define('vs/nls', [], {
|
|
||||||
create: function () {
|
|
||||||
return {
|
|
||||||
localize: function () {
|
|
||||||
return 'NO_LOCALIZATION_FOR_YOU';
|
|
||||||
},
|
|
||||||
localize2: function () {
|
|
||||||
return 'NO_LOCALIZATION_FOR_YOU';
|
|
||||||
},
|
|
||||||
getConfiguredDefaultLocale: function () {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
localize: function () {
|
|
||||||
return 'NO_LOCALIZATION_FOR_YOU';
|
|
||||||
},
|
|
||||||
localize2: function (key, message) {
|
|
||||||
return { value: 'NO_LOCALIZATION_FOR_YOU', original: message };
|
|
||||||
},
|
|
||||||
load: function (name, req, load) {
|
|
||||||
load({});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
define(['vs/editor/editor.main'], function (api) {
|
|
||||||
global.monaco = api;
|
|
||||||
});
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue