wip

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