@rushstack/rundown 1.0.166 → 1.0.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +2819 -2750
- package/CHANGELOG.md +873 -853
- package/README.md +230 -230
- package/lib/LauncherTypes.js.map +1 -1
- package/lib/Rundown.js.map +1 -1
- package/lib/cli/BaseReportAction.js.map +1 -1
- package/lib/cli/InspectAction.js.map +1 -1
- package/lib/cli/RundownCommandLine.js.map +1 -1
- package/lib/cli/SnapshotAction.js.map +1 -1
- package/lib/launcher.js.map +1 -1
- package/lib/start.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,230 +1,230 @@
|
|
|
1
|
-
# @rushstack/rundown
|
|
2
|
-
|
|
3
|
-
Slow startup times for Node.js commands or services? **Rundown** can invoke a Node.js process and:
|
|
4
|
-
|
|
5
|
-
1. **View imported files:** Intercept all `require()` calls and show which paths were loaded.
|
|
6
|
-
2. **Find culprits:** Show the chain for `require()` calls for each import, explaining why it was imported.
|
|
7
|
-
3. **Detect regressions over time:** Generate a concise "snapshot" report that can be committed to Git. Changes
|
|
8
|
-
to this file may indicate potential performance regressions.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
You can install this tool globally:
|
|
14
|
-
|
|
15
|
-
```shell
|
|
16
|
-
$ npm install --global @rushstack/rundown
|
|
17
|
-
|
|
18
|
-
# View command line help
|
|
19
|
-
$ rundown --help
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
If you will generate rundown snapshots during your build, it is recommended to install via `devDependencies`:
|
|
23
|
-
|
|
24
|
-
```shell
|
|
25
|
-
$ cd my-tool
|
|
26
|
-
$ npm install @rushstack/rundown --save-dev
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Viewing imported files
|
|
31
|
-
|
|
32
|
-
Suppose you maintain a small NPM project that is invoked as follows:
|
|
33
|
-
|
|
34
|
-
```shell
|
|
35
|
-
# The folder where your tool is developed
|
|
36
|
-
$ cd my-tool
|
|
37
|
-
|
|
38
|
-
# When you invoke "my-tool --my-option 123 --verbose" from the shell, let's suppose that it invokes
|
|
39
|
-
# this Node.js command:
|
|
40
|
-
$ node lib/start.js --my-option 123 --verbose
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
And suppose that your tool's startup time is rather slow, because the code calls `require()` to load many different
|
|
44
|
-
NPM packages. We can create a report to see all the imports:
|
|
45
|
-
|
|
46
|
-
```shell
|
|
47
|
-
# We use "--args" to pass the command-line arguments for "my-tool"
|
|
48
|
-
$ rundown inspect --script lib/start.js --args="--my-option 123 --verbose"
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
The report may look like this:
|
|
52
|
-
|
|
53
|
-
**rundown-inspect.log**
|
|
54
|
-
```
|
|
55
|
-
/path/to/my-tool/lib/start.js
|
|
56
|
-
/path/to/my-tool/node_modules/at-least-node/index.js
|
|
57
|
-
/path/to/my-tool/node_modules/fs-extra/lib/copy-sync/copy-sync.js
|
|
58
|
-
/path/to/my-tool/node_modules/fs-extra/lib/copy-sync/index.js
|
|
59
|
-
/path/to/my-tool/node_modules/fs-extra/lib/copy/copy.js
|
|
60
|
-
/path/to/my-tool/node_modules/fs-extra/lib/copy/index.js
|
|
61
|
-
/path/to/my-tool/node_modules/fs-extra/lib/empty/index.js
|
|
62
|
-
/path/to/my-tool/node_modules/fs-extra/lib/ensure/file.js
|
|
63
|
-
/path/to/my-tool/node_modules/fs-extra/lib/ensure/index.js
|
|
64
|
-
/path/to/my-tool/node_modules/fs-extra/lib/ensure/link.js
|
|
65
|
-
/path/to/my-tool/node_modules/fs-extra/lib/ensure/symlink-paths.js
|
|
66
|
-
/path/to/my-tool/node_modules/fs-extra/lib/ensure/symlink-type.js
|
|
67
|
-
/path/to/my-tool/node_modules/fs-extra/lib/ensure/symlink.js
|
|
68
|
-
/path/to/my-tool/node_modules/fs-extra/lib/fs/index.js
|
|
69
|
-
/path/to/my-tool/node_modules/fs-extra/lib/index.js
|
|
70
|
-
/path/to/my-tool/node_modules/fs-extra/lib/json/jsonfile.js
|
|
71
|
-
/path/to/my-tool/node_modules/fs-extra/lib/json/output-json-sync.js
|
|
72
|
-
/path/to/my-tool/node_modules/fs-extra/lib/json/output-json.js
|
|
73
|
-
/path/to/my-tool/node_modules/fs-extra/lib/mkdirs/index.js
|
|
74
|
-
/path/to/my-tool/node_modules/fs-extra/lib/mkdirs/make-dir.js
|
|
75
|
-
/path/to/my-tool/node_modules/fs-extra/lib/move-sync/index.js
|
|
76
|
-
/path/to/my-tool/node_modules/fs-extra/lib/move-sync/move-sync.js
|
|
77
|
-
/path/to/my-tool/node_modules/fs-extra/lib/move/index.js
|
|
78
|
-
/path/to/my-tool/node_modules/fs-extra/lib/move/move.js
|
|
79
|
-
/path/to/my-tool/node_modules/fs-extra/lib/output/index.js
|
|
80
|
-
/path/to/my-tool/node_modules/fs-extra/lib/path-exists/index.js
|
|
81
|
-
/path/to/my-tool/node_modules/fs-extra/lib/remove/index.js
|
|
82
|
-
/path/to/my-tool/node_modules/fs-extra/lib/remove/rimraf.js
|
|
83
|
-
/path/to/my-tool/node_modules/fs-extra/lib/util/stat.js
|
|
84
|
-
/path/to/my-tool/node_modules/fs-extra/lib/util/utimes.js
|
|
85
|
-
/path/to/my-tool/node_modules/graceful-fs/clone.js
|
|
86
|
-
/path/to/my-tool/node_modules/graceful-fs/graceful-fs.js
|
|
87
|
-
/path/to/my-tool/node_modules/graceful-fs/legacy-streams.js
|
|
88
|
-
/path/to/my-tool/node_modules/graceful-fs/polyfills.js
|
|
89
|
-
/path/to/my-tool/node_modules/jsonfile/index.js
|
|
90
|
-
/path/to/my-tool/node_modules/jsonfile/utils.js
|
|
91
|
-
/path/to/my-tool/node_modules/universalify/index.js
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Finding callers
|
|
95
|
-
|
|
96
|
-
To see how each file is imported, you can add the `--trace-imports` switch.
|
|
97
|
-
```shell
|
|
98
|
-
# We use "--args" to pass the command-line arguments for "my-tool"
|
|
99
|
-
$ rundown inspect --script lib/start.js --args="--my-option 123 --verbose" --trace-imports
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
The report now shows more detail:
|
|
103
|
-
|
|
104
|
-
**rundown-inspect.log**
|
|
105
|
-
```
|
|
106
|
-
. . .
|
|
107
|
-
/path/to/my-tool/node_modules/graceful-fs/legacy-streams.js
|
|
108
|
-
imported by /path/to/my-tool/node_modules/graceful-fs/graceful-fs.js
|
|
109
|
-
imported by /path/to/my-tool/node_modules/fs-extra/lib/fs/index.js
|
|
110
|
-
imported by /path/to/my-tool/node_modules/fs-extra/lib/index.js
|
|
111
|
-
imported by /path/to/my-tool/lib/start.js
|
|
112
|
-
imported by /rundown/lib/launcher.js
|
|
113
|
-
|
|
114
|
-
/path/to/my-tool/node_modules/graceful-fs/polyfills.js
|
|
115
|
-
imported by /path/to/my-tool/node_modules/graceful-fs/graceful-fs.js
|
|
116
|
-
imported by /path/to/my-tool/node_modules/fs-extra/lib/fs/index.js
|
|
117
|
-
imported by /path/to/my-tool/node_modules/fs-extra/lib/index.js
|
|
118
|
-
imported by /path/to/my-tool/lib/start.js
|
|
119
|
-
imported by rundown/lib/launcher.js
|
|
120
|
-
. . .
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Fixing problems
|
|
124
|
-
|
|
125
|
-
It may be the case that many of these imports are not actually used. You can avoid preloading them
|
|
126
|
-
by converting them to lazy imports using the `Import.lazy()` from
|
|
127
|
-
[@rushstack/node-core-library](https://www.npmjs.com/package/@rushstack/node-core-library)
|
|
128
|
-
or [import-lazy](https://www.npmjs.com/package/import-lazy).
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
## Generating a snapshot
|
|
132
|
-
|
|
133
|
-
To detect future regressions, use the `rundown snapshot` command to write a snapshot file:
|
|
134
|
-
|
|
135
|
-
```shell
|
|
136
|
-
# We use "--args" to pass the command-line arguments for "my-tool"
|
|
137
|
-
$ rundown snapshot --script lib/start.js --args="--my-option 123 --verbose"
|
|
138
|
-
|
|
139
|
-
# This file can be committed to Git to track regressions
|
|
140
|
-
$ git add rundown-snapshot.log
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
The snapshot file format eliminates spurious diffs, by showing only the names of the imported packages.
|
|
144
|
-
For local projects in a monorepo, it will show relative paths. Example output:
|
|
145
|
-
|
|
146
|
-
**rundown-snapshot.log**
|
|
147
|
-
```
|
|
148
|
-
../path/to/monorepo-sibling
|
|
149
|
-
at-least-node
|
|
150
|
-
fs-extra
|
|
151
|
-
graceful-fs
|
|
152
|
-
jsonfile
|
|
153
|
-
universalify
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Command-line reference
|
|
157
|
-
|
|
158
|
-
```
|
|
159
|
-
usage: rundown [-h] <command> ...
|
|
160
|
-
|
|
161
|
-
Detect load time regressions by running an app, tracing require() calls, and
|
|
162
|
-
generating a deterministic report
|
|
163
|
-
|
|
164
|
-
Positional arguments:
|
|
165
|
-
<command>
|
|
166
|
-
snapshot Invoke a Node.js script and generate a test snapshot
|
|
167
|
-
inspect Invoke a Node.js script and generate detailed diagnostic output
|
|
168
|
-
|
|
169
|
-
Optional arguments:
|
|
170
|
-
-h, --help Show this help message and exit.
|
|
171
|
-
|
|
172
|
-
For detailed help about a specific command, use: rundown <command> -h
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
```
|
|
176
|
-
usage: rundown snapshot [-h] -s PATH [-a STRING] [-q] [-i]
|
|
177
|
-
|
|
178
|
-
Invoke a Node.js script and generate a test snapshot. This command creates a
|
|
179
|
-
concise report that can be added to Git, so that its diff can be used to
|
|
180
|
-
detect performance regressions
|
|
181
|
-
|
|
182
|
-
Optional arguments:
|
|
183
|
-
-h, --help Show this help message and exit.
|
|
184
|
-
-s PATH, --script PATH
|
|
185
|
-
The path to a .js file that will be the entry point
|
|
186
|
-
for the target Node.js process
|
|
187
|
-
-a STRING, --args STRING
|
|
188
|
-
Specifies command-line arguments to be passed to the
|
|
189
|
-
target Node.js process. The value should be a single
|
|
190
|
-
text string delimited by spaces. Example: rundown
|
|
191
|
-
inspect --scripts ./example.js --args="--flag
|
|
192
|
-
--option=123"
|
|
193
|
-
-q, --quiet Suppress STDOUT/STDERR for the target Node.js process
|
|
194
|
-
-i, --ignore-exit-code
|
|
195
|
-
Do not report an error if the target Node.js process
|
|
196
|
-
returns a nonzero exit code
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
```
|
|
200
|
-
usage: rundown inspect [-h] -s PATH [-a STRING] [-q] [-i] [-t]
|
|
201
|
-
|
|
202
|
-
Invoke a Node.js script and generate detailed diagnostic output. This command
|
|
203
|
-
is used to inspect performance regressions.
|
|
204
|
-
|
|
205
|
-
Optional arguments:
|
|
206
|
-
-h, --help Show this help message and exit.
|
|
207
|
-
-s PATH, --script PATH
|
|
208
|
-
The path to a .js file that will be the entry point
|
|
209
|
-
for the target Node.js process
|
|
210
|
-
-a STRING, --args STRING
|
|
211
|
-
Specifies command-line arguments to be passed to the
|
|
212
|
-
target Node.js process. The value should be a single
|
|
213
|
-
text string delimited by spaces. Example: rundown
|
|
214
|
-
inspect --scripts ./example.js --args="--flag
|
|
215
|
-
--option=123"
|
|
216
|
-
-q, --quiet Suppress STDOUT/STDERR for the target Node.js process
|
|
217
|
-
-i, --ignore-exit-code
|
|
218
|
-
Do not report an error if the target Node.js process
|
|
219
|
-
returns a nonzero exit code
|
|
220
|
-
-t, --trace-imports Reports the call chain for each module path, showing
|
|
221
|
-
how it was imported
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
## Links
|
|
225
|
-
|
|
226
|
-
- [CHANGELOG.md](
|
|
227
|
-
https://github.com/microsoft/rushstack/blob/master/apps/rundown/CHANGELOG.md) - Find
|
|
228
|
-
out what's new in the latest version
|
|
229
|
-
|
|
230
|
-
Rundown is part of the [Rush Stack](https://rushstack.io/) family of projects.
|
|
1
|
+
# @rushstack/rundown
|
|
2
|
+
|
|
3
|
+
Slow startup times for Node.js commands or services? **Rundown** can invoke a Node.js process and:
|
|
4
|
+
|
|
5
|
+
1. **View imported files:** Intercept all `require()` calls and show which paths were loaded.
|
|
6
|
+
2. **Find culprits:** Show the chain for `require()` calls for each import, explaining why it was imported.
|
|
7
|
+
3. **Detect regressions over time:** Generate a concise "snapshot" report that can be committed to Git. Changes
|
|
8
|
+
to this file may indicate potential performance regressions.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
You can install this tool globally:
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
$ npm install --global @rushstack/rundown
|
|
17
|
+
|
|
18
|
+
# View command line help
|
|
19
|
+
$ rundown --help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If you will generate rundown snapshots during your build, it is recommended to install via `devDependencies`:
|
|
23
|
+
|
|
24
|
+
```shell
|
|
25
|
+
$ cd my-tool
|
|
26
|
+
$ npm install @rushstack/rundown --save-dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Viewing imported files
|
|
31
|
+
|
|
32
|
+
Suppose you maintain a small NPM project that is invoked as follows:
|
|
33
|
+
|
|
34
|
+
```shell
|
|
35
|
+
# The folder where your tool is developed
|
|
36
|
+
$ cd my-tool
|
|
37
|
+
|
|
38
|
+
# When you invoke "my-tool --my-option 123 --verbose" from the shell, let's suppose that it invokes
|
|
39
|
+
# this Node.js command:
|
|
40
|
+
$ node lib/start.js --my-option 123 --verbose
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
And suppose that your tool's startup time is rather slow, because the code calls `require()` to load many different
|
|
44
|
+
NPM packages. We can create a report to see all the imports:
|
|
45
|
+
|
|
46
|
+
```shell
|
|
47
|
+
# We use "--args" to pass the command-line arguments for "my-tool"
|
|
48
|
+
$ rundown inspect --script lib/start.js --args="--my-option 123 --verbose"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The report may look like this:
|
|
52
|
+
|
|
53
|
+
**rundown-inspect.log**
|
|
54
|
+
```
|
|
55
|
+
/path/to/my-tool/lib/start.js
|
|
56
|
+
/path/to/my-tool/node_modules/at-least-node/index.js
|
|
57
|
+
/path/to/my-tool/node_modules/fs-extra/lib/copy-sync/copy-sync.js
|
|
58
|
+
/path/to/my-tool/node_modules/fs-extra/lib/copy-sync/index.js
|
|
59
|
+
/path/to/my-tool/node_modules/fs-extra/lib/copy/copy.js
|
|
60
|
+
/path/to/my-tool/node_modules/fs-extra/lib/copy/index.js
|
|
61
|
+
/path/to/my-tool/node_modules/fs-extra/lib/empty/index.js
|
|
62
|
+
/path/to/my-tool/node_modules/fs-extra/lib/ensure/file.js
|
|
63
|
+
/path/to/my-tool/node_modules/fs-extra/lib/ensure/index.js
|
|
64
|
+
/path/to/my-tool/node_modules/fs-extra/lib/ensure/link.js
|
|
65
|
+
/path/to/my-tool/node_modules/fs-extra/lib/ensure/symlink-paths.js
|
|
66
|
+
/path/to/my-tool/node_modules/fs-extra/lib/ensure/symlink-type.js
|
|
67
|
+
/path/to/my-tool/node_modules/fs-extra/lib/ensure/symlink.js
|
|
68
|
+
/path/to/my-tool/node_modules/fs-extra/lib/fs/index.js
|
|
69
|
+
/path/to/my-tool/node_modules/fs-extra/lib/index.js
|
|
70
|
+
/path/to/my-tool/node_modules/fs-extra/lib/json/jsonfile.js
|
|
71
|
+
/path/to/my-tool/node_modules/fs-extra/lib/json/output-json-sync.js
|
|
72
|
+
/path/to/my-tool/node_modules/fs-extra/lib/json/output-json.js
|
|
73
|
+
/path/to/my-tool/node_modules/fs-extra/lib/mkdirs/index.js
|
|
74
|
+
/path/to/my-tool/node_modules/fs-extra/lib/mkdirs/make-dir.js
|
|
75
|
+
/path/to/my-tool/node_modules/fs-extra/lib/move-sync/index.js
|
|
76
|
+
/path/to/my-tool/node_modules/fs-extra/lib/move-sync/move-sync.js
|
|
77
|
+
/path/to/my-tool/node_modules/fs-extra/lib/move/index.js
|
|
78
|
+
/path/to/my-tool/node_modules/fs-extra/lib/move/move.js
|
|
79
|
+
/path/to/my-tool/node_modules/fs-extra/lib/output/index.js
|
|
80
|
+
/path/to/my-tool/node_modules/fs-extra/lib/path-exists/index.js
|
|
81
|
+
/path/to/my-tool/node_modules/fs-extra/lib/remove/index.js
|
|
82
|
+
/path/to/my-tool/node_modules/fs-extra/lib/remove/rimraf.js
|
|
83
|
+
/path/to/my-tool/node_modules/fs-extra/lib/util/stat.js
|
|
84
|
+
/path/to/my-tool/node_modules/fs-extra/lib/util/utimes.js
|
|
85
|
+
/path/to/my-tool/node_modules/graceful-fs/clone.js
|
|
86
|
+
/path/to/my-tool/node_modules/graceful-fs/graceful-fs.js
|
|
87
|
+
/path/to/my-tool/node_modules/graceful-fs/legacy-streams.js
|
|
88
|
+
/path/to/my-tool/node_modules/graceful-fs/polyfills.js
|
|
89
|
+
/path/to/my-tool/node_modules/jsonfile/index.js
|
|
90
|
+
/path/to/my-tool/node_modules/jsonfile/utils.js
|
|
91
|
+
/path/to/my-tool/node_modules/universalify/index.js
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Finding callers
|
|
95
|
+
|
|
96
|
+
To see how each file is imported, you can add the `--trace-imports` switch.
|
|
97
|
+
```shell
|
|
98
|
+
# We use "--args" to pass the command-line arguments for "my-tool"
|
|
99
|
+
$ rundown inspect --script lib/start.js --args="--my-option 123 --verbose" --trace-imports
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The report now shows more detail:
|
|
103
|
+
|
|
104
|
+
**rundown-inspect.log**
|
|
105
|
+
```
|
|
106
|
+
. . .
|
|
107
|
+
/path/to/my-tool/node_modules/graceful-fs/legacy-streams.js
|
|
108
|
+
imported by /path/to/my-tool/node_modules/graceful-fs/graceful-fs.js
|
|
109
|
+
imported by /path/to/my-tool/node_modules/fs-extra/lib/fs/index.js
|
|
110
|
+
imported by /path/to/my-tool/node_modules/fs-extra/lib/index.js
|
|
111
|
+
imported by /path/to/my-tool/lib/start.js
|
|
112
|
+
imported by /rundown/lib/launcher.js
|
|
113
|
+
|
|
114
|
+
/path/to/my-tool/node_modules/graceful-fs/polyfills.js
|
|
115
|
+
imported by /path/to/my-tool/node_modules/graceful-fs/graceful-fs.js
|
|
116
|
+
imported by /path/to/my-tool/node_modules/fs-extra/lib/fs/index.js
|
|
117
|
+
imported by /path/to/my-tool/node_modules/fs-extra/lib/index.js
|
|
118
|
+
imported by /path/to/my-tool/lib/start.js
|
|
119
|
+
imported by rundown/lib/launcher.js
|
|
120
|
+
. . .
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Fixing problems
|
|
124
|
+
|
|
125
|
+
It may be the case that many of these imports are not actually used. You can avoid preloading them
|
|
126
|
+
by converting them to lazy imports using the `Import.lazy()` from
|
|
127
|
+
[@rushstack/node-core-library](https://www.npmjs.com/package/@rushstack/node-core-library)
|
|
128
|
+
or [import-lazy](https://www.npmjs.com/package/import-lazy).
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## Generating a snapshot
|
|
132
|
+
|
|
133
|
+
To detect future regressions, use the `rundown snapshot` command to write a snapshot file:
|
|
134
|
+
|
|
135
|
+
```shell
|
|
136
|
+
# We use "--args" to pass the command-line arguments for "my-tool"
|
|
137
|
+
$ rundown snapshot --script lib/start.js --args="--my-option 123 --verbose"
|
|
138
|
+
|
|
139
|
+
# This file can be committed to Git to track regressions
|
|
140
|
+
$ git add rundown-snapshot.log
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The snapshot file format eliminates spurious diffs, by showing only the names of the imported packages.
|
|
144
|
+
For local projects in a monorepo, it will show relative paths. Example output:
|
|
145
|
+
|
|
146
|
+
**rundown-snapshot.log**
|
|
147
|
+
```
|
|
148
|
+
../path/to/monorepo-sibling
|
|
149
|
+
at-least-node
|
|
150
|
+
fs-extra
|
|
151
|
+
graceful-fs
|
|
152
|
+
jsonfile
|
|
153
|
+
universalify
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Command-line reference
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
usage: rundown [-h] <command> ...
|
|
160
|
+
|
|
161
|
+
Detect load time regressions by running an app, tracing require() calls, and
|
|
162
|
+
generating a deterministic report
|
|
163
|
+
|
|
164
|
+
Positional arguments:
|
|
165
|
+
<command>
|
|
166
|
+
snapshot Invoke a Node.js script and generate a test snapshot
|
|
167
|
+
inspect Invoke a Node.js script and generate detailed diagnostic output
|
|
168
|
+
|
|
169
|
+
Optional arguments:
|
|
170
|
+
-h, --help Show this help message and exit.
|
|
171
|
+
|
|
172
|
+
For detailed help about a specific command, use: rundown <command> -h
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
usage: rundown snapshot [-h] -s PATH [-a STRING] [-q] [-i]
|
|
177
|
+
|
|
178
|
+
Invoke a Node.js script and generate a test snapshot. This command creates a
|
|
179
|
+
concise report that can be added to Git, so that its diff can be used to
|
|
180
|
+
detect performance regressions
|
|
181
|
+
|
|
182
|
+
Optional arguments:
|
|
183
|
+
-h, --help Show this help message and exit.
|
|
184
|
+
-s PATH, --script PATH
|
|
185
|
+
The path to a .js file that will be the entry point
|
|
186
|
+
for the target Node.js process
|
|
187
|
+
-a STRING, --args STRING
|
|
188
|
+
Specifies command-line arguments to be passed to the
|
|
189
|
+
target Node.js process. The value should be a single
|
|
190
|
+
text string delimited by spaces. Example: rundown
|
|
191
|
+
inspect --scripts ./example.js --args="--flag
|
|
192
|
+
--option=123"
|
|
193
|
+
-q, --quiet Suppress STDOUT/STDERR for the target Node.js process
|
|
194
|
+
-i, --ignore-exit-code
|
|
195
|
+
Do not report an error if the target Node.js process
|
|
196
|
+
returns a nonzero exit code
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
usage: rundown inspect [-h] -s PATH [-a STRING] [-q] [-i] [-t]
|
|
201
|
+
|
|
202
|
+
Invoke a Node.js script and generate detailed diagnostic output. This command
|
|
203
|
+
is used to inspect performance regressions.
|
|
204
|
+
|
|
205
|
+
Optional arguments:
|
|
206
|
+
-h, --help Show this help message and exit.
|
|
207
|
+
-s PATH, --script PATH
|
|
208
|
+
The path to a .js file that will be the entry point
|
|
209
|
+
for the target Node.js process
|
|
210
|
+
-a STRING, --args STRING
|
|
211
|
+
Specifies command-line arguments to be passed to the
|
|
212
|
+
target Node.js process. The value should be a single
|
|
213
|
+
text string delimited by spaces. Example: rundown
|
|
214
|
+
inspect --scripts ./example.js --args="--flag
|
|
215
|
+
--option=123"
|
|
216
|
+
-q, --quiet Suppress STDOUT/STDERR for the target Node.js process
|
|
217
|
+
-i, --ignore-exit-code
|
|
218
|
+
Do not report an error if the target Node.js process
|
|
219
|
+
returns a nonzero exit code
|
|
220
|
+
-t, --trace-imports Reports the call chain for each module path, showing
|
|
221
|
+
how it was imported
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Links
|
|
225
|
+
|
|
226
|
+
- [CHANGELOG.md](
|
|
227
|
+
https://github.com/microsoft/rushstack/blob/master/apps/rundown/CHANGELOG.md) - Find
|
|
228
|
+
out what's new in the latest version
|
|
229
|
+
|
|
230
|
+
Rundown is part of the [Rush Stack](https://rushstack.io/) family of projects.
|
package/lib/LauncherTypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LauncherTypes.js","sourceRoot":"","sources":["../src/LauncherTypes.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\
|
|
1
|
+
{"version":3,"file":"LauncherTypes.js","sourceRoot":"","sources":["../src/LauncherTypes.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport const enum LauncherAction {\n Snapshot = 'snapshot',\n Inspect = 'inspect'\n}\n\nexport interface IIpcTraceRecord {\n importedModule: string;\n callingModule: string;\n}\n\nexport interface IIpcTrace {\n id: 'trace';\n records: IIpcTraceRecord[];\n}\n\nexport interface IIpcDone {\n id: 'done';\n}\n\nexport type IpcMessage = IIpcTrace | IIpcDone;\n"]}
|
package/lib/Rundown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rundown.js","sourceRoot":"","sources":["../src/Rundown.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAAyF;AACzF,6DAA+C;AAC/C,2CAA6B;AAC7B,8DAAqC;AAIrC,MAAa,OAAO;IAApB;QACE,yCAAyC;QACjC,uBAAkB,GAAwB,IAAI,GAAG,EAAE,CAAC;IAqI9D,CAAC;IAnIQ,KAAK,CAAC,WAAW,CACtB,UAAkB,EAClB,IAAwB,EACxB,KAAc,EACd,cAAuB;QAEvB,IAAI,CAAC,8BAAU,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,4CAA4C,GAAG,UAAU,CAAC,CAAC;SAC5E;QACD,MAAM,kBAAkB,GAAW,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE5D,MAAM,YAAY,GAAa,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC;QAE1E,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,CAAC,kBAAkB,EAAE,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACpF,OAAO,CAAC,GAAG,EAAE,CAAC;QAEd,wBAAwB;QACxB,0EAA0E;QAC1E,MAAM,QAAQ,GAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC,CAAC;QAEtG,MAAM,IAAI,CAAC,mBAAmB,CAAC,QAAQ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I,iBAAiB,GAAY,KAAK,CAAC;QAEvC,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAmB,EAAQ,EAAE;YACvD,QAAQ,OAAO,CAAC,EAAE,EAAE;gBAClB,KAAK,OAAO;oBACV,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE;wBACpC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;qBAC1E;oBACD,MAAM;gBACR,KAAK,MAAM;oBACT,iBAAiB,GAAG,IAAI,CAAC;oBACzB,MAAM;gBACR;oBACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;aACtE;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1C,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAmB,EAAE,MAAqB,EAAQ,EAAE;gBAC3E,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE;oBACjC,MAAM,CAAC,IAAI,KAAK,CAAC,0CAA0C,GAAG,IAAI,CAAC,CAAC,CAAC;iBACtE;qBAAM,IAAI,CAAC,iBAAiB,EAAE;oBAC7B,MAAM,CAAC,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC,CAAC;iBAChF;qBAAM;oBACL,OAAO,EAAE,CAAC;iBACX;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvID,0BAuIC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { FileSystem, PackageJsonLookup, Sort, Text } from '@rushstack/node-core-library';\nimport * as child_process from 'child_process';\nimport * as path from 'path';\nimport stringArgv from 'string-argv';\n\nimport { IpcMessage } from './LauncherTypes';\n\nexport class Rundown {\n // Map from required path --> caller path\n private _importedModuleMap: Map<string, string> = new Map();\n\n public async invokeAsync(\n scriptPath: string,\n args: string | undefined,\n quiet: boolean,\n ignoreExitCode: boolean\n ): Promise<void> {\n if (!FileSystem.exists(scriptPath)) {\n throw new Error('The specified script path does not exist: ' + scriptPath);\n }\n const absoluteScriptPath: string = path.resolve(scriptPath);\n\n const expandedArgs: string[] = args === undefined ? [] : stringArgv(args);\n\n console.log('Starting process: ' + [absoluteScriptPath, ...expandedArgs].join(' '));\n console.log();\n\n // Example process.argv:\n // [\"path/to/launcher.js\", \"path/to/target-script.js\", \"first-target-arg\"]\n const nodeArgs: string[] = [path.join(__dirname, 'launcher.js'), absoluteScriptPath, ...expandedArgs];\n\n await this._spawnLauncherAsync(nodeArgs, quiet, ignoreExitCode);\n\n if (!quiet) {\n console.log();\n }\n }\n\n public writeSnapshotReport(): void {\n const reportPath: string = 'rundown-snapshot.log';\n console.log('Writing report file: ' + reportPath);\n\n const packageJsonLookup: PackageJsonLookup = new PackageJsonLookup();\n const importedPaths: string[] = [...this._importedModuleMap.keys()];\n const importedPackageFolders: Set<string> = new Set();\n\n for (const importedPath of importedPaths) {\n const importedPackageFolder: string | undefined =\n packageJsonLookup.tryGetPackageFolderFor(importedPath);\n if (importedPackageFolder) {\n if (/[\\\\/]node_modules[\\\\/]/i.test(importedPackageFolder)) {\n importedPackageFolders.add(path.basename(importedPackageFolder));\n } else {\n const relativePath: string = path.relative(process.cwd(), importedPackageFolder);\n importedPackageFolders.add(Text.replaceAll(relativePath, '\\\\', '/'));\n }\n } else {\n // If the importedPath does not belong to an NPM package, then rundown-snapshot.log can ignore it.\n // In other words, treat it the same way as the local project's source files.\n }\n }\n\n Sort.sortSet(importedPackageFolders);\n const data: string = [...importedPackageFolders].join('\\n') + '\\n';\n\n FileSystem.writeFile(reportPath, data);\n }\n\n public writeInspectReport(traceImports: boolean): void {\n const reportPath: string = 'rundown-inspect.log';\n console.log('Writing report file: ' + reportPath);\n\n const importedPaths: string[] = [...this._importedModuleMap.keys()];\n importedPaths.sort();\n\n let data: string = '';\n\n if (traceImports) {\n for (const importedPath of importedPaths) {\n data += importedPath + '\\n';\n\n let current: string = importedPath;\n const visited: Set<string> = new Set();\n for (;;) {\n const callerPath: string | undefined = this._importedModuleMap.get(current);\n if (!callerPath) {\n break;\n }\n if (visited.has(callerPath)) {\n break;\n }\n visited.add(callerPath);\n data += ' imported by ' + callerPath + '\\n';\n current = callerPath;\n }\n data += '\\n';\n }\n } else {\n data = importedPaths.join('\\n') + '\\n';\n }\n\n FileSystem.writeFile(reportPath, data);\n }\n\n private async _spawnLauncherAsync(\n nodeArgs: string[],\n quiet: boolean,\n ignoreExitCode: boolean\n ): Promise<void> {\n const childProcess: child_process.ChildProcess = child_process.spawn(process.execPath, nodeArgs, {\n stdio: quiet ? ['inherit', 'ignore', 'ignore', 'ipc'] : ['inherit', 'inherit', 'inherit', 'ipc']\n });\n\n let completedNormally: boolean = false;\n\n childProcess.on('message', (message: IpcMessage): void => {\n switch (message.id) {\n case 'trace':\n for (const record of message.records) {\n this._importedModuleMap.set(record.importedModule, record.callingModule);\n }\n break;\n case 'done':\n completedNormally = true;\n break;\n default:\n throw new Error('Unknown IPC message: ' + JSON.stringify(message));\n }\n });\n\n await new Promise<void>((resolve, reject) => {\n childProcess.on('exit', (code: number | null, signal: string | null): void => {\n if (code !== 0 && !ignoreExitCode) {\n reject(new Error('Child process terminated with exit code ' + code));\n } else if (!completedNormally) {\n reject(new Error('Child process terminated without completing IPC handshake'));\n } else {\n resolve();\n }\n });\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseReportAction.js","sourceRoot":"","sources":["../../src/cli/BaseReportAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,4FAA4F;AAC5F,2DAA2D;AAE3D,gEAKoC;AAEpC,MAAsB,gBAAiB,SAAQ,mCAAiB;IAM9D,YAAmB,OAAkC;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,WAAW;IACD,kBAAkB;QAC1B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,qBAAqB,CAAC;YAChD,iBAAiB,EAAE,UAAU;YAC7B,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,oFAAoF;YACjG,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC;YAC9C,iBAAiB,EAAE,QAAQ;YAC3B,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,QAAQ;YACtB,WAAW,EACT,yFAAyF;gBACzF,sDAAsD;gBACtD,+EAA+E;SAClF,CAAC,CAAC;QACH,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC7C,iBAAiB,EAAE,SAAS;YAC5B,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,uDAAuD;SACrE,CAAC,CAAC;QACH,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,mBAAmB,CAAC;YACtD,iBAAiB,EAAE,oBAAoB;YACvC,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,kFAAkF;SAChG,CAAC,CAAC;IACL,CAAC;CACF;AAvCD,4CAuCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\
|
|
1
|
+
{"version":3,"file":"BaseReportAction.js","sourceRoot":"","sources":["../../src/cli/BaseReportAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,4FAA4F;AAC5F,2DAA2D;AAE3D,gEAKoC;AAEpC,MAAsB,gBAAiB,SAAQ,mCAAiB;IAM9D,YAAmB,OAAkC;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,WAAW;IACD,kBAAkB;QAC1B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,qBAAqB,CAAC;YAChD,iBAAiB,EAAE,UAAU;YAC7B,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,oFAAoF;YACjG,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC;YAC9C,iBAAiB,EAAE,QAAQ;YAC3B,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,QAAQ;YACtB,WAAW,EACT,yFAAyF;gBACzF,sDAAsD;gBACtD,+EAA+E;SAClF,CAAC,CAAC;QACH,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC7C,iBAAiB,EAAE,SAAS;YAC5B,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,uDAAuD;SACrE,CAAC,CAAC;QACH,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,mBAAmB,CAAC;YACtD,iBAAiB,EAAE,oBAAoB;YACvC,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,kFAAkF;SAChG,CAAC,CAAC;IACL,CAAC;CACF;AAvCD,4CAuCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport {\n CommandLineAction,\n ICommandLineActionOptions,\n CommandLineStringParameter,\n CommandLineFlagParameter\n} from '@rushstack/ts-command-line';\n\nexport abstract class BaseReportAction extends CommandLineAction {\n protected scriptParameter!: CommandLineStringParameter;\n protected argsParameter!: CommandLineStringParameter;\n protected quietParameter!: CommandLineFlagParameter;\n protected ignoreExitCodeParameter!: CommandLineFlagParameter;\n\n public constructor(options: ICommandLineActionOptions) {\n super(options);\n }\n\n // abstract\n protected onDefineParameters(): void {\n this.scriptParameter = this.defineStringParameter({\n parameterLongName: '--script',\n parameterShortName: '-s',\n argumentName: 'PATH',\n description: 'The path to a .js file that will be the entry point for the target Node.js process',\n required: true\n });\n this.argsParameter = this.defineStringParameter({\n parameterLongName: '--args',\n parameterShortName: '-a',\n argumentName: 'STRING',\n description:\n 'Specifies command-line arguments to be passed to the target Node.js process. The value' +\n ' should be a single text string delimited by spaces.' +\n ' Example: rundown inspect --scripts ./example.js --args=\"--flag --option=123\"'\n });\n this.quietParameter = this.defineFlagParameter({\n parameterLongName: '--quiet',\n parameterShortName: '-q',\n description: 'Suppress STDOUT/STDERR for the target Node.js process'\n });\n this.ignoreExitCodeParameter = this.defineFlagParameter({\n parameterLongName: '--ignore-exit-code',\n parameterShortName: '-i',\n description: 'Do not report an error if the target Node.js process returns a nonzero exit code'\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InspectAction.js","sourceRoot":"","sources":["../../src/cli/InspectAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,yDAAsD;AACtD,wCAAqC;AAErC,MAAa,aAAc,SAAQ,mCAAgB;IAGjD;QACE,KAAK,CAAC;YACJ,UAAU,EAAE,SAAS;YACrB,OAAO,EAAE,iEAAiE;YAC1E,aAAa,EACX,wFAAwF;gBACxF,sCAAsC;SACzC,CAAC,CAAC;IACL,CAAC;IAES,kBAAkB;QAC1B,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAE3B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC9C,iBAAiB,EAAE,iBAAiB;YACpC,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,0EAA0E;SACxF,CAAC,CAAC;IACL,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,MAAM,OAAO,GAAY,IAAI,iBAAO,EAAE,CAAC;QACvC,MAAM,OAAO,CAAC,WAAW,CACvB,IAAI,CAAC,eAAe,CAAC,KAAM,EAC3B,IAAI,CAAC,aAAa,CAAC,KAAK,EACxB,IAAI,CAAC,cAAc,CAAC,KAAO,EAC3B,IAAI,CAAC,uBAAuB,CAAC,KAAO,CACrC,CAAC;QACF,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,KAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AAjCD,sCAiCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\
|
|
1
|
+
{"version":3,"file":"InspectAction.js","sourceRoot":"","sources":["../../src/cli/InspectAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,yDAAsD;AACtD,wCAAqC;AAErC,MAAa,aAAc,SAAQ,mCAAgB;IAGjD;QACE,KAAK,CAAC;YACJ,UAAU,EAAE,SAAS;YACrB,OAAO,EAAE,iEAAiE;YAC1E,aAAa,EACX,wFAAwF;gBACxF,sCAAsC;SACzC,CAAC,CAAC;IACL,CAAC;IAES,kBAAkB;QAC1B,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAE3B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC9C,iBAAiB,EAAE,iBAAiB;YACpC,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,0EAA0E;SACxF,CAAC,CAAC;IACL,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,MAAM,OAAO,GAAY,IAAI,iBAAO,EAAE,CAAC;QACvC,MAAM,OAAO,CAAC,WAAW,CACvB,IAAI,CAAC,eAAe,CAAC,KAAM,EAC3B,IAAI,CAAC,aAAa,CAAC,KAAK,EACxB,IAAI,CAAC,cAAc,CAAC,KAAO,EAC3B,IAAI,CAAC,uBAAuB,CAAC,KAAO,CACrC,CAAC;QACF,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,KAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AAjCD,sCAiCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { CommandLineFlagParameter } from '@rushstack/ts-command-line';\n\nimport { BaseReportAction } from './BaseReportAction';\nimport { Rundown } from '../Rundown';\n\nexport class InspectAction extends BaseReportAction {\n private _traceParameter!: CommandLineFlagParameter;\n\n public constructor() {\n super({\n actionName: 'inspect',\n summary: 'Invoke a Node.js script and generate detailed diagnostic output',\n documentation:\n 'Invoke a Node.js script and generate detailed diagnostic output. This command is used' +\n ' to inspect performance regressions.'\n });\n }\n\n protected onDefineParameters(): void {\n super.onDefineParameters();\n\n this._traceParameter = this.defineFlagParameter({\n parameterLongName: '--trace-imports',\n parameterShortName: '-t',\n description: 'Reports the call chain for each module path, showing how it was imported'\n });\n }\n\n protected async onExecute(): Promise<void> {\n const rundown: Rundown = new Rundown();\n await rundown.invokeAsync(\n this.scriptParameter.value!,\n this.argsParameter.value,\n this.quietParameter.value!!,\n this.ignoreExitCodeParameter.value!!\n );\n rundown.writeInspectReport(this._traceParameter.value!!);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RundownCommandLine.js","sourceRoot":"","sources":["../../src/cli/RundownCommandLine.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,gEAA+D;AAE/D,qDAAkD;AAClD,mDAAgD;AAEhD,MAAa,kBAAmB,SAAQ,mCAAiB;IACvD;QACE,KAAK,CAAC;YACJ,YAAY,EAAE,SAAS;YACvB,eAAe,EACb,0EAA0E;gBAC1E,wCAAwC;SAC3C,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,IAAI,+BAAc,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,IAAI,6BAAa,EAAE,CAAC,CAAC;IACtC,CAAC;IAES,kBAAkB,KAAU,CAAC;CACxC;AAdD,gDAcC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\
|
|
1
|
+
{"version":3,"file":"RundownCommandLine.js","sourceRoot":"","sources":["../../src/cli/RundownCommandLine.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,gEAA+D;AAE/D,qDAAkD;AAClD,mDAAgD;AAEhD,MAAa,kBAAmB,SAAQ,mCAAiB;IACvD;QACE,KAAK,CAAC;YACJ,YAAY,EAAE,SAAS;YACvB,eAAe,EACb,0EAA0E;gBAC1E,wCAAwC;SAC3C,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,IAAI,+BAAc,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,IAAI,6BAAa,EAAE,CAAC,CAAC;IACtC,CAAC;IAES,kBAAkB,KAAU,CAAC;CACxC;AAdD,gDAcC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { CommandLineParser } from '@rushstack/ts-command-line';\n\nimport { SnapshotAction } from './SnapshotAction';\nimport { InspectAction } from './InspectAction';\n\nexport class RundownCommandLine extends CommandLineParser {\n public constructor() {\n super({\n toolFilename: 'rundown',\n toolDescription:\n 'Detect load time regressions by running an app, tracing require() calls,' +\n ' and generating a deterministic report'\n });\n\n this.addAction(new SnapshotAction());\n this.addAction(new InspectAction());\n }\n\n protected onDefineParameters(): void {}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapshotAction.js","sourceRoot":"","sources":["../../src/cli/SnapshotAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,yDAAsD;AAEtD,wCAAqC;AAErC,MAAa,cAAe,SAAQ,mCAAgB;IAClD;QACE,KAAK,CAAC;YACJ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,sDAAsD;YAC/D,aAAa,EACX,0GAA0G;gBAC1G,+EAA+E;SAClF,CAAC,CAAC;IACL,CAAC;IAES,kBAAkB;QAC1B,KAAK,CAAC,kBAAkB,EAAE,CAAC;IAC7B,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,MAAM,OAAO,GAAY,IAAI,iBAAO,EAAE,CAAC;QACvC,MAAM,OAAO,CAAC,WAAW,CACvB,IAAI,CAAC,eAAe,CAAC,KAAM,EAC3B,IAAI,CAAC,aAAa,CAAC,KAAK,EACxB,IAAI,CAAC,cAAc,CAAC,KAAO,EAC3B,IAAI,CAAC,uBAAuB,CAAC,KAAO,CACrC,CAAC;QACF,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAChC,CAAC;CACF;AAzBD,wCAyBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\
|
|
1
|
+
{"version":3,"file":"SnapshotAction.js","sourceRoot":"","sources":["../../src/cli/SnapshotAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,yDAAsD;AAEtD,wCAAqC;AAErC,MAAa,cAAe,SAAQ,mCAAgB;IAClD;QACE,KAAK,CAAC;YACJ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,sDAAsD;YAC/D,aAAa,EACX,0GAA0G;gBAC1G,+EAA+E;SAClF,CAAC,CAAC;IACL,CAAC;IAES,kBAAkB;QAC1B,KAAK,CAAC,kBAAkB,EAAE,CAAC;IAC7B,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,MAAM,OAAO,GAAY,IAAI,iBAAO,EAAE,CAAC;QACvC,MAAM,OAAO,CAAC,WAAW,CACvB,IAAI,CAAC,eAAe,CAAC,KAAM,EAC3B,IAAI,CAAC,aAAa,CAAC,KAAK,EACxB,IAAI,CAAC,cAAc,CAAC,KAAO,EAC3B,IAAI,CAAC,uBAAuB,CAAC,KAAO,CACrC,CAAC;QACF,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAChC,CAAC;CACF;AAzBD,wCAyBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { BaseReportAction } from './BaseReportAction';\n\nimport { Rundown } from '../Rundown';\n\nexport class SnapshotAction extends BaseReportAction {\n public constructor() {\n super({\n actionName: 'snapshot',\n summary: 'Invoke a Node.js script and generate a test snapshot',\n documentation:\n 'Invoke a Node.js script and generate a test snapshot. This command creates a concise report that can be' +\n ' added to Git, so that its diff can be used to detect performance regressions'\n });\n }\n\n protected onDefineParameters(): void {\n super.onDefineParameters();\n }\n\n protected async onExecute(): Promise<void> {\n const rundown: Rundown = new Rundown();\n await rundown.invokeAsync(\n this.scriptParameter.value!,\n this.argsParameter.value,\n this.quietParameter.value!!,\n this.ignoreExitCodeParameter.value!!\n );\n rundown.writeSnapshotReport();\n }\n}\n"]}
|