@wolfstar/nitro-server 0.2.4 → 0.2.5
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 +201 -201
- package/README.md +61 -61
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/runtime.js.map +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2022 Wolfstar Project
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2022 Wolfstar Project
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
# @wolfstar/nitro-server
|
|
2
|
-
|
|
3
|
-
Nitro server integration for Stars projects.
|
|
4
|
-
|
|
5
|
-
The Stars CLI loads this integration on demand when `experimental.enableNitro` is enabled. Existing `stars.config` options and the CLI commands are unchanged.
|
|
6
|
-
Install `vite` and `nitro` in the consuming project; the integration uses the project's own versions and Vite configuration.
|
|
7
|
-
|
|
8
|
-
## Programmatic usage
|
|
9
|
-
|
|
10
|
-
The package exports `NitroBuilder`. Pass a resolved `StarsConfig` and a `BuilderContext` from `@wolfstar/schema`:
|
|
11
|
-
|
|
12
|
-
```typescript
|
|
13
|
-
import { NitroBuilder } from '@wolfstar/nitro-server';
|
|
14
|
-
import type { BuilderContext, ResolvedStarsConfig } from '@wolfstar/schema';
|
|
15
|
-
|
|
16
|
-
export async function build(config: ResolvedStarsConfig, context: BuilderContext) {
|
|
17
|
-
const builder = new NitroBuilder(config, context);
|
|
18
|
-
try {
|
|
19
|
-
return await builder.build();
|
|
20
|
-
} finally {
|
|
21
|
-
await builder.close();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
The host supplies `importFromProject` (project-relative dependency loading with diagnostics) and
|
|
27
|
-
`pluginRegistrations` (the entry transform that activates installed plugins). This explicit boundary keeps the
|
|
28
|
-
integration independent of the CLI and framework runtimes. `watch()` and `close()` implement the shared builder
|
|
29
|
-
lifecycle; `start`, `success`, `failure`, and `log` events expose build status.
|
|
30
|
-
|
|
31
|
-
Nitro uses `nitro/vite` with a virtual server entry forwarding requests to the application default export’s `fetch` method. The configured preset and output directory are preserved.
|
|
32
|
-
|
|
33
|
-
Integration coverage lives in `packages/cli/test/nitro-builder.test.ts`, including real builds through the CLI host.
|
|
34
|
-
|
|
35
|
-
## Development server
|
|
36
|
-
|
|
37
|
-
The package also exports `createNitroServer`, a native Nitro development server through the same `nitro/vite`
|
|
38
|
-
integration — server routes and Nitro's own HMR reload, without a production build:
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
import { createNitroServer } from '@wolfstar/nitro-server';
|
|
42
|
-
import type { ResolvedStarsConfig } from '@wolfstar/schema';
|
|
43
|
-
|
|
44
|
-
export async function dev(config: ResolvedStarsConfig) {
|
|
45
|
-
const server = await createNitroServer(config);
|
|
46
|
-
await server.listen();
|
|
47
|
-
return server; // { vite, nitro, fetch(request), listen(port?), close() }
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
A Nitro instance is created upfront and handed to `nitro/vite` through its `_nitro` option — the same extension
|
|
52
|
-
point framework integrations like Nuxt use to own the instance. This is what makes two things possible that a bare
|
|
53
|
-
`vite.createServer()` wrapper cannot do on its own:
|
|
54
|
-
|
|
55
|
-
- `server.fetch(request)` dispatches straight through Nitro's router without a listening socket, useful for tests
|
|
56
|
-
and for embedding the dev server behind another transport.
|
|
57
|
-
- `server.close()` also calls `nitro.close()`. Nitro's own file watchers and hooks (registered by its Vite plugin)
|
|
58
|
-
only run when Nitro closes; closing just the Vite server would leak them.
|
|
59
|
-
|
|
60
|
-
`server.nitro` exposes the underlying `Nitro` instance (`hooks`, `logger`, `routing`, `updateConfig`) for advanced
|
|
61
|
-
use. `server.vite` is the underlying `ViteDevServer`.
|
|
1
|
+
# @wolfstar/nitro-server
|
|
2
|
+
|
|
3
|
+
Nitro server integration for Stars projects.
|
|
4
|
+
|
|
5
|
+
The Stars CLI loads this integration on demand when `experimental.enableNitro` is enabled. Existing `stars.config` options and the CLI commands are unchanged.
|
|
6
|
+
Install `vite` and `nitro` in the consuming project; the integration uses the project's own versions and Vite configuration.
|
|
7
|
+
|
|
8
|
+
## Programmatic usage
|
|
9
|
+
|
|
10
|
+
The package exports `NitroBuilder`. Pass a resolved `StarsConfig` and a `BuilderContext` from `@wolfstar/schema`:
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { NitroBuilder } from '@wolfstar/nitro-server';
|
|
14
|
+
import type { BuilderContext, ResolvedStarsConfig } from '@wolfstar/schema';
|
|
15
|
+
|
|
16
|
+
export async function build(config: ResolvedStarsConfig, context: BuilderContext) {
|
|
17
|
+
const builder = new NitroBuilder(config, context);
|
|
18
|
+
try {
|
|
19
|
+
return await builder.build();
|
|
20
|
+
} finally {
|
|
21
|
+
await builder.close();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The host supplies `importFromProject` (project-relative dependency loading with diagnostics) and
|
|
27
|
+
`pluginRegistrations` (the entry transform that activates installed plugins). This explicit boundary keeps the
|
|
28
|
+
integration independent of the CLI and framework runtimes. `watch()` and `close()` implement the shared builder
|
|
29
|
+
lifecycle; `start`, `success`, `failure`, and `log` events expose build status.
|
|
30
|
+
|
|
31
|
+
Nitro uses `nitro/vite` with a virtual server entry forwarding requests to the application default export’s `fetch` method. The configured preset and output directory are preserved.
|
|
32
|
+
|
|
33
|
+
Integration coverage lives in `packages/cli/test/nitro-builder.test.ts`, including real builds through the CLI host.
|
|
34
|
+
|
|
35
|
+
## Development server
|
|
36
|
+
|
|
37
|
+
The package also exports `createNitroServer`, a native Nitro development server through the same `nitro/vite`
|
|
38
|
+
integration — server routes and Nitro's own HMR reload, without a production build:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { createNitroServer } from '@wolfstar/nitro-server';
|
|
42
|
+
import type { ResolvedStarsConfig } from '@wolfstar/schema';
|
|
43
|
+
|
|
44
|
+
export async function dev(config: ResolvedStarsConfig) {
|
|
45
|
+
const server = await createNitroServer(config);
|
|
46
|
+
await server.listen();
|
|
47
|
+
return server; // { vite, nitro, fetch(request), listen(port?), close() }
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
A Nitro instance is created upfront and handed to `nitro/vite` through its `_nitro` option — the same extension
|
|
52
|
+
point framework integrations like Nuxt use to own the instance. This is what makes two things possible that a bare
|
|
53
|
+
`vite.createServer()` wrapper cannot do on its own:
|
|
54
|
+
|
|
55
|
+
- `server.fetch(request)` dispatches straight through Nitro's router without a listening socket, useful for tests
|
|
56
|
+
and for embedding the dev server behind another transport.
|
|
57
|
+
- `server.close()` also calls `nitro.close()`. Nitro's own file watchers and hooks (registered by its Vite plugin)
|
|
58
|
+
only run when Nitro closes; closing just the Vite server would leak them.
|
|
59
|
+
|
|
60
|
+
`server.nitro` exposes the underlying `Nitro` instance (`hooks`, `logger`, `routing`, `updateConfig`) for advanced
|
|
61
|
+
use. `server.vite` is the underlying `ViteDevServer`.
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/config.ts","../../src/build.ts","../../src/dev.ts"],"sourcesContent":["import type { BuilderContext, ResolvedStarsConfig } from '@wolfstar/schema';\nimport type { NitroConfig } from 'nitro/types';\nimport type { InlineConfig, Plugin, UserConfig } from 'vite';\nimport { defaultBuilderContext, toArray, type ViteModule } from '@wolfstar/vite-server/internal';\n\nexport const NITRO_ENTRY_ID = '#stars/nitro-entry';\nexport const NITRO_ERROR_HANDLER_ID = '#stars/nitro-error-handler';\nexport type NitroViteModule = typeof import('nitro/vite');\nexport interface NitroHooks {\n\tconfigureNitro?(options: NitroConfig): void | Promise<void>;\n\tconfigureVite?(options: InlineConfig, command: 'build' | 'serve'): void | Promise<void>;\n}\n\n/** Type-check all upstream Nitro options without adding Nitro to the shared schema runtime. */\nexport function defineNitroConfig(config: NitroConfig): NitroConfig {\n\treturn config;\n}\n\nexport function createNitroConfig(config: ResolvedStarsConfig): NitroConfig {\n\tconst raw = config.experimental.nitro as NitroConfig;\n\treturn {\n\t\t...raw,\n\t\trootDir: config.root,\n\t\tpreset: config.experimental.nitro.preset,\n\t\toutput: { ...raw.output, dir: config.build.outDir },\n\t\tserverEntry: NITRO_ENTRY_ID,\n\t\t// A Stars app has no HTML renderer, so Nitro's default content negotiation (which favors\n\t\t// an HTML error page) is not useful here; always answer errors as JSON instead.\n\t\terrorHandler: raw.errorHandler ?? NITRO_ERROR_HANDLER_ID,\n\t\tvirtual: {\n\t\t\t...raw.virtual,\n\t\t\t[NITRO_ENTRY_ID]: () =>\n\t\t\t\t[\n\t\t\t\t\t`import client from ${JSON.stringify(config.entry)};`,\n\t\t\t\t\t'if (typeof client?.fetch !== \"function\") throw new TypeError(\"The Stars Nitro entry must default-export an object with fetch(request).\");',\n\t\t\t\t\t'export default { fetch: (request) => client.fetch(request) };'\n\t\t\t\t].join('\\n'),\n\t\t\t[NITRO_ERROR_HANDLER_ID]: () =>\n\t\t\t\t[\n\t\t\t\t\t'export default async function starsErrorHandler(error, event, { defaultHandler }) {',\n\t\t\t\t\t' const result = await defaultHandler(error, event, { json: true });',\n\t\t\t\t\t' const status = result.status ?? error.status ?? 500;',\n\t\t\t\t\t' const body = typeof result.body === \"string\" ? result.body : JSON.stringify(result.body ?? { message: error.message, status });',\n\t\t\t\t\t' return new Response(body, { status, statusText: result.statusText, headers: { \"content-type\": \"application/json; charset=utf-8\", ...result.headers } });',\n\t\t\t\t\t'}'\n\t\t\t\t].join('\\n')\n\t\t}\n\t};\n}\n\nexport async function createNitroViteConfig(\n\tconfig: ResolvedStarsConfig,\n\tcontext: BuilderContext = defaultBuilderContext,\n\thooks: NitroHooks = {},\n\tcommand: 'build' | 'serve' = 'build'\n): Promise<{ vite: ViteModule; options: InlineConfig }> {\n\tconst [vite, nitro] = await Promise.all([\n\t\tcontext.importFromProject<ViteModule>(config.root, 'vite', 'Install it with `pnpm add -D vite`.'),\n\t\tcontext.importFromProject<NitroViteModule>(config.root, 'nitro/vite', 'Install it with `pnpm add -D nitro`.')\n\t]);\n\tconst nitroConfig = createNitroConfig(config);\n\tawait hooks.configureNitro?.(nitroConfig);\n\tconst inline = config.vite as UserConfig;\n\tconst options: InlineConfig = {\n\t\t...inline,\n\t\troot: config.root,\n\t\tconfigFile: config.build.configFile ?? false,\n\t\tresolve: { tsconfigPaths: true, ...inline.resolve },\n\t\tplugins: [context.pluginRegistrations(config) as Plugin, ...toArray(inline.plugins), ...nitro.nitro(nitroConfig)]\n\t};\n\tawait hooks.configureVite?.(options, command);\n\treturn { vite, options };\n}\n","import { join, relative, resolve, isAbsolute } from 'node:path';\nimport type { BuilderContext, ResolvedStarsConfig } from '@wolfstar/schema';\nimport { ServerBuilder, createBuildLogger, type ServerHooks } from '@wolfstar/vite-server/internal';\nimport picomatch from 'picomatch';\nimport { createNitroViteConfig, type NitroHooks } from './config.js';\n\nexport interface NitroBuilderHooks extends ServerHooks, NitroHooks {}\nexport class NitroBuilder extends ServerBuilder {\n\tpublic constructor(\n\t\tconfig: ResolvedStarsConfig,\n\t\tcontext?: BuilderContext,\n\t\tprotected override readonly hooks: NitroBuilderHooks = {}\n\t) {\n\t\tsuper(config, context, hooks);\n\t}\n\tprotected async compile(): Promise<void> {\n\t\tconst { vite, options } = await createNitroViteConfig(this.config, this.context, this.hooks);\n\t\toptions.customLogger ??= createBuildLogger(vite, (level, text) => {\n\t\t\tthis.emit('log', level, text);\n\t\t});\n\t\toptions.build = { ...options.build, watch: null };\n\t\tthis.emit('progress', 0.2, 'building Nitro server');\n\t\tconst builder = await vite.createBuilder(options, null);\n\t\tawait builder.buildApp();\n\t}\n\tprotected async startWatching(): Promise<void> {\n\t\tconst { watch } = await import('chokidar');\n\t\tif (this.closed) return;\n\t\tconst config = this.config;\n\t\tconst ignored = picomatch([...config.dev.ignore], { dot: true });\n\t\tconst output = resolve(config.build.outDir);\n\t\tconst paths = [...config.dev.watch, join(config.root, 'package.json'), ...(config.build.configFile ? [config.build.configFile] : [])];\n\t\tconst watcher = watch(paths, {\n\t\t\tignoreInitial: true,\n\t\t\tignored(path) {\n\t\t\t\tconst absolute = resolve(path);\n\t\t\t\tconst fromOutput = relative(output, absolute);\n\t\t\t\tconst local = relative(config.root, absolute).replaceAll('\\\\', '/');\n\t\t\t\treturn (\n\t\t\t\t\tfromOutput === '' ||\n\t\t\t\t\t(!fromOutput.startsWith('..') && !isAbsolute(fromOutput)) ||\n\t\t\t\t\t/(^|\\/)(node_modules|\\.git|\\.stars)(\\/|$)/.test(local) ||\n\t\t\t\t\tignored(local) ||\n\t\t\t\t\tignored(`${local}/`) ||\n\t\t\t\t\tignored(absolute)\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\tlet dirty = false;\n\t\tlet rebuilding: Promise<void> | undefined;\n\t\tconst rebuild = async () => {\n\t\t\tdo {\n\t\t\t\tdirty = false;\n\t\t\t\tif (this.closed) return;\n\t\t\t\tawait this.build();\n\t\t\t} while (dirty && !this.closed);\n\t\t};\n\t\tconst schedule = () => {\n\t\t\tdirty = true;\n\t\t\tif (this.closed || rebuilding) return;\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = setTimeout(() => {\n\t\t\t\ttimer = undefined;\n\t\t\t\trebuilding = rebuild()\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tif (!this.closed) this.emit('log', 'error', String(error));\n\t\t\t\t\t})\n\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\trebuilding = undefined;\n\t\t\t\t\t});\n\t\t\t}, config.dev.debounce);\n\t\t};\n\t\tthis.stopWatching = async () => {\n\t\t\tclearTimeout(timer);\n\t\t\tawait watcher.close();\n\t\t\tawait rebuilding;\n\t\t};\n\t\twatcher.on('all', schedule);\n\t\twatcher.on('error', (error) => this.emit('log', 'error', String(error)));\n\t\tawait new Promise<void>((accept, reject) => {\n\t\t\tconst onError = (error: unknown) => reject(error);\n\t\t\twatcher.once('error', onError);\n\t\t\twatcher.once('ready', () => {\n\t\t\t\twatcher.off('error', onError);\n\t\t\t\taccept();\n\t\t\t});\n\t\t});\n\t\tif (!this.closed) {\n\t\t\trebuilding = rebuild().finally(() => {\n\t\t\t\trebuilding = undefined;\n\t\t\t});\n\t\t\tawait rebuilding;\n\t\t}\n\t}\n}\n","import type { BuilderContext, ResolvedStarsConfig } from '@wolfstar/schema';\nimport type { Nitro } from 'nitro/types';\nimport type { InlineConfig, Plugin, UserConfig, ViteDevServer } from 'vite';\nimport { defaultBuilderContext, toArray, type ViteModule } from '@wolfstar/vite-server/internal';\nimport { createNitroConfig, type NitroHooks, type NitroViteModule } from './config.js';\n\nexport type NitroBuilderModule = typeof import('nitro/builder');\n\nexport interface StarsNitroServer {\n\treadonly vite: ViteDevServer;\n\t/** The Nitro instance backing this server: routing, hooks, logger, and runtime config live here. */\n\treadonly nitro: Nitro;\n\t/** Dispatch through Nitro's own router, bypassing the HTTP socket entirely. */\n\tfetch(request: Request): Promise<Response>;\n\tlisten(port?: number): Promise<void>;\n\tclose(): Promise<void>;\n}\n\n/**\n * Native Nitro development through its Vite plugin: server routes, HMR reload, and runtime dispatch.\n *\n * A Nitro instance is created upfront and handed to the plugin via its `_nitro` option, the same\n * extension point framework integrations like Nuxt rely on. Owning that instance is what lets\n * {@link close} tear down Nitro's own watchers and hooks (they only run when its `close()` is\n * called) and lets {@link StarsNitroServer.fetch} dispatch requests without a listening socket.\n */\nexport async function createNitroServer(\n\tconfig: ResolvedStarsConfig,\n\tcontext: BuilderContext = defaultBuilderContext,\n\thooks: NitroHooks = {}\n): Promise<StarsNitroServer> {\n\tconst [vite, nitroVite, nitroBuilder] = await Promise.all([\n\t\tcontext.importFromProject<ViteModule>(config.root, 'vite', 'Install it with `pnpm add -D vite`.'),\n\t\tcontext.importFromProject<NitroViteModule>(config.root, 'nitro/vite', 'Install it with `pnpm add -D nitro`.'),\n\t\tcontext.importFromProject<NitroBuilderModule>(config.root, 'nitro/builder', 'Install it with `pnpm add -D nitro`.')\n\t]);\n\tconst nitroConfig = createNitroConfig(config);\n\tnitroConfig.dev ??= true;\n\tnitroConfig.builder ??= 'vite';\n\tawait hooks.configureNitro?.(nitroConfig);\n\tconst nitro = await nitroBuilder.createNitro(nitroConfig);\n\tconst inline = config.vite as UserConfig;\n\tconst options: InlineConfig = {\n\t\t...inline,\n\t\troot: config.root,\n\t\tconfigFile: config.build.configFile ?? false,\n\t\tresolve: { tsconfigPaths: true, ...inline.resolve },\n\t\tplugins: [context.pluginRegistrations(config) as Plugin, ...toArray(inline.plugins), ...nitroVite.nitro({ ...nitroConfig, _nitro: nitro })]\n\t};\n\tconst url = new URL(config.dev.url ?? 'http://localhost:3000');\n\toptions.appType = 'custom';\n\toptions.mode ??= 'development';\n\toptions.server = { host: url.hostname, port: Number(url.port || 3000), ...options.server };\n\tawait hooks.configureVite?.(options, 'serve');\n\tconst viteServer = await vite.createServer(options);\n\tlet closed = false;\n\tlet closing: Promise<void> | undefined;\n\treturn {\n\t\tvite: viteServer,\n\t\tnitro,\n\t\tasync fetch(request) {\n\t\t\tif (closed) return new Response('Server closed', { status: 503 });\n\t\t\treturn nitro.fetch(request);\n\t\t},\n\t\tasync listen(port) {\n\t\t\tif (closed) throw new Error('The server is closed.');\n\t\t\tawait viteServer.listen(port);\n\t\t},\n\t\tclose() {\n\t\t\tclosed = true;\n\t\t\t// Nitro's own watchers and hooks (registered by its Vite plugin) only run once its\n\t\t\t// close() fires; vite.close() alone would leak them.\n\t\t\tclosing ??= (async () => {\n\t\t\t\tawait viteServer.close();\n\t\t\t\tawait nitro.close();\n\t\t\t})();\n\t\t\treturn closing;\n\t\t}\n\t};\n}\n"],"mappings":";;;;;AAKA,MAAa,iBAAiB;AAC9B,MAAa,yBAAyB;;AAQtC,SAAgB,kBAAkB,QAAkC;CACnE,OAAO;AACR;AAEA,SAAgB,kBAAkB,QAA0C;CAC3E,MAAM,MAAM,OAAO,aAAa;CAChC,OAAO;EACN,GAAG;EACH,SAAS,OAAO;EAChB,QAAQ,OAAO,aAAa,MAAM;EAClC,QAAQ;GAAE,GAAG,IAAI;GAAQ,KAAK,OAAO,MAAM;EAAO;EAClD,aAAa;EAGb,cAAc,IAAI;EAClB,SAAS;GACR,GAAG,IAAI;IACN,uBACA;IACC,sBAAsB,KAAK,UAAU,OAAO,KAAK,EAAE;IACnD;IACA;GACD,CAAC,CAAC,KAAK,IAAI;IACX,+BACA;IACC;IACA;IACA;IACA;IACA;IACA;GACD,CAAC,CAAC,KAAK,IAAI;EACb;CACD;AACD;AAEA,eAAsB,sBACrB,QACA,UAA0B,uBAC1B,QAAoB,CAAC,GACrB,UAA6B,SAC0B;CACvD,MAAM,CAAC,MAAM,SAAS,MAAM,QAAQ,IAAI,CACvC,QAAQ,kBAA8B,OAAO,MAAM,QAAQ,qCAAqC,GAChG,QAAQ,kBAAmC,OAAO,MAAM,cAAc,sCAAsC,CAC7G,CAAC;CACD,MAAM,cAAc,kBAAkB,MAAM;CAC5C,MAAM,MAAM,iBAAiB,WAAW;CACxC,MAAM,SAAS,OAAO;CACtB,MAAM,UAAwB;EAC7B,GAAG;EACH,MAAM,OA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AAO,MAAM,MAAM,OAAO;EAC3B;EACA,MAAM,OAAO,MAAM;GAClB,IAAI,QAAQ,MAAM,IAAI,MAAM,uBAAuB;GACnD,MAAM,WAAW,OAAO,IAAI;EAC7B;EACA,QAAQ;GACP,SAAS;GAGT,aAAa,YAAY;IACxB,MAAM,WAAW,MAAM;IACvB,MAAM,MAAM,MAAM;GACnB,EAAC,CAAE;GACH,OAAO;EACR;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/config.ts","../../src/build.ts","../../src/dev.ts"],"sourcesContent":["import type { BuilderContext, ResolvedStarsConfig } from '@wolfstar/schema';\r\nimport type { NitroConfig } from 'nitro/types';\r\nimport type { InlineConfig, Plugin, UserConfig } from 'vite';\r\nimport { defaultBuilderContext, toArray, type ViteModule } from '@wolfstar/vite-server/internal';\r\n\r\nexport const NITRO_ENTRY_ID = '#stars/nitro-entry';\r\nexport const NITRO_ERROR_HANDLER_ID = '#stars/nitro-error-handler';\r\nexport type NitroViteModule = typeof import('nitro/vite');\r\nexport interface NitroHooks {\r\n\tconfigureNitro?(options: NitroConfig): void | Promise<void>;\r\n\tconfigureVite?(options: InlineConfig, command: 'build' | 'serve'): void | Promise<void>;\r\n}\r\n\r\n/** Type-check all upstream Nitro options without adding Nitro to the shared schema runtime. */\r\nexport function defineNitroConfig(config: NitroConfig): NitroConfig {\r\n\treturn config;\r\n}\r\n\r\nexport function createNitroConfig(config: ResolvedStarsConfig): NitroConfig {\r\n\tconst raw = config.experimental.nitro as NitroConfig;\r\n\treturn {\r\n\t\t...raw,\r\n\t\trootDir: config.root,\r\n\t\tpreset: config.experimental.nitro.preset,\r\n\t\toutput: { ...raw.output, dir: config.build.outDir },\r\n\t\tserverEntry: NITRO_ENTRY_ID,\r\n\t\t// A Stars app has no HTML renderer, so Nitro's default content negotiation (which favors\r\n\t\t// an HTML error page) is not useful here; always answer errors as JSON instead.\r\n\t\terrorHandler: raw.errorHandler ?? NITRO_ERROR_HANDLER_ID,\r\n\t\tvirtual: {\r\n\t\t\t...raw.virtual,\r\n\t\t\t[NITRO_ENTRY_ID]: () =>\r\n\t\t\t\t[\r\n\t\t\t\t\t`import client from ${JSON.stringify(config.entry)};`,\r\n\t\t\t\t\t'if (typeof client?.fetch !== \"function\") throw new TypeError(\"The Stars Nitro entry must default-export an object with fetch(request).\");',\r\n\t\t\t\t\t'export default { fetch: (request) => client.fetch(request) };'\r\n\t\t\t\t].join('\\n'),\r\n\t\t\t[NITRO_ERROR_HANDLER_ID]: () =>\r\n\t\t\t\t[\r\n\t\t\t\t\t'export default async function starsErrorHandler(error, event, { defaultHandler }) {',\r\n\t\t\t\t\t' const result = await defaultHandler(error, event, { json: true });',\r\n\t\t\t\t\t' const status = result.status ?? error.status ?? 500;',\r\n\t\t\t\t\t' const body = typeof result.body === \"string\" ? result.body : JSON.stringify(result.body ?? { message: error.message, status });',\r\n\t\t\t\t\t' return new Response(body, { status, statusText: result.statusText, headers: { \"content-type\": \"application/json; charset=utf-8\", ...result.headers } });',\r\n\t\t\t\t\t'}'\r\n\t\t\t\t].join('\\n')\r\n\t\t}\r\n\t};\r\n}\r\n\r\nexport async function createNitroViteConfig(\r\n\tconfig: ResolvedStarsConfig,\r\n\tcontext: BuilderContext = defaultBuilderContext,\r\n\thooks: NitroHooks = {},\r\n\tcommand: 'build' | 'serve' = 'build'\r\n): Promise<{ vite: ViteModule; options: InlineConfig }> {\r\n\tconst [vite, nitro] = await Promise.all([\r\n\t\tcontext.importFromProject<ViteModule>(config.root, 'vite', 'Install it with `pnpm add -D vite`.'),\r\n\t\tcontext.importFromProject<NitroViteModule>(config.root, 'nitro/vite', 'Install it with `pnpm add -D nitro`.')\r\n\t]);\r\n\tconst nitroConfig = createNitroConfig(config);\r\n\tawait hooks.configureNitro?.(nitroConfig);\r\n\tconst inline = config.vite as UserConfig;\r\n\tconst options: InlineConfig = {\r\n\t\t...inline,\r\n\t\troot: config.root,\r\n\t\tconfigFile: config.build.configFile ?? false,\r\n\t\tresolve: { tsconfigPaths: true, ...inline.resolve },\r\n\t\tplugins: [context.pluginRegistrations(config) as Plugin, ...toArray(inline.plugins), ...nitro.nitro(nitroConfig)]\r\n\t};\r\n\tawait hooks.configureVite?.(options, command);\r\n\treturn { vite, options };\r\n}\r\n","import { join, relative, resolve, isAbsolute } from 'node:path';\r\nimport type { BuilderContext, ResolvedStarsConfig } from '@wolfstar/schema';\r\nimport { ServerBuilder, createBuildLogger, type ServerHooks } from '@wolfstar/vite-server/internal';\r\nimport picomatch from 'picomatch';\r\nimport { createNitroViteConfig, type NitroHooks } from './config.js';\r\n\r\nexport interface NitroBuilderHooks extends ServerHooks, NitroHooks {}\r\nexport class NitroBuilder extends ServerBuilder {\r\n\tpublic constructor(\r\n\t\tconfig: ResolvedStarsConfig,\r\n\t\tcontext?: BuilderContext,\r\n\t\tprotected override readonly hooks: NitroBuilderHooks = {}\r\n\t) {\r\n\t\tsuper(config, context, hooks);\r\n\t}\r\n\tprotected async compile(): Promise<void> {\r\n\t\tconst { vite, options } = await createNitroViteConfig(this.config, this.context, this.hooks);\r\n\t\toptions.customLogger ??= createBuildLogger(vite, (level, text) => {\r\n\t\t\tthis.emit('log', level, text);\r\n\t\t});\r\n\t\toptions.build = { ...options.build, watch: null };\r\n\t\tthis.emit('progress', 0.2, 'building Nitro server');\r\n\t\tconst builder = await vite.createBuilder(options, null);\r\n\t\tawait builder.buildApp();\r\n\t}\r\n\tprotected async startWatching(): Promise<void> {\r\n\t\tconst { watch } = await import('chokidar');\r\n\t\tif (this.closed) return;\r\n\t\tconst config = this.config;\r\n\t\tconst ignored = picomatch([...config.dev.ignore], { dot: true });\r\n\t\tconst output = resolve(config.build.outDir);\r\n\t\tconst paths = [...config.dev.watch, join(config.root, 'package.json'), ...(config.build.configFile ? [config.build.configFile] : [])];\r\n\t\tconst watcher = watch(paths, {\r\n\t\t\tignoreInitial: true,\r\n\t\t\tignored(path) {\r\n\t\t\t\tconst absolute = resolve(path);\r\n\t\t\t\tconst fromOutput = relative(output, absolute);\r\n\t\t\t\tconst local = relative(config.root, absolute).replaceAll('\\\\', '/');\r\n\t\t\t\treturn (\r\n\t\t\t\t\tfromOutput === '' ||\r\n\t\t\t\t\t(!fromOutput.startsWith('..') && !isAbsolute(fromOutput)) ||\r\n\t\t\t\t\t/(^|\\/)(node_modules|\\.git|\\.stars)(\\/|$)/.test(local) ||\r\n\t\t\t\t\tignored(local) ||\r\n\t\t\t\t\tignored(`${local}/`) ||\r\n\t\t\t\t\tignored(absolute)\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t});\r\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\r\n\t\tlet dirty = false;\r\n\t\tlet rebuilding: Promise<void> | undefined;\r\n\t\tconst rebuild = async () => {\r\n\t\t\tdo {\r\n\t\t\t\tdirty = false;\r\n\t\t\t\tif (this.closed) return;\r\n\t\t\t\tawait this.build();\r\n\t\t\t} while (dirty && !this.closed);\r\n\t\t};\r\n\t\tconst schedule = () => {\r\n\t\t\tdirty = true;\r\n\t\t\tif (this.closed || rebuilding) return;\r\n\t\t\tclearTimeout(timer);\r\n\t\t\ttimer = setTimeout(() => {\r\n\t\t\t\ttimer = undefined;\r\n\t\t\t\trebuilding = rebuild()\r\n\t\t\t\t\t.catch((error) => {\r\n\t\t\t\t\t\tif (!this.closed) this.emit('log', 'error', String(error));\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.finally(() => {\r\n\t\t\t\t\t\trebuilding = undefined;\r\n\t\t\t\t\t});\r\n\t\t\t}, config.dev.debounce);\r\n\t\t};\r\n\t\tthis.stopWatching = async () => {\r\n\t\t\tclearTimeout(timer);\r\n\t\t\tawait watcher.close();\r\n\t\t\tawait rebuilding;\r\n\t\t};\r\n\t\twatcher.on('all', schedule);\r\n\t\twatcher.on('error', (error) => this.emit('log', 'error', String(error)));\r\n\t\tawait new Promise<void>((accept, reject) => {\r\n\t\t\tconst onError = (error: unknown) => reject(error);\r\n\t\t\twatcher.once('error', onError);\r\n\t\t\twatcher.once('ready', () => {\r\n\t\t\t\twatcher.off('error', onError);\r\n\t\t\t\taccept();\r\n\t\t\t});\r\n\t\t});\r\n\t\tif (!this.closed) {\r\n\t\t\trebuilding = rebuild().finally(() => {\r\n\t\t\t\trebuilding = undefined;\r\n\t\t\t});\r\n\t\t\tawait rebuilding;\r\n\t\t}\r\n\t}\r\n}\r\n","import type { BuilderContext, ResolvedStarsConfig } from '@wolfstar/schema';\r\nimport type { Nitro } from 'nitro/types';\r\nimport type { InlineConfig, Plugin, UserConfig, ViteDevServer } from 'vite';\r\nimport { defaultBuilderContext, toArray, type ViteModule } from '@wolfstar/vite-server/internal';\r\nimport { createNitroConfig, type NitroHooks, type NitroViteModule } from './config.js';\r\n\r\nexport type NitroBuilderModule = typeof import('nitro/builder');\r\n\r\nexport interface StarsNitroServer {\r\n\treadonly vite: ViteDevServer;\r\n\t/** The Nitro instance backing this server: routing, hooks, logger, and runtime config live here. */\r\n\treadonly nitro: Nitro;\r\n\t/** Dispatch through Nitro's own router, bypassing the HTTP socket entirely. */\r\n\tfetch(request: Request): Promise<Response>;\r\n\tlisten(port?: number): Promise<void>;\r\n\tclose(): Promise<void>;\r\n}\r\n\r\n/**\r\n * Native Nitro development through its Vite plugin: server routes, HMR reload, and runtime dispatch.\r\n *\r\n * A Nitro instance is created upfront and handed to the plugin via its `_nitro` option, the same\r\n * extension point framework integrations like Nuxt rely on. Owning that instance is what lets\r\n * {@link close} tear down Nitro's own watchers and hooks (they only run when its `close()` is\r\n * called) and lets {@link StarsNitroServer.fetch} dispatch requests without a listening socket.\r\n */\r\nexport async function createNitroServer(\r\n\tconfig: ResolvedStarsConfig,\r\n\tcontext: BuilderContext = defaultBuilderContext,\r\n\thooks: NitroHooks = {}\r\n): Promise<StarsNitroServer> {\r\n\tconst [vite, nitroVite, nitroBuilder] = await Promise.all([\r\n\t\tcontext.importFromProject<ViteModule>(config.root, 'vite', 'Install it with `pnpm add -D vite`.'),\r\n\t\tcontext.importFromProject<NitroViteModule>(config.root, 'nitro/vite', 'Install it with `pnpm add -D nitro`.'),\r\n\t\tcontext.importFromProject<NitroBuilderModule>(config.root, 'nitro/builder', 'Install it with `pnpm add -D nitro`.')\r\n\t]);\r\n\tconst nitroConfig = createNitroConfig(config);\r\n\tnitroConfig.dev ??= true;\r\n\tnitroConfig.builder ??= 'vite';\r\n\tawait hooks.configureNitro?.(nitroConfig);\r\n\tconst nitro = await nitroBuilder.createNitro(nitroConfig);\r\n\tconst inline = config.vite as UserConfig;\r\n\tconst options: InlineConfig = {\r\n\t\t...inline,\r\n\t\troot: config.root,\r\n\t\tconfigFile: config.build.configFile ?? false,\r\n\t\tresolve: { tsconfigPaths: true, ...inline.resolve },\r\n\t\tplugins: [context.pluginRegistrations(config) as Plugin, ...toArray(inline.plugins), ...nitroVite.nitro({ ...nitroConfig, _nitro: nitro })]\r\n\t};\r\n\tconst url = new URL(config.dev.url ?? 'http://localhost:3000');\r\n\toptions.appType = 'custom';\r\n\toptions.mode ??= 'development';\r\n\toptions.server = { host: url.hostname, port: Number(url.port || 3000), ...options.server };\r\n\tawait hooks.configureVite?.(options, 'serve');\r\n\tconst viteServer = await vite.createServer(options);\r\n\tlet closed = false;\r\n\tlet closing: Promise<void> | undefined;\r\n\treturn {\r\n\t\tvite: viteServer,\r\n\t\tnitro,\r\n\t\tasync fetch(request) {\r\n\t\t\tif (closed) return new Response('Server closed', { status: 503 });\r\n\t\t\treturn nitro.fetch(request);\r\n\t\t},\r\n\t\tasync listen(port) {\r\n\t\t\tif (closed) throw new Error('The server is closed.');\r\n\t\t\tawait viteServer.listen(port);\r\n\t\t},\r\n\t\tclose() {\r\n\t\t\tclosed = true;\r\n\t\t\t// Nitro's own watchers and hooks (registered by its Vite plugin) only run once its\r\n\t\t\t// close() fires; vite.close() alone would leak them.\r\n\t\t\tclosing ??= (async () => {\r\n\t\t\t\tawait viteServer.close();\r\n\t\t\t\tawait nitro.close();\r\n\t\t\t})();\r\n\t\t\treturn closing;\r\n\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 -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","names":["getNitroRouteRules"],"sources":["../../src/runtime/route-rules.ts"],"sourcesContent":["import { getRouteRules as getNitroRouteRules } from 'nitro/app';\nimport type { ResolvedRouteRules } from 'nitro/types';\n\n/**\n * The route rules Nitro resolved for a request (`headers`, `cors`, `redirect`, ...), matched by\n * method and pathname against `stars.config`'s `experimental.nitro.routeRules`.\n *\n * Nitro applies these rules before dispatching to the app entry regardless of whether a specific\n * route matched, so they are meaningful even for a Stars app that has no `routes/` directory.\n */\nexport function getRouteRules(request: Request): ResolvedRouteRules {\n\tconst { pathname } = new URL(request.url);\n\treturn getNitroRouteRules(request.method, pathname).routeRules;\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,cAAc,SAAsC;CACnE,MAAM,EAAE,aAAa,IAAI,IAAI,QAAQ,GAAG;CACxC,OAAOA,gBAAmB,QAAQ,QAAQ,QAAQ,CAAC,CAAC;AACrD"}
|
|
1
|
+
{"version":3,"file":"runtime.js","names":["getNitroRouteRules"],"sources":["../../src/runtime/route-rules.ts"],"sourcesContent":["import { getRouteRules as getNitroRouteRules } from 'nitro/app';\r\nimport type { ResolvedRouteRules } from 'nitro/types';\r\n\r\n/**\r\n * The route rules Nitro resolved for a request (`headers`, `cors`, `redirect`, ...), matched by\r\n * method and pathname against `stars.config`'s `experimental.nitro.routeRules`.\r\n *\r\n * Nitro applies these rules before dispatching to the app entry regardless of whether a specific\r\n * route matched, so they are meaningful even for a Stars app that has no `routes/` directory.\r\n */\r\nexport function getRouteRules(request: Request): ResolvedRouteRules {\r\n\tconst { pathname } = new URL(request.url);\r\n\treturn getNitroRouteRules(request.method, pathname).routeRules;\r\n}\r\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,cAAc,SAAsC;CACnE,MAAM,EAAE,aAAa,IAAI,IAAI,QAAQ,GAAG;CACxC,OAAOA,gBAAmB,QAAQ,QAAQ,QAAQ,CAAC,CAAC;AACrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wolfstar/nitro-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Nitro server integration for Stars projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"provenance": true
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@wolfstar/schema": "^0.
|
|
55
|
-
"@wolfstar/vite-server": "^0.
|
|
54
|
+
"@wolfstar/schema": "^0.5.0",
|
|
55
|
+
"@wolfstar/vite-server": "^0.4.0",
|
|
56
56
|
"chokidar": "^5.0.0",
|
|
57
57
|
"picomatch": "^4.0.7"
|
|
58
58
|
},
|