@atlaspack/reporter-tracer 2.14.5-canary.20 → 2.14.5-canary.200
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.md +198 -0
- package/lib/TracerReporter.js +13 -1
- package/lib/types/TracerReporter.d.ts +3 -0
- package/package.json +12 -7
- package/src/{TracerReporter.js → TracerReporter.ts} +28 -14
- package/tsconfig.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,203 @@
|
|
|
1
1
|
# @atlaspack/reporter-tracer
|
|
2
2
|
|
|
3
|
+
## 2.14.31
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#785](https://github.com/atlassian-labs/atlaspack/pull/785) [`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922) Thanks [@matt-koko](https://github.com/matt-koko)! - We need to re-publish every package in Atlaspack with the corrected types field.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922)]:
|
|
10
|
+
- @atlaspack/plugin@2.14.31
|
|
11
|
+
- @atlaspack/utils@2.19.3
|
|
12
|
+
|
|
13
|
+
## 2.14.30
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies []:
|
|
18
|
+
- @atlaspack/utils@2.19.2
|
|
19
|
+
- @atlaspack/plugin@2.14.30
|
|
20
|
+
|
|
21
|
+
## 2.14.29
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies []:
|
|
26
|
+
- @atlaspack/utils@2.19.1
|
|
27
|
+
- @atlaspack/plugin@2.14.29
|
|
28
|
+
|
|
29
|
+
## 2.14.28
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767)]:
|
|
34
|
+
- @atlaspack/utils@2.19.0
|
|
35
|
+
- @atlaspack/plugin@2.14.28
|
|
36
|
+
|
|
37
|
+
## 2.14.27
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies []:
|
|
42
|
+
- @atlaspack/utils@2.18.4
|
|
43
|
+
- @atlaspack/plugin@2.14.27
|
|
44
|
+
|
|
45
|
+
## 2.14.26
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
|
|
52
|
+
- @atlaspack/plugin@2.14.26
|
|
53
|
+
- @atlaspack/utils@2.18.3
|
|
54
|
+
|
|
55
|
+
## 2.14.25
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- Updated dependencies []:
|
|
60
|
+
- @atlaspack/utils@2.18.2
|
|
61
|
+
- @atlaspack/plugin@2.14.25
|
|
62
|
+
|
|
63
|
+
## 2.14.24
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- Updated dependencies []:
|
|
68
|
+
- @atlaspack/utils@2.18.1
|
|
69
|
+
- @atlaspack/plugin@2.14.24
|
|
70
|
+
|
|
71
|
+
## 2.14.23
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
|
|
76
|
+
- @atlaspack/utils@2.18.0
|
|
77
|
+
- @atlaspack/plugin@2.14.23
|
|
78
|
+
|
|
79
|
+
## 2.14.22
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
|
|
84
|
+
|
|
85
|
+
- Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
|
|
86
|
+
- @atlaspack/plugin@2.14.22
|
|
87
|
+
- @atlaspack/utils@2.17.4
|
|
88
|
+
|
|
89
|
+
## 2.14.21
|
|
90
|
+
|
|
91
|
+
### Patch Changes
|
|
92
|
+
|
|
93
|
+
- Updated dependencies []:
|
|
94
|
+
- @atlaspack/utils@2.17.3
|
|
95
|
+
- @atlaspack/plugin@2.14.21
|
|
96
|
+
|
|
97
|
+
## 2.14.20
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
|
|
102
|
+
- @atlaspack/plugin@2.14.20
|
|
103
|
+
- @atlaspack/utils@2.17.2
|
|
104
|
+
|
|
105
|
+
## 2.14.19
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- Updated dependencies []:
|
|
110
|
+
- @atlaspack/utils@2.17.1
|
|
111
|
+
- @atlaspack/plugin@2.14.19
|
|
112
|
+
|
|
113
|
+
## 2.14.18
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417), [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56)]:
|
|
118
|
+
- @atlaspack/utils@2.17.0
|
|
119
|
+
- @atlaspack/plugin@2.14.18
|
|
120
|
+
|
|
121
|
+
## 2.14.17
|
|
122
|
+
|
|
123
|
+
### Patch Changes
|
|
124
|
+
|
|
125
|
+
- Updated dependencies []:
|
|
126
|
+
- @atlaspack/utils@2.16.1
|
|
127
|
+
- @atlaspack/plugin@2.14.17
|
|
128
|
+
|
|
129
|
+
## 2.14.16
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
|
|
134
|
+
- @atlaspack/utils@2.16.0
|
|
135
|
+
- @atlaspack/plugin@2.14.16
|
|
136
|
+
|
|
137
|
+
## 2.14.15
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- Updated dependencies []:
|
|
142
|
+
- @atlaspack/utils@2.15.3
|
|
143
|
+
- @atlaspack/plugin@2.14.15
|
|
144
|
+
|
|
145
|
+
## 2.14.14
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- Updated dependencies []:
|
|
150
|
+
- @atlaspack/utils@2.15.2
|
|
151
|
+
- @atlaspack/plugin@2.14.14
|
|
152
|
+
|
|
153
|
+
## 2.14.13
|
|
154
|
+
|
|
155
|
+
### Patch Changes
|
|
156
|
+
|
|
157
|
+
- Updated dependencies []:
|
|
158
|
+
- @atlaspack/utils@2.15.1
|
|
159
|
+
- @atlaspack/plugin@2.14.13
|
|
160
|
+
|
|
161
|
+
## 2.14.12
|
|
162
|
+
|
|
163
|
+
### Patch Changes
|
|
164
|
+
|
|
165
|
+
- Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
|
|
166
|
+
- @atlaspack/utils@2.15.0
|
|
167
|
+
- @atlaspack/plugin@2.14.12
|
|
168
|
+
|
|
169
|
+
## 2.14.11
|
|
170
|
+
|
|
171
|
+
### Patch Changes
|
|
172
|
+
|
|
173
|
+
- Updated dependencies []:
|
|
174
|
+
- @atlaspack/utils@2.14.11
|
|
175
|
+
- @atlaspack/plugin@2.14.11
|
|
176
|
+
|
|
177
|
+
## 2.14.10
|
|
178
|
+
|
|
179
|
+
### Patch Changes
|
|
180
|
+
|
|
181
|
+
- Updated dependencies []:
|
|
182
|
+
- @atlaspack/plugin@2.14.10
|
|
183
|
+
- @atlaspack/utils@2.14.10
|
|
184
|
+
|
|
185
|
+
## 2.14.9
|
|
186
|
+
|
|
187
|
+
### Patch Changes
|
|
188
|
+
|
|
189
|
+
- Updated dependencies []:
|
|
190
|
+
- @atlaspack/utils@2.14.9
|
|
191
|
+
- @atlaspack/plugin@2.14.9
|
|
192
|
+
|
|
193
|
+
## 2.14.8
|
|
194
|
+
|
|
195
|
+
### Patch Changes
|
|
196
|
+
|
|
197
|
+
- Updated dependencies []:
|
|
198
|
+
- @atlaspack/utils@2.14.8
|
|
199
|
+
- @atlaspack/plugin@2.14.8
|
|
200
|
+
|
|
3
201
|
## 2.14.7
|
|
4
202
|
|
|
5
203
|
### Patch Changes
|
package/lib/TracerReporter.js
CHANGED
|
@@ -42,7 +42,9 @@ function _chromeTraceEvent() {
|
|
|
42
42
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
43
43
|
// We need to maintain some state here to ensure we write to the same output, there should only be one
|
|
44
44
|
// instance of this reporter (this gets asserted below)
|
|
45
|
+
// @ts-expect-error TS7034
|
|
45
46
|
let tracer;
|
|
47
|
+
// @ts-expect-error TS7034
|
|
46
48
|
let writeStream = null;
|
|
47
49
|
function millisecondsToMicroseconds(milliseconds) {
|
|
48
50
|
return Math.floor(milliseconds * 1000);
|
|
@@ -63,11 +65,14 @@ var _default = exports.default = new (_plugin().Reporter)({
|
|
|
63
65
|
let filePath;
|
|
64
66
|
switch (event.type) {
|
|
65
67
|
case 'buildStart':
|
|
68
|
+
// @ts-expect-error TS7005
|
|
66
69
|
(0, _assert().default)(tracer == null, 'Tracer multiple initialisation');
|
|
67
70
|
tracer = new (_chromeTraceEvent().Tracer)();
|
|
68
71
|
filename = `parcel-trace-${getTimeId()}.json`;
|
|
69
72
|
filePath = _path().default.join(options.projectRoot, filename);
|
|
70
|
-
(0, _assert().default)(
|
|
73
|
+
(0, _assert().default)(
|
|
74
|
+
// @ts-expect-error TS7005
|
|
75
|
+
writeStream == null, 'Trace write stream multiple initialisation');
|
|
71
76
|
logger.info({
|
|
72
77
|
message: `Writing trace to ${filename}. See https://parceljs.org/features/profiling/#analysing-traces for more information on working with traces.`
|
|
73
78
|
});
|
|
@@ -77,7 +82,10 @@ var _default = exports.default = new (_plugin().Reporter)({
|
|
|
77
82
|
case 'trace':
|
|
78
83
|
// Due to potential race conditions at the end of the build, we ignore any trace events that occur
|
|
79
84
|
// after we've closed the write stream.
|
|
85
|
+
// @ts-expect-error TS7005
|
|
80
86
|
if (tracer === null) return;
|
|
87
|
+
|
|
88
|
+
// @ts-expect-error TS7005
|
|
81
89
|
tracer.completeEvent({
|
|
82
90
|
name: event.name,
|
|
83
91
|
cat: event.categories,
|
|
@@ -90,6 +98,7 @@ var _default = exports.default = new (_plugin().Reporter)({
|
|
|
90
98
|
break;
|
|
91
99
|
case 'buildSuccess':
|
|
92
100
|
case 'buildFailure':
|
|
101
|
+
// @ts-expect-error TS7005
|
|
93
102
|
(0, _nullthrows().default)(tracer).flush();
|
|
94
103
|
tracer = null;
|
|
95
104
|
// We explicitly trigger `end` on the writeStream for the trace, then we need to wait for
|
|
@@ -97,14 +106,17 @@ var _default = exports.default = new (_plugin().Reporter)({
|
|
|
97
106
|
// that the file has been properly closed and moved from it's temp location before Parcel
|
|
98
107
|
// shuts down.
|
|
99
108
|
return new Promise((resolve, reject) => {
|
|
109
|
+
// @ts-expect-error TS7005
|
|
100
110
|
(0, _nullthrows().default)(writeStream).once('close', err => {
|
|
101
111
|
writeStream = null;
|
|
102
112
|
if (err) {
|
|
103
113
|
reject(err);
|
|
104
114
|
} else {
|
|
115
|
+
// @ts-expect-error TS2794
|
|
105
116
|
resolve();
|
|
106
117
|
}
|
|
107
118
|
});
|
|
119
|
+
// @ts-expect-error TS7005
|
|
108
120
|
(0, _nullthrows().default)(writeStream).end();
|
|
109
121
|
});
|
|
110
122
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/reporter-tracer",
|
|
3
|
-
"version": "2.14.5-canary.
|
|
3
|
+
"version": "2.14.5-canary.200+10ee3fa5b",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,17 +9,22 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
11
11
|
},
|
|
12
|
-
"main": "lib/TracerReporter.js",
|
|
13
|
-
"source": "src/TracerReporter.
|
|
12
|
+
"main": "./lib/TracerReporter.js",
|
|
13
|
+
"source": "./src/TracerReporter.ts",
|
|
14
|
+
"types": "./lib/types/TracerReporter.d.ts",
|
|
14
15
|
"engines": {
|
|
15
16
|
"node": ">= 16.0.0"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
19
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
19
|
+
"@atlaspack/plugin": "2.14.5-canary.200+10ee3fa5b",
|
|
20
|
+
"@atlaspack/utils": "2.14.5-canary.200+10ee3fa5b",
|
|
20
21
|
"chrome-trace-event": "^1.0.3",
|
|
21
22
|
"nullthrows": "^1.1.1"
|
|
22
23
|
},
|
|
23
24
|
"type": "commonjs",
|
|
24
|
-
"
|
|
25
|
-
|
|
25
|
+
"scripts": {
|
|
26
|
+
"check-ts": "tsc --emitDeclarationOnly --rootDir src",
|
|
27
|
+
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
28
|
+
},
|
|
29
|
+
"gitHead": "10ee3fa5b75a92acde8973673d9b3c5b6f3958e5"
|
|
30
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import invariant from 'assert';
|
|
3
2
|
import nullthrows from 'nullthrows';
|
|
4
3
|
import path from 'path';
|
|
@@ -7,7 +6,9 @@ import {Tracer} from 'chrome-trace-event';
|
|
|
7
6
|
|
|
8
7
|
// We need to maintain some state here to ensure we write to the same output, there should only be one
|
|
9
8
|
// instance of this reporter (this gets asserted below)
|
|
9
|
+
// @ts-expect-error TS7034
|
|
10
10
|
let tracer;
|
|
11
|
+
// @ts-expect-error TS7034
|
|
11
12
|
let writeStream = null;
|
|
12
13
|
|
|
13
14
|
function millisecondsToMicroseconds(milliseconds: number) {
|
|
@@ -28,17 +29,19 @@ function getTimeId() {
|
|
|
28
29
|
);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
export default
|
|
32
|
+
export default new Reporter({
|
|
32
33
|
report({event, options, logger}) {
|
|
33
34
|
let filename;
|
|
34
35
|
let filePath;
|
|
35
36
|
switch (event.type) {
|
|
36
37
|
case 'buildStart':
|
|
38
|
+
// @ts-expect-error TS7005
|
|
37
39
|
invariant(tracer == null, 'Tracer multiple initialisation');
|
|
38
40
|
tracer = new Tracer();
|
|
39
41
|
filename = `parcel-trace-${getTimeId()}.json`;
|
|
40
42
|
filePath = path.join(options.projectRoot, filename);
|
|
41
43
|
invariant(
|
|
44
|
+
// @ts-expect-error TS7005
|
|
42
45
|
writeStream == null,
|
|
43
46
|
'Trace write stream multiple initialisation',
|
|
44
47
|
);
|
|
@@ -51,8 +54,10 @@ export default (new Reporter({
|
|
|
51
54
|
case 'trace':
|
|
52
55
|
// Due to potential race conditions at the end of the build, we ignore any trace events that occur
|
|
53
56
|
// after we've closed the write stream.
|
|
57
|
+
// @ts-expect-error TS7005
|
|
54
58
|
if (tracer === null) return;
|
|
55
59
|
|
|
60
|
+
// @ts-expect-error TS7005
|
|
56
61
|
tracer.completeEvent({
|
|
57
62
|
name: event.name,
|
|
58
63
|
cat: event.categories,
|
|
@@ -65,23 +70,32 @@ export default (new Reporter({
|
|
|
65
70
|
break;
|
|
66
71
|
case 'buildSuccess':
|
|
67
72
|
case 'buildFailure':
|
|
73
|
+
// @ts-expect-error TS7005
|
|
68
74
|
nullthrows(tracer).flush();
|
|
69
75
|
tracer = null;
|
|
70
76
|
// We explicitly trigger `end` on the writeStream for the trace, then we need to wait for
|
|
71
77
|
// the `close` event before resolving the promise this report function returns to ensure
|
|
72
78
|
// that the file has been properly closed and moved from it's temp location before Parcel
|
|
73
79
|
// shuts down.
|
|
74
|
-
return new Promise(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
return new Promise(
|
|
81
|
+
(
|
|
82
|
+
resolve: (result: Promise<undefined> | undefined) => void,
|
|
83
|
+
reject: (error?: any) => void,
|
|
84
|
+
) => {
|
|
85
|
+
// @ts-expect-error TS7005
|
|
86
|
+
nullthrows(writeStream).once('close', (err) => {
|
|
87
|
+
writeStream = null;
|
|
88
|
+
if (err) {
|
|
89
|
+
reject(err);
|
|
90
|
+
} else {
|
|
91
|
+
// @ts-expect-error TS2794
|
|
92
|
+
resolve();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
// @ts-expect-error TS7005
|
|
96
|
+
nullthrows(writeStream).end();
|
|
97
|
+
},
|
|
98
|
+
);
|
|
85
99
|
}
|
|
86
100
|
},
|
|
87
|
-
})
|
|
101
|
+
}) as Reporter;
|
package/tsconfig.json
ADDED