Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rev087/ng-inspector
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2
Choose a base ref
...
head repository: rev087/ng-inspector
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 13,507 additions and 766 deletions.
  1. +21 −0 .gitignore
  2. +7 −0 .jshintrc
  3. +12 −0 .travis.yml
  4. +76 −0 CONTRIBUTING.md
  5. +0 −87 Info.plist
  6. 0 LICENCE.md → LICENSE.md
  7. +19 −7 README.md
  8. BIN artwork.sketch/Data
  9. +0 −24 artwork.sketch/metadata
  10. +0 −1 artwork.sketch/version
  11. +16 −0 gulp/config.js
  12. +16 −0 gulp/tasks/build-css.js
  13. +10 −0 gulp/tasks/build-icons.js
  14. +23 −0 gulp/tasks/build-js.js
  15. +6 −0 gulp/tasks/build-safari.js
  16. +82 −0 gulp/tasks/bump.js
  17. +1 −0 gulp/tasks/default.js
  18. +34 −0 gulp/tasks/e2e.js
  19. +14 −0 gulp/tasks/newtest.js
  20. +10 −0 gulp/tasks/scenarios.js
  21. +9 −0 gulp/tasks/watch.js
  22. +1 −0 gulpfile.js
  23. +0 −16 inject-end.js
  24. BIN logo.png
  25. +8 −0 ng-inspector.chrome/background.js
  26. BIN ng-inspector.chrome/btn19-disabled.png
  27. BIN ng-inspector.chrome/btn19.png
  28. BIN ng-inspector.chrome/btn38-disabled.png
  29. BIN ng-inspector.chrome/btn38.png
  30. BIN ng-inspector.chrome/empty.png
  31. BIN ng-inspector.chrome/icon128.png
  32. BIN ng-inspector.chrome/icon16.png
  33. BIN ng-inspector.chrome/icon48.png
  34. +18 −0 ng-inspector.chrome/inject.js
  35. +47 −0 ng-inspector.chrome/manifest.json
  36. BIN ng-inspector.chrome/processing.png
  37. +2 −0 ng-inspector.firefox/.jpmignore
  38. BIN ng-inspector.firefox/data/btn19.png
  39. BIN ng-inspector.firefox/data/btn38.png
  40. BIN ng-inspector.firefox/data/icon128.png
  41. BIN ng-inspector.firefox/data/icon16.png
  42. BIN ng-inspector.firefox/data/icon48.png
  43. +15 −0 ng-inspector.firefox/data/inject.js
  44. BIN ng-inspector.firefox/data/processing.png
  45. +76 −0 ng-inspector.firefox/lib/main.js
  46. +42 −0 ng-inspector.firefox/package.json
  47. +0 −443 ng-inspector.js
  48. BIN ng-inspector.safariextension/Icon-32.png
  49. BIN ng-inspector.safariextension/Icon-48.png
  50. BIN ng-inspector.safariextension/Icon-64.png
  51. +80 −0 ng-inspector.safariextension/Info.plist
  52. +16 −0 ng-inspector.safariextension/Settings.plist
  53. BIN ng-inspector.safariextension/empty.png
  54. +1 −1 { → ng-inspector.safariextension}/global.html
  55. +20 −0 ng-inspector.safariextension/inject-end.js
  56. BIN ng-inspector.safariextension/ng-disabled.png
  57. BIN ng-inspector.safariextension/ng.png
  58. BIN ng-inspector.safariextension/processing.png
  59. +48 −0 package.json
  60. BIN screenshot.png
  61. BIN src/artwork/icons.sketch
  62. BIN src/artwork/toolbar-button.sketch
  63. BIN src/artwork/ui.sketch
  64. BIN { → src}/icons/array.png
  65. BIN { → src}/icons/boolean.png
  66. BIN src/icons/caret.png
  67. BIN src/icons/circular.png
  68. BIN src/icons/date.png
  69. BIN { → src}/icons/element.png
  70. BIN { → src}/icons/function.png
  71. BIN ng.png → src/icons/isolate-scope.png
  72. BIN { → src}/icons/model.png
  73. BIN { → src}/icons/null.png
  74. BIN { → src}/icons/number.png
  75. BIN { → src}/icons/object.png
  76. BIN src/icons/promise.png
  77. BIN { → src}/icons/scope.png
  78. BIN { → src}/icons/string.png
  79. BIN { → src}/icons/undefined.png
  80. +196 −0 src/js/App.js
  81. +41 −0 src/js/Highlighter.js
  82. +87 −0 src/js/Inspector.js
  83. +169 −0 src/js/InspectorAgent.js
  84. +169 −0 src/js/InspectorPane.js
  85. +120 −0 src/js/Model.js
  86. +82 −0 src/js/ModelMixin.js
  87. +40 −0 src/js/Module.js
  88. +117 −0 src/js/Scope.js
  89. +130 −0 src/js/Service.js
  90. +194 −0 src/js/TreeView.js
  91. +70 −0 src/js/Utils.js
  92. +94 −0 src/js/bootstrap.js
  93. +254 −0 src/less/stylesheet.less
  94. +0 −187 stylesheet.css
  95. +36 −0 test/e2e/angular-versions.conf.js
  96. +15 −0 test/e2e/boilerplate-test/index.html
  97. +12 −0 test/e2e/boilerplate-test/index.js
  98. +34 −0 test/e2e/helpers/buildCapabilities.js
  99. +5 −0 test/e2e/helpers/getAngularVersion.js
  100. +10 −0 test/e2e/helpers/preparePage.js
  101. +250 −0 test/e2e/lib/angular.min.js
  102. +162 −0 test/e2e/lib/angular/1.0.6.min.js
  103. +173 −0 test/e2e/lib/angular/1.1.4.min.js
  104. +200 −0 test/e2e/lib/angular/1.2.0.min.js
  105. +247 −0 test/e2e/lib/angular/1.3.0.min.js
  106. +9,205 −0 test/e2e/lib/jquery-2.1.3.js
  107. +36 −0 test/e2e/lib/requirejs.min.js
  108. +28 −0 test/e2e/protractor.conf.js
  109. +30 −0 test/e2e/scenario-server/directory.html
  110. +58 −0 test/e2e/scenario-server/index.js
  111. +11 −0 test/e2e/tests/anon/index.html
  112. +19 −0 test/e2e/tests/anon/index.js
  113. +18 −0 test/e2e/tests/base-template.html
  114. +20 −0 test/e2e/tests/bootstrap-jquery/index.html
  115. +11 −0 test/e2e/tests/bootstrap-jquery/index.js
  116. +18 −0 test/e2e/tests/circular-reference/index.html
  117. +11 −0 test/e2e/tests/circular-reference/index.js
  118. +30 −0 test/e2e/tests/collapse-expand/index.html
  119. +99 −0 test/e2e/tests/collapse-expand/index.js
  120. +22 −0 test/e2e/tests/dependency/index.html
  121. +13 −0 test/e2e/tests/dependency/index.js
  122. +28 −0 test/e2e/tests/directive-object-declaration/index.html
  123. +38 −0 test/e2e/tests/directive-object-declaration/index.js
  124. +20 −0 test/e2e/tests/empty-directive/index.html
  125. +23 −0 test/e2e/tests/empty-directive/index.js
  126. +14 −0 test/e2e/tests/requirejs/app.js
  127. +13 −0 test/e2e/tests/requirejs/bootstrap.js
  128. +13 −0 test/e2e/tests/requirejs/controllers.js
  129. +17 −0 test/e2e/tests/requirejs/index.html
  130. +18 −0 test/e2e/tests/requirejs/index.js
  131. +13 −0 test/e2e/tests/requirejs/main.js
  132. +23 −0 test/e2e/tests/strict-di/index.html
  133. +21 −0 test/e2e/tests/strict-di/index.js
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules
npm-debug.log
.DS_Store

# Generated files

ng-inspector.firefox/*.xpi
ng-inspector.firefox/data/icons/
ng-inspector.firefox/data/ng-inspector.js
ng-inspector.firefox/data/stylesheet.css

ng-inspector.safariextension/icons/
ng-inspector.safariextension/ng-inspector.js
ng-inspector.safariextension/stylesheet.css

ng-inspector.chrome/icons/
ng-inspector.chrome/ng-inspector.js
ng-inspector.chrome/stylesheet.css

test/e2e/lib/ng-inspector.js
test/e2e/lib/stylesheet.css
7 changes: 7 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"strict": false,
"expr": true,
"boss": true,
"shadow": true,
"predef": ["console"]
}
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: node_js
node_js:
- "0.12"
sudo: false

env:
global:
- SAUCE_USERNAME: rev087
- SAUCE_ACCESS_KEY: 8247a039-7c68-484e-ae27-a8f2ef94c47f

addons:
sauce_connect: true
76 changes: 76 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributing

More tests are always welcome. Pull requests containing new features _must_ include tests for these features.

## Installing development dependencies

Run `npm install` (npm comes bundled with [node.js](http://nodejs.org)) to install all the development dependencies to build and test the project.

## Building the extension

JavaScript source is located at `/src`, and uses [gulp](http://gulpjs.com) to build for Chrome at `/ng-inspector.chrome`, Safari at `/ng-inspector.safariextension` and Firefox at `/ng-inspector.firefox`.

### Gulp Tasks:

- `default`: runs all the build tasks
- `build:icons`: copies the icons over to each browser folders
- `build:css`: compiles the less files over to each browser folders
- `build:js`: concatenates the source JavaScript over to each browser folder
- `bump:major`, `bump:minor`, `bump:patch`: bumps the version in the manifest files, stages the changes in git, commits with a "Prepare for vX.Y.Z" message and tag the commit with the version number. Manifest files updated:
- `package.json`
- `ng-inspector.safariextension/Info.plist` (Safari)
- `ng-inspector.chrome/manifest.json` (Chrome)
- `ng-inspector.firefox/package.json` (Firefox)

## Packaging the extension

Each of the supported browsers require a different packaging process. Begin by building the extension with the default `gulp` task, then follow the browser-specific instructions below.

### Safari

Make sure _Show Develop menu in menu bar_ is selected in _Preferences…_ > _Advanced_ tab. Navigate to _Develop_ > _Show Extension Builder_, click the `+` button and select the `ng-inspector.safariextension` directory to add the extension to Safari in development mode. Finally, click _Build Package…_.

### Chrome

Compress the `ng-inspector.chrome` directory in a _.zip_ file and upload to the _Chrome Web Store_.

### Firefox

For 30 <= Firefox < 38, use _CFX_:

- Install addon-sdk 1.17 from https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/jetpack-sdk-latest.zip
(Reference: https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Installation)
- Activate cfx (e.g. source bin/activate)
- In the terminal, navigate to the `ng-inspector.firefox` directory.
- To try the extension: `cfx run -b /path/to/firefox-30.0/firefox`
- To build the _xpi_: `cfx xpi`

For Firefox >= 38, use _JPM_:

- Make sure to have installed the npm dependencies via `npm install`
- To try: `npm run run-xpi -- -b /path/to/firefox-38/firefox`
- To build the _xpi_: `npm run build-xpi`

## Testing

### Prerequisites

- JDK
- Chrome & Firefox

ng-inspector uses [Protractor](https://github.com/angular/protractor) to run e2e tests in Chrome and Firefox. Tests are run against several releases of Angular.

### Running Tests

There are two different options for running tests locally:

* `npm test` - Will open as many browsers as possible when running tests
* `npm run test-throttled` - Will limit tests to one browser at a time

### Creating a new e2e test

The protractor tests in this repo follow a specific pattern, that helps to automate testing against the different versions of Angular. To scaffold a basic new e2e test, run `gulp newtest --name test-name-here`. This will create the basic test files for you, and place them in a new directory under `test/e2e/tests`.

### Angular Versions

Tests are executed against multiple versions of Angular, and can be configured in `test/e2e/angular-versions.conf.js`.
87 changes: 0 additions & 87 deletions Info.plist

This file was deleted.

File renamed without changes.
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
# ng-inspector
![logo](logo.png?raw=true)

__ng-inspector__ is a Safari extension that displays an inspector panel to display the AngularJS scope hierarchy in the current page in real time.
![Travis CI Status](https://travis-ci.org/rev087/ng-inspector.svg?branch=master)

Hovering over a scope in the inspector will highlight with a blue border the DOM element that scope is attached to, as well as any bindings with a red border. Clicking on a model will console.log that model's contents.
__ng-inspector__ is a browser extension for Chrome and Safari that displays an inspector panel showing the AngularJS scope hierarchy in the current page in real time, as well as which controllers or directives are associated with which scope.

The extension adds a toolbar icon with the AngularJS logo that toggles the pane on and off.
Hovering over a scope in the inspector will highlight the DOM element that scope is attached to. Clicking on a model will console.log that model's contents.

The extension adds a button next to the address bar with the AngularJS logo that toggles the pane on and off.

![screenshot](screenshot.png?raw=true)

## Roadmap
## Installing

### Chrome

Install it from the [Chrome Web Store](https://chrome.google.com/webstore/detail/ng-inspector/aadgmnobpdmgmigaicncghmmoeflnamj)

### Safari

Download the latest build from [ng-inspector.org](http://ng-inspector.org), then double click the `ng-inspector.safariextz` file to install.

## License

In the long term, I'd like to offer at least a larger subset of the features available in the [AngularJS Batarang](https://github.com/angular/angularjs-batarang) extension, but this project is not intended as a direct port. As far as I'm aware, it is not possible to extend the Safari Web Inspector, making a direct port impossible right out of the door.
The MIT License (MIT)

The current priority is adding a control to change the docking position of the inspector from the right to the left, as it often stands on top of elements on the page making it impossible to interact with those elements while the inspector is visible.
See [LICENSE.md](LICENSE.md) for details.
Binary file removed artwork.sketch/Data
Binary file not shown.
24 changes: 0 additions & 24 deletions artwork.sketch/metadata

This file was deleted.

1 change: 0 additions & 1 deletion artwork.sketch/version

This file was deleted.

16 changes: 16 additions & 0 deletions gulp/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var format = require('util').format;

var testDir = 'test';

module.exports = {
lessDir: 'src/less',
safariDir: 'ng-inspector.safariextension',
firefoxDir: 'ng-inspector.firefox',
chromeDir: 'ng-inspector.chrome',
iconsDir: 'src/icons',
jsDir: 'src/js',
browserifyEntry: 'src/js/bootstrap.js',
jsOutputName: 'ng-inspector.js',
testDir: testDir,
e2eDir: format('%s/e2e', testDir)
};
16 changes: 16 additions & 0 deletions gulp/tasks/build-css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var gulp = require('gulp');
var less = require('gulp-less');
var replace = require('gulp-replace');
var format = require('util').format;
var config = require('../config');

gulp.task('build:css', function() {
return gulp.src([format('%s/stylesheet.less', config.lessDir)])
.pipe(less())
.pipe(gulp.dest(format('%s/', config.safariDir)))
.pipe(gulp.dest(format('%s/data/', config.firefoxDir)))
.pipe(replace(/url\(/g, 'url(chrome-extension://__MSG_@@extension_id__/')) // Add path prefix for Chrome
.pipe(gulp.dest(format('%s/', config.chromeDir)))
.pipe(replace(/(\s*)(.+url\(.+)/g, '$1/* $2 */$1background-image: none !important;')) // Remove images from the test build
.pipe(gulp.dest(format('%s/lib/', config.e2eDir)));
});
10 changes: 10 additions & 0 deletions gulp/tasks/build-icons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var gulp = require('gulp');
var config = require('../config');
var format = require('util').format;

gulp.task('build:icons', function() {
return gulp.src([format('%s/*.png', config.iconsDir)])
.pipe(gulp.dest(format('%s/icons/', config.safariDir)))
.pipe(gulp.dest(format('%s/icons/', config.chromeDir)))
.pipe(gulp.dest(format('%s/data/icons/', config.firefoxDir)));
});
23 changes: 23 additions & 0 deletions gulp/tasks/build-js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var format = require('util').format;
var config = require('../config');

gulp.task('build:js', function () {
var b = browserify({
entries: config.browserifyEntry,
debug: true
});

return b.bundle()
.pipe(source(config.jsOutputName))
.pipe(buffer())
.on('error', gutil.log)
.pipe(gulp.dest(format('%s/', config.safariDir)))
.pipe(gulp.dest(format('%s/', config.chromeDir)))
.pipe(gulp.dest(format('%s/data/', config.firefoxDir)))
.pipe(gulp.dest(format('%s/lib/', config.e2eDir)));
});
6 changes: 6 additions & 0 deletions gulp/tasks/build-safari.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Here would be a good place to build the Safari archive. But it requires a
// custom build of the `xar` executable to extract certificates from a
// Safari-built .safariextz, then signing the .xar archive (renamed .safariextz)

// Steps to build from the command line:
// http://developer.streak.com/2013/01/how-to-build-safari-extension-using.html
Loading