Add smoketest for esbuild packaging
parent
c0b99e4785
commit
208f9218f9
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="editor-container" style="position: absolute; width: 500px; height: 400px"></div>
|
||||
<script type="text/javascript" src="out/index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,21 @@
|
||||
import * as monaco from '../../../release/esm/vs/editor/editor.main.js';
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorkerUrl: function (moduleId, label) {
|
||||
if (label === 'json') {
|
||||
return './out/vs/language/json/json.worker.js';
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
return './out/vs/language/css/css.worker.js';
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
return './out/vs/language/html/html.worker.js';
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
return './out/vs/language/typescript/ts.worker.js';
|
||||
}
|
||||
return './out/vs/editor/editor.worker.js';
|
||||
}
|
||||
};
|
||||
|
||||
window.monacoAPI = monaco;
|
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as esbuild from 'esbuild';
|
||||
import * as path from 'path';
|
||||
import { removeDir } from '../../build/fs';
|
||||
|
||||
removeDir('test/smoke/esbuild/out', (entry) => /esbuild.html$/.test(entry));
|
||||
|
||||
const workerEntryPoints = [
|
||||
'vs/language/json/json.worker.js',
|
||||
'vs/language/css/css.worker.js',
|
||||
'vs/language/html/html.worker.js',
|
||||
'vs/language/typescript/ts.worker.js',
|
||||
'vs/editor/editor.worker.js'
|
||||
];
|
||||
|
||||
build({
|
||||
entryPoints: workerEntryPoints.map((entry) => path.join(__dirname, `../../release/esm/${entry}`)),
|
||||
bundle: true,
|
||||
format: 'iife',
|
||||
logLevel: 'silent',
|
||||
outbase: path.join(__dirname, '../../release/esm/'),
|
||||
outdir: path.join(__dirname, 'esbuild/out')
|
||||
});
|
||||
|
||||
build({
|
||||
entryPoints: [path.join(__dirname, 'esbuild/index.js')],
|
||||
bundle: true,
|
||||
format: 'iife',
|
||||
logLevel: 'silent',
|
||||
outdir: path.join(__dirname, 'esbuild/out'),
|
||||
loader: {
|
||||
'.ttf': 'file'
|
||||
}
|
||||
});
|
||||
|
||||
function build(opts: esbuild.BuildOptions) {
|
||||
esbuild.build(opts).then((result) => {
|
||||
const errors = result.errors;
|
||||
const warnings = result.warnings.filter((w) => {
|
||||
return (
|
||||
w.text !==
|
||||
'Top-level "this" will be replaced with undefined since this file is an ECMAScript module'
|
||||
);
|
||||
});
|
||||
if (errors.length > 0) {
|
||||
console.log(`errors:`);
|
||||
console.error(errors);
|
||||
}
|
||||
if (warnings.length > 0) {
|
||||
console.log(`warnings:`);
|
||||
console.error(warnings);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue