@atlaspack/reporter-tracer 2.14.5-canary.19 → 2.14.5-canary.190

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 CHANGED
@@ -1,5 +1,185 @@
1
1
  # @atlaspack/reporter-tracer
2
2
 
3
+ ## 2.14.29
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/utils@2.19.1
9
+ - @atlaspack/plugin@2.14.29
10
+
11
+ ## 2.14.28
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767)]:
16
+ - @atlaspack/utils@2.19.0
17
+ - @atlaspack/plugin@2.14.28
18
+
19
+ ## 2.14.27
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies []:
24
+ - @atlaspack/utils@2.18.4
25
+ - @atlaspack/plugin@2.14.27
26
+
27
+ ## 2.14.26
28
+
29
+ ### Patch Changes
30
+
31
+ - [#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
32
+
33
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
34
+ - @atlaspack/plugin@2.14.26
35
+ - @atlaspack/utils@2.18.3
36
+
37
+ ## 2.14.25
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies []:
42
+ - @atlaspack/utils@2.18.2
43
+ - @atlaspack/plugin@2.14.25
44
+
45
+ ## 2.14.24
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies []:
50
+ - @atlaspack/utils@2.18.1
51
+ - @atlaspack/plugin@2.14.24
52
+
53
+ ## 2.14.23
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
58
+ - @atlaspack/utils@2.18.0
59
+ - @atlaspack/plugin@2.14.23
60
+
61
+ ## 2.14.22
62
+
63
+ ### Patch Changes
64
+
65
+ - [#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
66
+
67
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
68
+ - @atlaspack/plugin@2.14.22
69
+ - @atlaspack/utils@2.17.4
70
+
71
+ ## 2.14.21
72
+
73
+ ### Patch Changes
74
+
75
+ - Updated dependencies []:
76
+ - @atlaspack/utils@2.17.3
77
+ - @atlaspack/plugin@2.14.21
78
+
79
+ ## 2.14.20
80
+
81
+ ### Patch Changes
82
+
83
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
84
+ - @atlaspack/plugin@2.14.20
85
+ - @atlaspack/utils@2.17.2
86
+
87
+ ## 2.14.19
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies []:
92
+ - @atlaspack/utils@2.17.1
93
+ - @atlaspack/plugin@2.14.19
94
+
95
+ ## 2.14.18
96
+
97
+ ### Patch Changes
98
+
99
+ - 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)]:
100
+ - @atlaspack/utils@2.17.0
101
+ - @atlaspack/plugin@2.14.18
102
+
103
+ ## 2.14.17
104
+
105
+ ### Patch Changes
106
+
107
+ - Updated dependencies []:
108
+ - @atlaspack/utils@2.16.1
109
+ - @atlaspack/plugin@2.14.17
110
+
111
+ ## 2.14.16
112
+
113
+ ### Patch Changes
114
+
115
+ - Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
116
+ - @atlaspack/utils@2.16.0
117
+ - @atlaspack/plugin@2.14.16
118
+
119
+ ## 2.14.15
120
+
121
+ ### Patch Changes
122
+
123
+ - Updated dependencies []:
124
+ - @atlaspack/utils@2.15.3
125
+ - @atlaspack/plugin@2.14.15
126
+
127
+ ## 2.14.14
128
+
129
+ ### Patch Changes
130
+
131
+ - Updated dependencies []:
132
+ - @atlaspack/utils@2.15.2
133
+ - @atlaspack/plugin@2.14.14
134
+
135
+ ## 2.14.13
136
+
137
+ ### Patch Changes
138
+
139
+ - Updated dependencies []:
140
+ - @atlaspack/utils@2.15.1
141
+ - @atlaspack/plugin@2.14.13
142
+
143
+ ## 2.14.12
144
+
145
+ ### Patch Changes
146
+
147
+ - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
148
+ - @atlaspack/utils@2.15.0
149
+ - @atlaspack/plugin@2.14.12
150
+
151
+ ## 2.14.11
152
+
153
+ ### Patch Changes
154
+
155
+ - Updated dependencies []:
156
+ - @atlaspack/utils@2.14.11
157
+ - @atlaspack/plugin@2.14.11
158
+
159
+ ## 2.14.10
160
+
161
+ ### Patch Changes
162
+
163
+ - Updated dependencies []:
164
+ - @atlaspack/plugin@2.14.10
165
+ - @atlaspack/utils@2.14.10
166
+
167
+ ## 2.14.9
168
+
169
+ ### Patch Changes
170
+
171
+ - Updated dependencies []:
172
+ - @atlaspack/utils@2.14.9
173
+ - @atlaspack/plugin@2.14.9
174
+
175
+ ## 2.14.8
176
+
177
+ ### Patch Changes
178
+
179
+ - Updated dependencies []:
180
+ - @atlaspack/utils@2.14.8
181
+ - @atlaspack/plugin@2.14.8
182
+
3
183
  ## 2.14.7
4
184
 
5
185
  ### Patch Changes
@@ -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)(writeStream == null, 'Trace write stream multiple initialisation');
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
  }
@@ -0,0 +1,3 @@
1
+ import { Reporter } from '@atlaspack/plugin';
2
+ declare const _default: Reporter;
3
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/reporter-tracer",
3
- "version": "2.14.5-canary.19+a63b1da4d",
3
+ "version": "2.14.5-canary.190+7a52bab62",
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.js",
12
+ "main": "./lib/TracerReporter.js",
13
+ "source": "./src/TracerReporter.ts",
14
+ "types": "./lib/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+a63b1da4d",
19
- "@atlaspack/utils": "2.14.5-canary.19+a63b1da4d",
19
+ "@atlaspack/plugin": "2.14.5-canary.190+7a52bab62",
20
+ "@atlaspack/utils": "2.14.5-canary.190+7a52bab62",
20
21
  "chrome-trace-event": "^1.0.3",
21
22
  "nullthrows": "^1.1.1"
22
23
  },
23
24
  "type": "commonjs",
24
- "gitHead": "a63b1da4d98a7eda8a2130700dc844a56aa8308e"
25
- }
25
+ "scripts": {
26
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src",
27
+ "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
28
+ },
29
+ "gitHead": "7a52bab6281e8edbfa66af248eb6f872c6b4b7bd"
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 (new Reporter({
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((resolve, reject) => {
75
- nullthrows(writeStream).once('close', (err) => {
76
- writeStream = null;
77
- if (err) {
78
- reject(err);
79
- } else {
80
- resolve();
81
- }
82
- });
83
- nullthrows(writeStream).end();
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
- }): Reporter);
101
+ }) as Reporter;
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["src"]
4
+ }