wip

上级 a36fd18e
......@@ -192,6 +192,15 @@
"order": 6
}
},
{
"name": "Attach",
"port": 9229,
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"type": "pwa-chrome",
"request": "attach",
......
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const esbuild = require("esbuild");
const buildfile = require("../src/buildfile");
const _ = require("underscore");
const pkg = require("../package.json");
const dependencies = Object.keys(pkg.dependencies);
const entryPoints = _.flatten([
buildfile.entrypoint('vs/workbench/workbench.desktop.main'),
buildfile.base,
buildfile.workerExtensionHost,
buildfile.workerNotebook,
buildfile.workbenchDesktop,
buildfile.code
]).map(entrypoint => `src/${entrypoint.name}.ts`);
async function main() {
await esbuild.build({
entryPoints: [
...entryPoints,
'src/main.js',
'src/vs/base/parts/sandbox/electron-browser/preload.js',
'src/vs/code/electron-sandbox/workbench/workbench.html'
],
outdir: 'out',
outbase: 'src',
// format: 'iife',
platform: 'node',
target: 'node12.18',
bundle: true,
tsconfig: 'src/tsconfig.json',
logLevel: 'info',
sourcemap: true,
// minify: true,
loader: {
'.png': 'file',
'.ttf': 'file',
'.svg': 'file',
'.html': 'file'
},
inject: [
'src/vs/dummyloader.js'
],
external: [
...dependencies,
'vs/css!*',
// 'vs/nls',
'*/sqlite',
'electron*',
'vscode-windows-registry',
'windows-process-tree',
'windows-mutex',
'windows-foreground-love',
'vscode-windows-ca-certs',
'*.node',
'*keymapping',
'*pty.node'
]
});
}
if (require.main === module) {
main().catch(err => {
// console.error(err);
process.exit(1);
});
}
/*---------------------------------------------------------------------------------------------
* 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 buildfile from '../src/buildfile';
import * as _ from 'underscore';
import * as pkg from '../package.json';
const dependencies = Object.keys(pkg.dependencies);
const entryPoints = _.flatten([
buildfile.entrypoint('vs/workbench/workbench.desktop.main'),
buildfile.base,
buildfile.workerExtensionHost,
buildfile.workerNotebook,
buildfile.workbenchDesktop,
buildfile.code
]).map(entrypoint => `src/${entrypoint.name}.ts`);
async function main() {
await esbuild.build({
entryPoints: [
...entryPoints,
'src/main.js',
'src/vs/base/parts/sandbox/electron-browser/preload.js',
'src/vs/code/electron-sandbox/workbench/workbench.html'
],
outdir: 'out',
outbase: 'src',
// format: 'iife',
platform: 'node',
target: 'node12.18',
bundle: true,
tsconfig: 'src/tsconfig.json',
logLevel: 'info',
sourcemap: true,
// minify: true,
loader: {
'.png': 'file',
'.ttf': 'file',
'.svg': 'file',
'.html': 'file'
},
inject: [
'src/vs/dummyloader.js'
],
external: [
...dependencies,
'vs/css!*',
// 'vs/nls',
'*/sqlite',
'electron*',
'vscode-windows-registry',
'windows-process-tree',
'windows-mutex',
'windows-foreground-love',
'vscode-windows-ca-certs',
'*.node',
'*keymapping',
'*pty.node'
]
});
}
if (require.main === module) {
main().catch(err => {
// console.error(err);
process.exit(1);
});
}
......@@ -84,7 +84,7 @@
// replace the patched electron fs with the original node fs for all AMD code (TODO@sandbox non-sandboxed only)
if (!sandbox) {
require.define('fs', [], function () { return require.__$__nodeRequire('original-fs'); });
// require.define('fs', [], function () { return require.__$__nodeRequire('original-fs'); });
}
window['MonacoEnvironment'] = {};
......@@ -93,66 +93,66 @@
`${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out` :
`${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32' })}/out`;
const loaderConfig = {
baseUrl,
'vs/nls': nlsConfig,
preferScriptTags: useCustomProtocol
};
// use a trusted types policy when loading via script tags
if (loaderConfig.preferScriptTags) {
loaderConfig.trustedTypesPolicy = window.trustedTypes?.createPolicy('amdLoader', {
createScriptURL(value) {
if (value.startsWith(window.location.origin)) {
return value;
}
throw new Error(`Invalid script url: ${value}`);
}
});
}
// Enable loading of node modules:
// - sandbox: we list paths of webpacked modules to help the loader
// - non-sandbox: we signal that any module that does not begin with
// `vs/` should be loaded using node.js require()
if (sandbox) {
loaderConfig.paths = {
'vscode-textmate': `../node_modules/vscode-textmate/release/main`,
'vscode-oniguruma': `../node_modules/vscode-oniguruma/release/main`,
'xterm': `../node_modules/xterm/lib/xterm.js`,
'xterm-addon-search': `../node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
'xterm-addon-unicode11': `../node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`,
'xterm-addon-webgl': `../node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
'iconv-lite-umd': `../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`,
'jschardet': `../node_modules/jschardet/dist/jschardet.min.js`,
};
} else {
loaderConfig.amdModulesPattern = /^vs\//;
}
// cached data config
if (configuration.nodeCachedDataDir) {
loaderConfig.nodeCachedData = {
path: configuration.nodeCachedDataDir,
seed: modulePaths.join('')
};
}
if (options && typeof options.beforeLoaderConfig === 'function') {
options.beforeLoaderConfig(configuration, loaderConfig);
}
require.config(loaderConfig);
if (nlsConfig.pseudo) {
require(['vs/nls'], function (nlsPlugin) {
nlsPlugin.setPseudoTranslation(nlsConfig.pseudo);
});
}
if (options && typeof options.beforeRequire === 'function') {
options.beforeRequire();
}
// const loaderConfig = {
// baseUrl,
// 'vs/nls': nlsConfig,
// preferScriptTags: useCustomProtocol
// };
// // use a trusted types policy when loading via script tags
// if (loaderConfig.preferScriptTags) {
// loaderConfig.trustedTypesPolicy = window.trustedTypes?.createPolicy('amdLoader', {
// createScriptURL(value) {
// if (value.startsWith(window.location.origin)) {
// return value;
// }
// throw new Error(`Invalid script url: ${value}`);
// }
// });
// }
// // Enable loading of node modules:
// // - sandbox: we list paths of webpacked modules to help the loader
// // - non-sandbox: we signal that any module that does not begin with
// // `vs/` should be loaded using node.js require()
// if (sandbox) {
// loaderConfig.paths = {
// 'vscode-textmate': `../node_modules/vscode-textmate/release/main`,
// 'vscode-oniguruma': `../node_modules/vscode-oniguruma/release/main`,
// 'xterm': `../node_modules/xterm/lib/xterm.js`,
// 'xterm-addon-search': `../node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
// 'xterm-addon-unicode11': `../node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`,
// 'xterm-addon-webgl': `../node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
// 'iconv-lite-umd': `../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`,
// 'jschardet': `../node_modules/jschardet/dist/jschardet.min.js`,
// };
// } else {
// loaderConfig.amdModulesPattern = /^vs\//;
// }
// // cached data config
// if (configuration.nodeCachedDataDir) {
// loaderConfig.nodeCachedData = {
// path: configuration.nodeCachedDataDir,
// seed: modulePaths.join('')
// };
// }
// if (options && typeof options.beforeLoaderConfig === 'function') {
// options.beforeLoaderConfig(configuration, loaderConfig);
// }
// require.config(loaderConfig);
// if (nlsConfig.pseudo) {
// require(['vs/nls'], function (nlsPlugin) {
// nlsPlugin.setPseudoTranslation(nlsConfig.pseudo);
// });
// }
// if (options && typeof options.beforeRequire === 'function') {
// options.beforeRequire();
// }
require(modulePaths, async result => {
try {
......
......@@ -194,9 +194,10 @@ function startup(cachedDataDir, nlsConfig) {
// Load main in AMD
perf.mark('code/willLoadMainBundle');
require('./bootstrap-amd').load('vs/code/electron-main/main', () => {
perf.mark('code/didLoadMainBundle');
});
require('./vs/code/electron-main/main');
// require('./bootstrap-amd').load('vs/code/electron-main/main', () => {
perf.mark('code/didLoadMainBundle');
// });
}
async function onReady() {
......
......@@ -466,9 +466,9 @@ let __insane_func;
}, {}, [4]);
// ESM-comment-begin
define(function() { return { insane: __insane_func }; });
// define(function () { return { insane: __insane_func }; });
// ESM-comment-end
// ESM-uncomment-begin
// export var insane = __insane_func;
export var insane = __insane_func;
// ESM-uncomment-end
......@@ -204,7 +204,10 @@ class FileAccessImpl {
return uriOrModule;
}
return URI.parse(moduleIdToUrl!.toUrl(uriOrModule));
console.log(uriOrModule);
return URI.parse(`file:///home/joao/Work/vscode/out/${uriOrModule}`);
// return URI.parse(moduleIdToUrl!.toUrl(uriOrModule));
}
}
......
......@@ -107,13 +107,13 @@ if (typeof global === 'object') {
sharedObj = {};
}
if (typeof define === 'function') {
// amd
define([], function () { return _factory(sharedObj); });
} else if (typeof module === 'object' && typeof module.exports === 'object') {
// commonjs
module.exports = _factory(sharedObj);
} else {
console.trace('perf-util defined in UNKNOWN context (neither requirejs or commonjs)');
sharedObj.perf = _factory(sharedObj);
}
// if (typeof define === 'function') {
// // amd
// define([], function () { return _factory(sharedObj); });
// } else if (typeof module === 'object' && typeof module.exports === 'object') {
// commonjs
module.exports = _factory(sharedObj);
// } else {
// console.trace('perf-util defined in UNKNOWN context (neither requirejs or commonjs)');
// sharedObj.perf = _factory(sharedObj);
// }
......@@ -301,14 +301,14 @@ function factory(nodeRequire, path, fs, perf) {
}
if (typeof define === 'function') {
// amd
define(['path', 'fs', 'vs/base/common/performance'], function (path, fs, perf) { return factory(require.__$__nodeRequire, path, fs, perf); });
} else if (typeof module === 'object' && typeof module.exports === 'object') {
// if (typeof define === 'function') {
// // amd
// define(['path', 'fs', 'vs/base/common/performance'], function (path, fs, perf) { return factory(require.__$__nodeRequire, path, fs, perf); });
// } else if (typeof module === 'object' && typeof module.exports === 'object') {
const path = require('path');
const fs = require('fs');
const perf = require('../common/performance');
module.exports = factory(require, path, fs, perf);
} else {
throw new Error('Unknown context');
}
// } else {
// throw new Error('Unknown context');
// }
......@@ -3,9 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { FileAccess } from 'vs/base/common/network';
// import { FileAccess } from 'vs/base/common/network';
const pathsPath = FileAccess.asFileUri('paths', require).fsPath;
const paths = require.__$__nodeRequire<{ getDefaultUserDataPath(): string }>(pathsPath);
// const pathsPath = FileAccess.asFileUri('paths', require).fsPath;
// const paths = require.__$__nodeRequire<{ getDefaultUserDataPath(): string }>(pathsPath);
const paths = require('../../../paths.js');
export const getDefaultUserDataPath = paths.getDefaultUserDataPath;
......@@ -11,7 +11,7 @@
<!-- Init Bootstrap Helpers -->
<script src="../../../../bootstrap.js"></script>
<script src="../../../../vs/loader.js"></script>
<!-- <script src="../../../../vs/loader.js"></script> -->
<script src="../../../../bootstrap-window.js"></script>
<!-- Startup via workbench.js -->
......
......@@ -856,8 +856,9 @@ export class CodeWindow extends Disposable implements ICodeWindow {
workbench = 'vs/code/electron-browser/workbench/workbench.html';
}
return FileAccess
.asBrowserUri(workbench, require)
// return FileAccess
// .asBrowserUri(workbench, require)
return URI.file(`/home/joao/Work/vscode/src/${workbench}`)
.with({ query: `config=${encodeURIComponent(JSON.stringify(config))}` })
.toString(true);
}
......
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote-resource:; media-src 'none'; frame-src 'self' vscode-webview: https://*.vscode-webview-test.com; object-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' https:; font-src 'self' https: vscode-remote-resource:;">
</head>
<body aria-label="">
</body>
<!-- Init Bootstrap Helpers -->
<script src="../../../../bootstrap.js"></script>
<script src="../../../../vs/loader.js"></script>
<script src="../../../../bootstrap-window.js"></script>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy"
content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote-resource:; media-src 'none'; frame-src 'self' vscode-webview: https://*.vscode-webview-test.com; object-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' https:; font-src 'self' https: vscode-remote-resource:;">
</head>
<body aria-label="">
</body>
<!-- Init Bootstrap Helpers -->
<script src="../../../../bootstrap.js"></script>
<!-- <script src="../../../../vs/loader.js"></script> -->
<script src="../../../../bootstrap-window.js"></script>
<!-- Startup via workbench.js -->
<script src="workbench.js"></script>
<!-- Startup via workbench.js -->
<script src="workbench.js"></script>
</html>
export function define() {
}
require.__$__nodeRequire = () => { }
......@@ -158,3 +158,5 @@ var NLSLoaderPlugin;
NLSLoaderPlugin.NLSPlugin = NLSPlugin;
define('vs/nls', new NLSPlugin(new Environment()));
})(NLSLoaderPlugin || (NLSLoaderPlugin = {}));
module.exports.localize = (_, msg) => msg;
......@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as minimist from 'minimist';
const minimist = require('minimist');
import { localize } from 'vs/nls';
import { isWindows } from 'vs/base/common/platform';
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
......
......@@ -16,7 +16,7 @@ export namespace _util {
export const DI_DEPENDENCIES = '$di$dependencies';
export function getServiceDependencies(ctor: any): { id: ServiceIdentifier<any>, index: number, optional: boolean }[] {
return ctor[DI_DEPENDENCIES] || [];
return ctor.prototype[DI_DEPENDENCIES] || [];
}
}
......
......@@ -42,10 +42,13 @@ if (isWeb || typeof require === 'undefined' || typeof require.__$__nodeRequire !
else {
// Obtain values from product.json and package.json
const rootPath = dirname(FileAccess.asFileUri('', require));
// const rootPath = dirname(FileAccess.asFileUri('', require));
product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string; };
// product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
// const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string; };
product = require('../../../../../product.json');
const pkg = require('../../../../../package.json');
// Running out of sources
if (env['VSCODE_DEV']) {
......
......@@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
import * as gracefulFs from 'graceful-fs';
// import * as fs from 'fs';
// import * as gracefulFs from 'graceful-fs';
import { createHash } from 'crypto';
import { exists, stat } from 'vs/base/node/pfs';
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
......@@ -70,7 +70,7 @@ class DesktopMain extends Disposable {
private init(): void {
// Enable gracefulFs
gracefulFs.gracefulify(fs);
// gracefulFs.gracefulify(fs);
// Massage configuration file URIs
this.reviveUris();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册