@series-inc/venus-sdk 3.4.0-beta.1 → 3.4.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,8 +60,7 @@ var EMBEDDED_LIBRARIES = [
60
60
  globalVar: "THREE",
61
61
  cdnPath: "three/r170/three.min.js",
62
62
  moduleSpecifiers: [
63
- { match: "exact", value: "three", behavior: "namespace" },
64
- { match: "prefix", value: "three/examples/jsm/", behavior: "namespace" }
63
+ { match: "exact", value: "three", behavior: "namespace" }
65
64
  ],
66
65
  loadStage: 0,
67
66
  enabled: true
@@ -134,7 +133,473 @@ var MODULE_TO_LIBRARY_SPECIFIERS = EMBEDDED_LIBRARIES.filter(
134
133
  }))
135
134
  );
136
135
 
136
+ // src/shared-assets/generated/threeExports.ts
137
+ var EMBEDDED_THREE_VERSION = "0.170.0";
138
+ var EMBEDDED_THREE_NAMED_EXPORTS = [
139
+ "ACESFilmicToneMapping",
140
+ "AddEquation",
141
+ "AdditiveAnimationBlendMode",
142
+ "AdditiveBlending",
143
+ "AddOperation",
144
+ "AgXToneMapping",
145
+ "AlphaFormat",
146
+ "AlwaysCompare",
147
+ "AlwaysDepth",
148
+ "AlwaysStencilFunc",
149
+ "AmbientLight",
150
+ "AnimationAction",
151
+ "AnimationClip",
152
+ "AnimationLoader",
153
+ "AnimationMixer",
154
+ "AnimationObjectGroup",
155
+ "AnimationUtils",
156
+ "ArcCurve",
157
+ "ArrayCamera",
158
+ "ArrowHelper",
159
+ "AttachedBindMode",
160
+ "Audio",
161
+ "AudioAnalyser",
162
+ "AudioContext",
163
+ "AudioListener",
164
+ "AudioLoader",
165
+ "AxesHelper",
166
+ "BackSide",
167
+ "BasicDepthPacking",
168
+ "BasicShadowMap",
169
+ "BatchedMesh",
170
+ "Bone",
171
+ "BooleanKeyframeTrack",
172
+ "Box2",
173
+ "Box3",
174
+ "Box3Helper",
175
+ "BoxGeometry",
176
+ "BoxHelper",
177
+ "BufferAttribute",
178
+ "BufferGeometry",
179
+ "BufferGeometryLoader",
180
+ "ByteType",
181
+ "Cache",
182
+ "Camera",
183
+ "CameraHelper",
184
+ "CanvasTexture",
185
+ "CapsuleGeometry",
186
+ "CatmullRomCurve3",
187
+ "CineonToneMapping",
188
+ "CircleGeometry",
189
+ "ClampToEdgeWrapping",
190
+ "Clock",
191
+ "Color",
192
+ "ColorKeyframeTrack",
193
+ "ColorManagement",
194
+ "CompressedArrayTexture",
195
+ "CompressedCubeTexture",
196
+ "CompressedTexture",
197
+ "CompressedTextureLoader",
198
+ "ConeGeometry",
199
+ "ConstantAlphaFactor",
200
+ "ConstantColorFactor",
201
+ "Controls",
202
+ "createCanvasElement",
203
+ "CubeCamera",
204
+ "CubeReflectionMapping",
205
+ "CubeRefractionMapping",
206
+ "CubeTexture",
207
+ "CubeTextureLoader",
208
+ "CubeUVReflectionMapping",
209
+ "CubicBezierCurve",
210
+ "CubicBezierCurve3",
211
+ "CubicInterpolant",
212
+ "CullFaceBack",
213
+ "CullFaceFront",
214
+ "CullFaceFrontBack",
215
+ "CullFaceNone",
216
+ "Curve",
217
+ "CurvePath",
218
+ "CustomBlending",
219
+ "CustomToneMapping",
220
+ "CylinderGeometry",
221
+ "Cylindrical",
222
+ "Data3DTexture",
223
+ "DataArrayTexture",
224
+ "DataTexture",
225
+ "DataTextureLoader",
226
+ "DataUtils",
227
+ "DecrementStencilOp",
228
+ "DecrementWrapStencilOp",
229
+ "DefaultLoadingManager",
230
+ "DepthFormat",
231
+ "DepthStencilFormat",
232
+ "DepthTexture",
233
+ "DetachedBindMode",
234
+ "DirectionalLight",
235
+ "DirectionalLightHelper",
236
+ "DiscreteInterpolant",
237
+ "DodecahedronGeometry",
238
+ "DoubleSide",
239
+ "DstAlphaFactor",
240
+ "DstColorFactor",
241
+ "DynamicCopyUsage",
242
+ "DynamicDrawUsage",
243
+ "DynamicReadUsage",
244
+ "EdgesGeometry",
245
+ "EllipseCurve",
246
+ "EqualCompare",
247
+ "EqualDepth",
248
+ "EqualStencilFunc",
249
+ "EquirectangularReflectionMapping",
250
+ "EquirectangularRefractionMapping",
251
+ "Euler",
252
+ "EventDispatcher",
253
+ "ExtrudeGeometry",
254
+ "FileLoader",
255
+ "Float16BufferAttribute",
256
+ "Float32BufferAttribute",
257
+ "FloatType",
258
+ "Fog",
259
+ "FogExp2",
260
+ "FramebufferTexture",
261
+ "FrontSide",
262
+ "Frustum",
263
+ "GLBufferAttribute",
264
+ "GLSL1",
265
+ "GLSL3",
266
+ "GreaterCompare",
267
+ "GreaterDepth",
268
+ "GreaterEqualCompare",
269
+ "GreaterEqualDepth",
270
+ "GreaterEqualStencilFunc",
271
+ "GreaterStencilFunc",
272
+ "GridHelper",
273
+ "Group",
274
+ "HalfFloatType",
275
+ "HemisphereLight",
276
+ "HemisphereLightHelper",
277
+ "IcosahedronGeometry",
278
+ "ImageBitmapLoader",
279
+ "ImageLoader",
280
+ "ImageUtils",
281
+ "IncrementStencilOp",
282
+ "IncrementWrapStencilOp",
283
+ "InstancedBufferAttribute",
284
+ "InstancedBufferGeometry",
285
+ "InstancedInterleavedBuffer",
286
+ "InstancedMesh",
287
+ "Int16BufferAttribute",
288
+ "Int32BufferAttribute",
289
+ "Int8BufferAttribute",
290
+ "InterleavedBuffer",
291
+ "InterleavedBufferAttribute",
292
+ "Interpolant",
293
+ "InterpolateDiscrete",
294
+ "InterpolateLinear",
295
+ "InterpolateSmooth",
296
+ "IntType",
297
+ "InvertStencilOp",
298
+ "KeepStencilOp",
299
+ "KeyframeTrack",
300
+ "LatheGeometry",
301
+ "Layers",
302
+ "LessCompare",
303
+ "LessDepth",
304
+ "LessEqualCompare",
305
+ "LessEqualDepth",
306
+ "LessEqualStencilFunc",
307
+ "LessStencilFunc",
308
+ "Light",
309
+ "LightProbe",
310
+ "Line",
311
+ "Line3",
312
+ "LinearFilter",
313
+ "LinearInterpolant",
314
+ "LinearMipmapLinearFilter",
315
+ "LinearMipMapLinearFilter",
316
+ "LinearMipmapNearestFilter",
317
+ "LinearMipMapNearestFilter",
318
+ "LinearSRGBColorSpace",
319
+ "LinearToneMapping",
320
+ "LinearTransfer",
321
+ "LineBasicMaterial",
322
+ "LineCurve",
323
+ "LineCurve3",
324
+ "LineDashedMaterial",
325
+ "LineLoop",
326
+ "LineSegments",
327
+ "Loader",
328
+ "LoaderUtils",
329
+ "LoadingManager",
330
+ "LOD",
331
+ "LoopOnce",
332
+ "LoopPingPong",
333
+ "LoopRepeat",
334
+ "LuminanceAlphaFormat",
335
+ "LuminanceFormat",
336
+ "Material",
337
+ "MaterialLoader",
338
+ "MathUtils",
339
+ "Matrix2",
340
+ "Matrix3",
341
+ "Matrix4",
342
+ "MaxEquation",
343
+ "Mesh",
344
+ "MeshBasicMaterial",
345
+ "MeshDepthMaterial",
346
+ "MeshDistanceMaterial",
347
+ "MeshLambertMaterial",
348
+ "MeshMatcapMaterial",
349
+ "MeshNormalMaterial",
350
+ "MeshPhongMaterial",
351
+ "MeshPhysicalMaterial",
352
+ "MeshStandardMaterial",
353
+ "MeshToonMaterial",
354
+ "MinEquation",
355
+ "MirroredRepeatWrapping",
356
+ "MixOperation",
357
+ "MOUSE",
358
+ "MultiplyBlending",
359
+ "MultiplyOperation",
360
+ "NearestFilter",
361
+ "NearestMipmapLinearFilter",
362
+ "NearestMipMapLinearFilter",
363
+ "NearestMipmapNearestFilter",
364
+ "NearestMipMapNearestFilter",
365
+ "NeutralToneMapping",
366
+ "NeverCompare",
367
+ "NeverDepth",
368
+ "NeverStencilFunc",
369
+ "NoBlending",
370
+ "NoColorSpace",
371
+ "NormalAnimationBlendMode",
372
+ "NormalBlending",
373
+ "NotEqualCompare",
374
+ "NotEqualDepth",
375
+ "NotEqualStencilFunc",
376
+ "NoToneMapping",
377
+ "NumberKeyframeTrack",
378
+ "Object3D",
379
+ "ObjectLoader",
380
+ "ObjectSpaceNormalMap",
381
+ "OctahedronGeometry",
382
+ "OneFactor",
383
+ "OneMinusConstantAlphaFactor",
384
+ "OneMinusConstantColorFactor",
385
+ "OneMinusDstAlphaFactor",
386
+ "OneMinusDstColorFactor",
387
+ "OneMinusSrcAlphaFactor",
388
+ "OneMinusSrcColorFactor",
389
+ "OrthographicCamera",
390
+ "Path",
391
+ "PCFShadowMap",
392
+ "PCFSoftShadowMap",
393
+ "PerspectiveCamera",
394
+ "Plane",
395
+ "PlaneGeometry",
396
+ "PlaneHelper",
397
+ "PMREMGenerator",
398
+ "PointLight",
399
+ "PointLightHelper",
400
+ "Points",
401
+ "PointsMaterial",
402
+ "PolarGridHelper",
403
+ "PolyhedronGeometry",
404
+ "PositionalAudio",
405
+ "PropertyBinding",
406
+ "PropertyMixer",
407
+ "QuadraticBezierCurve",
408
+ "QuadraticBezierCurve3",
409
+ "Quaternion",
410
+ "QuaternionKeyframeTrack",
411
+ "QuaternionLinearInterpolant",
412
+ "RawShaderMaterial",
413
+ "Ray",
414
+ "Raycaster",
415
+ "RectAreaLight",
416
+ "RED_GREEN_RGTC2_Format",
417
+ "RED_RGTC1_Format",
418
+ "RedFormat",
419
+ "RedIntegerFormat",
420
+ "ReinhardToneMapping",
421
+ "RenderTarget",
422
+ "RepeatWrapping",
423
+ "ReplaceStencilOp",
424
+ "ReverseSubtractEquation",
425
+ "REVISION",
426
+ "RGB_BPTC_SIGNED_Format",
427
+ "RGB_BPTC_UNSIGNED_Format",
428
+ "RGB_ETC1_Format",
429
+ "RGB_ETC2_Format",
430
+ "RGB_PVRTC_2BPPV1_Format",
431
+ "RGB_PVRTC_4BPPV1_Format",
432
+ "RGB_S3TC_DXT1_Format",
433
+ "RGBA_ASTC_10x10_Format",
434
+ "RGBA_ASTC_10x5_Format",
435
+ "RGBA_ASTC_10x6_Format",
436
+ "RGBA_ASTC_10x8_Format",
437
+ "RGBA_ASTC_12x10_Format",
438
+ "RGBA_ASTC_12x12_Format",
439
+ "RGBA_ASTC_4x4_Format",
440
+ "RGBA_ASTC_5x4_Format",
441
+ "RGBA_ASTC_5x5_Format",
442
+ "RGBA_ASTC_6x5_Format",
443
+ "RGBA_ASTC_6x6_Format",
444
+ "RGBA_ASTC_8x5_Format",
445
+ "RGBA_ASTC_8x6_Format",
446
+ "RGBA_ASTC_8x8_Format",
447
+ "RGBA_BPTC_Format",
448
+ "RGBA_ETC2_EAC_Format",
449
+ "RGBA_PVRTC_2BPPV1_Format",
450
+ "RGBA_PVRTC_4BPPV1_Format",
451
+ "RGBA_S3TC_DXT1_Format",
452
+ "RGBA_S3TC_DXT3_Format",
453
+ "RGBA_S3TC_DXT5_Format",
454
+ "RGBADepthPacking",
455
+ "RGBAFormat",
456
+ "RGBAIntegerFormat",
457
+ "RGBDepthPacking",
458
+ "RGBFormat",
459
+ "RGBIntegerFormat",
460
+ "RGDepthPacking",
461
+ "RGFormat",
462
+ "RGIntegerFormat",
463
+ "RingGeometry",
464
+ "Scene",
465
+ "ShaderChunk",
466
+ "ShaderLib",
467
+ "ShaderMaterial",
468
+ "ShadowMaterial",
469
+ "Shape",
470
+ "ShapeGeometry",
471
+ "ShapePath",
472
+ "ShapeUtils",
473
+ "ShortType",
474
+ "SIGNED_RED_GREEN_RGTC2_Format",
475
+ "SIGNED_RED_RGTC1_Format",
476
+ "Skeleton",
477
+ "SkeletonHelper",
478
+ "SkinnedMesh",
479
+ "Source",
480
+ "Sphere",
481
+ "SphereGeometry",
482
+ "Spherical",
483
+ "SphericalHarmonics3",
484
+ "SplineCurve",
485
+ "SpotLight",
486
+ "SpotLightHelper",
487
+ "Sprite",
488
+ "SpriteMaterial",
489
+ "SrcAlphaFactor",
490
+ "SrcAlphaSaturateFactor",
491
+ "SrcColorFactor",
492
+ "SRGBColorSpace",
493
+ "SRGBTransfer",
494
+ "StaticCopyUsage",
495
+ "StaticDrawUsage",
496
+ "StaticReadUsage",
497
+ "StereoCamera",
498
+ "StreamCopyUsage",
499
+ "StreamDrawUsage",
500
+ "StreamReadUsage",
501
+ "StringKeyframeTrack",
502
+ "SubtractEquation",
503
+ "SubtractiveBlending",
504
+ "TangentSpaceNormalMap",
505
+ "TetrahedronGeometry",
506
+ "Texture",
507
+ "TextureLoader",
508
+ "TextureUtils",
509
+ "TorusGeometry",
510
+ "TorusKnotGeometry",
511
+ "TOUCH",
512
+ "Triangle",
513
+ "TriangleFanDrawMode",
514
+ "TrianglesDrawMode",
515
+ "TriangleStripDrawMode",
516
+ "TubeGeometry",
517
+ "Uint16BufferAttribute",
518
+ "Uint32BufferAttribute",
519
+ "Uint8BufferAttribute",
520
+ "Uint8ClampedBufferAttribute",
521
+ "Uniform",
522
+ "UniformsGroup",
523
+ "UniformsLib",
524
+ "UniformsUtils",
525
+ "UnsignedByteType",
526
+ "UnsignedInt248Type",
527
+ "UnsignedInt5999Type",
528
+ "UnsignedIntType",
529
+ "UnsignedShort4444Type",
530
+ "UnsignedShort5551Type",
531
+ "UnsignedShortType",
532
+ "UVMapping",
533
+ "Vector2",
534
+ "Vector3",
535
+ "Vector4",
536
+ "VectorKeyframeTrack",
537
+ "VideoTexture",
538
+ "VSMShadowMap",
539
+ "WebGL3DRenderTarget",
540
+ "WebGLArrayRenderTarget",
541
+ "WebGLCoordinateSystem",
542
+ "WebGLCubeRenderTarget",
543
+ "WebGLMultipleRenderTargets",
544
+ "WebGLRenderer",
545
+ "WebGLRenderTarget",
546
+ "WebGLUtils",
547
+ "WebGPUCoordinateSystem",
548
+ "WireframeGeometry",
549
+ "WrapAroundEnding",
550
+ "ZeroCurvatureEnding",
551
+ "ZeroFactor",
552
+ "ZeroSlopeEnding",
553
+ "ZeroStencilOp"
554
+ ];
555
+
137
556
  // src/vite/venusLibrariesPlugin.ts
557
+ async function resolveInstalledPackageVersion(pluginContext, packageName, cache) {
558
+ if (cache.has(packageName)) {
559
+ return cache.get(packageName) ?? null;
560
+ }
561
+ const readVersion = (packageJsonPath) => {
562
+ const raw = fs.readFileSync(packageJsonPath, "utf8");
563
+ const parsed = JSON.parse(raw);
564
+ return typeof parsed?.version === "string" ? parsed.version : null;
565
+ };
566
+ const findNearestPackageJson = (fromFilePath) => {
567
+ let dir = path.dirname(fromFilePath);
568
+ while (true) {
569
+ const candidate = path.join(dir, "package.json");
570
+ if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
571
+ return candidate;
572
+ }
573
+ const parent = path.dirname(dir);
574
+ if (parent === dir) return null;
575
+ dir = parent;
576
+ }
577
+ };
578
+ try {
579
+ const pkgJsonResolved = await pluginContext.resolve(
580
+ `${packageName}/package.json`,
581
+ void 0,
582
+ { skipSelf: true }
583
+ );
584
+ if (pkgJsonResolved?.id && fs.existsSync(pkgJsonResolved.id)) {
585
+ const v = readVersion(pkgJsonResolved.id);
586
+ cache.set(packageName, v);
587
+ return v;
588
+ }
589
+ const entryResolved = await pluginContext.resolve(packageName, void 0, {
590
+ skipSelf: true
591
+ });
592
+ if (entryResolved?.id) {
593
+ const pkgJsonPath = findNearestPackageJson(entryResolved.id);
594
+ const v = pkgJsonPath ? readVersion(pkgJsonPath) : null;
595
+ cache.set(packageName, v);
596
+ return v;
597
+ }
598
+ } catch {
599
+ }
600
+ cache.set(packageName, null);
601
+ return null;
602
+ }
138
603
  function generateVirtualModule(lib, spec, importPath) {
139
604
  const errorCheck = `
140
605
  // Wait for shim to complete loading libraries
@@ -160,6 +625,17 @@ if (!window.__venusLibraryExports || !window.__venusLibraryExports['${lib.librar
160
625
  }
161
626
  `;
162
627
  const libVar = `window.__venusLibraryExports['${lib.libraryKey}']`;
628
+ const renderForwardedNamedExports = (names, chunkSize = 50) => {
629
+ if (names.length === 0) return "";
630
+ const chunks = [];
631
+ for (let i = 0; i < names.length; i += chunkSize) {
632
+ const slice = names.slice(i, i + chunkSize).join(", ");
633
+ chunks.push(`export const { ${slice} } = lib;`);
634
+ }
635
+ return `
636
+ ${chunks.join("\n")}
637
+ `;
638
+ };
163
639
  switch (spec.behavior) {
164
640
  case "react-jsx-runtime":
165
641
  return `
@@ -199,9 +675,12 @@ export const {
199
675
  namedExports = `
200
676
  export const { createRoot, hydrateRoot, render, unmountComponentAtNode, findDOMNode, version } = lib;`;
201
677
  } else if (lib.packageName === "three") {
202
- namedExports = `
203
- // Three.js exports everything on the global THREE object, accessible via default export
204
- // Individual exports can be accessed as: import THREE from 'three'; const { Scene, Camera } = THREE;`;
678
+ if (lib.version !== EMBEDDED_THREE_VERSION) {
679
+ namedExports = `
680
+ 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)');`;
681
+ } else {
682
+ namedExports = renderForwardedNamedExports(EMBEDDED_THREE_NAMED_EXPORTS);
683
+ }
205
684
  } else {
206
685
  namedExports = "";
207
686
  }
@@ -237,10 +716,23 @@ function venusLibrariesPlugin(options = {}) {
237
716
  let isServe = false;
238
717
  let enabled = false;
239
718
  let appName = options.appName;
719
+ const installedVersionCache = /* @__PURE__ */ new Map();
720
+ const loggedMismatch = /* @__PURE__ */ new Set();
240
721
  return {
241
722
  name: "vite-plugin-venus-libraries",
242
723
  enforce: "pre",
243
724
  // Run before other plugins to intercept imports
725
+ async buildStart() {
726
+ if (!enabled) return;
727
+ const uniquePackages = Array.from(
728
+ new Set(
729
+ EMBEDDED_LIBRARIES.filter((l) => l.enabled).map((l) => l.packageName)
730
+ )
731
+ );
732
+ for (const pkgName of uniquePackages) {
733
+ await resolveInstalledPackageVersion(this, pkgName, installedVersionCache);
734
+ }
735
+ },
244
736
  // 0. Configure Vite build options
245
737
  config(config) {
246
738
  if (!enabled) return;
@@ -291,7 +783,7 @@ function venusLibrariesPlugin(options = {}) {
291
783
  }
292
784
  },
293
785
  // 1. Intercept library imports
294
- resolveId(id, importer) {
786
+ async resolveId(id, importer) {
295
787
  if (!enabled) return null;
296
788
  const match = MODULE_TO_LIBRARY_SPECIFIERS.find((spec) => {
297
789
  if (spec.match === "exact") {
@@ -302,9 +794,28 @@ function venusLibrariesPlugin(options = {}) {
302
794
  return false;
303
795
  });
304
796
  if (match) {
797
+ const lib = EMBEDDED_LIBRARY_BY_KEY[match.libraryKey];
798
+ if (!lib) {
799
+ throw new Error(
800
+ `[Venus Libraries] Internal error: no embedded library for key ${match.libraryKey}`
801
+ );
802
+ }
803
+ const installed = await resolveInstalledPackageVersion(
804
+ this,
805
+ lib.packageName,
806
+ installedVersionCache
807
+ );
808
+ if (installed !== lib.version) {
809
+ if (debug && !loggedMismatch.has(lib.packageName)) {
810
+ loggedMismatch.add(lib.packageName);
811
+ console.log(
812
+ `[Venus Libraries] Skipping embedded ${lib.packageName}: installed=${installed ?? "unknown"} embedded=${lib.version}`
813
+ );
814
+ }
815
+ return null;
816
+ }
305
817
  requiredLibraries.add(match.libraryKey);
306
- const virtualId = `\0virtual:venus-lib:${match.libraryKey}:${id}`;
307
- return virtualId;
818
+ return `\0virtual:venus-lib:${match.libraryKey}:${id}`;
308
819
  }
309
820
  return null;
310
821
  },
@@ -323,7 +834,11 @@ function venusLibrariesPlugin(options = {}) {
323
834
  `Unknown library: ${libraryKey}. Available libraries: ${availableKeys}`
324
835
  );
325
836
  }
326
- const spec = lib.moduleSpecifiers.find((s) => s.value === importPath);
837
+ const spec = lib.moduleSpecifiers.find((s) => {
838
+ if (s.match === "exact") return s.value === importPath;
839
+ if (s.match === "prefix") return importPath.startsWith(s.value);
840
+ return false;
841
+ });
327
842
  if (!spec) {
328
843
  const validSpecifiers = lib.moduleSpecifiers.map((s) => s.value).join(", ");
329
844
  throw new Error(