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

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.
@@ -118,11 +118,40 @@ var _default = exports.default = new (_plugin().Packager)({
118
118
  parcelRequireName: 'parcelRequire' + (0, _rust().hashString)(name).slice(-4)
119
119
  };
120
120
  },
121
+ loadBundleConfig({
122
+ bundle,
123
+ bundleGraph
124
+ }) {
125
+ let pages = [];
126
+ for (let b of bundleGraph.getEntryBundles()) {
127
+ let main = b.getMainEntry();
128
+ if (main && b.type === 'js' && b.needsStableName) {
129
+ let meta = pageMeta(main.meta);
130
+ pages.push({
131
+ url: (0, _utils().urlJoin)(b.target.publicUrl, b.name),
132
+ name: b.name,
133
+ ...meta
134
+ });
135
+ }
136
+ }
137
+ let referencedBundles = [];
138
+ for (let b of bundleGraph.getReferencedBundles(bundle, {
139
+ includeInline: false,
140
+ includeIsolated: false
141
+ })) {
142
+ referencedBundles.push(b.getContentHash());
143
+ }
144
+ return {
145
+ pages,
146
+ referencedBundles
147
+ };
148
+ },
121
149
  async package({
122
150
  bundle,
123
151
  bundleGraph,
124
152
  getInlineBundleContents,
125
- config
153
+ config,
154
+ bundleConfig
126
155
  }) {
127
156
  if (bundle.env.shouldScopeHoist) {
128
157
  throw new Error('Scope hoisting is not supported with SSG');
@@ -145,18 +174,7 @@ var _default = exports.default = new (_plugin().Packager)({
145
174
  let {
146
175
  injectRSCPayload
147
176
  } = await import('rsc-html-stream/server');
148
- let pages = [];
149
- for (let b of bundleGraph.getEntryBundles()) {
150
- let main = b.getMainEntry();
151
- if (main && b.type === 'js' && b.needsStableName) {
152
- let meta = pageMeta(main.meta);
153
- pages.push({
154
- url: (0, _utils().urlJoin)(b.target.publicUrl, b.name),
155
- name: b.name,
156
- ...meta
157
- });
158
- }
159
- }
177
+ let pages = bundleConfig.pages;
160
178
  let meta = pageMeta((0, _nullthrows().default)(bundle.getMainEntry()).meta);
161
179
  let props = {
162
180
  key: 'page',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/packager-react-static",
3
- "version": "2.15.3-canary.3472+b66f37168",
3
+ "version": "2.15.3-canary.3476+d948759d2",
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.1847+b66f37168"
20
+ "parcel": "^2.0.0-canary.1851+d948759d2"
21
21
  },
22
22
  "dependencies": {
23
- "@parcel/node-resolver-core": "3.6.3-canary.3472+b66f37168",
24
- "@parcel/plugin": "2.0.0-canary.1849+b66f37168",
25
- "@parcel/rust": "2.15.3-canary.3472+b66f37168",
26
- "@parcel/types": "2.0.0-canary.1849+b66f37168",
27
- "@parcel/utils": "2.0.0-canary.1849+b66f37168",
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",
28
28
  "nullthrows": "^1.1.1",
29
29
  "rsc-html-stream": "^0.0.6"
30
30
  },
31
- "gitHead": "b66f37168d0e830c030d0427bceac90117674cae"
31
+ "gitHead": "d948759d2fd502bc0c76cf87480f6fb12d2a2ee6"
32
32
  }
@@ -78,7 +78,37 @@ export default (new Packager({
78
78
  parcelRequireName: 'parcelRequire' + hashString(name).slice(-4),
79
79
  };
80
80
  },
81
- async package({bundle, bundleGraph, getInlineBundleContents, config}) {
81
+ loadBundleConfig({bundle, bundleGraph}) {
82
+ let pages: Page[] = [];
83
+ for (let b of bundleGraph.getEntryBundles()) {
84
+ let main = b.getMainEntry();
85
+ if (main && b.type === 'js' && b.needsStableName) {
86
+ let meta = pageMeta(main.meta);
87
+ pages.push({
88
+ url: urlJoin(b.target.publicUrl, b.name),
89
+ name: b.name,
90
+ ...meta,
91
+ });
92
+ }
93
+ }
94
+
95
+ let referencedBundles = [];
96
+ for (let b of bundleGraph.getReferencedBundles(bundle, {
97
+ includeInline: false,
98
+ includeIsolated: false,
99
+ })) {
100
+ referencedBundles.push(b.getContentHash());
101
+ }
102
+
103
+ return {pages, referencedBundles};
104
+ },
105
+ async package({
106
+ bundle,
107
+ bundleGraph,
108
+ getInlineBundleContents,
109
+ config,
110
+ bundleConfig,
111
+ }) {
82
112
  if (bundle.env.shouldScopeHoist) {
83
113
  throw new Error('Scope hoisting is not supported with SSG');
84
114
  }
@@ -108,19 +138,7 @@ export default (new Packager({
108
138
  );
109
139
  let {injectRSCPayload} = await import('rsc-html-stream/server');
110
140
 
111
- let pages: Page[] = [];
112
- for (let b of bundleGraph.getEntryBundles()) {
113
- let main = b.getMainEntry();
114
- if (main && b.type === 'js' && b.needsStableName) {
115
- let meta = pageMeta(main.meta);
116
- pages.push({
117
- url: urlJoin(b.target.publicUrl, b.name),
118
- name: b.name,
119
- ...meta,
120
- });
121
- }
122
- }
123
-
141
+ let pages: Page[] = bundleConfig.pages;
124
142
  let meta = pageMeta(nullthrows(bundle.getMainEntry()).meta);
125
143
  let props: PageProps = {
126
144
  key: 'page',