@parcel/packager-react-static 2.15.3-canary.3476 → 2.15.4

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.
@@ -234,7 +234,28 @@ var _default = exports.default = new (_plugin().Packager)({
234
234
  } = await prerender(React.createElement(Content), {
235
235
  bootstrapScriptContent
236
236
  });
237
- let response = prelude.pipeThrough(injectRSCPayload(injectStream));
237
+
238
+ // Buffer into a single chunk so hash reference replacement works correctly.
239
+ // There could potentially be a more optimal way of doing this in the future.
240
+ let buffers = [];
241
+ let len = 0;
242
+ // $FlowFixMe
243
+ let bufferedStream = new TransformStream({
244
+ transform(chunk) {
245
+ len += chunk.length;
246
+ buffers.push(chunk);
247
+ },
248
+ flush(controller) {
249
+ let concated = new Uint8Array(len);
250
+ let offset = 0;
251
+ for (let buf of buffers) {
252
+ concated.set(buf, offset);
253
+ offset += buf.length;
254
+ }
255
+ controller.enqueue(concated);
256
+ }
257
+ });
258
+ let response = prelude.pipeThrough(injectRSCPayload(injectStream.pipeThrough(bufferedStream)));
238
259
  return [{
239
260
  type: 'html',
240
261
  contents: _stream().Readable.from(response)
@@ -367,9 +388,13 @@ async function loadBundleUncached(bundle, bundleGraph, getInlineBundleContents)
367
388
  return loadAsset((0, _nullthrows().default)(assetsByPublicId.get(publicId)));
368
389
  };
369
390
  parcelRequire.root = parcelRequire;
391
+ let publicUrl = bundle.target.publicUrl;
392
+ if (!publicUrl.endsWith('/')) {
393
+ publicUrl += '/';
394
+ }
370
395
  parcelRequire.meta = {
371
396
  distDir: bundle.target.distDir,
372
- publicUrl: bundle.target.publicUrl
397
+ publicUrl
373
398
  };
374
399
  parcelRequire.load = async filePath => {
375
400
  let bundle = bundleGraph.getBundles().find(b => b.publicId === filePath || b.name === filePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/packager-react-static",
3
- "version": "2.15.3-canary.3476+d948759d2",
3
+ "version": "2.15.4",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -17,16 +17,16 @@
17
17
  "source": "src/ReactStaticPackager.js",
18
18
  "engines": {
19
19
  "node": ">= 16.0.0",
20
- "parcel": "^2.0.0-canary.1851+d948759d2"
20
+ "parcel": "^2.15.4"
21
21
  },
22
22
  "dependencies": {
23
- "@parcel/node-resolver-core": "3.6.3-canary.3476+d948759d2",
24
- "@parcel/plugin": "2.0.0-canary.1853+d948759d2",
25
- "@parcel/rust": "2.15.3-canary.3476+d948759d2",
26
- "@parcel/types": "2.0.0-canary.1853+d948759d2",
27
- "@parcel/utils": "2.0.0-canary.1853+d948759d2",
23
+ "@parcel/node-resolver-core": "3.6.4",
24
+ "@parcel/plugin": "2.15.4",
25
+ "@parcel/rust": "2.15.4",
26
+ "@parcel/types": "2.15.4",
27
+ "@parcel/utils": "2.15.4",
28
28
  "nullthrows": "^1.1.1",
29
29
  "rsc-html-stream": "^0.0.6"
30
30
  },
31
- "gitHead": "d948759d2fd502bc0c76cf87480f6fb12d2a2ee6"
31
+ "gitHead": "dadcead5ec12286a4d4115880f47cab02dbdbbf6"
32
32
  }
@@ -215,7 +215,31 @@ export default (new Packager({
215
215
  let {prelude} = await prerender(React.createElement(Content), {
216
216
  bootstrapScriptContent,
217
217
  });
218
- let response = prelude.pipeThrough(injectRSCPayload(injectStream));
218
+
219
+ // Buffer into a single chunk so hash reference replacement works correctly.
220
+ // There could potentially be a more optimal way of doing this in the future.
221
+ let buffers = [];
222
+ let len = 0;
223
+ // $FlowFixMe
224
+ let bufferedStream = new TransformStream({
225
+ transform(chunk) {
226
+ len += chunk.length;
227
+ buffers.push(chunk);
228
+ },
229
+ flush(controller) {
230
+ let concated = new Uint8Array(len);
231
+ let offset = 0;
232
+ for (let buf of buffers) {
233
+ concated.set(buf, offset);
234
+ offset += buf.length;
235
+ }
236
+ controller.enqueue(concated);
237
+ },
238
+ });
239
+
240
+ let response = prelude.pipeThrough(
241
+ injectRSCPayload(injectStream.pipeThrough(bufferedStream)),
242
+ );
219
243
 
220
244
  return [
221
245
  {
@@ -392,9 +416,13 @@ async function loadBundleUncached(
392
416
 
393
417
  parcelRequire.root = parcelRequire;
394
418
 
419
+ let publicUrl = bundle.target.publicUrl;
420
+ if (!publicUrl.endsWith('/')) {
421
+ publicUrl += '/';
422
+ }
395
423
  parcelRequire.meta = {
396
424
  distDir: bundle.target.distDir,
397
- publicUrl: bundle.target.publicUrl,
425
+ publicUrl,
398
426
  };
399
427
 
400
428
  parcelRequire.load = async (filePath: string) => {