@series-inc/venus-sdk 3.3.1-beta.0 → 3.4.0-beta.0
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/dist/{AdsApi-OXtzPhiB.d.mts → AdsApi-CrobHGGD.d.ts} +2 -1
- package/dist/{chunk-QABXMFND.mjs → chunk-3APM3V2M.js} +2 -2
- package/dist/chunk-3APM3V2M.js.map +1 -0
- package/dist/{chunk-UXY5CKKG.mjs → chunk-3UPXLWK7.js} +3 -3
- package/dist/chunk-3UPXLWK7.js.map +1 -0
- package/dist/{chunk-C6GZ5FEB.mjs → chunk-RUYSUI26.js} +178 -180
- package/dist/chunk-RUYSUI26.js.map +1 -0
- package/dist/core-NMKO2UFW.js +3 -0
- package/dist/{core-62LWDHN7.mjs.map → core-NMKO2UFW.js.map} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/{index.mjs → index.js} +5 -6
- package/dist/{index.mjs.map → index.js.map} +1 -1
- package/dist/venus-api/index.d.ts +2 -2
- package/dist/venus-api/{index.mjs → index.js} +20 -34
- package/dist/venus-api/index.js.map +1 -0
- package/dist/vite/{index.mjs → index.js} +11 -526
- package/dist/vite/index.js.map +1 -0
- package/dist/webview/index.js +3 -0
- package/dist/webview/{index.mjs.map → index.js.map} +1 -1
- package/package.json +13 -19
- package/dist/AdsApi-OXtzPhiB.d.ts +0 -1551
- package/dist/chunk-C6GZ5FEB.mjs.map +0 -1
- package/dist/chunk-NSSMTXJJ.mjs +0 -7
- package/dist/chunk-NSSMTXJJ.mjs.map +0 -1
- package/dist/chunk-QABXMFND.mjs.map +0 -1
- package/dist/chunk-UXY5CKKG.mjs.map +0 -1
- package/dist/core-62LWDHN7.mjs +0 -4
- package/dist/index.cjs +0 -5272
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -904
- package/dist/venus-api/index.cjs +0 -7185
- package/dist/venus-api/index.cjs.map +0 -1
- package/dist/venus-api/index.d.mts +0 -15
- package/dist/venus-api/index.mjs.map +0 -1
- package/dist/vite/index.cjs +0 -1069
- package/dist/vite/index.cjs.map +0 -1
- package/dist/vite/index.mjs.map +0 -1
- package/dist/webview/index.cjs +0 -15
- package/dist/webview/index.cjs.map +0 -1
- package/dist/webview/index.d.mts +0 -15
- package/dist/webview/index.mjs +0 -4
package/dist/vite/index.cjs
DELETED
|
@@ -1,1069 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var path = require('path');
|
|
4
|
-
var fs = require('fs');
|
|
5
|
-
|
|
6
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
-
|
|
8
|
-
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
9
|
-
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
10
|
-
|
|
11
|
-
// src/vite/venusLibrariesPlugin.ts
|
|
12
|
-
|
|
13
|
-
// src/shared-assets/embeddedLibrariesManifest.ts
|
|
14
|
-
var DEFAULT_SHARED_LIB_CDN_BASE = "https://venus-static-01293ak.web.app/libs";
|
|
15
|
-
var EMBEDDED_LIBRARIES = [
|
|
16
|
-
{
|
|
17
|
-
libraryKey: "phaser@3.90.0",
|
|
18
|
-
assetKey: "library:phaser@3.90.0",
|
|
19
|
-
packageName: "phaser",
|
|
20
|
-
version: "3.90.0",
|
|
21
|
-
globalVar: "Phaser",
|
|
22
|
-
cdnPath: "phaser/3.90.0/phaser.min.js",
|
|
23
|
-
moduleSpecifiers: [{ match: "exact", value: "phaser" }],
|
|
24
|
-
loadStage: 0,
|
|
25
|
-
enabled: true
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
libraryKey: "react@18.3.1",
|
|
29
|
-
assetKey: "library:react@18.3.1",
|
|
30
|
-
packageName: "react",
|
|
31
|
-
version: "18.3.1",
|
|
32
|
-
globalVar: "React",
|
|
33
|
-
cdnPath: "react/18.3.1/react.production.min.js",
|
|
34
|
-
moduleSpecifiers: [
|
|
35
|
-
{ match: "exact", value: "react", behavior: "namespace" },
|
|
36
|
-
{ match: "exact", value: "react/jsx-runtime", behavior: "react-jsx-runtime" },
|
|
37
|
-
{
|
|
38
|
-
match: "exact",
|
|
39
|
-
value: "react/jsx-dev-runtime",
|
|
40
|
-
behavior: "react-jsx-dev-runtime"
|
|
41
|
-
}
|
|
42
|
-
],
|
|
43
|
-
loadStage: 0,
|
|
44
|
-
// Must load before ReactDOM
|
|
45
|
-
enabled: true
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
libraryKey: "react-dom@18.3.1",
|
|
49
|
-
assetKey: "library:react-dom@18.3.1",
|
|
50
|
-
packageName: "react-dom",
|
|
51
|
-
version: "18.3.1",
|
|
52
|
-
globalVar: "ReactDOM",
|
|
53
|
-
cdnPath: "react-dom/18.3.1/react-dom.production.min.js",
|
|
54
|
-
moduleSpecifiers: [
|
|
55
|
-
{ match: "exact", value: "react-dom", behavior: "namespace" },
|
|
56
|
-
{ match: "exact", value: "react-dom/client", behavior: "namespace" }
|
|
57
|
-
],
|
|
58
|
-
loadStage: 1,
|
|
59
|
-
// Depends on React (stage 0)
|
|
60
|
-
enabled: true
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
libraryKey: "three@0.170.0",
|
|
64
|
-
assetKey: "library:three@0.170.0",
|
|
65
|
-
packageName: "three",
|
|
66
|
-
version: "0.170.0",
|
|
67
|
-
globalVar: "THREE",
|
|
68
|
-
cdnPath: "three/r170/three.min.js",
|
|
69
|
-
moduleSpecifiers: [
|
|
70
|
-
{ match: "exact", value: "three", behavior: "namespace" }
|
|
71
|
-
],
|
|
72
|
-
loadStage: 0,
|
|
73
|
-
enabled: true
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
libraryKey: "matter-js@0.19.0",
|
|
77
|
-
assetKey: "library:matter-js@0.19.0",
|
|
78
|
-
packageName: "matter-js",
|
|
79
|
-
version: "0.19.0",
|
|
80
|
-
globalVar: "Matter",
|
|
81
|
-
cdnPath: "matter-js/0.19.0/matter.min.js",
|
|
82
|
-
moduleSpecifiers: [{ match: "exact", value: "matter-js" }],
|
|
83
|
-
loadStage: 0,
|
|
84
|
-
enabled: true
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
libraryKey: "inkjs@2.2.0",
|
|
88
|
-
assetKey: "library:inkjs@2.2.0",
|
|
89
|
-
packageName: "inkjs",
|
|
90
|
-
version: "2.2.0",
|
|
91
|
-
globalVar: "inkjs",
|
|
92
|
-
cdnPath: "inkjs/2.2.0/ink.min.js",
|
|
93
|
-
moduleSpecifiers: [{ match: "exact", value: "inkjs" }],
|
|
94
|
-
loadStage: 0,
|
|
95
|
-
enabled: true
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
libraryKey: "zustand@5.0.3",
|
|
99
|
-
assetKey: "library:zustand@5.0.3",
|
|
100
|
-
packageName: "zustand",
|
|
101
|
-
version: "5.0.3",
|
|
102
|
-
globalVar: "zustand",
|
|
103
|
-
cdnPath: "zustand/5.0.3/zustand.min.js",
|
|
104
|
-
moduleSpecifiers: [
|
|
105
|
-
{ match: "exact", value: "zustand" },
|
|
106
|
-
{ match: "exact", value: "zustand/middleware" }
|
|
107
|
-
],
|
|
108
|
-
loadStage: 0,
|
|
109
|
-
enabled: true
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
libraryKey: "ammo.js@2024.11",
|
|
113
|
-
assetKey: "library:ammo.js@2024.11",
|
|
114
|
-
packageName: "ammo.js",
|
|
115
|
-
version: "2024.11",
|
|
116
|
-
globalVar: "Ammo",
|
|
117
|
-
cdnPath: "ammo/2024.11/ammo.js",
|
|
118
|
-
moduleSpecifiers: [
|
|
119
|
-
{ match: "exact", value: "ammo.js" },
|
|
120
|
-
{ match: "exact", value: "ammo.js/builds/ammo.wasm.js" }
|
|
121
|
-
],
|
|
122
|
-
loadStage: 0,
|
|
123
|
-
enabled: false
|
|
124
|
-
// Not ready yet - WASM loading needs additional work
|
|
125
|
-
}
|
|
126
|
-
];
|
|
127
|
-
var EMBEDDED_LIBRARY_BY_KEY = EMBEDDED_LIBRARIES.reduce(
|
|
128
|
-
(acc, lib) => {
|
|
129
|
-
acc[lib.libraryKey] = lib;
|
|
130
|
-
return acc;
|
|
131
|
-
},
|
|
132
|
-
{}
|
|
133
|
-
);
|
|
134
|
-
var MODULE_TO_LIBRARY_SPECIFIERS = EMBEDDED_LIBRARIES.filter(
|
|
135
|
-
(lib) => lib.enabled
|
|
136
|
-
).flatMap(
|
|
137
|
-
(lib) => lib.moduleSpecifiers.map((specifier) => ({
|
|
138
|
-
...specifier,
|
|
139
|
-
libraryKey: lib.libraryKey
|
|
140
|
-
}))
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
// src/shared-assets/generated/threeExports.ts
|
|
144
|
-
var EMBEDDED_THREE_VERSION = "0.170.0";
|
|
145
|
-
var EMBEDDED_THREE_NAMED_EXPORTS = [
|
|
146
|
-
"ACESFilmicToneMapping",
|
|
147
|
-
"AddEquation",
|
|
148
|
-
"AdditiveAnimationBlendMode",
|
|
149
|
-
"AdditiveBlending",
|
|
150
|
-
"AddOperation",
|
|
151
|
-
"AgXToneMapping",
|
|
152
|
-
"AlphaFormat",
|
|
153
|
-
"AlwaysCompare",
|
|
154
|
-
"AlwaysDepth",
|
|
155
|
-
"AlwaysStencilFunc",
|
|
156
|
-
"AmbientLight",
|
|
157
|
-
"AnimationAction",
|
|
158
|
-
"AnimationClip",
|
|
159
|
-
"AnimationLoader",
|
|
160
|
-
"AnimationMixer",
|
|
161
|
-
"AnimationObjectGroup",
|
|
162
|
-
"AnimationUtils",
|
|
163
|
-
"ArcCurve",
|
|
164
|
-
"ArrayCamera",
|
|
165
|
-
"ArrowHelper",
|
|
166
|
-
"AttachedBindMode",
|
|
167
|
-
"Audio",
|
|
168
|
-
"AudioAnalyser",
|
|
169
|
-
"AudioContext",
|
|
170
|
-
"AudioListener",
|
|
171
|
-
"AudioLoader",
|
|
172
|
-
"AxesHelper",
|
|
173
|
-
"BackSide",
|
|
174
|
-
"BasicDepthPacking",
|
|
175
|
-
"BasicShadowMap",
|
|
176
|
-
"BatchedMesh",
|
|
177
|
-
"Bone",
|
|
178
|
-
"BooleanKeyframeTrack",
|
|
179
|
-
"Box2",
|
|
180
|
-
"Box3",
|
|
181
|
-
"Box3Helper",
|
|
182
|
-
"BoxGeometry",
|
|
183
|
-
"BoxHelper",
|
|
184
|
-
"BufferAttribute",
|
|
185
|
-
"BufferGeometry",
|
|
186
|
-
"BufferGeometryLoader",
|
|
187
|
-
"ByteType",
|
|
188
|
-
"Cache",
|
|
189
|
-
"Camera",
|
|
190
|
-
"CameraHelper",
|
|
191
|
-
"CanvasTexture",
|
|
192
|
-
"CapsuleGeometry",
|
|
193
|
-
"CatmullRomCurve3",
|
|
194
|
-
"CineonToneMapping",
|
|
195
|
-
"CircleGeometry",
|
|
196
|
-
"ClampToEdgeWrapping",
|
|
197
|
-
"Clock",
|
|
198
|
-
"Color",
|
|
199
|
-
"ColorKeyframeTrack",
|
|
200
|
-
"ColorManagement",
|
|
201
|
-
"CompressedArrayTexture",
|
|
202
|
-
"CompressedCubeTexture",
|
|
203
|
-
"CompressedTexture",
|
|
204
|
-
"CompressedTextureLoader",
|
|
205
|
-
"ConeGeometry",
|
|
206
|
-
"ConstantAlphaFactor",
|
|
207
|
-
"ConstantColorFactor",
|
|
208
|
-
"Controls",
|
|
209
|
-
"createCanvasElement",
|
|
210
|
-
"CubeCamera",
|
|
211
|
-
"CubeReflectionMapping",
|
|
212
|
-
"CubeRefractionMapping",
|
|
213
|
-
"CubeTexture",
|
|
214
|
-
"CubeTextureLoader",
|
|
215
|
-
"CubeUVReflectionMapping",
|
|
216
|
-
"CubicBezierCurve",
|
|
217
|
-
"CubicBezierCurve3",
|
|
218
|
-
"CubicInterpolant",
|
|
219
|
-
"CullFaceBack",
|
|
220
|
-
"CullFaceFront",
|
|
221
|
-
"CullFaceFrontBack",
|
|
222
|
-
"CullFaceNone",
|
|
223
|
-
"Curve",
|
|
224
|
-
"CurvePath",
|
|
225
|
-
"CustomBlending",
|
|
226
|
-
"CustomToneMapping",
|
|
227
|
-
"CylinderGeometry",
|
|
228
|
-
"Cylindrical",
|
|
229
|
-
"Data3DTexture",
|
|
230
|
-
"DataArrayTexture",
|
|
231
|
-
"DataTexture",
|
|
232
|
-
"DataTextureLoader",
|
|
233
|
-
"DataUtils",
|
|
234
|
-
"DecrementStencilOp",
|
|
235
|
-
"DecrementWrapStencilOp",
|
|
236
|
-
"DefaultLoadingManager",
|
|
237
|
-
"DepthFormat",
|
|
238
|
-
"DepthStencilFormat",
|
|
239
|
-
"DepthTexture",
|
|
240
|
-
"DetachedBindMode",
|
|
241
|
-
"DirectionalLight",
|
|
242
|
-
"DirectionalLightHelper",
|
|
243
|
-
"DiscreteInterpolant",
|
|
244
|
-
"DodecahedronGeometry",
|
|
245
|
-
"DoubleSide",
|
|
246
|
-
"DstAlphaFactor",
|
|
247
|
-
"DstColorFactor",
|
|
248
|
-
"DynamicCopyUsage",
|
|
249
|
-
"DynamicDrawUsage",
|
|
250
|
-
"DynamicReadUsage",
|
|
251
|
-
"EdgesGeometry",
|
|
252
|
-
"EllipseCurve",
|
|
253
|
-
"EqualCompare",
|
|
254
|
-
"EqualDepth",
|
|
255
|
-
"EqualStencilFunc",
|
|
256
|
-
"EquirectangularReflectionMapping",
|
|
257
|
-
"EquirectangularRefractionMapping",
|
|
258
|
-
"Euler",
|
|
259
|
-
"EventDispatcher",
|
|
260
|
-
"ExtrudeGeometry",
|
|
261
|
-
"FileLoader",
|
|
262
|
-
"Float16BufferAttribute",
|
|
263
|
-
"Float32BufferAttribute",
|
|
264
|
-
"FloatType",
|
|
265
|
-
"Fog",
|
|
266
|
-
"FogExp2",
|
|
267
|
-
"FramebufferTexture",
|
|
268
|
-
"FrontSide",
|
|
269
|
-
"Frustum",
|
|
270
|
-
"GLBufferAttribute",
|
|
271
|
-
"GLSL1",
|
|
272
|
-
"GLSL3",
|
|
273
|
-
"GreaterCompare",
|
|
274
|
-
"GreaterDepth",
|
|
275
|
-
"GreaterEqualCompare",
|
|
276
|
-
"GreaterEqualDepth",
|
|
277
|
-
"GreaterEqualStencilFunc",
|
|
278
|
-
"GreaterStencilFunc",
|
|
279
|
-
"GridHelper",
|
|
280
|
-
"Group",
|
|
281
|
-
"HalfFloatType",
|
|
282
|
-
"HemisphereLight",
|
|
283
|
-
"HemisphereLightHelper",
|
|
284
|
-
"IcosahedronGeometry",
|
|
285
|
-
"ImageBitmapLoader",
|
|
286
|
-
"ImageLoader",
|
|
287
|
-
"ImageUtils",
|
|
288
|
-
"IncrementStencilOp",
|
|
289
|
-
"IncrementWrapStencilOp",
|
|
290
|
-
"InstancedBufferAttribute",
|
|
291
|
-
"InstancedBufferGeometry",
|
|
292
|
-
"InstancedInterleavedBuffer",
|
|
293
|
-
"InstancedMesh",
|
|
294
|
-
"Int16BufferAttribute",
|
|
295
|
-
"Int32BufferAttribute",
|
|
296
|
-
"Int8BufferAttribute",
|
|
297
|
-
"InterleavedBuffer",
|
|
298
|
-
"InterleavedBufferAttribute",
|
|
299
|
-
"Interpolant",
|
|
300
|
-
"InterpolateDiscrete",
|
|
301
|
-
"InterpolateLinear",
|
|
302
|
-
"InterpolateSmooth",
|
|
303
|
-
"IntType",
|
|
304
|
-
"InvertStencilOp",
|
|
305
|
-
"KeepStencilOp",
|
|
306
|
-
"KeyframeTrack",
|
|
307
|
-
"LatheGeometry",
|
|
308
|
-
"Layers",
|
|
309
|
-
"LessCompare",
|
|
310
|
-
"LessDepth",
|
|
311
|
-
"LessEqualCompare",
|
|
312
|
-
"LessEqualDepth",
|
|
313
|
-
"LessEqualStencilFunc",
|
|
314
|
-
"LessStencilFunc",
|
|
315
|
-
"Light",
|
|
316
|
-
"LightProbe",
|
|
317
|
-
"Line",
|
|
318
|
-
"Line3",
|
|
319
|
-
"LinearFilter",
|
|
320
|
-
"LinearInterpolant",
|
|
321
|
-
"LinearMipmapLinearFilter",
|
|
322
|
-
"LinearMipMapLinearFilter",
|
|
323
|
-
"LinearMipmapNearestFilter",
|
|
324
|
-
"LinearMipMapNearestFilter",
|
|
325
|
-
"LinearSRGBColorSpace",
|
|
326
|
-
"LinearToneMapping",
|
|
327
|
-
"LinearTransfer",
|
|
328
|
-
"LineBasicMaterial",
|
|
329
|
-
"LineCurve",
|
|
330
|
-
"LineCurve3",
|
|
331
|
-
"LineDashedMaterial",
|
|
332
|
-
"LineLoop",
|
|
333
|
-
"LineSegments",
|
|
334
|
-
"Loader",
|
|
335
|
-
"LoaderUtils",
|
|
336
|
-
"LoadingManager",
|
|
337
|
-
"LOD",
|
|
338
|
-
"LoopOnce",
|
|
339
|
-
"LoopPingPong",
|
|
340
|
-
"LoopRepeat",
|
|
341
|
-
"LuminanceAlphaFormat",
|
|
342
|
-
"LuminanceFormat",
|
|
343
|
-
"Material",
|
|
344
|
-
"MaterialLoader",
|
|
345
|
-
"MathUtils",
|
|
346
|
-
"Matrix2",
|
|
347
|
-
"Matrix3",
|
|
348
|
-
"Matrix4",
|
|
349
|
-
"MaxEquation",
|
|
350
|
-
"Mesh",
|
|
351
|
-
"MeshBasicMaterial",
|
|
352
|
-
"MeshDepthMaterial",
|
|
353
|
-
"MeshDistanceMaterial",
|
|
354
|
-
"MeshLambertMaterial",
|
|
355
|
-
"MeshMatcapMaterial",
|
|
356
|
-
"MeshNormalMaterial",
|
|
357
|
-
"MeshPhongMaterial",
|
|
358
|
-
"MeshPhysicalMaterial",
|
|
359
|
-
"MeshStandardMaterial",
|
|
360
|
-
"MeshToonMaterial",
|
|
361
|
-
"MinEquation",
|
|
362
|
-
"MirroredRepeatWrapping",
|
|
363
|
-
"MixOperation",
|
|
364
|
-
"MOUSE",
|
|
365
|
-
"MultiplyBlending",
|
|
366
|
-
"MultiplyOperation",
|
|
367
|
-
"NearestFilter",
|
|
368
|
-
"NearestMipmapLinearFilter",
|
|
369
|
-
"NearestMipMapLinearFilter",
|
|
370
|
-
"NearestMipmapNearestFilter",
|
|
371
|
-
"NearestMipMapNearestFilter",
|
|
372
|
-
"NeutralToneMapping",
|
|
373
|
-
"NeverCompare",
|
|
374
|
-
"NeverDepth",
|
|
375
|
-
"NeverStencilFunc",
|
|
376
|
-
"NoBlending",
|
|
377
|
-
"NoColorSpace",
|
|
378
|
-
"NormalAnimationBlendMode",
|
|
379
|
-
"NormalBlending",
|
|
380
|
-
"NotEqualCompare",
|
|
381
|
-
"NotEqualDepth",
|
|
382
|
-
"NotEqualStencilFunc",
|
|
383
|
-
"NoToneMapping",
|
|
384
|
-
"NumberKeyframeTrack",
|
|
385
|
-
"Object3D",
|
|
386
|
-
"ObjectLoader",
|
|
387
|
-
"ObjectSpaceNormalMap",
|
|
388
|
-
"OctahedronGeometry",
|
|
389
|
-
"OneFactor",
|
|
390
|
-
"OneMinusConstantAlphaFactor",
|
|
391
|
-
"OneMinusConstantColorFactor",
|
|
392
|
-
"OneMinusDstAlphaFactor",
|
|
393
|
-
"OneMinusDstColorFactor",
|
|
394
|
-
"OneMinusSrcAlphaFactor",
|
|
395
|
-
"OneMinusSrcColorFactor",
|
|
396
|
-
"OrthographicCamera",
|
|
397
|
-
"Path",
|
|
398
|
-
"PCFShadowMap",
|
|
399
|
-
"PCFSoftShadowMap",
|
|
400
|
-
"PerspectiveCamera",
|
|
401
|
-
"Plane",
|
|
402
|
-
"PlaneGeometry",
|
|
403
|
-
"PlaneHelper",
|
|
404
|
-
"PMREMGenerator",
|
|
405
|
-
"PointLight",
|
|
406
|
-
"PointLightHelper",
|
|
407
|
-
"Points",
|
|
408
|
-
"PointsMaterial",
|
|
409
|
-
"PolarGridHelper",
|
|
410
|
-
"PolyhedronGeometry",
|
|
411
|
-
"PositionalAudio",
|
|
412
|
-
"PropertyBinding",
|
|
413
|
-
"PropertyMixer",
|
|
414
|
-
"QuadraticBezierCurve",
|
|
415
|
-
"QuadraticBezierCurve3",
|
|
416
|
-
"Quaternion",
|
|
417
|
-
"QuaternionKeyframeTrack",
|
|
418
|
-
"QuaternionLinearInterpolant",
|
|
419
|
-
"RawShaderMaterial",
|
|
420
|
-
"Ray",
|
|
421
|
-
"Raycaster",
|
|
422
|
-
"RectAreaLight",
|
|
423
|
-
"RED_GREEN_RGTC2_Format",
|
|
424
|
-
"RED_RGTC1_Format",
|
|
425
|
-
"RedFormat",
|
|
426
|
-
"RedIntegerFormat",
|
|
427
|
-
"ReinhardToneMapping",
|
|
428
|
-
"RenderTarget",
|
|
429
|
-
"RepeatWrapping",
|
|
430
|
-
"ReplaceStencilOp",
|
|
431
|
-
"ReverseSubtractEquation",
|
|
432
|
-
"REVISION",
|
|
433
|
-
"RGB_BPTC_SIGNED_Format",
|
|
434
|
-
"RGB_BPTC_UNSIGNED_Format",
|
|
435
|
-
"RGB_ETC1_Format",
|
|
436
|
-
"RGB_ETC2_Format",
|
|
437
|
-
"RGB_PVRTC_2BPPV1_Format",
|
|
438
|
-
"RGB_PVRTC_4BPPV1_Format",
|
|
439
|
-
"RGB_S3TC_DXT1_Format",
|
|
440
|
-
"RGBA_ASTC_10x10_Format",
|
|
441
|
-
"RGBA_ASTC_10x5_Format",
|
|
442
|
-
"RGBA_ASTC_10x6_Format",
|
|
443
|
-
"RGBA_ASTC_10x8_Format",
|
|
444
|
-
"RGBA_ASTC_12x10_Format",
|
|
445
|
-
"RGBA_ASTC_12x12_Format",
|
|
446
|
-
"RGBA_ASTC_4x4_Format",
|
|
447
|
-
"RGBA_ASTC_5x4_Format",
|
|
448
|
-
"RGBA_ASTC_5x5_Format",
|
|
449
|
-
"RGBA_ASTC_6x5_Format",
|
|
450
|
-
"RGBA_ASTC_6x6_Format",
|
|
451
|
-
"RGBA_ASTC_8x5_Format",
|
|
452
|
-
"RGBA_ASTC_8x6_Format",
|
|
453
|
-
"RGBA_ASTC_8x8_Format",
|
|
454
|
-
"RGBA_BPTC_Format",
|
|
455
|
-
"RGBA_ETC2_EAC_Format",
|
|
456
|
-
"RGBA_PVRTC_2BPPV1_Format",
|
|
457
|
-
"RGBA_PVRTC_4BPPV1_Format",
|
|
458
|
-
"RGBA_S3TC_DXT1_Format",
|
|
459
|
-
"RGBA_S3TC_DXT3_Format",
|
|
460
|
-
"RGBA_S3TC_DXT5_Format",
|
|
461
|
-
"RGBADepthPacking",
|
|
462
|
-
"RGBAFormat",
|
|
463
|
-
"RGBAIntegerFormat",
|
|
464
|
-
"RGBDepthPacking",
|
|
465
|
-
"RGBFormat",
|
|
466
|
-
"RGBIntegerFormat",
|
|
467
|
-
"RGDepthPacking",
|
|
468
|
-
"RGFormat",
|
|
469
|
-
"RGIntegerFormat",
|
|
470
|
-
"RingGeometry",
|
|
471
|
-
"Scene",
|
|
472
|
-
"ShaderChunk",
|
|
473
|
-
"ShaderLib",
|
|
474
|
-
"ShaderMaterial",
|
|
475
|
-
"ShadowMaterial",
|
|
476
|
-
"Shape",
|
|
477
|
-
"ShapeGeometry",
|
|
478
|
-
"ShapePath",
|
|
479
|
-
"ShapeUtils",
|
|
480
|
-
"ShortType",
|
|
481
|
-
"SIGNED_RED_GREEN_RGTC2_Format",
|
|
482
|
-
"SIGNED_RED_RGTC1_Format",
|
|
483
|
-
"Skeleton",
|
|
484
|
-
"SkeletonHelper",
|
|
485
|
-
"SkinnedMesh",
|
|
486
|
-
"Source",
|
|
487
|
-
"Sphere",
|
|
488
|
-
"SphereGeometry",
|
|
489
|
-
"Spherical",
|
|
490
|
-
"SphericalHarmonics3",
|
|
491
|
-
"SplineCurve",
|
|
492
|
-
"SpotLight",
|
|
493
|
-
"SpotLightHelper",
|
|
494
|
-
"Sprite",
|
|
495
|
-
"SpriteMaterial",
|
|
496
|
-
"SrcAlphaFactor",
|
|
497
|
-
"SrcAlphaSaturateFactor",
|
|
498
|
-
"SrcColorFactor",
|
|
499
|
-
"SRGBColorSpace",
|
|
500
|
-
"SRGBTransfer",
|
|
501
|
-
"StaticCopyUsage",
|
|
502
|
-
"StaticDrawUsage",
|
|
503
|
-
"StaticReadUsage",
|
|
504
|
-
"StereoCamera",
|
|
505
|
-
"StreamCopyUsage",
|
|
506
|
-
"StreamDrawUsage",
|
|
507
|
-
"StreamReadUsage",
|
|
508
|
-
"StringKeyframeTrack",
|
|
509
|
-
"SubtractEquation",
|
|
510
|
-
"SubtractiveBlending",
|
|
511
|
-
"TangentSpaceNormalMap",
|
|
512
|
-
"TetrahedronGeometry",
|
|
513
|
-
"Texture",
|
|
514
|
-
"TextureLoader",
|
|
515
|
-
"TextureUtils",
|
|
516
|
-
"TorusGeometry",
|
|
517
|
-
"TorusKnotGeometry",
|
|
518
|
-
"TOUCH",
|
|
519
|
-
"Triangle",
|
|
520
|
-
"TriangleFanDrawMode",
|
|
521
|
-
"TrianglesDrawMode",
|
|
522
|
-
"TriangleStripDrawMode",
|
|
523
|
-
"TubeGeometry",
|
|
524
|
-
"Uint16BufferAttribute",
|
|
525
|
-
"Uint32BufferAttribute",
|
|
526
|
-
"Uint8BufferAttribute",
|
|
527
|
-
"Uint8ClampedBufferAttribute",
|
|
528
|
-
"Uniform",
|
|
529
|
-
"UniformsGroup",
|
|
530
|
-
"UniformsLib",
|
|
531
|
-
"UniformsUtils",
|
|
532
|
-
"UnsignedByteType",
|
|
533
|
-
"UnsignedInt248Type",
|
|
534
|
-
"UnsignedInt5999Type",
|
|
535
|
-
"UnsignedIntType",
|
|
536
|
-
"UnsignedShort4444Type",
|
|
537
|
-
"UnsignedShort5551Type",
|
|
538
|
-
"UnsignedShortType",
|
|
539
|
-
"UVMapping",
|
|
540
|
-
"Vector2",
|
|
541
|
-
"Vector3",
|
|
542
|
-
"Vector4",
|
|
543
|
-
"VectorKeyframeTrack",
|
|
544
|
-
"VideoTexture",
|
|
545
|
-
"VSMShadowMap",
|
|
546
|
-
"WebGL3DRenderTarget",
|
|
547
|
-
"WebGLArrayRenderTarget",
|
|
548
|
-
"WebGLCoordinateSystem",
|
|
549
|
-
"WebGLCubeRenderTarget",
|
|
550
|
-
"WebGLMultipleRenderTargets",
|
|
551
|
-
"WebGLRenderer",
|
|
552
|
-
"WebGLRenderTarget",
|
|
553
|
-
"WebGLUtils",
|
|
554
|
-
"WebGPUCoordinateSystem",
|
|
555
|
-
"WireframeGeometry",
|
|
556
|
-
"WrapAroundEnding",
|
|
557
|
-
"ZeroCurvatureEnding",
|
|
558
|
-
"ZeroFactor",
|
|
559
|
-
"ZeroSlopeEnding",
|
|
560
|
-
"ZeroStencilOp"
|
|
561
|
-
];
|
|
562
|
-
|
|
563
|
-
// src/vite/venusLibrariesPlugin.ts
|
|
564
|
-
async function resolveInstalledPackageVersion(pluginContext, packageName, cache) {
|
|
565
|
-
if (cache.has(packageName)) {
|
|
566
|
-
return cache.get(packageName) ?? null;
|
|
567
|
-
}
|
|
568
|
-
const readVersion = (packageJsonPath) => {
|
|
569
|
-
const raw = fs__default.default.readFileSync(packageJsonPath, "utf8");
|
|
570
|
-
const parsed = JSON.parse(raw);
|
|
571
|
-
return typeof parsed?.version === "string" ? parsed.version : null;
|
|
572
|
-
};
|
|
573
|
-
const findNearestPackageJson = (fromFilePath) => {
|
|
574
|
-
let dir = path__default.default.dirname(fromFilePath);
|
|
575
|
-
while (true) {
|
|
576
|
-
const candidate = path__default.default.join(dir, "package.json");
|
|
577
|
-
if (fs__default.default.existsSync(candidate) && fs__default.default.statSync(candidate).isFile()) {
|
|
578
|
-
return candidate;
|
|
579
|
-
}
|
|
580
|
-
const parent = path__default.default.dirname(dir);
|
|
581
|
-
if (parent === dir) return null;
|
|
582
|
-
dir = parent;
|
|
583
|
-
}
|
|
584
|
-
};
|
|
585
|
-
try {
|
|
586
|
-
const pkgJsonResolved = await pluginContext.resolve(
|
|
587
|
-
`${packageName}/package.json`,
|
|
588
|
-
void 0,
|
|
589
|
-
{ skipSelf: true }
|
|
590
|
-
);
|
|
591
|
-
if (pkgJsonResolved?.id && fs__default.default.existsSync(pkgJsonResolved.id)) {
|
|
592
|
-
const v = readVersion(pkgJsonResolved.id);
|
|
593
|
-
cache.set(packageName, v);
|
|
594
|
-
return v;
|
|
595
|
-
}
|
|
596
|
-
const entryResolved = await pluginContext.resolve(packageName, void 0, {
|
|
597
|
-
skipSelf: true
|
|
598
|
-
});
|
|
599
|
-
if (entryResolved?.id) {
|
|
600
|
-
const pkgJsonPath = findNearestPackageJson(entryResolved.id);
|
|
601
|
-
const v = pkgJsonPath ? readVersion(pkgJsonPath) : null;
|
|
602
|
-
cache.set(packageName, v);
|
|
603
|
-
return v;
|
|
604
|
-
}
|
|
605
|
-
} catch {
|
|
606
|
-
}
|
|
607
|
-
cache.set(packageName, null);
|
|
608
|
-
return null;
|
|
609
|
-
}
|
|
610
|
-
function generateVirtualModule(lib, spec, importPath) {
|
|
611
|
-
const errorCheck = `
|
|
612
|
-
// Wait for shim to complete loading libraries
|
|
613
|
-
if (window.__venusLibraryShim && window.__venusLibraryShim.ready) {
|
|
614
|
-
try {
|
|
615
|
-
await window.__venusLibraryShim.ready();
|
|
616
|
-
} catch (error) {
|
|
617
|
-
console.error('[Venus Libraries] Shim bootstrap failed:', error);
|
|
618
|
-
throw error;
|
|
619
|
-
}
|
|
620
|
-
} else {
|
|
621
|
-
console.warn('[Venus Libraries] No shim found - running without embedded libraries');
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
// Verify library was loaded
|
|
625
|
-
if (!window.__venusLibraryExports || !window.__venusLibraryExports['${lib.libraryKey}']) {
|
|
626
|
-
console.error('[Venus Libraries] ${lib.packageName} library not loaded');
|
|
627
|
-
console.error('[Venus Libraries] Config:', window.__venusLibrariesConfig);
|
|
628
|
-
console.error('[Venus Libraries] Exports:', window.__venusLibraryExports);
|
|
629
|
-
throw new Error(
|
|
630
|
-
'${lib.packageName} not loaded (${importPath}). Check console for errors.'
|
|
631
|
-
);
|
|
632
|
-
}
|
|
633
|
-
`;
|
|
634
|
-
const libVar = `window.__venusLibraryExports['${lib.libraryKey}']`;
|
|
635
|
-
const renderForwardedNamedExports = (names, chunkSize = 50) => {
|
|
636
|
-
if (names.length === 0) return "";
|
|
637
|
-
const chunks = [];
|
|
638
|
-
for (let i = 0; i < names.length; i += chunkSize) {
|
|
639
|
-
const slice = names.slice(i, i + chunkSize).join(", ");
|
|
640
|
-
chunks.push(`export const { ${slice} } = lib;`);
|
|
641
|
-
}
|
|
642
|
-
return `
|
|
643
|
-
${chunks.join("\n")}
|
|
644
|
-
`;
|
|
645
|
-
};
|
|
646
|
-
switch (spec.behavior) {
|
|
647
|
-
case "react-jsx-runtime":
|
|
648
|
-
return `
|
|
649
|
-
const React = await (async function() {
|
|
650
|
-
${errorCheck}
|
|
651
|
-
return ${libVar};
|
|
652
|
-
})();
|
|
653
|
-
|
|
654
|
-
export const jsx = React.jsx || function(type, props, key) {
|
|
655
|
-
return React.createElement(type, { ...props, key });
|
|
656
|
-
};
|
|
657
|
-
export const jsxs = React.jsxs || jsx;
|
|
658
|
-
export const Fragment = React.Fragment;
|
|
659
|
-
`;
|
|
660
|
-
case "react-jsx-dev-runtime":
|
|
661
|
-
return `
|
|
662
|
-
const React = await (async function() {
|
|
663
|
-
${errorCheck}
|
|
664
|
-
return ${libVar};
|
|
665
|
-
})();
|
|
666
|
-
|
|
667
|
-
export const jsxDEV = React.jsxDEV || React.createElement;
|
|
668
|
-
export const Fragment = React.Fragment;
|
|
669
|
-
`;
|
|
670
|
-
case "namespace":
|
|
671
|
-
let namedExports = "";
|
|
672
|
-
if (lib.packageName === "react") {
|
|
673
|
-
namedExports = `
|
|
674
|
-
export const {
|
|
675
|
-
createElement, createContext, createRef,
|
|
676
|
-
Component, PureComponent, Fragment, StrictMode, Suspense, lazy, forwardRef, memo,
|
|
677
|
-
useState, useEffect, useContext, useReducer, useCallback, useMemo, useRef,
|
|
678
|
-
useLayoutEffect, useImperativeHandle, useDebugValue, useTransition, useDeferredValue,
|
|
679
|
-
Children, cloneElement, isValidElement, version
|
|
680
|
-
} = lib;`;
|
|
681
|
-
} else if (lib.packageName === "react-dom") {
|
|
682
|
-
namedExports = `
|
|
683
|
-
export const { createRoot, hydrateRoot, render, unmountComponentAtNode, findDOMNode, version } = lib;`;
|
|
684
|
-
} else if (lib.packageName === "three") {
|
|
685
|
-
if (lib.version !== EMBEDDED_THREE_VERSION) {
|
|
686
|
-
namedExports = `
|
|
687
|
-
throw new Error('[Venus Libraries] Embedded three version mismatch: manifest has ${lib.version} but generated export list is for ${EMBEDDED_THREE_VERSION}. Run: npm run generate:embedded-three-exports (packages/api)');`;
|
|
688
|
-
} else {
|
|
689
|
-
namedExports = renderForwardedNamedExports(EMBEDDED_THREE_NAMED_EXPORTS);
|
|
690
|
-
}
|
|
691
|
-
} else {
|
|
692
|
-
namedExports = "";
|
|
693
|
-
}
|
|
694
|
-
return `
|
|
695
|
-
const lib = await (async function() {
|
|
696
|
-
${errorCheck}
|
|
697
|
-
return ${libVar};
|
|
698
|
-
})();
|
|
699
|
-
|
|
700
|
-
export default lib;
|
|
701
|
-
${namedExports}
|
|
702
|
-
`;
|
|
703
|
-
case "default":
|
|
704
|
-
case void 0:
|
|
705
|
-
return `
|
|
706
|
-
const lib = await (async function() {
|
|
707
|
-
${errorCheck}
|
|
708
|
-
return ${libVar};
|
|
709
|
-
})();
|
|
710
|
-
|
|
711
|
-
export default lib;
|
|
712
|
-
`;
|
|
713
|
-
default:
|
|
714
|
-
throw new Error(
|
|
715
|
-
`Unknown behavior: ${spec.behavior} for ${lib.packageName}. Valid behaviors: default, namespace, react-jsx-runtime, react-jsx-dev-runtime`
|
|
716
|
-
);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
function venusLibrariesPlugin(options = {}) {
|
|
720
|
-
const cdnDir = path__default.default.resolve(options.cdnDir || "./cdn");
|
|
721
|
-
const debug = options.debug || false;
|
|
722
|
-
const requiredLibraries = /* @__PURE__ */ new Set();
|
|
723
|
-
let isServe = false;
|
|
724
|
-
let enabled = false;
|
|
725
|
-
let appName = options.appName;
|
|
726
|
-
const installedVersionCache = /* @__PURE__ */ new Map();
|
|
727
|
-
const loggedMismatch = /* @__PURE__ */ new Set();
|
|
728
|
-
return {
|
|
729
|
-
name: "vite-plugin-venus-libraries",
|
|
730
|
-
enforce: "pre",
|
|
731
|
-
// Run before other plugins to intercept imports
|
|
732
|
-
async buildStart() {
|
|
733
|
-
if (!enabled) return;
|
|
734
|
-
const uniquePackages = Array.from(
|
|
735
|
-
new Set(
|
|
736
|
-
EMBEDDED_LIBRARIES.filter((l) => l.enabled).map((l) => l.packageName)
|
|
737
|
-
)
|
|
738
|
-
);
|
|
739
|
-
for (const pkgName of uniquePackages) {
|
|
740
|
-
await resolveInstalledPackageVersion(this, pkgName, installedVersionCache);
|
|
741
|
-
}
|
|
742
|
-
},
|
|
743
|
-
// 0. Configure Vite build options
|
|
744
|
-
config(config) {
|
|
745
|
-
if (!enabled) return;
|
|
746
|
-
if (!config.build) config.build = {};
|
|
747
|
-
if (!config.build.rollupOptions) config.build.rollupOptions = {};
|
|
748
|
-
if (config.build.rollupOptions.output) {
|
|
749
|
-
const output = config.build.rollupOptions.output;
|
|
750
|
-
const outputs = Array.isArray(output) ? output : [output];
|
|
751
|
-
outputs.forEach((o) => {
|
|
752
|
-
if (o.manualChunks && typeof o.manualChunks === "object") {
|
|
753
|
-
const chunks = o.manualChunks;
|
|
754
|
-
EMBEDDED_LIBRARIES.forEach((lib) => {
|
|
755
|
-
if (lib.enabled && chunks[lib.packageName]) {
|
|
756
|
-
delete chunks[lib.packageName];
|
|
757
|
-
}
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
},
|
|
763
|
-
// Log plugin status
|
|
764
|
-
configResolved(config) {
|
|
765
|
-
isServe = config.command === "serve";
|
|
766
|
-
enabled = !isServe && process.env.VENUS_DISABLE_EMBEDDED_LIBS !== "true";
|
|
767
|
-
if (!appName && config.root) {
|
|
768
|
-
const rootParts = config.root.split(path__default.default.sep);
|
|
769
|
-
const h5Index = rootParts.indexOf("H5");
|
|
770
|
-
if (h5Index >= 0 && h5Index < rootParts.length - 1) {
|
|
771
|
-
appName = rootParts[h5Index + 1];
|
|
772
|
-
if (debug) {
|
|
773
|
-
console.log(
|
|
774
|
-
`[Venus Libraries] Auto-detected app name from folder structure: ${appName}`
|
|
775
|
-
);
|
|
776
|
-
}
|
|
777
|
-
} else if (debug) {
|
|
778
|
-
console.log(
|
|
779
|
-
"[Venus Libraries] Not in H5 folder structure - CDN asset serving disabled (embedded libraries still work)"
|
|
780
|
-
);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
if (isServe) {
|
|
784
|
-
return;
|
|
785
|
-
}
|
|
786
|
-
if (!enabled) {
|
|
787
|
-
console.log(
|
|
788
|
-
"\n[Venus Libraries] Building with bundled libraries (standalone mode)"
|
|
789
|
-
);
|
|
790
|
-
}
|
|
791
|
-
},
|
|
792
|
-
// 1. Intercept library imports
|
|
793
|
-
async resolveId(id, importer) {
|
|
794
|
-
if (!enabled) return null;
|
|
795
|
-
const match = MODULE_TO_LIBRARY_SPECIFIERS.find((spec) => {
|
|
796
|
-
if (spec.match === "exact") {
|
|
797
|
-
return spec.value === id;
|
|
798
|
-
} else if (spec.match === "prefix") {
|
|
799
|
-
return id.startsWith(spec.value);
|
|
800
|
-
}
|
|
801
|
-
return false;
|
|
802
|
-
});
|
|
803
|
-
if (match) {
|
|
804
|
-
const lib = EMBEDDED_LIBRARY_BY_KEY[match.libraryKey];
|
|
805
|
-
if (!lib) {
|
|
806
|
-
throw new Error(
|
|
807
|
-
`[Venus Libraries] Internal error: no embedded library for key ${match.libraryKey}`
|
|
808
|
-
);
|
|
809
|
-
}
|
|
810
|
-
const installed = await resolveInstalledPackageVersion(
|
|
811
|
-
this,
|
|
812
|
-
lib.packageName,
|
|
813
|
-
installedVersionCache
|
|
814
|
-
);
|
|
815
|
-
if (installed !== lib.version) {
|
|
816
|
-
if (debug && !loggedMismatch.has(lib.packageName)) {
|
|
817
|
-
loggedMismatch.add(lib.packageName);
|
|
818
|
-
console.log(
|
|
819
|
-
`[Venus Libraries] Skipping embedded ${lib.packageName}: installed=${installed ?? "unknown"} embedded=${lib.version}`
|
|
820
|
-
);
|
|
821
|
-
}
|
|
822
|
-
return null;
|
|
823
|
-
}
|
|
824
|
-
requiredLibraries.add(match.libraryKey);
|
|
825
|
-
return `\0virtual:venus-lib:${match.libraryKey}:${id}`;
|
|
826
|
-
}
|
|
827
|
-
return null;
|
|
828
|
-
},
|
|
829
|
-
// 2. Generate virtual module
|
|
830
|
-
load(id) {
|
|
831
|
-
if (!id.startsWith("\0virtual:venus-lib:")) {
|
|
832
|
-
return null;
|
|
833
|
-
}
|
|
834
|
-
const parts = id.split(":");
|
|
835
|
-
const libraryKey = parts[2];
|
|
836
|
-
const importPath = parts.slice(3).join(":");
|
|
837
|
-
const lib = EMBEDDED_LIBRARY_BY_KEY[libraryKey];
|
|
838
|
-
if (!lib) {
|
|
839
|
-
const availableKeys = Object.keys(EMBEDDED_LIBRARY_BY_KEY).join(", ");
|
|
840
|
-
throw new Error(
|
|
841
|
-
`Unknown library: ${libraryKey}. Available libraries: ${availableKeys}`
|
|
842
|
-
);
|
|
843
|
-
}
|
|
844
|
-
const spec = lib.moduleSpecifiers.find((s) => {
|
|
845
|
-
if (s.match === "exact") return s.value === importPath;
|
|
846
|
-
if (s.match === "prefix") return importPath.startsWith(s.value);
|
|
847
|
-
return false;
|
|
848
|
-
});
|
|
849
|
-
if (!spec) {
|
|
850
|
-
const validSpecifiers = lib.moduleSpecifiers.map((s) => s.value).join(", ");
|
|
851
|
-
throw new Error(
|
|
852
|
-
`Unknown module specifier: ${importPath} for ${libraryKey}. Valid specifiers: ${validSpecifiers}`
|
|
853
|
-
);
|
|
854
|
-
}
|
|
855
|
-
const virtualModule = generateVirtualModule(lib, spec, importPath);
|
|
856
|
-
return `// Virtual module: ${importPath}
|
|
857
|
-
${virtualModule}`;
|
|
858
|
-
},
|
|
859
|
-
// 3. Transform HTML - inject config and shim for web support
|
|
860
|
-
transformIndexHtml(html) {
|
|
861
|
-
if (!enabled || requiredLibraries.size === 0) {
|
|
862
|
-
return html;
|
|
863
|
-
}
|
|
864
|
-
const manifest = {};
|
|
865
|
-
requiredLibraries.forEach((libraryKey) => {
|
|
866
|
-
const lib = EMBEDDED_LIBRARY_BY_KEY[libraryKey];
|
|
867
|
-
manifest[libraryKey] = {
|
|
868
|
-
assetKey: lib.assetKey,
|
|
869
|
-
cdnPath: lib.cdnPath,
|
|
870
|
-
globalVar: lib.globalVar,
|
|
871
|
-
loadStage: lib.loadStage
|
|
872
|
-
};
|
|
873
|
-
});
|
|
874
|
-
const embeddedLibsScript = `
|
|
875
|
-
<script>
|
|
876
|
-
// Set config (may be overridden by Venus host)
|
|
877
|
-
if (!window.__venusLibrariesConfig) {
|
|
878
|
-
window.__venusLibrariesConfig = {
|
|
879
|
-
enabled: true,
|
|
880
|
-
required: ${JSON.stringify(Array.from(requiredLibraries))},
|
|
881
|
-
manifest: ${JSON.stringify(manifest, null, 2)},
|
|
882
|
-
cdnBase: '${DEFAULT_SHARED_LIB_CDN_BASE}',
|
|
883
|
-
useHost: false, // Web uses CDN
|
|
884
|
-
debug: ${debug}
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
// Minimal shim for web (CDN loading)
|
|
889
|
-
if (!window.__venusLibraryShim) {
|
|
890
|
-
var bootstrapResolve, bootstrapReject;
|
|
891
|
-
var bootstrapPromise = new Promise(function(resolve, reject) {
|
|
892
|
-
bootstrapResolve = resolve;
|
|
893
|
-
bootstrapReject = reject;
|
|
894
|
-
});
|
|
895
|
-
|
|
896
|
-
window.__venusLibraryShim = {
|
|
897
|
-
ready: function() { return bootstrapPromise; },
|
|
898
|
-
__initialized: true
|
|
899
|
-
};
|
|
900
|
-
|
|
901
|
-
// Auto-load libraries from CDN by stage (respects dependencies)
|
|
902
|
-
var config = window.__venusLibrariesConfig;
|
|
903
|
-
if (!config.required || config.required.length === 0) {
|
|
904
|
-
bootstrapResolve();
|
|
905
|
-
} else {
|
|
906
|
-
// Group libraries by load stage
|
|
907
|
-
var librariesByStage = {};
|
|
908
|
-
for (var i = 0; i < config.required.length; i++) {
|
|
909
|
-
var libraryKey = config.required[i];
|
|
910
|
-
var entry = config.manifest[libraryKey];
|
|
911
|
-
var stage = entry.loadStage || 0;
|
|
912
|
-
if (!librariesByStage[stage]) librariesByStage[stage] = [];
|
|
913
|
-
librariesByStage[stage].push({ libraryKey: libraryKey, entry: entry });
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
// Load stages sequentially, libraries within each stage in parallel
|
|
917
|
-
var stages = Object.keys(librariesByStage).sort(function(a, b) { return parseInt(a, 10) - parseInt(b, 10); });
|
|
918
|
-
|
|
919
|
-
(async function loadByStages() {
|
|
920
|
-
for (var s = 0; s < stages.length; s++) {
|
|
921
|
-
var stage = stages[s];
|
|
922
|
-
var libs = librariesByStage[stage];
|
|
923
|
-
|
|
924
|
-
// Load all libraries in this stage in parallel
|
|
925
|
-
var stagePromises = libs.map(function(lib) {
|
|
926
|
-
var base = config.cdnBase || '';
|
|
927
|
-
if (!base.endsWith('/')) base += '/';
|
|
928
|
-
var path = lib.entry.cdnPath;
|
|
929
|
-
if (path.charAt(0) === '/') path = path.substring(1);
|
|
930
|
-
var url = base + path;
|
|
931
|
-
return fetch(url)
|
|
932
|
-
.then(function(r) { return r.text(); })
|
|
933
|
-
.then(function(src) {
|
|
934
|
-
(new Function(src)).call(window);
|
|
935
|
-
if (!window.__venusLibraryExports) window.__venusLibraryExports = {};
|
|
936
|
-
window.__venusLibraryExports[lib.libraryKey] = window[lib.entry.globalVar];
|
|
937
|
-
});
|
|
938
|
-
});
|
|
939
|
-
|
|
940
|
-
await Promise.all(stagePromises);
|
|
941
|
-
}
|
|
942
|
-
})()
|
|
943
|
-
.then(function() {
|
|
944
|
-
bootstrapResolve();
|
|
945
|
-
})
|
|
946
|
-
.catch(function(err) {
|
|
947
|
-
console.error('[Venus Libraries] Library loading failed:', err);
|
|
948
|
-
bootstrapReject(err);
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
</script>`;
|
|
953
|
-
return html.replace("<head>", "<head>" + embeddedLibsScript);
|
|
954
|
-
},
|
|
955
|
-
// 4. Serve CDN assets in dev mode (only if in H5 folder structure)
|
|
956
|
-
configureServer(server) {
|
|
957
|
-
if (!enabled || !appName) {
|
|
958
|
-
return;
|
|
959
|
-
}
|
|
960
|
-
if (debug) {
|
|
961
|
-
console.log(
|
|
962
|
-
`[Venus Libraries] Dev server will serve /${appName}/* from ${cdnDir}`
|
|
963
|
-
);
|
|
964
|
-
}
|
|
965
|
-
server.middlewares.use(
|
|
966
|
-
(req, res, next) => {
|
|
967
|
-
if (!req.url) return next();
|
|
968
|
-
const urlPath = req.url.split("?")[0];
|
|
969
|
-
if (!urlPath.startsWith(`/${appName}/`)) return next();
|
|
970
|
-
const relativePath = urlPath.replace(`/${appName}/`, "");
|
|
971
|
-
const filePath = path__default.default.join(cdnDir, relativePath);
|
|
972
|
-
if (fs__default.default.existsSync(filePath) && fs__default.default.statSync(filePath).isFile()) {
|
|
973
|
-
const ext = path__default.default.extname(filePath).toLowerCase();
|
|
974
|
-
const contentTypes = {
|
|
975
|
-
".png": "image/png",
|
|
976
|
-
".jpg": "image/jpeg",
|
|
977
|
-
".jpeg": "image/jpeg",
|
|
978
|
-
".gif": "image/gif",
|
|
979
|
-
".webp": "image/webp",
|
|
980
|
-
".mp3": "audio/mpeg",
|
|
981
|
-
".mp4": "video/mp4",
|
|
982
|
-
".ogg": "audio/ogg",
|
|
983
|
-
".wav": "audio/wav",
|
|
984
|
-
".json": "application/json"
|
|
985
|
-
};
|
|
986
|
-
res.setHeader(
|
|
987
|
-
"Content-Type",
|
|
988
|
-
contentTypes[ext] || "application/octet-stream"
|
|
989
|
-
);
|
|
990
|
-
res.setHeader("Cache-Control", "public, max-age=3600");
|
|
991
|
-
return res.end(fs__default.default.readFileSync(filePath));
|
|
992
|
-
}
|
|
993
|
-
next();
|
|
994
|
-
}
|
|
995
|
-
);
|
|
996
|
-
},
|
|
997
|
-
// 5. Emit manifest for debugging
|
|
998
|
-
generateBundle() {
|
|
999
|
-
if (!enabled || requiredLibraries.size === 0) return;
|
|
1000
|
-
const libraries = {};
|
|
1001
|
-
const libraryNames = [];
|
|
1002
|
-
let totalSavingsKB = 0;
|
|
1003
|
-
requiredLibraries.forEach((libraryKey) => {
|
|
1004
|
-
const lib = EMBEDDED_LIBRARY_BY_KEY[libraryKey];
|
|
1005
|
-
libraries[libraryKey] = {
|
|
1006
|
-
assetKey: lib.assetKey,
|
|
1007
|
-
cdnPath: lib.cdnPath,
|
|
1008
|
-
globalVar: lib.globalVar,
|
|
1009
|
-
packageName: lib.packageName,
|
|
1010
|
-
version: lib.version,
|
|
1011
|
-
moduleSpecifiers: lib.moduleSpecifiers.map((s) => s.value)
|
|
1012
|
-
};
|
|
1013
|
-
libraryNames.push(lib.packageName);
|
|
1014
|
-
const sizes = {
|
|
1015
|
-
phaser: 1100,
|
|
1016
|
-
react: 138,
|
|
1017
|
-
"react-dom": 42,
|
|
1018
|
-
three: 600,
|
|
1019
|
-
"matter-js": 100,
|
|
1020
|
-
inkjs: 50
|
|
1021
|
-
};
|
|
1022
|
-
totalSavingsKB += sizes[lib.packageName] || 0;
|
|
1023
|
-
});
|
|
1024
|
-
const manifest = {
|
|
1025
|
-
enabled: true,
|
|
1026
|
-
required: Array.from(requiredLibraries),
|
|
1027
|
-
libraries,
|
|
1028
|
-
cdnBase: DEFAULT_SHARED_LIB_CDN_BASE,
|
|
1029
|
-
buildTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1030
|
-
plugin: "@series-inc/venus-sdk/vite"
|
|
1031
|
-
};
|
|
1032
|
-
this.emitFile({
|
|
1033
|
-
type: "asset",
|
|
1034
|
-
fileName: "venus-libraries.manifest.json",
|
|
1035
|
-
source: JSON.stringify(manifest, null, 2)
|
|
1036
|
-
});
|
|
1037
|
-
const libList = libraryNames.join(", ");
|
|
1038
|
-
const savingsMsg = totalSavingsKB > 0 ? ` (~${totalSavingsKB}KB saved)` : "";
|
|
1039
|
-
console.log(
|
|
1040
|
-
`
|
|
1041
|
-
[Venus Libraries] Using embedded libraries to reduce bundle size: ${libList}${savingsMsg}`
|
|
1042
|
-
);
|
|
1043
|
-
}
|
|
1044
|
-
};
|
|
1045
|
-
}
|
|
1046
|
-
function cdnPlugin() {
|
|
1047
|
-
let config;
|
|
1048
|
-
return {
|
|
1049
|
-
name: "remove-dev-assets",
|
|
1050
|
-
apply: "build",
|
|
1051
|
-
// Hook to capture the resolved config
|
|
1052
|
-
configResolved(resolvedConfig) {
|
|
1053
|
-
config = resolvedConfig;
|
|
1054
|
-
},
|
|
1055
|
-
closeBundle() {
|
|
1056
|
-
const outDir = config.build.outDir;
|
|
1057
|
-
const devAssetsDir = path__default.default.resolve(config.root, outDir, "cdn");
|
|
1058
|
-
if (fs__default.default.existsSync(devAssetsDir)) {
|
|
1059
|
-
fs__default.default.rmSync(devAssetsDir, { recursive: true, force: true });
|
|
1060
|
-
console.log(`[Cleanup] Removed cdn from: ${devAssetsDir}`);
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
exports.cdnPlugin = cdnPlugin;
|
|
1067
|
-
exports.venusLibrariesPlugin = venusLibrariesPlugin;
|
|
1068
|
-
//# sourceMappingURL=index.cjs.map
|
|
1069
|
-
//# sourceMappingURL=index.cjs.map
|