This commit is contained in:
Rob Lourens 2016-06-13 20:44:34 -07:00
Коммит aee853f236
14 изменённых файлов: 431 добавлений и 0 удалений

8
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,8 @@
.DS_Store
node_modules/
out/
lib/
*.vsix
vscode-chrome-debug.txt
typings/
.browse.VC.db

17
.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,17 @@
{
"version": "0.1.0",
"configurations": [
{
"name": "launch as server",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/out/src/nodeDebug.js",
"runtimeArgs": ["--harmony"],
"stopOnEntry": false,
"args": [ "--server=4712" ],
"sourceMaps": true,
"outDir": "${workspaceRoot}/out"
}
]
}

15
.vscode/settings.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,15 @@
{
"editor.insertSpaces": true,
"files.trimTrailingWhitespace": true,
"files.exclude": {
".git": true,
"bin": true,
"node_modules": false
},
"search.exclude": {
".git": true,
"node_modules": true,
"bin": true,
"out": true
}
}

21
.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,21 @@
{
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"tasks": [
{
"taskName": "watch",
"args": [],
"isBuildCommand": true,
"isWatching": true,
"problemMatcher": [
"$tsc"
]
},
{
"taskName": "watch-build-test",
"isWatching": true,
"isTestCommand": true
}
]
}

19
.vscodeignore Normal file
Просмотреть файл

@ -0,0 +1,19 @@
**/*.ts
**/*.map
.vscode/**
typings/**
*.vsix
gulpfile.js
tsconfig.json
tsd.json
tslint.json
vscode-chrome-debug.txt
node_modules/.bin/**
node_modules/bufferutil/**
node_modules/utf-8-validate/**
node_modules/vscode-chrome-debug-core/node_modules/ws/node_modules/bufferutil/**
node_modules/vscode-chrome-debug-core/node_modules/ws/node_modules/utf-8-validate/**
node_modules/vscode-chrome-debug-core/out/test/**
node_modules/vscode-chrome-debug-core/typings/**

13
LICENSE.txt Normal file
Просмотреть файл

@ -0,0 +1,13 @@
VS Code - Debugger for Chrome
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

27
README.md Normal file
Просмотреть файл

@ -0,0 +1,27 @@
# vscode-node-cdp-debug
This is a prototype of a debug adapter for VS Code that can target Node, using the Chrome Debugging Protocol. At the moment, this is only supported in Node v7. It's based on the vscode-debug-chrome-core library.
## How to run
Clone this repo, run npm install. Open the directory in Code and press ctrl+shift+b to build and F5 to run as a debug server.
Open your app's directory in Code and set up a launch config. It should look something like this:
```
{
"version": "0.2.0",
"debugServer": "4712", // To use the vscode-node-cdp-debug server, instead of vscode's built in Node debugger
"configurations": [
{
"name": "Node",
"type": "chrome",
"request": "attach",
"port": 9229,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
// "diagnosticLogging": true // May be useful for debugging
}
]
}
```
Start your app using "node --inspect". Press F5 in Code to attach.

13
ThirdPartyNotices.txt Normal file
Просмотреть файл

@ -0,0 +1,13 @@
This project may use or incorporate third party material from the projects listed below. The original copyright notice and the license under which Microsoft received such third party material are set forth below. Microsoft reserves all other rights not expressly granted, whether by implication, estoppel or otherwise.
websockets-ws
(The MIT License)
Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

55
gulpfile.js Normal file
Просмотреть файл

@ -0,0 +1,55 @@
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
const gulp = require('gulp');
const path = require('path');
const ts = require('gulp-typescript');
const log = require('gulp-util').log;
const typescript = require('typescript');
const sourcemaps = require('gulp-sourcemaps');
const tslint = require('gulp-tslint');
const sources = [
'src',
'typings/main'
].map(function(tsFolder) { return tsFolder + '/**/*.ts'; });
const lintSources = [
'src'
].map(function(tsFolder) { return tsFolder + '/**/*.ts'; });
const projectConfig = {
noImplicitAny: false,
target: 'ES5',
module: 'commonjs',
declaration: true,
typescript,
outDir: 'out'
};
function computeSourceRoot(file) {
return path.relative(path.dirname(file.path), __dirname);
}
const tsProject = ts.createProject(projectConfig);
gulp.task('build', function () {
return gulp.src(sources, { base: '.' })
.pipe(sourcemaps.init())
.pipe(ts(projectConfig)).js
.pipe(sourcemaps.write('.', { includeContent: false, sourceRoot: computeSourceRoot }))
.pipe(gulp.dest('out'));
});
gulp.task('watch', ['build'], function(cb) {
log('Watching build sources...');
return gulp.watch(sources, ['build']);
});
gulp.task('default', ['build']);
gulp.task('tslint', function() {
return gulp.src(lintSources, { base: '.' })
.pipe(tslint())
.pipe(tslint.report('verbose'));
});

103
package.json Normal file
Просмотреть файл

@ -0,0 +1,103 @@
{
"name": "vscode-node-cdp-debug",
"displayName": "Node Debugger via CDP",
"version": "0.0.1",
"description": "Debug Node using the Chrome Debug Protocol",
"publisher": "microsoft",
"engines": {
"vscode": "*"
},
"categories": [
"Debuggers"
],
"license": "SEE LICENSE IN LICENSE.txt",
"dependencies": {
"vscode-chrome-debug-core": "0.1.2"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-sourcemaps": "^1.5.2",
"gulp-tslint": "^3.3.1",
"gulp-typescript": "^2.12.1",
"gulp-util": "^3.0.5",
"tslint": "^2.5.1",
"typescript": "^1.8.9",
"typings": "^0.7.12"
},
"scripts": {
"postinstall": "typings install"
},
"contributes": {
"debuggers": [
{
"type": "node",
"label": "Node.js via CDP",
"enableBreakpointsFor": {
"languageIds": [
"javascript",
"typescriptreact",
"javascriptreact"
]
},
"program": "./out/src/nodeDebug.js",
"runtime": "node",
"initialConfigurations": [
],
"configurationAttributes": {
"launch": {
"required": [],
"properties": {
"port": {
"type": "number",
"description": "Debug port to attach to.",
"default": 9222
},
"sourceMaps": {
"type": "boolean",
"description": "Use JavaScript source maps (if they exist).",
"default": true
},
"diagnosticLogging": {
"type": "boolean",
"description": "When true, the adapter logs its own diagnostic info to the console",
"default": true
},
"verboseDiagnosticLogging": {
"type": "boolean",
"description": "When true, the adapter logs all traffic with the client and target (as well as the info logged by 'diagnosticLogging')",
"default": true
}
}
},
"attach": {
"required": [
"port"
],
"properties": {
"port": {
"type": "number",
"description": "Debug port to attach to.",
"default": 9222
},
"sourceMaps": {
"type": "boolean",
"description": "Use JavaScript source maps (if they exist).",
"default": true
},
"diagnosticLogging": {
"type": "boolean",
"description": "When true, the adapter logs its own diagnostic info to the console",
"default": true
},
"verboseDiagnosticLogging": {
"type": "boolean",
"description": "When true, the adapter logs all traffic with the client and target (as well as the info logged by 'diagnosticLogging')",
"default": true
}
}
}
}
}
]
}
}

7
src/nodeDebug.ts Normal file
Просмотреть файл

@ -0,0 +1,7 @@
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import {ChromeDebugSession} from 'vscode-chrome-debug-core';
ChromeDebugSession.run(ChromeDebugSession);

15
tsconfig.json Normal file
Просмотреть файл

@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": false,
"removeComments": false,
"target": "ES5",
"sourceMap": true,
"outDir": "out"
},
"exclude": [
"node_modules",
"testapp/node_modules",
"typings/browser"
]
}

111
tslint.json Normal file
Просмотреть файл

@ -0,0 +1,111 @@
{
"rules": {
"align": [
true,
"parameters",
"statements"
],
"ban": false,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": false,
"forin": true,
"indent": [
true,
"spaces"
],
"jsdoc-format": true,
"label-position": true,
"label-undefined": true,
"max-line-length": [
false,
140
],
"member-access": true,
"member-ordering": [
true,
"variables-before-functions"
],
"no-any": false,
"no-arg": true,
"no-bitwise": true,
"no-conditional-assignment": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-key": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-eval": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-keyword-named-variables": true,
"no-require-imports": false,
"no-shadowed-variable": true,
"no-string-literal": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unreachable": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"no-var-requires": true,
"object-literal-sort-keys": true,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": true,
"switch-default": true,
"trailing-comma": [
true,
{
"multiline": "always",
"singleline": "never"
}
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
}
}

7
typings.json Normal file
Просмотреть файл

@ -0,0 +1,7 @@
{
"ambientDependencies": {
"es6-collections": "registry:dt/es6-collections#0.5.1+20160316155526",
"es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304",
"node": "registry:dt/node#4.0.0+20160423143914"
}
}