@pix3/vite-plugin 2.0.0-alpha.0 → 2.0.0-alpha.1
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 +40 -38
- package/dist/build/player-modules.d.ts +24 -0
- package/dist/build/player-modules.js +50 -0
- package/dist/editor-page.js +23 -23
- package/dist/index.js +13 -1
- package/dist/module-paths.js +1 -1
- package/dist/player/debug/context.d.ts +9 -0
- package/dist/player/debug/context.js +1 -0
- package/dist/player/debug/device-info.d.ts +15 -0
- package/dist/player/debug/device-info.js +36 -0
- package/dist/player/debug/frame-stats.d.ts +79 -0
- package/dist/player/debug/frame-stats.js +159 -0
- package/dist/player/debug/index.d.ts +10 -0
- package/dist/player/debug/index.js +20 -0
- package/dist/player/debug/long-frames.d.ts +46 -0
- package/dist/player/debug/long-frames.js +79 -0
- package/dist/player/debug/overlay.d.ts +25 -0
- package/dist/player/debug/overlay.js +320 -0
- package/dist/player/debug/session.d.ts +92 -0
- package/dist/player/debug/session.js +156 -0
- package/dist/player/dev/editor-link.d.ts +16 -0
- package/dist/player/dev/editor-link.js +125 -0
- package/dist/player/index.d.ts +7 -0
- package/dist/player/index.js +18 -1
- package/dist/vite-config.js +6 -3
- package/package.json +60 -60
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 2026 Igor Gritsenko
|
|
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 2026 Igor Gritsenko
|
|
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,38 +1,40 @@
|
|
|
1
|
-
# @pix3/vite-plugin
|
|
2
|
-
|
|
3
|
-
`pix3({ resRoot = '.', editor = true, build = 'html' | 'zip' | false, strip = true | false | { keep }, entryScene, compress = false, allowRemote = false, imageGen: { home, upstreams } })` — serves the Pix3 editor at `/__pix3/` on the project's Vite dev server, with the file API (`/__pix3/api/*`), the sync barrier, `virtual:pix3/*` modules, the player and the playable build. Design: plan `pix3/.plans/pix3-core.md` §B; the record of the player/build port is `.plans/player-build.md`. `pix3()` returns a plugin array (`plugins: [pix3()]`).
|
|
4
|
-
|
|
5
|
-
Source layout: `src/index.ts` wires the hooks; `src/vite-config.ts` (the `config` hook), `src/dev-server.ts` (`configureServer`: file API, socket, barrier, image-gen proxy, `.pix3/dev.json`), `src/server/` (routes, guard), `src/files/` (the file table, changesets, the journal), `src/sync/` (script graph, barrier, `hotUpdate`), `src/build/` (`plan.ts` — flush, scan and strip decision in `buildStart`; `bundle-hooks.ts`, `output-plugins.ts`, `finish.ts` — report and record), `src/client/` (the page's `EditorHost`), `player/`.
|
|
6
|
-
|
|
7
|
-
## Player
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- `
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
- `
|
|
33
|
-
-
|
|
34
|
-
- `
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
# @pix3/vite-plugin
|
|
2
|
+
|
|
3
|
+
`pix3({ resRoot = '.', editor = true, build = 'html' | 'zip' | false, strip = true | false | { keep }, entryScene, compress = false, allowRemote = false, imageGen: { home, upstreams } })` — serves the Pix3 editor at `/__pix3/` on the project's Vite dev server, with the file API (`/__pix3/api/*`), the sync barrier, `virtual:pix3/*` modules, the player and the playable build. Design: plan `pix3/.plans/pix3-core.md` §B; the record of the player/build port is `.plans/player-build.md`. `pix3()` returns a plugin array (`plugins: [pix3()]`).
|
|
4
|
+
|
|
5
|
+
Source layout: `src/index.ts` wires the hooks; `src/vite-config.ts` (the `config` hook), `src/dev-server.ts` (`configureServer`: file API, socket, barrier, image-gen proxy, `.pix3/dev.json`), `src/server/` (routes, guard), `src/files/` (the file table, changesets, the journal), `src/sync/` (script graph, barrier, `hotUpdate`), `src/build/` (`plan.ts` — flush, scan and strip decision in `buildStart`; `bundle-hooks.ts`, `output-plugins.ts`, `finish.ts` — report and record), `src/client/` (the page's `EditorHost`), `player/`.
|
|
6
|
+
|
|
7
|
+
## Player
|
|
8
|
+
|
|
9
|
+
In dev, the plugin excludes `@pix3/vite-plugin/player` from dependency prebundling so its `virtual:pix3/*` imports reach Vite's plugin hooks, including when installed from an npm tarball.
|
|
10
|
+
|
|
11
|
+
`src/main.ts` of a project is `import { startGame } from '@pix3/vite-plugin/player'; startGame('#app');`. The player (`player/index.ts`, emitted to `dist/player/`) boots `@pix3/runtime` on the `virtual:pix3/*` modules the plugin generates: `scene-manifest` (from `pix3project.yaml`: entry scene, scene list, viewport, quality, fonts, locales), `embedded-assets` (`{}` in dev and zip, every asset as base64 in an html build), `project-scripts` (eager glob of `scripts/` and `src/scripts/`, registered as `user:<Export>`), `spine` / `postprocessing` / `network` (static imports in a build that uses them, no-ops otherwise). The entry scene is `pix3({ entryScene })`, else `defaultExportScenePath`, else `scenes/main.pix3scene`, else the first non-prefab scene, in dev and in a build alike (one function, `resolveEntryScene` in `src/build/scan.ts`; a named scene that does not exist is skipped with a warning). In dev `ResourceManager('/<resRoot>/')` fetches from the dev server; a build uses `./`. `window.__PIX3_PLAYER__ = { status, frames, errors, scene, runner }` is what a check reads. In dev (`virtual:pix3/dev`; no-ops in a build): `?scene=<res path>` boots that scene; `/?debug` adds the debug overlay (`player/debug/`) — frame chart and percentiles, renderer counters, Long Animation Frames, audio, errors, Pause / Step, and `__PIX3_PLAYER__.debug.snapshot()`; otherwise a top-level page gets a "Pix3 editor" link (`player/dev/`; not on `?clean`, not with `editor: false`) that opens the editor in its tab unless one is already open (spec "Run Modes and Debug Mode").
|
|
12
|
+
|
|
13
|
+
## Build (`vite build`)
|
|
14
|
+
|
|
15
|
+
- `build: 'html'` (default): one self-contained `dist/index.html` — `vite-plugin-singlefile`, then DeepCore's classic-script rewrite (no `type="module"`, script at the end of `<body>`, no `import.meta`), so it runs from `file://` and inside a sandboxed iframe. `build: 'zip'`: the plain build with the assets beside `index.html` under their `res://` paths, archived to `dist/<projectName>.zip` (`fflate`) — for hosting: its `index.html` is a module script that loads chunks and fetches assets, which `file://` refuses. `build: false`: `vite build` is left alone (the player's modules still generate).
|
|
16
|
+
- `compress: true` (html only): the bundle is built as an `iife`, gzip'd and base64'd into the page behind a bootstrap that inflates it with `DecompressionStream` and injects the text as a classic `<script>` (`src/build/compress.ts`; never a blob/`data:` URL or `eval`, which sandboxed containers refuse). About two thirds off the file (the budget ad networks measure); over a gzip channel it is a wash, over brotli +21% — CLAUDE.md «Playable export size». Needs Chrome 80+ / Safari 16.4+ / Firefox 113+.
|
|
17
|
+
- `buildStart` scans every text source outside `node_modules`/`dist`/`.pix3` (`src/build/scan.ts`; `.vue`/`.svelte`/`.astro` included), plus every source of a dependency that declares `@pix3/runtime`: `mentionedNames`, the import specifiers, the asset set (every scene and prefab, `res://` references, directories, Spine atlas pages, declared locale tables and their sprites, manifest fonts), and whether Spine / `postprocessing` (a `PostProcess` node, or an `import` of the package) / the network are used.
|
|
18
|
+
- Strip (`src/build/strippable-runtime-modules.ts`): runtime modules nothing mentions — neither a keep-name of the table nor any of the module's value exports (`pointInPolygon` keeps `collision-shapes-2d`) — are replaced by throwing stubs in the `load` hook (module ids compared by real path, so `resolve.preserveSymlinks` changes nothing). For the runtime's own importers only, `postprocessing` resolves to a stub in an html build with no `PostProcess` node and no import of it; `three/examples/jsm/loaders/GLTFLoader.js` to a stub when no scene, script, library or asset names a `.glb`/`.gltf` (any case); and `yaml` to `{ parse: JSON.parse }` while every scene and prefab ships as JSON (`src/build/player-modules.ts`; a project module or a dependency importing any of the three itself gets the real one, and JSON is YAML). On by default; `strip: false` keeps everything, `strip: true` strips regardless of dependencies. The table is guarded by `strippable-runtime-modules.spec.ts` against the runtime's import graph.
|
|
19
|
+
- Dependencies that import the runtime (N11, `src/build/dependency-imports.ts`): every project dependency that declares `@pix3/runtime` is parsed before the strip decision (the bundler's `this.parse`, TypeScript lowered with Vite's own transform) and its named imports keep their modules. `import * as`, a dynamic `import('@pix3/runtime')`, `export *`, `require` or a parse error is opaque: strip goes off with a message naming `pix3({ strip: { keep: ['GeometryMesh', …] } })`, which names what the library uses and keeps strip on. A `transform`-hook net checks every `node_modules` module the bundle pulls in (a transitive or undeclared dependency): a named import of a stripped module fails the build with the same fix.
|
|
20
|
+
- Before reading the disk, a build asks the dev server named by `.pix3/dev.json` to flush the editor's unsaved scenes (`POST /__pix3/api/flush`, 15 s); a live editor that cannot flush, or a server that accepts the connection but does not answer `hello` within 2 s, fails the build with `E_EDITOR_UNSYNCED`; a refused connection is a stale `dev.json` (logged); `PIX3_NO_SYNC=1` skips it (as `pix3 check --no-sync` does).
|
|
21
|
+
- Vite 7 and 8: single-chunk output is `inlineDynamicImports` (rollup) or `codeSplitting: false` (rolldown), chosen by `this.meta.rolldownVersion`; stable hooks only.
|
|
22
|
+
- The result is recorded in `.pix3/build.json` (format, path, bytes, sha256, entry scene, assets, stripped modules, warnings, the report's path) and explained in `dist/<name>.report.json` beside the artifact (`src/build/report.ts`): bytes and gzip bytes of the artifact, the compression numbers, code by group (`three`, `runtime`, `player`, `project`, `assets`, `dependencies` by package — rendered bytes per the bundler's module map and an estimate of each group's minified share), the largest modules, the strip decision with what the dependencies import, how each optional library was resolved (`yaml`, `GLTFLoader`, `postprocessing`, `spine`, `network`), every embedded asset with raw and base64 bytes. The answer to "why is it this big" without a rebuild.
|
|
23
|
+
- The build is run by whoever owns the terminal (`npm run build` — the coding agent, the user, CI), never from the editor: the dev server has no build route (owner decision 2026-10-10, `.plans/player-build.md`).
|
|
24
|
+
- Not yet: WebP re-encoding of embedded images (optional `sharp`, P2+). Not at all: the 1.x `pix3project.yaml` `export:` block (no build reads it; `pix3 validate` warns `W_MANIFEST_EXPORT`) and a pre-packed `assets/.atlas/` (nothing in 2.x writes one; the player does not probe for it).
|
|
25
|
+
|
|
26
|
+
Done (P1, dev side):
|
|
27
|
+
|
|
28
|
+
- editor page at `/__pix3/` as raw HTML (variant B: no `/@vite/client`), own WebSocket `/__pix3/ws`;
|
|
29
|
+
- file API ported from `packages/cli/src/serve/` without token/lease: `file` GET/HEAD/PUT with sha256 ETag, `If-Match` → 412, `manifest`, `hash`, `mkdir|delete|move`, `X-Mutation-Id` replay, `hello`;
|
|
30
|
+
- write guard: Host check (`localhost`, a literal 127.0.0.0/8 / `::1` address, `server.allowedHosts`, and any IP literal under `allowRemote`), loopback peers unless `allowRemote`, `X-Pix3: 1` + own `Origin` for mutations and the socket;
|
|
31
|
+
- writer hand-over `handover/claim` under the write mutex, `409 writer_superseded`;
|
|
32
|
+
- changeset `POST /__pix3/api/changeset` (plan §C.4): several files as one transaction under the same mutex — preflight of every `If-Match`/`createOnly` (412 names the file), staging in `.pix3/tx/<id>/{new,old}/<n>` + `intent.json` with fsync, renames, one `pix3:fs` frame; a failed rename rolls back from `old/`, a crash is rolled forward (complete staging) or back at the next start;
|
|
33
|
+
- version journal `.pix3/history/<path>/{index.jsonl,<stamp>-<hash8>}` for `*.pix3scene`, `*.prefab`, `pix3project.yaml` (200 versions / 7 days per path, the newest always kept): authors `editor` (PUT, changeset), `external` (watcher, rescans, a start-up snapshot of what changed while no server ran), `restore`, `rejected-draft` (posted by any tab); routes `history`, `history/version`, `history/record`, `history/restore` (a restore is broadcast as `external`, so the editor follows it like an agent's change);
|
|
34
|
+
- `pix3:fs` events (two scans 300 ms apart, `author: editor|external`);
|
|
35
|
+
- sync barrier `POST /__pix3/api/sync` (rescan → hard-invalidate roots → `environment.reloadModule` → page ack with executed-content stamps), `POST /__pix3/api/flush`;
|
|
36
|
+
- `virtual:pix3/{editor-host,editor-scripts,bot-policies,spine-loader}`; `.pix3/dev.json`; version gate;
|
|
37
|
+
- image-generation keys and proxy (plan §B.1, `src/server/image-{keys,proxy}.ts`): `GET|PUT /__pix3/api/keys` (status `{set, last4?}` per provider; a key is written, never read back) and `POST /__pix3/api/proxy/{gemini,openai}/…` (only `v1beta/models/<m>:generateContent` and `v1/images/{generations,edits}`; the plugin adds `x-goog-api-key` / `Authorization: Bearer`, drops whatever credential the page sent, replaces the key by `[key]` should an upstream echo it, and logs provider, path, status and size only). Keys live in `~/.pix3/keys.json` (`PIX3_HOME`; 0600 in a 0700 directory), or `.pix3/local/keys.json` when the home refuses the write; no URL with a `.pix3` segment is served (root, `/@fs/`, any spelling). Both routes answer the editor page only: `X-Pix3: 1`, own `Origin`, `Sec-Fetch-Site: same-origin`, a `Referer` under `/__pix3/` and `X-Pix3-Session` — a per-server token embedded in the editor page only for a top-level navigation (`Sec-Fetch-Dest: document`; the game's `fetch('/__pix3/')` or an iframe gets none), read and removed by the page client; the page is served with `Cross-Origin-Opener-Policy: same-origin-allow-popups`, so a `window.open` from the game gets no handle into it. `imageGen.upstreams` / `PIX3_PROXY_{GEMINI,OPENAI}_URL` point the proxy at a mock;
|
|
38
|
+
- the page client is the editor's `EditorHost` (`src/client/`, conformance in `host-contract.spec.ts`); `/__pix3/editor.css` and `optimizeDeps.include` come from the installed `@pix3/editor-core/dist`.
|
|
39
|
+
|
|
40
|
+
Specs: `src/plugin.spec.ts`, `src/server/image-proxy.spec.ts` (keys and proxy against a local upstream), `src/files/changeset.spec.ts`, `src/files/history.spec.ts` (real Vite on a free port, fake tab over the socket; crash/recovery cases drive `ProjectFiles` directly with its `faults` hook); `src/build/build.spec.ts` (a real `vite build` of the inline fixture in `src/test-support/build-fixture.ts`: html, zip, `build: false`, strip, `compress`, the report, the yaml/GLTFLoader stubs, the N11 libraries — named import kept, `import * as` turns strip off with the message, an undeclared dependency fails the build), `src/build/dependency-imports.spec.ts`, `src/build/scan.spec.ts`, `src/build/strippable-runtime-modules.spec.ts`. The artifact itself is checked in headless Chrome by `../pix3-e2e/build-check/run.mjs` (`vite preview`, `file://`, a sandboxed iframe; `--compress`, `--vite 7|8`, `--lib named|namespace`).
|
|
@@ -13,6 +13,7 @@ export declare const PROJECT_SCRIPTS_ID = "virtual:pix3/project-scripts";
|
|
|
13
13
|
export declare const SPINE_ID = "virtual:pix3/spine";
|
|
14
14
|
export declare const POSTPROCESSING_ID = "virtual:pix3/postprocessing";
|
|
15
15
|
export declare const NETWORK_ID = "virtual:pix3/network";
|
|
16
|
+
export declare const DEV_ID = "virtual:pix3/dev";
|
|
16
17
|
/** What `postprocessing` resolves to in a single-file build whose scenes place no `PostProcess`. */
|
|
17
18
|
export declare const POSTPROCESSING_STUB_ID = "virtual:pix3/postprocessing-stub";
|
|
18
19
|
/** What `yaml` resolves to for the runtime when the scenes ship as JSON. */
|
|
@@ -97,3 +98,26 @@ export declare const postprocessingSource: (mode: "default" | "static") => strin
|
|
|
97
98
|
export declare const postprocessingStubSource: () => string;
|
|
98
99
|
/** `virtual:pix3/network`: the real installer, or a no-op that keeps `net/**` out of the bundle. */
|
|
99
100
|
export declare const networkSource: (usesNetwork: boolean) => string;
|
|
101
|
+
export interface DevSourceOptions {
|
|
102
|
+
/** This package's `player/debug/index` (the debug overlay), as a file path. */
|
|
103
|
+
readonly overlayPath: string;
|
|
104
|
+
/** This package's `player/dev/editor-link` (the "Pix3 editor" link), as a file path. */
|
|
105
|
+
readonly editorLinkPath: string;
|
|
106
|
+
/** `<base>__pix3/` when the plugin serves the editor, else null (no link). */
|
|
107
|
+
readonly editorUrl: string | null;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* `virtual:pix3/dev`: the player's dev-only hooks. In dev:
|
|
111
|
+
*
|
|
112
|
+
* - `devSceneOverride()` is the URL's `?scene=` (`res://` stripped), the scene the editor's
|
|
113
|
+
* "Play in Browser Tab / with Profiler" asks for; the player checks it against its scene list;
|
|
114
|
+
* - `installDevTools(context)` imports the debug overlay when the URL has `debug`, otherwise the
|
|
115
|
+
* "Pix3 editor" link (top-level page, editor on, no `?clean`), so a plain `/` costs one small
|
|
116
|
+
* module and `/?clean` none.
|
|
117
|
+
*
|
|
118
|
+
* In a build both are no-ops and nothing of the overlay or the link is bundled (a single-file
|
|
119
|
+
* HTML cannot fetch a chunk anyway). The modules are imported by file path, not by a package
|
|
120
|
+
* subpath: Vite's resolver answers bare specifiers from `exports` before any plugin's
|
|
121
|
+
* `resolveId` runs.
|
|
122
|
+
*/
|
|
123
|
+
export declare const devSource: (mode: "dev" | "none", options?: DevSourceOptions) => string;
|