Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Document the support of transpiled code#277

Merged
DominicKramer merged 4 commits intogoogleapis:masterfrom
DominicKramer:docs/add-breakpoint-path-resolution
Jun 15, 2017
Merged

Document the support of transpiled code#277
DominicKramer merged 4 commits intogoogleapis:masterfrom
DominicKramer:docs/add-breakpoint-path-resolution

Conversation

@DominicKramer
Copy link
Copy Markdown
Contributor

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 12, 2017
@DominicKramer DominicKramer requested a review from ofrobots June 12, 2017 18:12
Copy link
Copy Markdown
Contributor

@matthewloring matthewloring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with a few nits.

README.md Outdated

![Breakpoint Hit](doc/images/breakpoint-hit.png?raw=true)

Note that the directory layout of the code that is being debugged does not have to exactly match the source code specified in the Debug UI. In particular, if a snapshot is specified in a file in the Debug UI, a breakpoint is set in the corresponding file in the code of the running instance that matches the most path components of the file specified in the Debug UI starting from the rightmost path component and working left.

This comment was marked as spam.

This comment was marked as spam.

README.md Outdated
/running/instance/a/index.js
/running/instance/b/a/index.js
```
Now suppose on your device you have a copy of the code as follows, and you have selected the local `/your/device` directory in the Debug UI as the directory containing the code to debug.

This comment was marked as spam.

This comment was marked as spam.

README.md Outdated

In this case, if you specify a snapshot in file `/your/device/b/a/index.js` in the Debug UI, the debugger will identify that that file corresponds to the file `/running/instance/b/a/index.js` of the code on the running instance, and the breakpoint will hit when the specified line of `/running/instance/b/a/index.js` is reached.

Note, however, if a snapshot is specified for the file `/your/device/a/index.js` in the Debug UI, then the debugger would not know whether this file corresponds to the file `/running/instance/a/index.js` or `/running/instance/b/a/index.js`. If such an ambiguity occurs, a message will be displayed in the Debug UI.

This comment was marked as spam.

This comment was marked as spam.

README.md Outdated

The debugger supports the use of transpiled code, whether it be Javascript to Javascript transpilation or transpilation from another language (such as Typescript) to Javascript. In order to use transpiled code with the debugger, sourcemaps need to be generated with the transpiled code. The sourcemaps can either be included inline in the transpiled code or provided in separate `.js.map` files.

To use the debugger, the only files that are needed at runtime are the transpiled files as well as the generated sourcemap files (if the sourcemaps are not inlined). In particular, the original source does not need to be available to the debugger at runtime.

This comment was marked as spam.

This comment was marked as spam.

README.md Outdated

## Support for Transpiled Code

The debugger supports the use of transpiled code, whether it be Javascript to Javascript transpilation or transpilation from another language (such as Typescript) to Javascript. In order to use transpiled code with the debugger, sourcemaps need to be generated with the transpiled code. The sourcemaps can either be included inline in the transpiled code or provided in separate `.js.map` files.

This comment was marked as spam.

This comment was marked as spam.

README.md Outdated
```
Now suppose on your local machine you have a copy of the code as follows, and you have selected the `/local/machine` directory in the Debug UI as the directory containing the code to debug.
```
/local/machine/package.json

This comment was marked as spam.

This comment was marked as spam.

README.md Outdated
/local/machine/b/a/index.js
```

In this case, if you specify a snapshot in file `/local/machine/b/a/index.js` in the Debug UI, the debugger will identify that that file corresponds to the file `/running/instance/b/a/index.js` of the code on the running instance, and the breakpoint will hit when the specified line of `/running/instance/b/a/index.js` is reached.

This comment was marked as spam.

This comment was marked as spam.

README.md Outdated

Note, however, if a snapshot is specified for the file `/local/machine/a/index.js` in the Debug UI, then the debugger would not know whether this file corresponds to the file `/running/instance/a/index.js` or `/running/instance/b/a/index.js`. If such an ambiguity occurs, a message will be displayed in the Debug UI.

In this case, the `appPathRelativeToRepository` configuration option can be used to specify the directory containing the application's `package.json` file to help resolve the ambiguity. In the example above, if the `appPathRelativeToRepository` configuration option is set to `/local/machine`, the debugger would be able to identify `/running/instance/a/index.js` as the file where the breakpoint should be set. See the [Debugger Agent Settings](#debugger-agent-settings) section for more information on configuring the debugger.

This comment was marked as spam.

This comment was marked as spam.

Copy link
Copy Markdown
Contributor

@ofrobots ofrobots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some copy edits.

README.md Outdated

![Breakpoint Hit](doc/images/breakpoint-hit.png?raw=true)

Note that the directory layout of the code that is being debugged does not have to exactly match the source code specified in the Debug UI. In particular, if a snapshot is specified in a file in the Debug UI, a breakpoint is set in the deployed file with the longest matching path suffix.

This comment was marked as spam.

This comment was marked as spam.

README.md Outdated

The debugger supports the use of transpiled code, whether it be Javascript to Javascript transpilation or transpilation from another language (such as Typescript) to Javascript. In order to use transpiled code with the debugger, sourcemaps need to be generated with the transpiled code. The sourcemaps need to be provided in `.js.map` files.

To use the debugger, the only files that are needed in the deployment environment are the transpiled files as well as the generated sourcemap files. In particular, the original source does not need to be available to the debugger in the deployment environment.

This comment was marked as spam.

This comment was marked as spam.

README.md Outdated

To use the debugger, the only files that are needed in the deployment environment are the transpiled files as well as the generated sourcemap files. In particular, the original source does not need to be available to the debugger in the deployment environment.

Instead, the original source code is provided to the Debug UI to specify snapshots. When specifying a snapshot in an original source file in the Debug UI, the corresponding file and line in the transpiled code is automatically determined based on the sourcemap files provided with the transpiled code at runtime. See the [Using the Debugger](#using-the-debugger) section for more information about using the Debug UI. In addition, the exact directory layout of the original source is somewhat flexible, just as it is with the use of non-transpiled code as described in the [Using the Debugger](#using-the-debugger) section.

This comment was marked as spam.

This comment was marked as spam.

README.md Outdated

In this case, if you specify a snapshot in file `b/a/index.js` in the Debug UI, the debugger will identify that that file corresponds to the file `/running/instance/b/a/index.js` of the code on the running instance, and the breakpoint will hit when the specified line of `/running/instance/b/a/index.js` is reached.

Note, however, if a snapshot is specified for the file `a/index.js` in the Debug UI, then the debugger would not know whether this file corresponds to the file `/running/instance/a/index.js` or `/running/instance/b/a/index.js`. If such an ambiguity occurs, a message will be displayed in the Debug UI.

This comment was marked as spam.

This comment was marked as spam.

@DominicKramer DominicKramer merged commit e3c4853 into googleapis:master Jun 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants