|
5 | 5 | *--------------------------------------------------------------------------------------------*/ |
6 | 6 | Object.defineProperty(exports, "__esModule", { value: true }); |
7 | 7 | const ts = require("typescript"); |
| 8 | +const es = require("event-stream"); |
8 | 9 | const fs = require("fs"); |
9 | 10 | const path = require("path"); |
10 | 11 | const tss = require("./treeshaking"); |
| 12 | +const gulp = require("gulp"); |
| 13 | +const webpack = require("webpack"); |
| 14 | +const webpackGulp = require('webpack-stream'); |
11 | 15 | const REPO_ROOT = path.join(__dirname, '../../'); |
12 | 16 | const SRC_DIR = path.join(REPO_ROOT, 'src'); |
13 | 17 | let dirCache = {}; |
@@ -309,3 +313,23 @@ function transportCSS(module, enqueue, write) { |
309 | 313 | return haystack.length >= needle.length && haystack.substr(0, needle.length) === needle; |
310 | 314 | } |
311 | 315 | } |
| 316 | +function bundleESM() { |
| 317 | + const result = es.through(); |
| 318 | + const webpackConfigPath = path.join(__dirname, '../../build/monaco/monaco.webpack.config.js'); |
| 319 | + const webpackConfig = Object.assign(Object.assign({}, require(webpackConfigPath)), { mode: 'production' }); |
| 320 | + const webpackDone = (err, stats) => { |
| 321 | + if (err) { |
| 322 | + result.emit('error', err); |
| 323 | + } |
| 324 | + const { compilation } = stats; |
| 325 | + if (compilation.errors.length > 0) { |
| 326 | + result.emit('error', compilation.errors.join('\n')); |
| 327 | + } |
| 328 | + if (compilation.warnings.length > 0) { |
| 329 | + result.emit('data', compilation.warnings.join('\n')); |
| 330 | + } |
| 331 | + }; |
| 332 | + return webpackGulp(webpackConfig, webpack, webpackDone) |
| 333 | + .pipe(gulp.dest('out-editor-esm-bundle')); |
| 334 | +} |
| 335 | +exports.bundleESM = bundleESM; |
0 commit comments