Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update bootstrap-amd for recent upstream changes #58

Merged
merged 1 commit into from
Jan 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions data/bootstrap-amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
//@ts-check
'use strict';

// Store the node.js require function in a variable
// before loading our AMD loader to avoid issues
// when this file is bundled with other files.
const nodeRequire = require;

// VSCODE_GLOBALS: node_modules
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), { get: (_target, mod) => nodeRequire(String(mod)) });

// VSCODE_GLOBALS: package/product.json
globalThis._VSCODE_PRODUCT_JSON = require('../product.json');
globalThis._VSCODE_PACKAGE_JSON = require('../package.json');

const loader = require('./vs/loader');
const bootstrap = require('./bootstrap');

Expand All @@ -25,7 +37,7 @@ const baseUrl = bootstrap.fileUriFromPath
loader.config({
baseUrl,
catchError: true,
nodeRequire: require,
nodeRequire,
nodeMain: __filename,
'vs/nls': nlsConfig,
paths : {
Expand Down Expand Up @@ -70,8 +82,8 @@ exports.load = function (entrypoint, onLoad, onError) {
// The best approach for now seem to be to load monkey patch immediately
// after the main.js file is read.
if (entrypoint === "vs/code/electron-main/main") {
let fs = require('fs');
let p = require('path');
let fs = nodeRequire('fs');
let p = nodeRequire('path');
let readFile = fs.readFile;
fs.readFile = function (path, options, callback) {
readFile(path, options, function () {
Expand Down