UNPKG

1.59 kBJavaScriptView Raw
1#!/usr/bin/env node
2"use strict";
3/* -----------------------------------------------------------------------------
4| Copyright (c) Jupyter Development Team.
5| Distributed under the terms of the Modified BSD License.
6|----------------------------------------------------------------------------*/
7var __importStar = (this && this.__importStar) || function (mod) {
8 if (mod && mod.__esModule) return mod;
9 var result = {};
10 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
11 result["default"] = mod;
12 return result;
13};
14Object.defineProperty(exports, "__esModule", { value: true });
15/**
16 * This file is a temporary workaround to ensure that we can set
17 * max_old_space by default but allow others to override it.
18 *
19 * When node 10 support is dropped, we can remove this file as node 12
20 * should just grow as required.
21 *
22 * See: https://github.com/jupyterlab/jupyterlab/issues/7175
23 *
24 * @example
25 * node ensure-max-old-space.js real-cli.js arg1 arg2
26 */
27const child_process_1 = require("child_process");
28const which = __importStar(require("which"));
29const MAX_OLD_SPACE = '--max_old_space_size=4096';
30if (!process.env.NODE_OPTIONS) {
31 process.env.NODE_OPTIONS = MAX_OLD_SPACE;
32}
33else if (!/--max[_\-]old[_\-]space[_\-]size/.test(process.env.NODE_OPTIONS)) {
34 process.env.NODE_OPTIONS += ` ${MAX_OLD_SPACE}`;
35}
36const program = which.sync(process.argv[2]);
37const args = process.argv.slice(3);
38child_process_1.execFileSync(program, args, { env: process.env, stdio: 'inherit' });
39//# sourceMappingURL=ensure-max-old-space.js.map
\No newline at end of file