@sitecore-jss/sitecore-jss-rendering-host 18.0.1 → 18.0.2

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/LICENSE.txt CHANGED
@@ -1,202 +1,202 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # Sitecore JavaScript Services Rendering Host
2
-
3
- This module is provided as a part of Sitecore JavaScript Services. It contains the rendering host implementation.
4
-
5
- Consult the [Sitecore JSS documentation](https://jss.sitecore.com) for further details.
1
+ # Sitecore JavaScript Services Rendering Host
2
+
3
+ This module is provided as a part of Sitecore JavaScript Services. It contains the rendering host implementation.
4
+
5
+ Consult the [Sitecore JSS documentation](https://jss.sitecore.com) for further details.
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-rendering-host",
3
- "version": "18.0.1",
3
+ "version": "18.0.2",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "npm run clean && tsc",
7
7
  "clean": "del-cli dist types",
8
8
  "lint": "eslint ./src/**/*.ts",
9
- "test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
9
+ "test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\" --exit",
10
10
  "prepublishOnly": "npm run build",
11
- "coverage": "nyc --require ts-node/register npm test"
11
+ "coverage": "nyc --require ts-node/register/transpile-only npm test"
12
12
  },
13
13
  "engines": {
14
14
  "node": ">=8.10"
@@ -56,5 +56,5 @@
56
56
  "type": "git",
57
57
  "url": "git+https://github.com/Sitecore/jss.git"
58
58
  },
59
- "gitHead": "ea31b23a9e6dc6f19cb5830a31040df4ee571fad"
59
+ "gitHead": "d248cbf9ca65ca3574ba0c86cfc34b36ce70770b"
60
60
  }
@@ -1 +0,0 @@
1
- {"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\defaultAppInvocationInfoResolver.ts":{"path":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\defaultAppInvocationInfoResolver.ts","statementMap":{"0":{"start":{"line":2,"column":22},"end":{"line":4,"column":1}},"1":{"start":{"line":3,"column":4},"end":{"line":3,"column":62}},"2":{"start":{"line":5,"column":0},"end":{"line":5,"column":62}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":53}},"4":{"start":{"line":7,"column":23},"end":{"line":7,"column":63}},"5":{"start":{"line":8,"column":15},"end":{"line":8,"column":47}},"6":{"start":{"line":25,"column":4},"end":{"line":25,"column":81}},"7":{"start":{"line":27,"column":21},"end":{"line":48,"column":5}},"8":{"start":{"line":30,"column":27},"end":{"line":30,"column":55}},"9":{"start":{"line":31,"column":31},"end":{"line":31,"column":65}},"10":{"start":{"line":32,"column":43},"end":{"line":32,"column":83}},"11":{"start":{"line":33,"column":31},"end":{"line":33,"column":73}},"12":{"start":{"line":34,"column":8},"end":{"line":39,"column":9}},"13":{"start":{"line":35,"column":12},"end":{"line":38,"column":49}},"14":{"start":{"line":40,"column":35},"end":{"line":40,"column":51}},"15":{"start":{"line":41,"column":8},"end":{"line":47,"column":10}},"16":{"start":{"line":43,"column":16},"end":{"line":43,"column":124}},"17":{"start":{"line":44,"column":16},"end":{"line":44,"column":47}},"18":{"start":{"line":49,"column":4},"end":{"line":49,"column":20}},"19":{"start":{"line":51,"column":0},"end":{"line":51,"column":82}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":2,"column":56},"end":{"line":2,"column":57}},"loc":{"start":{"line":2,"column":71},"end":{"line":4,"column":1}},"line":2},"1":{"name":"getDefaultAppInvocationInfoResolver","decl":{"start":{"line":23,"column":9},"end":{"line":23,"column":44}},"loc":{"start":{"line":26,"column":66},"end":{"line":50,"column":1}},"line":26},"2":{"name":"(anonymous_2)","decl":{"start":{"line":23,"column":65},"end":{"line":23,"column":66}},"loc":{"start":{"line":23,"column":82},"end":{"line":26,"column":1}},"line":23},"3":{"name":"(anonymous_3)","decl":{"start":{"line":27,"column":21},"end":{"line":27,"column":22}},"loc":{"start":{"line":27,"column":38},"end":{"line":48,"column":5}},"line":27},"4":{"name":"(anonymous_4)","decl":{"start":{"line":42,"column":28},"end":{"line":42,"column":29}},"loc":{"start":{"line":42,"column":41},"end":{"line":45,"column":13}},"line":42}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":22},"end":{"line":4,"column":1}},"type":"binary-expr","locations":[{"start":{"line":2,"column":23},"end":{"line":2,"column":27}},{"start":{"line":2,"column":31},"end":{"line":2,"column":51}},{"start":{"line":2,"column":56},"end":{"line":4,"column":1}}],"line":2},"1":{"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":61}},"type":"cond-expr","locations":[{"start":{"line":3,"column":37},"end":{"line":3,"column":40}},{"start":{"line":3,"column":43},"end":{"line":3,"column":61}}],"line":3},"2":{"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":33}},"type":"binary-expr","locations":[{"start":{"line":3,"column":12},"end":{"line":3,"column":15}},{"start":{"line":3,"column":19},"end":{"line":3,"column":33}}],"line":3},"3":{"loc":{"start":{"line":23,"column":47},"end":{"line":26,"column":1}},"type":"default-arg","locations":[{"start":{"line":23,"column":65},"end":{"line":26,"column":1}}],"line":23},"4":{"loc":{"start":{"line":26,"column":3},"end":{"line":26,"column":25}},"type":"default-arg","locations":[{"start":{"line":26,"column":17},"end":{"line":26,"column":25}}],"line":26},"5":{"loc":{"start":{"line":26,"column":27},"end":{"line":26,"column":61}},"type":"default-arg","locations":[{"start":{"line":26,"column":46},"end":{"line":26,"column":61}}],"line":26},"6":{"loc":{"start":{"line":32,"column":43},"end":{"line":32,"column":83}},"type":"binary-expr","locations":[{"start":{"line":32,"column":43},"end":{"line":32,"column":67}},{"start":{"line":32,"column":71},"end":{"line":32,"column":83}}],"line":32},"7":{"loc":{"start":{"line":34,"column":8},"end":{"line":39,"column":9}},"type":"if","locations":[{"start":{"line":34,"column":8},"end":{"line":39,"column":9}},{"start":{"line":34,"column":8},"end":{"line":39,"column":9}}],"line":34}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0},"f":{"0":0,"1":0,"2":0,"3":0,"4":0},"b":{"0":[0,0,0],"1":[0,0],"2":[0,0],"3":[0],"4":[0],"5":[0],"6":[0,0],"7":[0,0]},"inputSourceMap":{"version":3,"file":"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/defaultAppInvocationInfoResolver.ts","sources":["C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/defaultAppInvocationInfoResolver.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AACvC,gDAAwB;AAGxB;;;;;;;;;;;;;GAaG;AACH,SAAgB,mCAAmC,CAAC,EAClD,eAAe,GAAG,CAAC,WAAuB,EAAE,EAAE;IAC5C,mEAAmE;IACnE,OAAO,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC;AACrE,CAAC,EACD,WAAW,GAAG,QAAQ,EACtB,gBAAgB,GAAG,eAAe,GACnC;IACC,MAAM,QAAQ,GAA8B,CAAC,WAAW,EAAE,EAAE;QAC1D,kDAAkD;QAClD,4CAA4C;QAC5C,MAAM,UAAU,GAAG,eAAe,CAAC,WAAyB,CAAC,CAAC;QAC9D,MAAM,cAAc,GAAG,sBAAW,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,0BAA0B,GAAI,WAA0B,CAAC,YAAY,IAAI,YAAY,CAAC;QAC5F,MAAM,cAAc,GAAG,cAAc,CAAC,0BAA0B,CAAC,CAAC;QAElE,IAAI,CAAC,cAAc,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,eAAe,UAAU,0BAA0B,0BAA0B;;;iBAGlF,0BAA0B,IAAI,CAAC,CAAC;SAC5C;QAED,MAAM,kBAAkB,GAAI,WAA0B,CAAC,IAAI,CAAC;QAE5D,OAAO;YACL,cAAc,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE;gBAC1B,OAAO,CAAC,GAAG,CACT,0BAA0B,UAAU,8BAA8B,0BAA0B,EAAE,CAC/F,CAAC;gBACF,OAAO,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;YACjC,CAAC;YACD,kBAAkB;SACnB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AArCD,kFAqCC","sourcesContent":["import importFresh from 'import-fresh';\r\nimport path from 'path';\r\nimport { AppInvocationInfoResolver, JsonObject } from './ssrMiddleware';\r\n\r\n/**\r\n * Returns the default AppInvocationInfoResolver, which is responsible for resolving the function, within your app bundle,\r\n * that should be invoked for rendering your app.\r\n *\r\n * By default, the resolver assumes a folder structure of:\r\n * `./{baseAppPath}/{JSSAppName}/{serverBundleName}.js`\r\n *\r\n * `JSSAppName` is the `id` property of the JSON request body that is POSTed to the rendering host by Sitecore.\r\n *\r\n * `serverBundleName` is the name of the JavaScript file (typically a bundle) that contains the function for rendering your app.\r\n *\r\n * @param {string} [baseAppPath='./dist'] The base path to your JSS app(s), defaults to `./dist`\r\n * @returns {AppInvocationInfoResolver} resolver\r\n */\r\nexport function getDefaultAppInvocationInfoResolver({\r\n appPathResolver = (requestJson: JsonObject) => {\r\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\r\n return path.resolve(baseAppPath, requestJson.id, serverBundleName);\r\n },\r\n baseAppPath = './dist',\r\n serverBundleName = 'server.bundle',\r\n}) {\r\n const resolver: AppInvocationInfoResolver = (requestJson) => {\r\n // default resolution assumes folder structure of:\r\n // ./dist/{JSSAppName}/{ServerBundleName}.js\r\n const modulePath = appPathResolver(requestJson as JsonObject);\r\n const resolvedModule = importFresh(modulePath);\r\n const resolvedRenderFunctionName = (requestJson as JsonObject).functionName || 'renderView';\r\n const renderFunction = resolvedModule[resolvedRenderFunctionName];\r\n\r\n if (!renderFunction) {\r\n throw new Error(`The module \"${modulePath}\" has no export named \"${resolvedRenderFunctionName}\".\r\n Ensure that your server bundle is transpiled to CommonJS (or equivalent) format that can be\r\n resolved by a Node.js 'require' statement. And ensure that your server bundle exports a function\r\n named \"${resolvedRenderFunctionName}\".`);\r\n }\r\n\r\n const renderFunctionArgs = (requestJson as JsonObject).args;\r\n\r\n return {\r\n renderFunction: (...args) => {\r\n console.log(\r\n `[SSR] rendering app at ${modulePath} via render function named ${resolvedRenderFunctionName}`\r\n );\r\n return renderFunction(...args);\r\n },\r\n renderFunctionArgs,\r\n };\r\n };\r\n\r\n return resolver;\r\n}\r\n"]},"all":true},"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\devServer.ts":{"path":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\devServer.ts","statementMap":{"0":{"start":{"line":2,"column":22},"end":{"line":4,"column":1}},"1":{"start":{"line":3,"column":4},"end":{"line":3,"column":62}},"2":{"start":{"line":5,"column":0},"end":{"line":5,"column":62}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":32}},"4":{"start":{"line":7,"column":14},"end":{"line":7,"column":28}},"5":{"start":{"line":10,"column":14},"end":{"line":10,"column":45}},"6":{"start":{"line":11,"column":15},"end":{"line":11,"column":47}},"7":{"start":{"line":12,"column":18},"end":{"line":12,"column":53}},"8":{"start":{"line":13,"column":29},"end":{"line":13,"column":75}},"9":{"start":{"line":14,"column":24},"end":{"line":14,"column":50}},"10":{"start":{"line":15,"column":43},"end":{"line":15,"column":88}},"11":{"start":{"line":21,"column":20},"end":{"line":21,"column":66}},"12":{"start":{"line":24,"column":4},"end":{"line":28,"column":5}},"13":{"start":{"line":25,"column":8},"end":{"line":27,"column":45}},"14":{"start":{"line":31,"column":4},"end":{"line":35,"column":5}},"15":{"start":{"line":32,"column":8},"end":{"line":34,"column":48}},"16":{"start":{"line":36,"column":31},"end":{"line":38,"column":47}},"17":{"start":{"line":39,"column":4},"end":{"line":44,"column":5}},"18":{"start":{"line":40,"column":8},"end":{"line":43,"column":22}},"19":{"start":{"line":45,"column":33},"end":{"line":45,"column":125}},"20":{"start":{"line":49,"column":4},"end":{"line":52,"column":5}},"21":{"start":{"line":50,"column":8},"end":{"line":50,"column":98}},"22":{"start":{"line":51,"column":8},"end":{"line":51,"column":66}},"23":{"start":{"line":54,"column":4},"end":{"line":54,"column":107}},"24":{"start":{"line":55,"column":21},"end":{"line":55,"column":95}},"25":{"start":{"line":63,"column":4},"end":{"line":73,"column":5}},"26":{"start":{"line":64,"column":28},"end":{"line":64,"column":33}},"27":{"start":{"line":65,"column":8},"end":{"line":72,"column":11}},"28":{"start":{"line":66,"column":12},"end":{"line":71,"column":13}},"29":{"start":{"line":67,"column":16},"end":{"line":67,"column":80}},"30":{"start":{"line":68,"column":16},"end":{"line":70,"column":19}},"31":{"start":{"line":69,"column":20},"end":{"line":69,"column":41}},"32":{"start":{"line":82,"column":40},"end":{"line":86,"column":5}},"33":{"start":{"line":92,"column":26},"end":{"line":92,"column":277}},"34":{"start":{"line":93,"column":4},"end":{"line":95,"column":5}},"35":{"start":{"line":94,"column":8},"end":{"line":94,"column":41}},"36":{"start":{"line":96,"column":23},"end":{"line":96,"column":84}},"37":{"start":{"line":97,"column":4},"end":{"line":97,"column":59}},"38":{"start":{"line":98,"column":38},"end":{"line":99,"column":117}},"39":{"start":{"line":99,"column":104},"end":{"line":99,"column":114}},"40":{"start":{"line":102,"column":26},"end":{"line":102,"column":45}},"41":{"start":{"line":103,"column":4},"end":{"line":120,"column":6}},"42":{"start":{"line":104,"column":27},"end":{"line":110,"column":14}},"43":{"start":{"line":113,"column":8},"end":{"line":113,"column":69}},"44":{"start":{"line":116,"column":8},"end":{"line":116,"column":55}},"45":{"start":{"line":117,"column":8},"end":{"line":119,"column":9}},"46":{"start":{"line":118,"column":12},"end":{"line":118,"column":39}},"47":{"start":{"line":122,"column":4},"end":{"line":127,"column":5}},"48":{"start":{"line":123,"column":27},"end":{"line":123,"column":105}},"49":{"start":{"line":124,"column":8},"end":{"line":124,"column":50}},"50":{"start":{"line":125,"column":29},"end":{"line":125,"column":51}},"51":{"start":{"line":126,"column":8},"end":{"line":126,"column":51}},"52":{"start":{"line":129,"column":4},"end":{"line":129,"column":70}},"53":{"start":{"line":132,"column":19},"end":{"line":132,"column":76}},"54":{"start":{"line":134,"column":4},"end":{"line":134,"column":53}},"55":{"start":{"line":136,"column":4},"end":{"line":143,"column":7}},"56":{"start":{"line":137,"column":8},"end":{"line":140,"column":9}},"57":{"start":{"line":138,"column":12},"end":{"line":138,"column":31}},"58":{"start":{"line":139,"column":12},"end":{"line":139,"column":19}},"59":{"start":{"line":141,"column":8},"end":{"line":141,"column":72}},"60":{"start":{"line":142,"column":8},"end":{"line":142,"column":56}},"61":{"start":{"line":145,"column":0},"end":{"line":145,"column":40}},"62":{"start":{"line":152,"column":4},"end":{"line":154,"column":5}},"63":{"start":{"line":153,"column":8},"end":{"line":153,"column":22}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":2,"column":56},"end":{"line":2,"column":57}},"loc":{"start":{"line":2,"column":71},"end":{"line":4,"column":1}},"line":2},"1":{"name":"startDevServer","decl":{"start":{"line":19,"column":9},"end":{"line":19,"column":23}},"loc":{"start":{"line":19,"column":299},"end":{"line":144,"column":1}},"line":19},"2":{"name":"(anonymous_2)","decl":{"start":{"line":65,"column":110},"end":{"line":65,"column":111}},"loc":{"start":{"line":65,"column":121},"end":{"line":72,"column":9}},"line":65},"3":{"name":"(anonymous_3)","decl":{"start":{"line":68,"column":53},"end":{"line":68,"column":54}},"loc":{"start":{"line":68,"column":59},"end":{"line":70,"column":17}},"line":68},"4":{"name":"(anonymous_4)","decl":{"start":{"line":99,"column":98},"end":{"line":99,"column":99}},"loc":{"start":{"line":99,"column":104},"end":{"line":99,"column":114}},"line":99},"5":{"name":"(anonymous_5)","decl":{"start":{"line":103,"column":26},"end":{"line":103,"column":27}},"loc":{"start":{"line":103,"column":43},"end":{"line":120,"column":5}},"line":103},"6":{"name":"(anonymous_6)","decl":{"start":{"line":136,"column":37},"end":{"line":136,"column":38}},"loc":{"start":{"line":136,"column":46},"end":{"line":143,"column":5}},"line":136},"7":{"name":"invokeHook","decl":{"start":{"line":151,"column":9},"end":{"line":151,"column":19}},"loc":{"start":{"line":151,"column":35},"end":{"line":155,"column":1}},"line":151}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":22},"end":{"line":4,"column":1}},"type":"binary-expr","locations":[{"start":{"line":2,"column":23},"end":{"line":2,"column":27}},{"start":{"line":2,"column":31},"end":{"line":2,"column":51}},{"start":{"line":2,"column":56},"end":{"line":4,"column":1}}],"line":2},"1":{"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":61}},"type":"cond-expr","locations":[{"start":{"line":3,"column":37},"end":{"line":3,"column":40}},{"start":{"line":3,"column":43},"end":{"line":3,"column":61}}],"line":3},"2":{"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":33}},"type":"binary-expr","locations":[{"start":{"line":3,"column":12},"end":{"line":3,"column":15}},{"start":{"line":3,"column":19},"end":{"line":3,"column":33}}],"line":3},"3":{"loc":{"start":{"line":19,"column":26},"end":{"line":19,"column":34}},"type":"default-arg","locations":[{"start":{"line":19,"column":33},"end":{"line":19,"column":34}}],"line":19},"4":{"loc":{"start":{"line":19,"column":176},"end":{"line":19,"column":186}},"type":"default-arg","locations":[{"start":{"line":19,"column":184},"end":{"line":19,"column":186}}],"line":19},"5":{"loc":{"start":{"line":19,"column":282},"end":{"line":19,"column":294}},"type":"default-arg","locations":[{"start":{"line":19,"column":290},"end":{"line":19,"column":294}}],"line":19},"6":{"loc":{"start":{"line":24,"column":4},"end":{"line":28,"column":5}},"type":"if","locations":[{"start":{"line":24,"column":4},"end":{"line":28,"column":5}},{"start":{"line":24,"column":4},"end":{"line":28,"column":5}}],"line":24},"7":{"loc":{"start":{"line":31,"column":4},"end":{"line":35,"column":5}},"type":"if","locations":[{"start":{"line":31,"column":4},"end":{"line":35,"column":5}},{"start":{"line":31,"column":4},"end":{"line":35,"column":5}}],"line":31},"8":{"loc":{"start":{"line":36,"column":31},"end":{"line":38,"column":47}},"type":"binary-expr","locations":[{"start":{"line":36,"column":31},"end":{"line":36,"column":55}},{"start":{"line":37,"column":8},"end":{"line":37,"column":44}},{"start":{"line":38,"column":8},"end":{"line":38,"column":47}}],"line":36},"9":{"loc":{"start":{"line":39,"column":4},"end":{"line":44,"column":5}},"type":"if","locations":[{"start":{"line":39,"column":4},"end":{"line":44,"column":5}},{"start":{"line":39,"column":4},"end":{"line":44,"column":5}}],"line":39},"10":{"loc":{"start":{"line":45,"column":33},"end":{"line":45,"column":125}},"type":"binary-expr","locations":[{"start":{"line":45,"column":33},"end":{"line":45,"column":59}},{"start":{"line":45,"column":63},"end":{"line":45,"column":103}},{"start":{"line":45,"column":107},"end":{"line":45,"column":125}}],"line":45},"11":{"loc":{"start":{"line":49,"column":4},"end":{"line":52,"column":5}},"type":"if","locations":[{"start":{"line":49,"column":4},"end":{"line":52,"column":5}},{"start":{"line":49,"column":4},"end":{"line":52,"column":5}}],"line":49},"12":{"loc":{"start":{"line":63,"column":4},"end":{"line":73,"column":5}},"type":"if","locations":[{"start":{"line":63,"column":4},"end":{"line":73,"column":5}},{"start":{"line":63,"column":4},"end":{"line":73,"column":5}}],"line":63},"13":{"loc":{"start":{"line":66,"column":12},"end":{"line":71,"column":13}},"type":"if","locations":[{"start":{"line":66,"column":12},"end":{"line":71,"column":13}},{"start":{"line":66,"column":12},"end":{"line":71,"column":13}}],"line":66},"14":{"loc":{"start":{"line":93,"column":4},"end":{"line":95,"column":5}},"type":"if","locations":[{"start":{"line":93,"column":4},"end":{"line":95,"column":5}},{"start":{"line":93,"column":4},"end":{"line":95,"column":5}}],"line":93},"15":{"loc":{"start":{"line":98,"column":38},"end":{"line":99,"column":117}},"type":"binary-expr","locations":[{"start":{"line":98,"column":38},"end":{"line":98,"column":69}},{"start":{"line":99,"column":8},"end":{"line":99,"column":117}}],"line":98},"16":{"loc":{"start":{"line":104,"column":27},"end":{"line":110,"column":14}},"type":"cond-expr","locations":[{"start":{"line":105,"column":14},"end":{"line":107,"column":14}},{"start":{"line":108,"column":14},"end":{"line":110,"column":14}}],"line":104},"17":{"loc":{"start":{"line":116,"column":17},"end":{"line":116,"column":41}},"type":"binary-expr","locations":[{"start":{"line":116,"column":17},"end":{"line":116,"column":34}},{"start":{"line":116,"column":38},"end":{"line":116,"column":41}}],"line":116},"18":{"loc":{"start":{"line":117,"column":8},"end":{"line":119,"column":9}},"type":"if","locations":[{"start":{"line":117,"column":8},"end":{"line":119,"column":9}},{"start":{"line":117,"column":8},"end":{"line":119,"column":9}}],"line":117},"19":{"loc":{"start":{"line":122,"column":4},"end":{"line":127,"column":5}},"type":"if","locations":[{"start":{"line":122,"column":4},"end":{"line":127,"column":5}},{"start":{"line":122,"column":4},"end":{"line":127,"column":5}}],"line":122},"20":{"loc":{"start":{"line":137,"column":8},"end":{"line":140,"column":9}},"type":"if","locations":[{"start":{"line":137,"column":8},"end":{"line":140,"column":9}},{"start":{"line":137,"column":8},"end":{"line":140,"column":9}}],"line":137},"21":{"loc":{"start":{"line":152,"column":4},"end":{"line":154,"column":5}},"type":"if","locations":[{"start":{"line":152,"column":4},"end":{"line":154,"column":5}},{"start":{"line":152,"column":4},"end":{"line":154,"column":5}}],"line":152},"22":{"loc":{"start":{"line":152,"column":8},"end":{"line":152,"column":42}},"type":"binary-expr","locations":[{"start":{"line":152,"column":8},"end":{"line":152,"column":12}},{"start":{"line":152,"column":16},"end":{"line":152,"column":42}}],"line":152}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0},"f":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0},"b":{"0":[0,0,0],"1":[0,0],"2":[0,0],"3":[0],"4":[0],"5":[0],"6":[0,0],"7":[0,0],"8":[0,0,0],"9":[0,0],"10":[0,0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0]},"inputSourceMap":{"version":3,"file":"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/devServer.ts","sources":["C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/devServer.ts"],"names":[],"mappings":";;;;;;AAAA,6BAAsC;AAGtC,6DAA6D;AAC7D,aAAa;AACb,8CAA8B;AAC9B,gDAAwB;AACxB,sDAA8B;AAE9B,4EAAkD;AAClD,mDAIyB;AACzB,yFAAyF;AAyDzF;;GAEG;AACH,SAAgB,cAAc,CAAC,EAC7B,IAAI,GAAG,CAAC,EACR,SAAS,EACT,aAAa,EACb,kBAAkB,EAAE,wBAAwB,EAC5C,oBAAoB,EAAE,0BAA0B,EAChD,gBAAgB,EAChB,KAAK,GAAG,EAAE,EACV,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EAAE,+BAA+B,EAC1D,KAAK,GAAG,IAAI,GACK;IACjB,4BAA4B;IAC5B,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAE/D,+FAA+F;IAC/F,mEAAmE;IACnE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE;QACpC,MAAM,IAAI,KAAK,CAAC;;2CAEuB,CAAC,CAAC;KAC1C;IACD,6DAA6D;IAC7D,mEAAmE;IAEnE,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,MAAM,EAAE;QACvC,MAAM,IAA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G,EAAE;YACP,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO;SACR;QAED,OAAO,CAAC,GAAG,CAAC,4CAA4C,IAAI,EAAE,CAAC,CAAC;QAChE,UAAU,CAAC,KAAK,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC;AArLD,wCAqLC;AAED;;;GAGG;AACH,wDAAwD;AACxD,SAAS,UAAU,CAAC,IAA0B,EAAE,GAAG,IAAe;IAChE,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;QACtC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;KACf;AACH,CAAC;AAED,+EAA+E;AAC/E,qEAAqE;AACrE,yDAAyD;AACzD,gFAAgF;AAChF,yEAAyE;AAEzE,6BAA6B;AAC7B,4GAA4G;AAC5G,sGAAsG;AACtG,8GAA8G;AAC9G,oDAAoD;AACpD,QAAQ;AAER,gDAAgD;AAEhD,eAAe;AACf,wBAAwB;AACxB,4BAA4B;AAC5B,SAAS;AACT,OAAO;AAEP,qBAAqB;AACrB,IAAI","sourcesContent":["import { sync as delSync } from 'del';\r\nimport { Application } from 'express';\r\nimport { PathParams } from 'express-serve-static-core';\r\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\r\n// @ts-ignore\r\nimport openBrowser from 'opn';\r\nimport path from 'path';\r\nimport webpack from 'webpack';\r\nimport WebpackDevMiddleware from 'webpack-dev-middleware';\r\nimport WebpackDevServer from 'webpack-dev-server';\r\nimport {\r\n ssrMiddleware as defaultSSRMiddleware,\r\n AppInvocationInfoResolver,\r\n SSRMiddleware,\r\n} from './ssrMiddleware';\r\nimport { getDefaultAppInvocationInfoResolver } from './defaultAppInvocationInfoResolver';\r\n\r\nexport interface ConfigFactoryResult {\r\n ssrWebpackConfig: webpack.Configuration;\r\n clientWebpackConfig: webpack.Configuration;\r\n devServerConfig: WebpackDevServer.Configuration;\r\n}\r\n\r\nexport type ConfigFactory = (nodeEnv?: string, tunnelUrl?: string) => ConfigFactoryResult;\r\n\r\nexport interface DevServerOptions {\r\n configFactory: ConfigFactory;\r\n /**\r\n * Path to the build artifacts from your SSR Webpack configuration. By default,\r\n * we'll use the 'ssrWebpackConfig.output.path' value. But you can specify a different\r\n * value with the 'buildArtifactsPath' property. Note: this does _not_ replace the\r\n * value specified in your Webpack configuration, instead this value is used for resolving\r\n * the path to your app's server bundle.\r\n */\r\n buildArtifactsPath?: string;\r\n serverBundleFileName?: string;\r\n /**\r\n * The port number the server should listen on. Defaults to `0` if no value is provided;\r\n * @default 0\r\n */\r\n port?: number;\r\n /**\r\n * The hostname the server should bind to. Defaults to `localhost` if no value is provided.\r\n * @default localhost\r\n */\r\n hostname?: string;\r\n tunnelUrl?: string;\r\n urlToOpenOnStart?: string;\r\n hooks?: {\r\n beforeWebpackCompilerCreation?: (\r\n clientWebpackConfig: webpack.Configuration,\r\n ssrWebpackConfig: webpack.Configuration\r\n ) => void;\r\n beforeSSRMiddlewareRegistered?: (app: Application, server: WebpackDevServer) => void;\r\n beforeDevServerCreated?: (\r\n compiler: webpack.MultiCompiler,\r\n devServerOptions: WebpackDevServer.Configuration & WebpackDevMiddleware.Options\r\n ) => void;\r\n beforeDevServerStarted?: (devServer: WebpackDevServer) => void;\r\n afterDevServerStarted?: (devServer: WebpackDevServer) => void;\r\n };\r\n ssrMiddleware?: SSRMiddleware;\r\n /**\r\n * Defines the path for which the SSR Middleware is invoked. Defaults to `'*'` if no value is provided.\r\n * More information can be found in the Express docs: https://expressjs.com/en/4x/api.html#path-examples\r\n * @default '*'\r\n */\r\n ssrMiddlewarePath?: PathParams;\r\n appInvocationInfoResolver?: AppInvocationInfoResolver;\r\n clean?: boolean;\r\n}\r\n\r\n/**\r\n * @param {DevServerOptions} config\r\n */\r\nexport function startDevServer({\r\n port = 0,\r\n tunnelUrl,\r\n configFactory,\r\n buildArtifactsPath: customBuildArtifactsPath,\r\n serverBundleFileName: customServerBundleFileName,\r\n urlToOpenOnStart,\r\n hooks = {},\r\n ssrMiddleware,\r\n ssrMiddlewarePath,\r\n appInvocationInfoResolver: customAppInvocationInfoResolver,\r\n clean = true,\r\n}: DevServerOptions) {\r\n // WEBPACK DEV SERVER config\r\n const configs = configFactory(process.env.NODE_ENV, tunnelUrl);\r\n\r\n // Override existing webpack config settings to a separate \"known\" location for http rendering.\r\n // Helps to avoid any conflicts with other build process artifacts.\r\n if (!configs.ssrWebpackConfig.output) {\r\n throw new Error(`The SSR webpack config doesn't have an 'output' property defined.\r\n Ensure that your config factory is returning a valid webpack configuration\r\n for the 'ssrWebpackConfig' property.`);\r\n }\r\n // configs.ssrWebpackConfig.output.path = buildArtifactsPath;\r\n // configs.ssrWebpackConfig.output.filename = serverBundleFileName;\r\n\r\n if (!configs.clientWebpackConfig.output) {\r\n throw new Error(`The client webpack config doesn't have an 'output' property defined.\r\n Ensure that your config factory is returning a valid webpack configuration\r\n for the 'clientWebpackConfig' property.`);\r\n }\r\n\r\n const buildArtifactsPath =\r\n customBuildArtifactsPath ||\r\n configs.ssrWebpackConfig.output.path ||\r\n configs.clientWebpackConfig.output.path;\r\n\r\n if (!buildArtifactsPath) {\r\n throw new Error(`No path was specified for your webpack build artifacts. The SSR Middleware needs to know where your\r\n webpack build artifacts are located in order to fulfill it's glorious destiny. You can specify a path via the options provided to\r\n the 'startDevServer' function, otherwise we'll attempt to use the value specified in your SSR webpack config or client webpack config,\r\n respectively.`);\r\n }\r\n\r\n const serverBundleFileName =\r\n customServerBundleFileName || configs.ssrWebpackConfig.output.filename || 'server.bundle.js';\r\n // configs.clientWebpackConfig.output.path = buildArtifactsPath;\r\n\r\n // If a `tunnelUrl` is provided, be sure to set the `publicPath` property of the client\r\n // webpack config so that references to static assets will be prefixed with the `tunnelUrl` value.\r\n if (tunnelUrl) {\r\n console.log(`Setting client webpack configuration publicPath to tunnelUrl: ${tunnelUrl}`);\r\n configs.clientWebpackConfig.output.publicPath = tunnelUrl;\r\n }\r\n\r\n // Give devs a chance to modify the webpack configurations before creating the compiler instance.\r\n invokeHook(\r\n hooks.beforeWebpackCompilerCreation,\r\n configs.clientWebpackConfig,\r\n configs.ssrWebpackConfig\r\n );\r\n\r\n const compiler = webpack([configs.clientWebpackConfig, configs.ssrWebpackConfig]);\r\n\r\n // `open` and `openPage` don't seem to work when starting webpack dev server via Node API.\r\n // Seems like this is a known issue with a potential PR: https://github.com/webpack/webpack-dev-server/issues/1510\r\n // But for now, need to work around it by using the `opn` module. Note: CRA does something similar.\r\n // This should happen _after_ WDS has completed compiling, otherwise the render engine request will\r\n // timeout while the WDS server is busy compiling.\r\n // Therefore, attach a custom plugin to the `done` hook of the last compiler that is defined. Webpack\r\n // executes compilers serially, and we only want the plugin to run after everything is done.\r\n if (urlToOpenOnStart) {\r\n let browserOpened = false;\r\n compiler.compilers[compiler.compilers.length - 1].hooks.done.tap(\r\n 'OpenBrowserAfterCompilationPlugin',\r\n (stats) => {\r\n if (!browserOpened) {\r\n console.log('opening browser', stats.compilation.compiler.name);\r\n openBrowser(urlToOpenOnStart).then(() => {\r\n browserOpened = true;\r\n });\r\n }\r\n }\r\n );\r\n }\r\n\r\n // These options get passed on to the underlying webpack-dev-middleware instance used by WebpackDevServer\r\n // `writeToDisk` is essential so that we can `require` the server bundle for rendering, otherwise\r\n // the server bundle is only available in the WDS in-memory file system.\r\n // At some point, we could potentially look into using `https://github.com/floatdrop/require-from-string`\r\n // to `require` the server bundle from the WDS in-memory file system.\r\n // Also, webpack-dev-middleware does expose a `fs` property that allows you to inject your own file-system-like module,\r\n // but WebpackDevServer does not propagate that property to the underlying middleware.\r\n // (it's a fairly new feature of webpack-dev-middleware, though, so maybe something to monitor over time).\r\n const webpackDevMiddlewareOptions = {\r\n serverSideRender: true,\r\n writeToDisk: true,\r\n logLevel: 'debug',\r\n };\r\n\r\n // Options for the webpack-dev-server instance\r\n // We're \"hacking\" a bit here by attaching webpack-dev-middleware options to the WebpackDevServer options.\r\n // This isn't \"documented\" behavior/feature, but WebpackDevServer will pass this options object to\r\n // the underlying webpack-dev-middleware. Naturally, TypeScript doesn't like that, so declare the options\r\n // object as `any` to make TS happy.\r\n const serverOptions: WebpackDevServer.Configuration & WebpackDevMiddleware.Options = {\r\n publicPath: '/',\r\n ...configs.devServerConfig,\r\n inline: true,\r\n contentBase: configs.ssrWebpackConfig.output.path, // buildArtifactsPath,\r\n hot: true,\r\n quiet: false,\r\n stats: 'none',\r\n clientLogLevel: 'info',\r\n // watchContentBase: true,\r\n ...webpackDevMiddlewareOptions,\r\n };\r\n\r\n if (tunnelUrl) {\r\n serverOptions.public = tunnelUrl;\r\n }\r\n\r\n const modulePath = path.join(buildArtifactsPath, serverBundleFileName);\r\n console.log('Resolved server bundle path', modulePath);\r\n const appInvocationInfoResolver =\r\n customAppInvocationInfoResolver ||\r\n getDefaultAppInvocationInfoResolver({ appPathResolver: () => modulePath });\r\n\r\n // Devs may have assigned a value to `serverOptions.after` via `configs.devServerConfig`, so\r\n // preserve the existing value so we can invoke it later.\r\n const originalAfter = serverOptions.after;\r\n serverOptions.after = (app: Application, server: WebpackDevServer) => {\r\n const middleware = ssrMiddleware\r\n ? ssrMiddleware({\r\n appInvocationInfoResolver,\r\n })\r\n : defaultSSRMiddleware({\r\n appInvocationInfoResolver,\r\n });\r\n\r\n // Give devs a chance to add custom middleware before the SSR middleware is registered,\r\n // but after all WDS middleware.\r\n invokeHook(hooks.beforeSSRMiddlewareRegistered, app, server);\r\n\r\n // WDS _should_ handle requests for static assets and socket connections.\r\n // Otherwise, by default we assume all POST requests should be handled by the SSR middleware.\r\n app.post(ssrMiddlewarePath || '*', middleware);\r\n\r\n if (originalAfter) {\r\n originalAfter(app, server);\r\n }\r\n };\r\n\r\n // Remove any existing artifacts (if `clean` is enabled)\r\n if (clean) {\r\n const cleanPaths = [`${path.join(buildArtifactsPath, '**')}`, `!${buildArtifactsPath}`];\r\n console.log('cleaning paths', cleanPaths);\r\n const cleanedPaths = delSync(cleanPaths);\r\n console.log('cleaned paths', cleanedPaths);\r\n }\r\n\r\n // Give devs a chance to modify serverOptions and/or the compiler before creating the WDS instance.\r\n invokeHook(hooks.beforeDevServerCreated, compiler, serverOptions);\r\n\r\n // WDS types don't expose the `use` method from the underlying Express interface.\r\n // So declare as `any` to make the compiler happy.\r\n const server: WebpackDevServer = new WebpackDevServer(compiler, serverOptions);\r\n\r\n // Give devs a chance to add more middleware or whatever prior to starting the server.\r\n invokeHook(hooks.beforeDevServerStarted, server);\r\n\r\n // Start the webpack dev server\r\n server.listen(port, 'localhost', (err?: Error) => {\r\n if (err) {\r\n console.error(err);\r\n return;\r\n }\r\n\r\n console.log(`Starting webpack dev server at localhost:${port}`);\r\n invokeHook(hooks.afterDevServerStarted, server);\r\n });\r\n}\r\n\r\n/**\r\n * @param {Function | undefined} hook\r\n * @param {...unknown} args\r\n */\r\n// eslint-disable-next-line @typescript-eslint/ban-types\r\nfunction invokeHook(hook: Function | undefined, ...args: unknown[]) {\r\n if (hook && typeof hook === 'function') {\r\n hook(...args);\r\n }\r\n}\r\n\r\n// export function getDefaultAppInvocationInfoResolver(appBundlePath: string) {\r\n// const resolver: AppInvocationInfoResolver = (bodyJson: any) => {\r\n// const resolvedModule = importFresh(appBundlePath);\r\n// const resolvedRenderFunctionName = bodyJson.functionName || 'renderView';\r\n// const renderFunction = resolvedModule[resolvedRenderFunctionName];\r\n\r\n// if (!renderFunction) {\r\n// throw new Error(`The module \"${appBundlePath}\" has no export named \"${resolvedRenderFunctionName}\".\r\n// Ensure that your server bundle is transpiled to CommonJS (or equivalent) format that can be\r\n// resolved by Node.js 'require' statement. And ensure that your server entry point exports a function\r\n// named \"${resolvedRenderFunctionName}\".`);\r\n// }\r\n\r\n// const renderFunctionArgs = bodyJson.args;\r\n\r\n// return {\r\n// renderFunction,\r\n// renderFunctionArgs,\r\n// };\r\n// };\r\n\r\n// return resolver;\r\n// }\r\n"]},"all":true},"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\index.ts":{"path":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\index.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":169}},"2":{"start":{"line":4,"column":15},"end":{"line":4,"column":34}},"3":{"start":{"line":5,"column":0},"end":{"line":5,"column":139}},"4":{"start":{"line":5,"column":95},"end":{"line":5,"column":133}},"5":{"start":{"line":6,"column":18},"end":{"line":6,"column":40}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":128}},"7":{"start":{"line":7,"column":88},"end":{"line":7,"column":122}},"8":{"start":{"line":8,"column":22},"end":{"line":8,"column":48}},"9":{"start":{"line":9,"column":0},"end":{"line":9,"column":130}},"10":{"start":{"line":9,"column":87},"end":{"line":9,"column":124}},"11":{"start":{"line":10,"column":28},"end":{"line":10,"column":60}},"12":{"start":{"line":11,"column":0},"end":{"line":11,"column":158}},"13":{"start":{"line":11,"column":98},"end":{"line":11,"column":152}},"14":{"start":{"line":12,"column":41},"end":{"line":12,"column":86}},"15":{"start":{"line":13,"column":0},"end":{"line":13,"column":193}},"16":{"start":{"line":13,"column":109},"end":{"line":13,"column":187}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":5,"column":81},"end":{"line":5,"column":82}},"loc":{"start":{"line":5,"column":93},"end":{"line":5,"column":135}},"line":5},"1":{"name":"(anonymous_1)","decl":{"start":{"line":7,"column":74},"end":{"line":7,"column":75}},"loc":{"start":{"line":7,"column":86},"end":{"line":7,"column":124}},"line":7},"2":{"name":"(anonymous_2)","decl":{"start":{"line":9,"column":73},"end":{"line":9,"column":74}},"loc":{"start":{"line":9,"column":85},"end":{"line":9,"column":126}},"line":9},"3":{"name":"(anonymous_3)","decl":{"start":{"line":11,"column":84},"end":{"line":11,"column":85}},"loc":{"start":{"line":11,"column":96},"end":{"line":11,"column":154}},"line":11},"4":{"name":"(anonymous_4)","decl":{"start":{"line":13,"column":95},"end":{"line":13,"column":96}},"loc":{"start":{"line":13,"column":107},"end":{"line":13,"column":189}},"line":13}},"branchMap":{},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0},"f":{"0":0,"1":0,"2":0,"3":0,"4":0},"b":{},"inputSourceMap":{"version":3,"file":"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/index.ts","sources":["C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AAAxC,+GAAA,qBAAqB,OAAA;AAC9B,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AACvB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,6DAAiE;AAAxD,+HAAA,wBAAwB,OAAA;AACjC,uFAAyF;AAAhF,uJAAA,mCAAmC,OAAA;AAE5C,oDAAoD;AACpD,uEAAuE;AACvE,2FAA2F;AAC3F,6GAA6G;AAE7G,cAAc;AAEd,wDAAwD;AACxD,+BAA+B;AAC/B,wDAAwD;AACxD,qCAAqC;AACrC,4CAA4C;AAC5C,yBAAyB;AACzB,gBAAgB;AAChB,qBAAqB;AACrB,yBAAyB;AACzB,0CAA0C;AAC1C,iDAAiD;AACjD,uGAAuG;AACvG,YAAY;AACZ,SAAS;AACT,+BAA+B;AAC/B,4BAA4B;AAC5B,UAAU;AACV,IAAI","sourcesContent":["export { startRenderHostTunnel } from './tunnel';\r\nexport { startDevServer } from './devServer';\r\nexport { ssrMiddleware } from './ssrMiddleware';\r\nexport { startRenderingHostServer } from './renderingHostServer';\r\nexport { getDefaultAppInvocationInfoResolver } from './defaultAppInvocationInfoResolver';\r\n\r\n// const jssConfig = require('../scjssconfig.json');\r\n// const ssrWebpackConfig = require('../server/server.webpack.config');\r\n// const craWebpackConfig = require('../node_modules/react-scripts/config/webpack.config');\r\n// const craWebpackDevServerConfig = require('../node_modules/react-scripts/config/webpackDevServer.config');\r\n\r\n// doIt(5000);\r\n\r\n// // invoking code, to be called from within sample app\r\n// function doIt(port = 5000) {\r\n// startRenderHostTunnel('http://localhost', { port })\r\n// .then((tunnelUrl: string) => {\r\n// // generateHtmlTemplate(tunnelUrl);\r\n// startDevServer({\r\n// port,\r\n// tunnelUrl,\r\n// configFactory,\r\n// buildArtifactsPath: '../build',\r\n// serverBundleFileName: 'server.bundle',\r\n// urlToOpenOnStart: `${jssConfig.sitecore.layoutServiceHost}?sc_renderengineurl=${tunnelUrl}`,\r\n// });\r\n// })\r\n// .catch((err: Error) => {\r\n// console.error(err);\r\n// });\r\n// }\r\n"]},"all":true},"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\renderingHostServer.ts":{"path":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\renderingHostServer.ts","statementMap":{"0":{"start":{"line":2,"column":22},"end":{"line":4,"column":1}},"1":{"start":{"line":3,"column":4},"end":{"line":3,"column":62}},"2":{"start":{"line":5,"column":0},"end":{"line":5,"column":62}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":42}},"4":{"start":{"line":7,"column":22},"end":{"line":7,"column":61}},"5":{"start":{"line":8,"column":18},"end":{"line":8,"column":53}},"6":{"start":{"line":11,"column":24},"end":{"line":11,"column":50}},"7":{"start":{"line":12,"column":43},"end":{"line":12,"column":88}},"8":{"start":{"line":17,"column":19},"end":{"line":17,"column":38}},"9":{"start":{"line":18,"column":4},"end":{"line":23,"column":5}},"10":{"start":{"line":19,"column":38},"end":{"line":21,"column":37}},"11":{"start":{"line":22,"column":8},"end":{"line":22,"column":42}},"12":{"start":{"line":24,"column":38},"end":{"line":24,"column":147}},"13":{"start":{"line":25,"column":23},"end":{"line":31,"column":10}},"14":{"start":{"line":33,"column":4},"end":{"line":33,"column":60}},"15":{"start":{"line":35,"column":4},"end":{"line":35,"column":54}},"16":{"start":{"line":36,"column":4},"end":{"line":36,"column":67}},"17":{"start":{"line":39,"column":4},"end":{"line":39,"column":50}},"18":{"start":{"line":41,"column":4},"end":{"line":48,"column":7}},"19":{"start":{"line":42,"column":8},"end":{"line":45,"column":9}},"20":{"start":{"line":43,"column":12},"end":{"line":43,"column":31}},"21":{"start":{"line":44,"column":12},"end":{"line":44,"column":19}},"22":{"start":{"line":46,"column":8},"end":{"line":46,"column":70}},"23":{"start":{"line":47,"column":8},"end":{"line":47,"column":53}},"24":{"start":{"line":50,"column":0},"end":{"line":50,"column":60}},"25":{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},"26":{"start":{"line":58,"column":8},"end":{"line":58,"column":22}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":2,"column":56},"end":{"line":2,"column":57}},"loc":{"start":{"line":2,"column":71},"end":{"line":4,"column":1}},"line":2},"1":{"name":"startRenderingHostServer","decl":{"start":{"line":16,"column":9},"end":{"line":16,"column":33}},"loc":{"start":{"line":16,"column":223},"end":{"line":49,"column":1}},"line":16},"2":{"name":"(anonymous_2)","decl":{"start":{"line":41,"column":34},"end":{"line":41,"column":35}},"loc":{"start":{"line":41,"column":43},"end":{"line":48,"column":5}},"line":41},"3":{"name":"invokeHook","decl":{"start":{"line":56,"column":9},"end":{"line":56,"column":19}},"loc":{"start":{"line":56,"column":35},"end":{"line":60,"column":1}},"line":56}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":22},"end":{"line":4,"column":1}},"type":"binary-expr","locations":[{"start":{"line":2,"column":23},"end":{"line":2,"column":27}},{"start":{"line":2,"column":31},"end":{"line":2,"column":51}},{"start":{"line":2,"column":56},"end":{"line":4,"column":1}}],"line":2},"1":{"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":61}},"type":"cond-expr","locations":[{"start":{"line":3,"column":37},"end":{"line":3,"column":40}},{"start":{"line":3,"column":43},"end":{"line":3,"column":61}}],"line":3},"2":{"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":33}},"type":"binary-expr","locations":[{"start":{"line":3,"column":12},"end":{"line":3,"column":15}},{"start":{"line":3,"column":19},"end":{"line":3,"column":33}}],"line":3},"3":{"loc":{"start":{"line":16,"column":36},"end":{"line":16,"column":44}},"type":"default-arg","locations":[{"start":{"line":16,"column":43},"end":{"line":16,"column":44}}],"line":16},"4":{"loc":{"start":{"line":16,"column":46},"end":{"line":16,"column":68}},"type":"default-arg","locations":[{"start":{"line":16,"column":57},"end":{"line":16,"column":68}}],"line":16},"5":{"loc":{"start":{"line":16,"column":70},"end":{"line":16,"column":80}},"type":"default-arg","locations":[{"start":{"line":16,"column":78},"end":{"line":16,"column":80}}],"line":16},"6":{"loc":{"start":{"line":16,"column":82},"end":{"line":16,"column":98}},"type":"default-arg","locations":[{"start":{"line":16,"column":96},"end":{"line":16,"column":98}}],"line":16},"7":{"loc":{"start":{"line":16,"column":100},"end":{"line":16,"column":124}},"type":"default-arg","locations":[{"start":{"line":16,"column":120},"end":{"line":16,"column":124}}],"line":16},"8":{"loc":{"start":{"line":18,"column":4},"end":{"line":23,"column":5}},"type":"if","locations":[{"start":{"line":18,"column":4},"end":{"line":23,"column":5}},{"start":{"line":18,"column":4},"end":{"line":23,"column":5}}],"line":18},"9":{"loc":{"start":{"line":19,"column":38},"end":{"line":21,"column":37}},"type":"cond-expr","locations":[{"start":{"line":20,"column":14},"end":{"line":20,"column":37}},{"start":{"line":21,"column":14},"end":{"line":21,"column":37}}],"line":19},"10":{"loc":{"start":{"line":19,"column":38},"end":{"line":19,"column":110}},"type":"binary-expr","locations":[{"start":{"line":19,"column":38},"end":{"line":19,"column":61}},{"start":{"line":19,"column":65},"end":{"line":19,"column":110}}],"line":19},"11":{"loc":{"start":{"line":24,"column":38},"end":{"line":24,"column":147}},"type":"binary-expr","locations":[{"start":{"line":24,"column":38},"end":{"line":24,"column":69}},{"start":{"line":24,"column":73},"end":{"line":24,"column":147}}],"line":24},"12":{"loc":{"start":{"line":25,"column":23},"end":{"line":31,"column":10}},"type":"cond-expr","locations":[{"start":{"line":26,"column":10},"end":{"line":28,"column":10}},{"start":{"line":29,"column":10},"end":{"line":31,"column":10}}],"line":25},"13":{"loc":{"start":{"line":35,"column":16},"end":{"line":35,"column":40}},"type":"binary-expr","locations":[{"start":{"line":35,"column":16},"end":{"line":35,"column":33}},{"start":{"line":35,"column":37},"end":{"line":35,"column":40}}],"line":35},"14":{"loc":{"start":{"line":42,"column":8},"end":{"line":45,"column":9}},"type":"if","locations":[{"start":{"line":42,"column":8},"end":{"line":45,"column":9}},{"start":{"line":42,"column":8},"end":{"line":45,"column":9}}],"line":42},"15":{"loc":{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},"type":"if","locations":[{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},{"start":{"line":57,"column":4},"end":{"line":59,"column":5}}],"line":57},"16":{"loc":{"start":{"line":57,"column":8},"end":{"line":57,"column":42}},"type":"binary-expr","locations":[{"start":{"line":57,"column":8},"end":{"line":57,"column":12}},{"start":{"line":57,"column":16},"end":{"line":57,"column":42}}],"line":57}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0},"f":{"0":0,"1":0,"2":0,"3":0},"b":{"0":[0,0,0],"1":[0,0],"2":[0,0],"3":[0],"4":[0],"5":[0],"6":[0],"7":[0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0]},"inputSourceMap":{"version":3,"file":"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/renderingHostServer.ts","sources":["C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/renderingHostServer.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAsC;AACtC,sDAA2D;AAE3D,0CAA0C;AAC1C,2BAA2B;AAC3B,mDAIyB;AACzB,yFAAyF;AAi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ACnB,OAAO;SACR;QAED,OAAO,CAAC,GAAG,CAAC,8BAA8B,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC;QAC9D,UAAU,CAAC,KAAK,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC;AApDD,4DAoDC;AAED;;;GAGG;AACH,wDAAwD;AACxD,SAAS,UAAU,CAAC,IAA0B,EAAE,GAAG,IAAe;IAChE,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;QACtC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;KACf;AACH,CAAC;AAED,iFAAiF;AACjF,qEAAqE;AACrE,yDAAyD;AACzD,mDAAmD;AACnD,sFAAsF;AACtF,sDAAsD;AACtD,gFAAgF;AAChF,yEAAyE;AAEzE,6BAA6B;AAC7B,yGAAyG;AACzG,sGAAsG;AACtG,8GAA8G;AAC9G,oDAAoD;AACpD,QAAQ;AAER,gDAAgD;AAEhD,eAAe;AACf,uCAAuC;AACvC,uHAAuH;AACvH,0CAA0C;AAC1C,WAAW;AACX,4BAA4B;AAC5B,SAAS;AACT,OAAO;AAEP,qBAAqB;AACrB,IAAI","sourcesContent":["import compression from 'compression';\r\nimport express, { Express, RequestHandler } from 'express';\r\nimport { PathParams } from 'express-serve-static-core';\r\n// import importFresh from 'import-fresh';\r\n// import path from 'path';\r\nimport {\r\n AppInvocationInfoResolver,\r\n SSRMiddleware,\r\n ssrMiddleware as defaultSSRMiddleware,\r\n} from './ssrMiddleware';\r\nimport { getDefaultAppInvocationInfoResolver } from './defaultAppInvocationInfoResolver';\r\n\r\nexport interface RenderingHostServerOptions {\r\n /**\r\n * The port number the server should listen on. Defaults to `0` if no value is provided;\r\n * @default 0\r\n */\r\n port?: number;\r\n /**\r\n * The hostname the server should bind to. Defaults to `localhost` if no value is provided.\r\n * @default localhost\r\n */\r\n hostname?: string;\r\n hooks?: {\r\n beforeSSRMiddlewareRegistered?: (server: Express) => void;\r\n beforeStaticFileMiddlewareRegistered?: (server: Express) => void;\r\n beforeServerStarted?: (server: Express) => void;\r\n afterServerStarted?: (server: Express) => void;\r\n };\r\n ssrMiddleware?: SSRMiddleware;\r\n /**\r\n * Defines the path for which the SSR Middleware is invoked. Defaults to `'*'` if no value is provided.\r\n * More information can be found in the Express docs: https://expressjs.com/en/4x/api.html#path-examples\r\n * @default '*'\r\n */\r\n ssrMiddlewarePath?: PathParams;\r\n appInvocationInfoResolver?: AppInvocationInfoResolver;\r\n middlewares: {\r\n compression?: RequestHandler;\r\n };\r\n enableCompression?: boolean;\r\n}\r\n\r\n/**\r\n * @param {RenderingHostServerOptions} config\r\n */\r\nexport function startRenderingHostServer({\r\n port = 0,\r\n hostname = 'localhost',\r\n hooks = {},\r\n middlewares = {},\r\n enableCompression = true,\r\n ssrMiddleware,\r\n ssrMiddlewarePath,\r\n appInvocationInfoResolver: customAppInvocationInfoResolver,\r\n}: RenderingHostServerOptions) {\r\n const server: Express = express();\r\n\r\n if (enableCompression) {\r\n const compressionMiddleware =\r\n middlewares.compression && typeof middlewares.compression === 'function'\r\n ? middlewares.compression\r\n : compression();\r\n server.use(compressionMiddleware);\r\n }\r\n\r\n const appInvocationInfoResolver =\r\n customAppInvocationInfoResolver || getDefaultAppInvocationInfoResolver({});\r\n\r\n const middleware = ssrMiddleware\r\n ? ssrMiddleware({\r\n appInvocationInfoResolver,\r\n })\r\n : defaultSSRMiddleware({\r\n appInvocationInfoResolver,\r\n });\r\n\r\n // Give devs a chance to add custom middleware before the SSR middleware is registered.\r\n invokeHook(hooks.beforeSSRMiddlewareRegistered, server);\r\n\r\n // Otherwise, by default we assume all POST requests should be handled by the SSR middleware.\r\n server.post(ssrMiddlewarePath || '*', middleware);\r\n\r\n invokeHook(hooks.beforeStaticFileMiddlewareRegistered, server);\r\n // TODO: register static asset middleware\r\n\r\n // Give devs a chance to add more middleware or whatever prior to starting the server.\r\n invokeHook(hooks.beforeServerStarted, server);\r\n // Start the webpack dev server\r\n server.listen(port, hostname, (err?: Error) => {\r\n if (err) {\r\n console.error(err);\r\n return;\r\n }\r\n\r\n console.log(`Starting rendering host at ${hostname}:${port}`);\r\n invokeHook(hooks.afterServerStarted, server);\r\n });\r\n}\r\n\r\n/**\r\n * @param {Function | undefined} hook\r\n * @param {...unknown} args\r\n */\r\n// eslint-disable-next-line @typescript-eslint/ban-types\r\nfunction invokeHook(hook: Function | undefined, ...args: unknown[]) {\r\n if (hook && typeof hook === 'function') {\r\n hook(...args);\r\n }\r\n}\r\n\r\n// function getDefaultAppInvocationInfoResolver(baseAppPath: string = './dist') {\r\n// const resolver: AppInvocationInfoResolver = (bodyJson: any) => {\r\n// // default resolution assumes folder structure of:\r\n// // ./dist/{JSSAppName}/{ServerBundleName}.js\r\n// const modulePath = path.resolve(baseAppPath, bodyJson.id, bodyJson.moduleName);\r\n// const resolvedModule = importFresh(modulePath);\r\n// const resolvedRenderFunctionName = bodyJson.functionName || 'renderView';\r\n// const renderFunction = resolvedModule[resolvedRenderFunctionName];\r\n\r\n// if (!renderFunction) {\r\n// throw new Error(`The module \"${modulePath}\" has no export named \"${resolvedRenderFunctionName}\".\r\n// Ensure that your server bundle is transpiled to CommonJS (or equivalent) format that can be\r\n// resolved by Node.js 'require' statement. And ensure that your server entry point exports a function\r\n// named \"${resolvedRenderFunctionName}\".`);\r\n// }\r\n\r\n// const renderFunctionArgs = bodyJson.args;\r\n\r\n// return {\r\n// renderFunction: (...args) => {\r\n// console.log(`[SSR] rendering app at ${modulePath} via render function named ${resolvedRenderFunctionName}`);\r\n// return renderFunction(...args);\r\n// },\r\n// renderFunctionArgs,\r\n// };\r\n// };\r\n\r\n// return resolver;\r\n// }\r\n"]},"all":true},"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\ssrMiddleware.ts":{"path":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\ssrMiddleware.ts","statementMap":{"0":{"start":{"line":2,"column":22},"end":{"line":4,"column":1}},"1":{"start":{"line":3,"column":4},"end":{"line":3,"column":62}},"2":{"start":{"line":5,"column":0},"end":{"line":5,"column":62}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":227}},"4":{"start":{"line":7,"column":15},"end":{"line":7,"column":47}},"5":{"start":{"line":10,"column":22},"end":{"line":30,"column":1}},"6":{"start":{"line":11,"column":4},"end":{"line":13,"column":5}},"7":{"start":{"line":12,"column":8},"end":{"line":12,"column":89}},"8":{"start":{"line":14,"column":4},"end":{"line":29,"column":6}},"9":{"start":{"line":16,"column":8},"end":{"line":28,"column":11}},"10":{"start":{"line":18,"column":12},"end":{"line":20,"column":13}},"11":{"start":{"line":19,"column":16},"end":{"line":19,"column":73}},"12":{"start":{"line":21,"column":35},"end":{"line":21,"column":80}},"13":{"start":{"line":22,"column":12},"end":{"line":22,"column":99}},"14":{"start":{"line":23,"column":12},"end":{"line":23,"column":90}},"15":{"start":{"line":26,"column":12},"end":{"line":26,"column":31}},"16":{"start":{"line":27,"column":12},"end":{"line":27,"column":32}},"17":{"start":{"line":31,"column":0},"end":{"line":31,"column":38}},"18":{"start":{"line":37,"column":21},"end":{"line":60,"column":5}},"19":{"start":{"line":38,"column":8},"end":{"line":59,"column":9}},"20":{"start":{"line":39,"column":12},"end":{"line":39,"column":46}},"21":{"start":{"line":41,"column":13},"end":{"line":59,"column":9}},"22":{"start":{"line":43,"column":35},"end":{"line":43,"column":37}},"23":{"start":{"line":44,"column":12},"end":{"line":51,"column":13}},"24":{"start":{"line":45,"column":16},"end":{"line":45,"column":64}},"25":{"start":{"line":49,"column":16},"end":{"line":49,"column":42}},"26":{"start":{"line":50,"column":16},"end":{"line":50,"column":23}},"27":{"start":{"line":52,"column":12},"end":{"line":52,"column":62}},"28":{"start":{"line":53,"column":12},"end":{"line":53,"column":38}},"29":{"start":{"line":57,"column":12},"end":{"line":57,"column":56}},"30":{"start":{"line":58,"column":12},"end":{"line":58,"column":34}},"31":{"start":{"line":61,"column":4},"end":{"line":61,"column":20}},"32":{"start":{"line":63,"column":0},"end":{"line":63,"column":70}},"33":{"start":{"line":68,"column":23},"end":{"line":68,"column":50}},"34":{"start":{"line":69,"column":4},"end":{"line":69,"column":64}},"35":{"start":{"line":70,"column":4},"end":{"line":77,"column":7}},"36":{"start":{"line":71,"column":8},"end":{"line":76,"column":11}},"37":{"start":{"line":72,"column":36},"end":{"line":72,"column":71}},"38":{"start":{"line":73,"column":12},"end":{"line":75,"column":45}},"39":{"start":{"line":74,"column":32},"end":{"line":74,"column":45}},"40":{"start":{"line":75,"column":32},"end":{"line":75,"column":43}},"41":{"start":{"line":79,"column":0},"end":{"line":79,"column":54}},"42":{"start":{"line":85,"column":4},"end":{"line":85,"column":30}},"43":{"start":{"line":86,"column":4},"end":{"line":86,"column":25}},"44":{"start":{"line":87,"column":4},"end":{"line":90,"column":8}},"45":{"start":{"line":92,"column":0},"end":{"line":92,"column":44}},"46":{"start":{"line":98,"column":4},"end":{"line":105,"column":6}},"47":{"start":{"line":99,"column":8},"end":{"line":104,"column":9}},"48":{"start":{"line":100,"column":12},"end":{"line":100,"column":73}},"49":{"start":{"line":103,"column":12},"end":{"line":103,"column":86}},"50":{"start":{"line":107,"column":0},"end":{"line":107,"column":66}},"51":{"start":{"line":114,"column":4},"end":{"line":129,"column":5}},"52":{"start":{"line":116,"column":8},"end":{"line":125,"column":11}},"53":{"start":{"line":117,"column":12},"end":{"line":124,"column":15}},"54":{"start":{"line":118,"column":16},"end":{"line":120,"column":17}},"55":{"start":{"line":119,"column":20},"end":{"line":119,"column":34}},"56":{"start":{"line":121,"column":16},"end":{"line":123,"column":17}},"57":{"start":{"line":122,"column":20},"end":{"line":122,"column":54}},"58":{"start":{"line":128,"column":8},"end":{"line":128,"column":65}},"59":{"start":{"line":130,"column":4},"end":{"line":130,"column":45}},"60":{"start":{"line":132,"column":0},"end":{"line":132,"column":62}},"61":{"start":{"line":137,"column":4},"end":{"line":146,"column":5}},"62":{"start":{"line":138,"column":21},"end":{"line":138,"column":43}},"63":{"start":{"line":140,"column":8},"end":{"line":142,"column":9}},"64":{"start":{"line":141,"column":12},"end":{"line":141,"column":24}},"65":{"start":{"line":145,"column":8},"end":{"line":145,"column":70}},"66":{"start":{"line":147,"column":4},"end":{"line":147,"column":16}},"67":{"start":{"line":149,"column":0},"end":{"line":149,"column":36}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":2,"column":56},"end":{"line":2,"column":57}},"loc":{"start":{"line":2,"column":71},"end":{"line":4,"column":1}},"line":2},"1":{"name":"(anonymous_1)","decl":{"start":{"line":10,"column":22},"end":{"line":10,"column":23}},"loc":{"start":{"line":10,"column":58},"end":{"line":30,"column":1}},"line":10},"2":{"name":"(anonymous_2)","decl":{"start":{"line":14,"column":11},"end":{"line":14,"column":12}},"loc":{"start":{"line":14,"column":25},"end":{"line":29,"column":5}},"line":14},"3":{"name":"(anonymous_3)","decl":{"start":{"line":17,"column":18},"end":{"line":17,"column":19}},"loc":{"start":{"line":17,"column":32},"end":{"line":24,"column":9}},"line":17},"4":{"name":"(anonymous_4)","decl":{"start":{"line":25,"column":19},"end":{"line":25,"column":20}},"loc":{"start":{"line":25,"column":28},"end":{"line":28,"column":9}},"line":25},"5":{"name":"getDefaultAppRendererCallback","decl":{"start":{"line":36,"column":9},"end":{"line":36,"column":38}},"loc":{"start":{"line":36,"column":44},"end":{"line":62,"column":1}},"line":36},"6":{"name":"(anonymous_6)","decl":{"start":{"line":37,"column":21},"end":{"line":37,"column":22}},"loc":{"start":{"line":37,"column":51},"end":{"line":60,"column":5}},"line":37},"7":{"name":"readRequestBodyAsJson","decl":{"start":{"line":67,"column":9},"end":{"line":67,"column":30}},"loc":{"start":{"line":67,"column":40},"end":{"line":78,"column":1}},"line":67},"8":{"name":"(anonymous_8)","decl":{"start":{"line":70,"column":23},"end":{"line":70,"column":24}},"loc":{"start":{"line":70,"column":44},"end":{"line":77,"column":5}},"line":70},"9":{"name":"(anonymous_9)","decl":{"start":{"line":71,"column":26},"end":{"line":71,"column":27}},"loc":{"start":{"line":71,"column":32},"end":{"line":76,"column":9}},"line":71},"10":{"name":"(anonymous_10)","decl":{"start":{"line":74,"column":22},"end":{"line":74,"column":23}},"loc":{"start":{"line":74,"column":32},"end":{"line":74,"column":45}},"line":74},"11":{"name":"(anonymous_11)","decl":{"start":{"line":75,"column":23},"end":{"line":75,"column":24}},"loc":{"start":{"line":75,"column":32},"end":{"line":75,"column":43}},"line":75},"12":{"name":"respondWithError","decl":{"start":{"line":84,"column":9},"end":{"line":84,"column":25}},"loc":{"start":{"line":84,"column":43},"end":{"line":91,"column":1}},"line":84},"13":{"name":"onReadableStreamDataHandler","decl":{"start":{"line":97,"column":9},"end":{"line":97,"column":36}},"loc":{"start":{"line":97,"column":49},"end":{"line":106,"column":1}},"line":97},"14":{"name":"(anonymous_14)","decl":{"start":{"line":98,"column":11},"end":{"line":98,"column":12}},"loc":{"start":{"line":98,"column":21},"end":{"line":105,"column":5}},"line":98},"15":{"name":"extractJsonFromStreamData","decl":{"start":{"line":112,"column":9},"end":{"line":112,"column":34}},"loc":{"start":{"line":112,"column":58},"end":{"line":131,"column":1}},"line":112},"16":{"name":"(anonymous_16)","decl":{"start":{"line":116,"column":37},"end":{"line":116,"column":38}},"loc":{"start":{"line":116,"column":58},"end":{"line":125,"column":9}},"line":116},"17":{"name":"(anonymous_17)","decl":{"start":{"line":117,"column":39},"end":{"line":117,"column":40}},"loc":{"start":{"line":117,"column":58},"end":{"line":124,"column":13}},"line":117},"18":{"name":"tryParseJson","decl":{"start":{"line":136,"column":9},"end":{"line":136,"column":21}},"loc":{"start":{"line":136,"column":34},"end":{"line":148,"column":1}},"line":136}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":22},"end":{"line":4,"column":1}},"type":"binary-expr","locations":[{"start":{"line":2,"column":23},"end":{"line":2,"column":27}},{"start":{"line":2,"column":31},"end":{"line":2,"column":51}},{"start":{"line":2,"column":56},"end":{"line":4,"column":1}}],"line":2},"1":{"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":61}},"type":"cond-expr","locations":[{"start":{"line":3,"column":37},"end":{"line":3,"column":40}},{"start":{"line":3,"column":43},"end":{"line":3,"column":61}}],"line":3},"2":{"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":33}},"type":"binary-expr","locations":[{"start":{"line":3,"column":12},"end":{"line":3,"column":15}},{"start":{"line":3,"column":19},"end":{"line":3,"column":33}}],"line":3},"3":{"loc":{"start":{"line":11,"column":4},"end":{"line":13,"column":5}},"type":"if","locations":[{"start":{"line":11,"column":4},"end":{"line":13,"column":5}},{"start":{"line":11,"column":4},"end":{"line":13,"column":5}}],"line":11},"4":{"loc":{"start":{"line":18,"column":12},"end":{"line":20,"column":13}},"type":"if","locations":[{"start":{"line":18,"column":12},"end":{"line":20,"column":13}},{"start":{"line":18,"column":12},"end":{"line":20,"column":13}}],"line":18},"5":{"loc":{"start":{"line":22,"column":23},"end":{"line":22,"column":98}},"type":"binary-expr","locations":[{"start":{"line":22,"column":23},"end":{"line":22,"column":60}},{"start":{"line":22,"column":64},"end":{"line":22,"column":98}}],"line":22},"6":{"loc":{"start":{"line":38,"column":8},"end":{"line":59,"column":9}},"type":"if","locations":[{"start":{"line":38,"column":8},"end":{"line":59,"column":9}},{"start":{"line":38,"column":8},"end":{"line":59,"column":9}}],"line":38},"7":{"loc":{"start":{"line":41,"column":13},"end":{"line":59,"column":9}},"type":"if","locations":[{"start":{"line":41,"column":13},"end":{"line":59,"column":9}},{"start":{"line":41,"column":13},"end":{"line":59,"column":9}}],"line":41},"8":{"loc":{"start":{"line":88,"column":22},"end":{"line":88,"column":54}},"type":"binary-expr","locations":[{"start":{"line":88,"column":22},"end":{"line":88,"column":40}},{"start":{"line":88,"column":44},"end":{"line":88,"column":54}}],"line":88},"9":{"loc":{"start":{"line":89,"column":22},"end":{"line":89,"column":46}},"type":"binary-expr","locations":[{"start":{"line":89,"column":22},"end":{"line":89,"column":38}},{"start":{"line":89,"column":42},"end":{"line":89,"column":46}}],"line":89},"10":{"loc":{"start":{"line":99,"column":8},"end":{"line":104,"column":9}},"type":"if","locations":[{"start":{"line":99,"column":8},"end":{"line":104,"column":9}},{"start":{"line":99,"column":8},"end":{"line":104,"column":9}}],"line":99},"11":{"loc":{"start":{"line":114,"column":4},"end":{"line":129,"column":5}},"type":"if","locations":[{"start":{"line":114,"column":4},"end":{"line":129,"column":5}},{"start":{"line":114,"column":4},"end":{"line":129,"column":5}}],"line":114},"12":{"loc":{"start":{"line":114,"column":8},"end":{"line":115,"column":93}},"type":"binary-expr","locations":[{"start":{"line":114,"column":8},"end":{"line":114,"column":23}},{"start":{"line":115,"column":9},"end":{"line":115,"column":47}},{"start":{"line":115,"column":51},"end":{"line":115,"column":92}}],"line":114},"13":{"loc":{"start":{"line":118,"column":16},"end":{"line":120,"column":17}},"type":"if","locations":[{"start":{"line":118,"column":16},"end":{"line":120,"column":17}},{"start":{"line":118,"column":16},"end":{"line":120,"column":17}}],"line":118},"14":{"loc":{"start":{"line":121,"column":16},"end":{"line":123,"column":17}},"type":"if","locations":[{"start":{"line":121,"column":16},"end":{"line":123,"column":17}},{"start":{"line":121,"column":16},"end":{"line":123,"column":17}}],"line":121},"15":{"loc":{"start":{"line":140,"column":8},"end":{"line":142,"column":9}},"type":"if","locations":[{"start":{"line":140,"column":8},"end":{"line":142,"column":9}},{"start":{"line":140,"column":8},"end":{"line":142,"column":9}}],"line":140},"16":{"loc":{"start":{"line":140,"column":12},"end":{"line":140,"column":61}},"type":"binary-expr","locations":[{"start":{"line":140,"column":12},"end":{"line":140,"column":16}},{"start":{"line":140,"column":20},"end":{"line":140,"column":44}},{"start":{"line":140,"column":48},"end":{"line":140,"column":61}}],"line":140}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0},"f":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0},"b":{"0":[0,0,0],"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0,0]},"inputSourceMap":{"version":3,"file":"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/ssrMiddleware.ts","sources":["C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/ssrMiddleware.ts"],"names":[],"mappings":";;;;;;AACA,gDAAwB,CAAC,uBAAuB;AAyChD,uEAAuE;AACvE,6EAA6E;AACtE,MAAM,aAAa,GAAkB,CAAC,EAC3C,yBAAyB,GACJ,EAAE,EAAE;IACzB,IAAI,CAAC,yBAAyB,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;KAClF;IACD,OAAO,CAAC,GAAoB,EAAE,GAAmB,EAAE,EAAE;QACnD,IAAI,QAAwB,CAAC;QAC7B,qBAAqB,CAAC,GAAG,CAAC;aACvB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;aAC1D;YACD,MAAM,cAAc,GAAG,yBAAyB,CAAC,QAAQ,EAAE,GAAG,EA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AAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE;YACrD,OAAO,IAAI,CAAC;SACb;KACF;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,8BAA8B,UAAU,GAAG,EAAE,CAAC,CAAC,CAAC;KAC/D;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAZD,oCAYC","sourcesContent":["import { IncomingMessage, ServerResponse } from 'http';\r\nimport zlib from 'zlib'; // node.js standard lib\r\n\r\nexport type RenderCallback = (\r\n errorValue: Error,\r\n successValue?: string | { [key: string]: unknown } | null\r\n) => void;\r\n\r\nexport type RenderFunction = (callback: RenderCallback, ...args: unknown[]) => void;\r\n\r\nexport interface AppInvocationInfo {\r\n renderFunction: RenderFunction;\r\n renderFunctionArgs: unknown[];\r\n renderFunctionCallback?: RenderCallback;\r\n}\r\n\r\nexport type JsonObject = {\r\n [key: string]: unknown;\r\n id: string;\r\n functionName: string;\r\n moduleName: string;\r\n args: string[];\r\n};\r\n\r\nexport type AppInvocationInfoResolver = (\r\n bodyJson: string | JsonObject,\r\n req: IncomingMessage,\r\n res: ServerResponse\r\n) => AppInvocationInfo;\r\n\r\nexport interface SSRMiddlewareOptions {\r\n appInvocationInfoResolver: AppInvocationInfoResolver;\r\n}\r\n\r\nexport type WebServerMiddleware = (\r\n req: IncomingMessage,\r\n res: ServerResponse,\r\n next?: (err?: unknown) => void\r\n) => void;\r\n\r\nexport type SSRMiddleware = (options: SSRMiddlewareOptions) => WebServerMiddleware;\r\n\r\n// don't assume this middleware will always be used by WebpackDevServer\r\n// it may also be used by a \"standalone\" JSS rendering host / express server.\r\nexport const ssrMiddleware: SSRMiddleware = ({\r\n appInvocationInfoResolver,\r\n}: SSRMiddlewareOptions) => {\r\n if (!appInvocationInfoResolver) {\r\n throw new Error('No AppInvocationInfo resolver was provided for SSR middleware');\r\n }\r\n return (req: IncomingMessage, res: ServerResponse) => {\r\n let callback: RenderCallback;\r\n readRequestBodyAsJson(req)\r\n .then((bodyJson) => {\r\n if (!bodyJson) {\r\n throw new Error(`Request body was not JSON: ${req.url}`);\r\n }\r\n const invocationInfo = appInvocationInfoResolver(bodyJson, req, res);\r\n callback = invocationInfo.renderFunctionCallback || getDefaultAppRendererCallback(res);\r\n invocationInfo.renderFunction(callback, ...invocationInfo.renderFunctionArgs);\r\n })\r\n .catch((err) => {\r\n console.error(err);\r\n callback(err, null);\r\n });\r\n };\r\n};\r\n\r\n// todo: add hook for modifying html / response before end\r\n/**\r\n * @param {ServerResponse} res\r\n */\r\nexport function getDefaultAppRendererCallback(res: ServerResponse) {\r\n const callback: RenderCallback = (errorValue, successValue) => {\r\n if (errorValue) {\r\n respondWithError(res, errorValue);\r\n } else if (typeof successValue !== 'string') {\r\n // Arbitrary object/number/etc - JSON-serialize it\r\n let successValueJson = {};\r\n try {\r\n successValueJson = JSON.stringify(successValue);\r\n } catch (ex) {\r\n // JSON serialization error - pass it back to http caller.\r\n respondWithError(res, ex);\r\n return;\r\n }\r\n res.setHeader('Content-Type', 'application/json');\r\n res.end(successValueJson);\r\n } else {\r\n // String - can bypass JSON-serialization altogether\r\n res.setHeader('Content-Type', 'text/plain');\r\n res.end(successValue);\r\n }\r\n };\r\n return callback;\r\n}\r\n\r\n/**\r\n * @param {IncomingMessage} request\r\n */\r\nexport function readRequestBodyAsJson(request: IncomingMessage): Promise<string | JsonObject> {\r\n const dataWriter = { output: Buffer.from('') };\r\n request.on('data', onReadableStreamDataHandler(dataWriter));\r\n\r\n return new Promise((resolve, reject) => {\r\n request.on('end', () => {\r\n const contentEncoding = request.headers['content-encoding'];\r\n extractJsonFromStreamData(dataWriter.output, contentEncoding)\r\n .then((json) => resolve(json))\r\n .catch((err) => reject(err));\r\n });\r\n });\r\n}\r\n\r\n/**\r\n * @param {ServerResponse} res\r\n * @param {Error} errorValue\r\n */\r\nexport function respondWithError(res: ServerResponse, errorValue: Error) {\r\n console.error(errorValue);\r\n res.statusCode = 500;\r\n res.end(\r\n JSON.stringify({\r\n errorMessage: errorValue.message || errorValue,\r\n errorDetails: errorValue.stack || null,\r\n })\r\n );\r\n}\r\n\r\n/**\r\n * @param {Object} dataWriter\r\n * @param {Buffer} dataWriter.output\r\n */\r\nexport function onReadableStreamDataHandler(dataWriter: { output: Buffer }) {\r\n return (data: Buffer) => {\r\n if (Buffer.isBuffer(data)) {\r\n dataWriter.output = Buffer.concat([dataWriter.output, data]); // append raw buffer\r\n } else {\r\n dataWriter.output = Buffer.concat([dataWriter.output, Buffer.from(data)]);\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * @param {Buffer} data\r\n * @param {string} [contentEncoding]\r\n */\r\nexport function extractJsonFromStreamData(\r\n data: Buffer,\r\n contentEncoding?: string\r\n): Promise<string | JsonObject> {\r\n let responseString: Promise<string>;\r\n\r\n if (\r\n contentEncoding &&\r\n (contentEncoding.indexOf('gzip') !== -1 || contentEncoding.indexOf('deflate') !== -1)\r\n ) {\r\n responseString = new Promise((resolve, reject) => {\r\n zlib.unzip(data, (error, result) => {\r\n if (error) {\r\n reject(error);\r\n }\r\n\r\n if (result) {\r\n resolve(result.toString('utf-8'));\r\n }\r\n });\r\n });\r\n } else {\r\n responseString = Promise.resolve(data.toString('utf-8'));\r\n }\r\n\r\n return responseString.then(tryParseJson);\r\n}\r\n\r\n/**\r\n * @param {string} jsonString\r\n */\r\nexport function tryParseJson(jsonString: string) {\r\n try {\r\n const json = JSON.parse(jsonString);\r\n // handle non-exception-throwing cases\r\n if (json && typeof json === 'object' && json !== null) {\r\n return json;\r\n }\r\n } catch (e) {\r\n console.error(`error parsing json string '${jsonString}'`, e);\r\n }\r\n\r\n return null;\r\n}\r\n"]},"all":true},"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\tunnel.ts":{"path":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\tunnel.ts","statementMap":{"0":{"start":{"line":2,"column":22},"end":{"line":4,"column":1}},"1":{"start":{"line":3,"column":4},"end":{"line":3,"column":62}},"2":{"start":{"line":5,"column":0},"end":{"line":5,"column":62}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":39}},"4":{"start":{"line":7,"column":16},"end":{"line":7,"column":49}},"5":{"start":{"line":13,"column":4},"end":{"line":15,"column":5}},"6":{"start":{"line":14,"column":8},"end":{"line":14,"column":115}},"7":{"start":{"line":16,"column":24},"end":{"line":16,"column":59}},"8":{"start":{"line":17,"column":25},"end":{"line":17,"column":113}},"9":{"start":{"line":18,"column":4},"end":{"line":23,"column":7}},"10":{"start":{"line":19,"column":8},"end":{"line":21,"column":9}},"11":{"start":{"line":20,"column":12},"end":{"line":20,"column":83}},"12":{"start":{"line":22,"column":8},"end":{"line":22,"column":19}},"13":{"start":{"line":25,"column":0},"end":{"line":25,"column":54}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":2,"column":56},"end":{"line":2,"column":57}},"loc":{"start":{"line":2,"column":71},"end":{"line":4,"column":1}},"line":2},"1":{"name":"startRenderHostTunnel","decl":{"start":{"line":12,"column":9},"end":{"line":12,"column":30}},"loc":{"start":{"line":12,"column":100},"end":{"line":24,"column":1}},"line":12},"2":{"name":"(anonymous_2)","decl":{"start":{"line":18,"column":54},"end":{"line":18,"column":55}},"loc":{"start":{"line":18,"column":63},"end":{"line":23,"column":5}},"line":18}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":22},"end":{"line":4,"column":1}},"type":"binary-expr","locations":[{"start":{"line":2,"column":23},"end":{"line":2,"column":27}},{"start":{"line":2,"column":31},"end":{"line":2,"column":51}},{"start":{"line":2,"column":56},"end":{"line":4,"column":1}}],"line":2},"1":{"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":61}},"type":"cond-expr","locations":[{"start":{"line":3,"column":37},"end":{"line":3,"column":40}},{"start":{"line":3,"column":43},"end":{"line":3,"column":61}}],"line":3},"2":{"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":33}},"type":"binary-expr","locations":[{"start":{"line":3,"column":12},"end":{"line":3,"column":15}},{"start":{"line":3,"column":19},"end":{"line":3,"column":33}}],"line":3},"3":{"loc":{"start":{"line":12,"column":47},"end":{"line":12,"column":98}},"type":"default-arg","locations":[{"start":{"line":12,"column":57},"end":{"line":12,"column":98}}],"line":12},"4":{"loc":{"start":{"line":13,"column":4},"end":{"line":15,"column":5}},"type":"if","locations":[{"start":{"line":13,"column":4},"end":{"line":15,"column":5}},{"start":{"line":13,"column":4},"end":{"line":15,"column":5}}],"line":13},"5":{"loc":{"start":{"line":19,"column":8},"end":{"line":21,"column":9}},"type":"if","locations":[{"start":{"line":19,"column":8},"end":{"line":21,"column":9}},{"start":{"line":19,"column":8},"end":{"line":21,"column":9}}],"line":19}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0},"f":{"0":0,"1":0,"2":0},"b":{"0":[0,0,0],"1":[0,0],"2":[0,0],"3":[0],"4":[0,0],"5":[0,0]},"inputSourceMap":{"version":3,"file":"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/tunnel.ts","sources":["C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/tunnel.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAO7C;;;GAGG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,UAAyB,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE;IAElE,IAAI,CAAC,cAAc,EAAE;QACnB,MAAM,IAAI,KAAK,CACb,yFAAyF,CAC1F,CAAC;KACH;IAED,MAAM,WAAW,GAAG,GAAG,cAAc,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IACxD,MAAM,YAAY,mCACb,OAAO,KACV,WAAW,EAAE,SAAS,EACtB,IAAI,EAAE,WAAW,GAClB,CAAC;IAEF,OAAO,eAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,GAAW,EAAE,EAAE;QACtD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAO,CAAC,GAAG,CAAC,+BAA+B,GAAG,SAAS,WAAW,GAAG,CAAC,CAAC;SACxE;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAvBD,sDAuBC","sourcesContent":["import ngrok, { INgrokOptions } from 'ngrok';\r\n\r\nexport interface TunnelOptions extends INgrokOptions {\r\n port?: number;\r\n quiet?: boolean;\r\n}\r\n\r\n/**\r\n * @param {string} renderHostname\r\n * @param {INgrokOptions} options\r\n */\r\nexport function startRenderHostTunnel(\r\n renderHostname: string,\r\n options: INgrokOptions = { port: 80, proto: 'http', quiet: false }\r\n) {\r\n if (!renderHostname) {\r\n throw new Error(\r\n 'Unable to start render host tunnel as no hostname for the rendering host was specified.'\r\n );\r\n }\r\n\r\n const rewriteHost = `${renderHostname}:${options.port}`;\r\n const finalOptions = {\r\n ...options,\r\n host_header: 'rewrite',\r\n addr: rewriteHost,\r\n };\r\n\r\n return ngrok.connect(finalOptions).then((url: string) => {\r\n if (!options.quiet) {\r\n console.log(`Tunnel started, forwarding '${url}' to '${rewriteHost}'`);\r\n }\r\n return url;\r\n });\r\n}\r\n"]},"all":true}}
@@ -1 +0,0 @@
1
- {"parent":null,"pid":38320,"argv":["C:\\Program Files\\nodejs\\node.exe","C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js","test"],"execArgv":[],"cwd":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host","time":1629289340429,"ppid":25888,"coverageFilename":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\.nyc_output\\563d6c6a-8cca-4e78-a19e-4dcb81674520.json","externalId":"","uuid":"563d6c6a-8cca-4e78-a19e-4dcb81674520","files":[]}
@@ -1 +0,0 @@
1
- {"parent":null,"pid":18456,"argv":["C:\\Program Files\\nodejs\\node.exe","C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js","prefix","-g"],"execArgv":[],"cwd":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host","time":1629289336170,"ppid":13448,"coverageFilename":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\.nyc_output\\8f2f93a8-4320-430e-bcc6-3e46695f4783.json","externalId":"","uuid":"8f2f93a8-4320-430e-bcc6-3e46695f4783","files":[]}
@@ -1 +0,0 @@
1
- {"parent":null,"pid":12684,"argv":["C:\\Program Files\\nodejs\\node.exe","C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\node_modules\\nyc\\bin\\nyc.js","npm","test"],"execArgv":[],"cwd":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host","time":1629289325948,"ppid":3936,"coverageFilename":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\.nyc_output\\9f6483cd-f3ec-479b-a026-68580fe44fb5.json","externalId":"","uuid":"9f6483cd-f3ec-479b-a026-68580fe44fb5","files":["C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\defaultAppInvocationInfoResolver.ts","C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\devServer.ts","C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\index.ts","C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\renderingHostServer.ts","C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\ssrMiddleware.ts","C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\tunnel.ts"]}
@@ -1 +0,0 @@
1
- {"parent":"563d6c6a-8cca-4e78-a19e-4dcb81674520","pid":38600,"argv":["C:\\Program Files\\nodejs\\node.exe","C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\node_modules\\mocha\\bin\\mocha","--require","ts-node/register/transpile-only","./src/**/*.test.ts"],"execArgv":[],"cwd":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host","time":1629289344595,"ppid":42948,"coverageFilename":"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\.nyc_output\\ee3d820f-a433-4aaf-9d43-6f8f3558a3a8.json","externalId":"","uuid":"ee3d820f-a433-4aaf-9d43-6f8f3558a3a8","files":[]}
@@ -1 +0,0 @@
1
- {"processes":{"563d6c6a-8cca-4e78-a19e-4dcb81674520":{"parent":null,"children":["ee3d820f-a433-4aaf-9d43-6f8f3558a3a8"]},"8f2f93a8-4320-430e-bcc6-3e46695f4783":{"parent":null,"children":[]},"9f6483cd-f3ec-479b-a026-68580fe44fb5":{"parent":null,"children":[]},"ee3d820f-a433-4aaf-9d43-6f8f3558a3a8":{"parent":"563d6c6a-8cca-4e78-a19e-4dcb81674520","children":[]}},"files":{"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\defaultAppInvocationInfoResolver.ts":["9f6483cd-f3ec-479b-a026-68580fe44fb5"],"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\devServer.ts":["9f6483cd-f3ec-479b-a026-68580fe44fb5"],"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\index.ts":["9f6483cd-f3ec-479b-a026-68580fe44fb5"],"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\renderingHostServer.ts":["9f6483cd-f3ec-479b-a026-68580fe44fb5"],"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\ssrMiddleware.ts":["9f6483cd-f3ec-479b-a026-68580fe44fb5"],"C:\\Users\\cobs\\repos\\jss\\packages\\sitecore-jss-rendering-host\\src\\tunnel.ts":["9f6483cd-f3ec-479b-a026-68580fe44fb5"]},"externalIds":{}}
@@ -1,8 +0,0 @@
1
- {"total": {"lines":{"total":177,"covered":0,"skipped":0,"pct":0},"statements":{"total":183,"covered":0,"skipped":0,"pct":0},"functions":{"total":39,"covered":0,"skipped":0,"pct":0},"branches":{"total":104,"covered":0,"skipped":0,"pct":0}}
2
- ,"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/defaultAppInvocationInfoResolver.ts": {"lines":{"total":16,"covered":0,"skipped":0,"pct":0},"functions":{"total":4,"covered":0,"skipped":0,"pct":0},"statements":{"total":16,"covered":0,"skipped":0,"pct":0},"branches":{"total":7,"covered":0,"skipped":0,"pct":0}}
3
- ,"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/devServer.ts": {"lines":{"total":60,"covered":0,"skipped":0,"pct":0},"functions":{"total":7,"covered":0,"skipped":0,"pct":0},"statements":{"total":60,"covered":0,"skipped":0,"pct":0},"branches":{"total":39,"covered":0,"skipped":0,"pct":0}}
4
- ,"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/index.ts": {"lines":{"total":5,"covered":0,"skipped":0,"pct":0},"functions":{"total":5,"covered":0,"skipped":0,"pct":0},"statements":{"total":10,"covered":0,"skipped":0,"pct":0},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
5
- ,"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/renderingHostServer.ts": {"lines":{"total":23,"covered":0,"skipped":0,"pct":0},"functions":{"total":3,"covered":0,"skipped":0,"pct":0},"statements":{"total":23,"covered":0,"skipped":0,"pct":0},"branches":{"total":23,"covered":0,"skipped":0,"pct":0}}
6
- ,"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/ssrMiddleware.ts": {"lines":{"total":63,"covered":0,"skipped":0,"pct":0},"functions":{"total":18,"covered":0,"skipped":0,"pct":0},"statements":{"total":64,"covered":0,"skipped":0,"pct":0},"branches":{"total":30,"covered":0,"skipped":0,"pct":0}}
7
- ,"C:/Users/cobs/repos/jss/packages/sitecore-jss-rendering-host/src/tunnel.ts": {"lines":{"total":10,"covered":0,"skipped":0,"pct":0},"functions":{"total":2,"covered":0,"skipped":0,"pct":0},"statements":{"total":10,"covered":0,"skipped":0,"pct":0},"branches":{"total":5,"covered":0,"skipped":0,"pct":0}}
8
- }