You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
monaco-editor/scripts/bundle.js

98 lines
2.8 KiB
JavaScript

7 years ago
const requirejs = require('requirejs');
const path = require('path');
const fs = require('fs');
const UglifyJS = require("uglify-js");
const helpers = require('monaco-plugin-helpers');
7 years ago
const REPO_ROOT = path.resolve(__dirname, '..');
const sha1 = helpers.getGitVersion(REPO_ROOT);
7 years ago
const semver = require('../package.json').version;
const headerVersion = semver + '(' + sha1 + ')';
const BUNDLED_FILE_HEADER = [
'/*!-----------------------------------------------------------------------------',
' * Copyright (c) Microsoft Corporation. All rights reserved.',
7 years ago
' * monaco-languages version: ' + headerVersion,
7 years ago
' * Released under the MIT license',
7 years ago
' * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md',
7 years ago
' *-----------------------------------------------------------------------------*/',
''
].join('\n');
bundleOne('monaco.contribution');
bundleOne('bat/bat');
bundleOne('css/css');
bundleOne('coffee/coffee');
bundleOne('cpp/cpp');
bundleOne('csharp/csharp');
bundleOne('dockerfile/dockerfile');
bundleOne('fsharp/fsharp');
bundleOne('go/go');
bundleOne('handlebars/handlebars');
bundleOne('html/html');
bundleOne('ini/ini');
bundleOne('pug/pug');
bundleOne('java/java');
bundleOne('javascript/javascript');
bundleOne('less/less');
bundleOne('lua/lua');
bundleOne('markdown/markdown');
bundleOne('msdax/msdax');
bundleOne('objective-c/objective-c');
bundleOne('php/php');
bundleOne('powershell/powershell');
bundleOne('postiats/postiats');
bundleOne('python/python');
bundleOne('r/r');
bundleOne('razor/razor');
bundleOne('ruby/ruby');
bundleOne('rust/rust');
bundleOne('scss/scss');
bundleOne('sql/sql');
bundleOne('st/st');
bundleOne('swift/swift');
bundleOne('typescript/typescript');
bundleOne('vb/vb');
bundleOne('xml/xml');
bundleOne('yaml/yaml');
bundleOne('solidity/solidity');
bundleOne('sb/sb');
bundleOne('mysql/mysql');
bundleOne('redshift/redshift');
bundleOne('pgsql/pgsql');
bundleOne('redis/redis');
bundleOne('csp/csp');
bundleOne('scheme/scheme');
7 years ago
bundleOne('clojure/clojure');
bundleOne('shell/shell');
7 years ago
bundleOne('perl/perl'),
bundleOne('powerquery/powerquery')
7 years ago
bundleOne('azcli/azcli')
7 years ago
bundleOne('apex/apex');
7 years ago
function bundleOne(moduleId, exclude) {
requirejs.optimize({
baseUrl: 'release/dev/',
name: 'vs/basic-languages/' + moduleId,
out: 'release/min/' + moduleId + '.js',
exclude: exclude,
paths: {
'vs/basic-languages': REPO_ROOT + '/release/dev'
},
optimize: 'none'
}, function (buildResponse) {
7 years ago
const filePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js');
const fileContents = fs.readFileSync(filePath).toString();
console.log();
console.log(`Minifying ${filePath}...`);
const result = UglifyJS.minify(fileContents, {
output: {
comments: 'some'
}
});
console.log(`Done.`);
fs.writeFileSync(filePath, BUNDLED_FILE_HEADER + result.code);
})
}