Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
af86202
Initial commit to this repository.
robpaveza Jun 2, 2020
8256fe5
Added support for messagePort from host
robpaveza Jun 2, 2020
3b034c7
Configured Content-Security-Policy.
robpaveza Jun 2, 2020
032cb8c
Moved azure-pipelines.yml to root.
robpaveza Jun 2, 2020
68c5246
Updated install command in azure pipeline
robpaveza Jun 2, 2020
3f56686
Incorrect # of params in build script
robpaveza Jun 2, 2020
6d7fc38
Code review comments
robpaveza Jun 3, 2020
490deeb
CR feedback: Moved from CDNJS to DevTools Azure storage
robpaveza Jun 3, 2020
7d6c2f7
More code review feedback
robpaveza Jun 3, 2020
91c200d
Code review comments
robpaveza Jun 3, 2020
303172d
Added an additional note to the Readme.
robpaveza Jun 3, 2020
f7b3343
Updated link to host protocol documentation from root README
robpaveza Jun 3, 2020
a7cab68
Added support to use hash instead of query to indicate host
robpaveza Jun 4, 2020
6a610fa
UX design review feedback addressed in this change:
robpaveza Jun 5, 2020
579dee2
Fixed a series of frontend-specific bugs:
robpaveza Jun 9, 2020
70ca5de
Several additional fixes to the aforementioned bugs in the previous c…
robpaveza Jun 9, 2020
5f88b2c
Fixed a bug with request ID mismatches
robpaveza Jun 9, 2020
8a69273
Migrated Fabric to Fluent UI framework (version bump)
robpaveza Jun 9, 2020
4a085aa
Rolled back to Monaco 0.19.3 because of auto-layout bug
robpaveza Jun 9, 2020
d7c8194
Fixed link color for ResponseBody component
robpaveza Jun 9, 2020
c9c0cab
Fixed scrolling bugs
robpaveza Jun 10, 2020
50b7bd1
Code review comments
robpaveza Jun 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Build output
dist/
build/

# Logs
logs
*.log
Expand Down
113 changes: 113 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,112 @@
# Introduction
Network Console (working title) is an experimental component for Chromium-based DevTools for making synthetic
network requests over HTTP. It can be used during the dev-test loop for web APIs.

As part of this effort, we want to meet our customers where they are. We know that Network Console isn't
going to be feature-complete with our initial pass; we want to have the flexibility to iterate rapidly,
experiment in the open, and get great ideas for what will be going into Network Console in the future.

This project is new, and while the first iteration is going to be rolling into Microsoft Edge DevTools behind
an experiment flag, we're not sure what the right long-term vision for it is; for example, will it be better to
package it into a browser extension rather than a built-in tool? We're not sure yet; this is a relatively fresh
canvas for us to start from. Please keep that in mind if you consider contributing.

## Structure of Network Console

Network Console is constructed in a monorepo style. It presently has two packages:

* `devtools-network-console` is the primary front-end of the UI. It is presently built in React bootstrapped from
create-react-app, and wherever it makes sense, we're using off-the-shelf components to try to go fast.
* `network-console-shared` contains file parsing logic which needs to be shared with the host, as well as
interfaces which define the host-frontend communication channel. This allows our messages to be type-checked
in the host and frontend.

The "Host" is responsible for a number of tasks:

* *File system*: Reading, saving, and managing API collections and environment settings
* *Executing requests*: By separating out the concern of constructing the request from actually
executing the request, it allows for "special considerations" to be applied. For example, when
hosted within Edge, requests made by Network Console are issued in the context of the page being
debugged.

Some parts of the UI as seen in Microsoft Edge are part of the actual DevTools code. These parts
include the tab frame and the tree lists presenting the API collections view.

Host communication occurs over a `postMessage` message channel. For details about what a host needs
to implement, please see the
[Host protocol documentation](./packages/devtools-network-console/src/host/host-protocol.md).

## Developing

After obtaining the source tree, run:

- `npm install`
- `npm run install-children`

Then, depending on which task you want to do:

### Developing for Chromium DevTools

1. Determine the path to devtools-frontend/src in your
[devtools-frontend](https://chromium.googlesource.com/devtools/devtools-frontend/) enlistment. For
example, from a root Chromium developer enlistment, this path will be something like
`f:\chromium\src\third_party\devtools-frontend\src` or `~/chromium/src/third_party/devtools-frontend/src`.
1. Optional: Set the environment variable `NETCONSOLE_DEVTOOLS_SRC_PATH` to the devtools-frontend
path of your Chromium enlistment. (If you omit this step, you'll need to include a command line
parameter later).
1. From the root of the Network Console enlistment, run `npm run build`. Optionally, you can pass in
parameters here using `-- --devtools_src_path` parameters (more info below).

The outputs from this will be:

* In `packages/network-console-shared/dist`, a `global.js` file which contains a number of components
injected into the global namespace `NCShared` in Chromium/Edge.
* In the same folder, two .d.ts files (`network-console-shared.d.ts` and `index.d.ts` which describe
the global namespace `NCShared`).
* In `packages/devtools-network-console/build`, the staged files output from the
default `create-react-app` build.
* In `dist`, these files are all scaffolded for ingestion into Chromium.

If the `NETCONSOLE_DEVTOOLS_SRC_PATH` environment variable was set, or `--devtools_src_path`
parameter specified, the build script will also update the scaffolded version of Network Console
in the target Chromium enlistment. This is referred to as "rolling Network Console," and should
be done in a clean destination directory (because Chromium's presubmit checks verify that
changes to `third_party` are isolated from other changes).

### Building and running locally

If you just want to run Network Console in a local browser instance, first ensure that you have built
the `network-console-shared` project by running `npm run build` from that folder. Then, you should
be able to run the Network Console frontend in a browser by changing to the `devtools-network-console`
folder and running `npm run start`. Bear in mind that updates to the `network-console-shared` project
will require a new build of that project to be triggered; however, running `tsc --watch` in that
folder should generally be adequate while in the build-test loop.

When running the Network Console frontend in a web browser, it uses the
[Web Application Host](./packages/devtools-network-console/src/host/web-application-host.ts)
implementation, which stubs much of the functionality and doesn't actually do much, although
you can generally interact with it via the DevTools console, and most of the UI should be
accessible.

Bear in mind that when you use Network Console from the Web Application Host, because it
simply executes [Fetch requests](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
from the hosting web page, those requests are subject to
[CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS) browser security restrictions.
Generally this means that outgoing requests will be subject to cross-origin preflight
requirements.

## NPM Commands

- `npm run clean`: Deletes the `/dist` folder from the root repository
- `npm run install-children`: runs `npm install` on child folders under `/packages`
- `npm run build-locally`: Runs production build of both shared component and frontend
- `npm run install-and-build`: Single step to `npm install` and build (suitable for CI)
- `npm run deploy -- --devtools_src_path <path>`: After running one of the build steps,
will deploy the build output to the Chromium enlistment. See notes above about how
to determine the path to pass into this command, or how to configure the
`NETCONSOLE_DEVTOOLS_SRC_PATH` environment variable.
- `npm run start`: Runs the frontend in development mode (equivalent to running the
same command in the `packages/devtools-network-console` path)

# Contributing

Expand All @@ -12,3 +121,7 @@ provided by the bot. You will only need to do this once across all repos using o
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

## Notices

- **Data Collection**. The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
28 changes: 28 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Node.js with React
# Build a Node.js project that uses React.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

pool:
vmImage: 'ubuntu-latest'

steps:

- task: ComponentGovernanceComponentDetection@0
inputs:
scanType: 'Register'
verbosity: 'Verbose'
alertWarningLevel: 'High'

- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'

- script: |
npm ci
npm run install-and-build
displayName: 'npm install and build'
Loading