@atlaspack/reporter-dev-server 2.12.1-dev.3450 → 2.12.1-dev.3460
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/lib/ServerReporter.js.map +1 -1
- package/package.json +6 -6
- package/src/HMRServer.js +7 -7
- package/src/Server.js +11 -11
- package/src/ServerReporter.js +1 -1
- package/src/templates/500.html +14 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/reporter-dev-server",
|
|
3
|
-
"version": "2.12.1-dev.
|
|
3
|
+
"version": "2.12.1-dev.3460+340817991",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"publishConfig": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"source": "src/ServerReporter.js",
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">= 16.0.0",
|
|
17
|
-
"parcel": "^2.12.1-dev.
|
|
17
|
+
"parcel": "^2.12.1-dev.3460+340817991"
|
|
18
18
|
},
|
|
19
19
|
"targets": {
|
|
20
20
|
"main": {
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atlaspack/plugin": "2.12.1-dev.
|
|
29
|
-
"@atlaspack/utils": "2.12.1-dev.
|
|
28
|
+
"@atlaspack/plugin": "2.12.1-dev.3460+340817991",
|
|
29
|
+
"@atlaspack/utils": "2.12.1-dev.3460+340817991"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@atlaspack/babel-preset": "2.12.0",
|
|
33
|
-
"@atlaspack/types": "2.12.1-dev.
|
|
33
|
+
"@atlaspack/types": "2.12.1-dev.3460+340817991",
|
|
34
34
|
"connect": "^3.7.0",
|
|
35
35
|
"ejs": "^3.1.6",
|
|
36
36
|
"fresh": "^0.5.2",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"serve-handler": "^6.0.0",
|
|
42
42
|
"ws": "^7.0.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "3408179911d6c67e2bdad99e545dd7a0a9a6782c"
|
|
45
45
|
}
|
package/src/HMRServer.js
CHANGED
|
@@ -95,14 +95,14 @@ export default class HMRServer {
|
|
|
95
95
|
}
|
|
96
96
|
this.wss = new WebSocket.Server({server});
|
|
97
97
|
|
|
98
|
-
this.wss.on('connection', ws => {
|
|
98
|
+
this.wss.on('connection', (ws) => {
|
|
99
99
|
if (this.unresolvedError) {
|
|
100
100
|
ws.send(JSON.stringify(this.unresolvedError));
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
// $FlowFixMe[incompatible-exact]
|
|
105
|
-
this.wss.on('error', err => this.handleSocketError(err));
|
|
105
|
+
this.wss.on('error', (err) => this.handleSocketError(err));
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
handle(req: Request, res: Response): boolean {
|
|
@@ -111,7 +111,7 @@ export default class HMRServer {
|
|
|
111
111
|
let id = pathname.slice(HMR_ENDPOINT.length + 1);
|
|
112
112
|
let bundleGraph = nullthrows(this.bundleGraph);
|
|
113
113
|
let asset = bundleGraph.getAssetById(id);
|
|
114
|
-
this.getHotAssetContents(asset).then(output => {
|
|
114
|
+
this.getHotAssetContents(asset).then((output) => {
|
|
115
115
|
res.setHeader('Content-Type', mime.contentType(asset.type));
|
|
116
116
|
res.end(output);
|
|
117
117
|
});
|
|
@@ -130,7 +130,7 @@ export default class HMRServer {
|
|
|
130
130
|
|
|
131
131
|
async emitError(options: PluginOptions, diagnostics: Array<Diagnostic>) {
|
|
132
132
|
let renderedDiagnostics = await Promise.all(
|
|
133
|
-
diagnostics.map(d => prettyDiagnostic(d, options)),
|
|
133
|
+
diagnostics.map((d) => prettyDiagnostic(d, options)),
|
|
134
134
|
);
|
|
135
135
|
|
|
136
136
|
// store the most recent error so we can notify new connections
|
|
@@ -143,11 +143,11 @@ export default class HMRServer {
|
|
|
143
143
|
return {
|
|
144
144
|
message: ansiHtml(d.message),
|
|
145
145
|
stack: ansiHtml(d.stack),
|
|
146
|
-
frames: d.frames.map(f => ({
|
|
146
|
+
frames: d.frames.map((f) => ({
|
|
147
147
|
location: f.location,
|
|
148
148
|
code: ansiHtml(f.code),
|
|
149
149
|
})),
|
|
150
|
-
hints: d.hints.map(hint => ansiHtml(hint)),
|
|
150
|
+
hints: d.hints.map((hint) => ansiHtml(hint)),
|
|
151
151
|
documentation: diagnostics[i].documentationURL ?? '',
|
|
152
152
|
};
|
|
153
153
|
}),
|
|
@@ -176,7 +176,7 @@ export default class HMRServer {
|
|
|
176
176
|
// have a cache busting query param added with HMR enabled which will trigger a reload.
|
|
177
177
|
let runtimes = new Set();
|
|
178
178
|
let incomingDeps = event.bundleGraph.getIncomingDependencies(asset);
|
|
179
|
-
let isOnlyReferencedByRuntimes = incomingDeps.every(dep => {
|
|
179
|
+
let isOnlyReferencedByRuntimes = incomingDeps.every((dep) => {
|
|
180
180
|
let resolved = event.bundleGraph.getResolvedAsset(dep);
|
|
181
181
|
let isRuntime = resolved?.type === 'js' && resolved !== asset;
|
|
182
182
|
if (resolved && isRuntime) {
|
package/src/Server.js
CHANGED
|
@@ -118,17 +118,17 @@ export default class Server {
|
|
|
118
118
|
async buildError(options: PluginOptions, diagnostics: Array<Diagnostic>) {
|
|
119
119
|
this.pending = false;
|
|
120
120
|
this.errors = await Promise.all(
|
|
121
|
-
diagnostics.map(async d => {
|
|
121
|
+
diagnostics.map(async (d) => {
|
|
122
122
|
let ansiDiagnostic = await prettyDiagnostic(d, options);
|
|
123
123
|
|
|
124
124
|
return {
|
|
125
125
|
message: ansiHtml(ansiDiagnostic.message),
|
|
126
126
|
stack: ansiDiagnostic.stack ? ansiHtml(ansiDiagnostic.stack) : null,
|
|
127
|
-
frames: ansiDiagnostic.frames.map(f => ({
|
|
127
|
+
frames: ansiDiagnostic.frames.map((f) => ({
|
|
128
128
|
location: f.location,
|
|
129
129
|
code: ansiHtml(f.code),
|
|
130
130
|
})),
|
|
131
|
-
hints: ansiDiagnostic.hints.map(hint => ansiHtml(hint)),
|
|
131
|
+
hints: ansiDiagnostic.hints.map((hint) => ansiHtml(hint)),
|
|
132
132
|
documentation: d.documentationURL ?? '',
|
|
133
133
|
};
|
|
134
134
|
}),
|
|
@@ -136,7 +136,7 @@ export default class Server {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
respond(req: Request, res: Response): mixed {
|
|
139
|
-
if (this.middleware.some(handler => handler(req, res))) return;
|
|
139
|
+
if (this.middleware.some((handler) => handler(req, res))) return;
|
|
140
140
|
let {pathname, search} = url.parse(req.originalUrl || req.url);
|
|
141
141
|
if (pathname == null) {
|
|
142
142
|
pathname = '/';
|
|
@@ -186,8 +186,8 @@ export default class Server {
|
|
|
186
186
|
// If the main asset is an HTML file, serve it
|
|
187
187
|
let htmlBundleFilePaths = this.bundleGraph
|
|
188
188
|
.getBundles()
|
|
189
|
-
.filter(bundle => path.posix.extname(bundle.name) === '.html')
|
|
190
|
-
.map(bundle => {
|
|
189
|
+
.filter((bundle) => path.posix.extname(bundle.name) === '.html')
|
|
190
|
+
.map((bundle) => {
|
|
191
191
|
return `/${relativePath(
|
|
192
192
|
this.options.distDir,
|
|
193
193
|
bundle.filePath,
|
|
@@ -270,7 +270,7 @@ export default class Server {
|
|
|
270
270
|
let bundle = bundleGraph
|
|
271
271
|
.getBundles()
|
|
272
272
|
.find(
|
|
273
|
-
b =>
|
|
273
|
+
(b) =>
|
|
274
274
|
path.relative(this.options.distDir, b.filePath) === requestedPath,
|
|
275
275
|
);
|
|
276
276
|
if (!bundle) {
|
|
@@ -370,10 +370,10 @@ export default class Server {
|
|
|
370
370
|
cleanUrls: false,
|
|
371
371
|
},
|
|
372
372
|
{
|
|
373
|
-
lstat: path => fs.stat(path),
|
|
374
|
-
realpath: path => fs.realpath(path),
|
|
373
|
+
lstat: (path) => fs.stat(path),
|
|
374
|
+
realpath: (path) => fs.realpath(path),
|
|
375
375
|
createReadStream: (path, options) => fs.createReadStream(path, options),
|
|
376
|
-
readdir: path => fs.readdir(path),
|
|
376
|
+
readdir: (path) => fs.readdir(path),
|
|
377
377
|
},
|
|
378
378
|
);
|
|
379
379
|
}
|
|
@@ -521,7 +521,7 @@ export default class Server {
|
|
|
521
521
|
|
|
522
522
|
server.listen(this.options.port, this.options.host);
|
|
523
523
|
return new Promise((resolve, reject) => {
|
|
524
|
-
server.once('error', err => {
|
|
524
|
+
server.once('error', (err) => {
|
|
525
525
|
this.options.logger.error(
|
|
526
526
|
({
|
|
527
527
|
message: serverErrors(err, this.options.port),
|
package/src/ServerReporter.js
CHANGED
package/src/templates/500.html
CHANGED
|
@@ -74,18 +74,26 @@
|
|
|
74
74
|
<% errors.forEach(function(error){ %>
|
|
75
75
|
<h2 class="error-message"><%- error.message %></h2>
|
|
76
76
|
|
|
77
|
-
<div class="error-stack-trace"
|
|
78
|
-
|
|
77
|
+
<div class="error-stack-trace">
|
|
78
|
+
<% if (error.frames?.length) { %><% error.frames.forEach(function(frame){
|
|
79
|
+
%><a
|
|
80
|
+
href="/__parcel_launch_editor?file=<%- encodeURIComponent(frame.location) %>"
|
|
81
|
+
style="text-decoration: underline; color: #888"
|
|
82
|
+
onclick="fetch(this.href); return false"
|
|
83
|
+
><%- frame.location %></a
|
|
84
|
+
>
|
|
85
|
+
<%- frame.code %><% }); %><% } else { %><%- error.stack %><% } %>
|
|
86
|
+
</div>
|
|
79
87
|
<ul class="error-hints-container">
|
|
80
88
|
<% error.hints.forEach(function(hint){ %>
|
|
81
89
|
<li class="error-hint"><%- hint %></li>
|
|
82
90
|
<% }); %>
|
|
83
91
|
</ul>
|
|
84
92
|
<% if (error.documentation) { %>
|
|
85
|
-
<div class="documentation"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<% if (hmrOptions) { %>
|
|
93
|
+
<div class="documentation">
|
|
94
|
+
📝 <a href="<%- error.documentation %>" target="_blank">Learn more</a>
|
|
95
|
+
</div>
|
|
96
|
+
<% } %> <% }); %> <% if (hmrOptions) { %>
|
|
89
97
|
<script>
|
|
90
98
|
// Reload the page when an HMR update occurs.
|
|
91
99
|
var protocol =
|