Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jun 14, 2016
0 parents commit aee853f
Show file tree
Hide file tree
Showing 14 changed files with 431 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
node_modules/
out/
lib/
*.vsix
vscode-chrome-debug.txt
typings/
.browse.VC.db
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 55 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -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 changes: 103 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions src/nodeDebug.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/

import {ChromeDebugSession} from 'vscode-chrome-debug-core';

ChromeDebugSession.run(ChromeDebugSession);
15 changes: 15 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
Loading

0 comments on commit aee853f

Please sign in to comment.