@needle-tools/engine 5.1.0 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/dist/{needle-engine.bundle-5oIL49YP.js → needle-engine.bundle-BAUfRyBA.js} +7692 -7506
- package/dist/{needle-engine.bundle-DvOrfXws.umd.cjs → needle-engine.bundle-BL2wG5Te.umd.cjs} +159 -159
- package/dist/{needle-engine.bundle-DAAfj8Cs.min.js → needle-engine.bundle-BpNRkY3s.min.js} +184 -184
- package/dist/needle-engine.d.ts +25 -7
- package/dist/needle-engine.js +533 -533
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/api.d.ts +1 -1
- package/lib/engine/api.js +1 -1
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_init.js +2 -2
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_license.d.ts +45 -7
- package/lib/engine/engine_license.js +276 -77
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_networking.js +6 -0
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_networking_blob.js +3 -3
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_networking_peer.js +19 -13
- package/lib/engine/engine_networking_peer.js.map +1 -1
- package/lib/engine/engine_utils_qrcode.js +2 -2
- package/lib/engine/engine_utils_qrcode.js.map +1 -1
- package/lib/engine/webcomponents/WebXRButtons.js +5 -6
- package/lib/engine/webcomponents/WebXRButtons.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +31 -2
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.d.ts +7 -1
- package/lib/engine/xr/NeedleXRSession.js +70 -11
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine/xr/NeedleXRSync.js +23 -4
- package/lib/engine/xr/NeedleXRSync.js.map +1 -1
- package/lib/engine/xr/TempXRContext.js +2 -2
- package/lib/engine/xr/TempXRContext.js.map +1 -1
- package/lib/engine-components/SyncedTransform.d.ts +5 -1
- package/lib/engine-components/SyncedTransform.js +45 -8
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
- package/lib/engine-components/webxr/Avatar.d.ts +8 -0
- package/lib/engine-components/webxr/Avatar.js +60 -32
- package/lib/engine-components/webxr/Avatar.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.js +25 -14
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-schemes/synced-transform-model.d.ts +2 -0
- package/lib/engine-schemes/synced-transform-model.js +8 -1
- package/lib/engine-schemes/synced-transform-model.js.map +1 -1
- package/package.json +2 -2
- package/plugins/common/license.js +4 -4
- package/plugins/types/userconfig.d.ts +4 -3
- package/plugins/vite/build-pipeline.d.ts +3 -1
- package/plugins/vite/build-pipeline.js +19 -9
- package/plugins/vite/license.js +4 -4
- package/src/engine/api.ts +1 -1
- package/src/engine/engine_init.ts +2 -2
- package/src/engine/engine_license.ts +263 -73
- package/src/engine/engine_networking.ts +5 -0
- package/src/engine/engine_networking_blob.ts +3 -3
- package/src/engine/engine_networking_peer.ts +12 -13
- package/src/engine/engine_utils_qrcode.ts +2 -2
- package/src/engine/webcomponents/WebXRButtons.ts +5 -6
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
- package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
- package/src/engine/webcomponents/needle-engine.ts +31 -2
- package/src/engine/xr/NeedleXRSession.ts +72 -14
- package/src/engine/xr/NeedleXRSync.ts +24 -4
- package/src/engine/xr/TempXRContext.ts +2 -2
- package/src/engine-components/SyncedTransform.ts +49 -10
- package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
- package/src/engine-components/webxr/Avatar.ts +60 -33
- package/src/engine-components/webxr/WebXR.ts +23 -15
- package/src/engine-schemes/synced-transform-model.ts +10 -1
- package/src/engine-schemes/transforms.fbs +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.",
|
|
5
5
|
"main": "dist/needle-engine.min.js",
|
|
6
6
|
"exports": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
],
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"@dimforge/rapier3d-compat": "0.19.3",
|
|
102
|
-
"@needle-tools/gltf-progressive": "3.6.0-beta.
|
|
102
|
+
"@needle-tools/gltf-progressive": "3.6.0-beta.2",
|
|
103
103
|
"@needle-tools/materialx": "1.7.0-next.0d06218",
|
|
104
104
|
"@needle-tools/three-animation-pointer": "1.1.2",
|
|
105
105
|
"@webxr-input-profiles/motion-controllers": "1.0.0",
|
|
@@ -111,7 +111,7 @@ async function requestNeedleCloud(path, options) {
|
|
|
111
111
|
* @param {DefaultOptions & {accessToken?:string, team:string|undefined}} opts
|
|
112
112
|
*/
|
|
113
113
|
export async function replaceLicense(code, opts) {
|
|
114
|
-
const index = code?.indexOf("
|
|
114
|
+
const index = code?.indexOf("__UoF");
|
|
115
115
|
if (index >= 0) {
|
|
116
116
|
const licenseResult = await resolveLicense(opts);
|
|
117
117
|
if (!licenseResult) {
|
|
@@ -120,18 +120,18 @@ export async function replaceLicense(code, opts) {
|
|
|
120
120
|
const end = code.indexOf(";", index);
|
|
121
121
|
if (end >= 0) {
|
|
122
122
|
const line = code.substring(index, end);
|
|
123
|
-
const replaced = "
|
|
123
|
+
const replaced = "__UoF = \"" + licenseResult.type + "\"";
|
|
124
124
|
code = code.replace(line, replaced);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
// Also inject JWT if available
|
|
128
128
|
if (licenseResult.jwt) {
|
|
129
|
-
const jwtIndex = code.indexOf("
|
|
129
|
+
const jwtIndex = code.indexOf("_nMW");
|
|
130
130
|
if (jwtIndex >= 0) {
|
|
131
131
|
const jwtEnd = code.indexOf(";", jwtIndex);
|
|
132
132
|
if (jwtEnd >= 0) {
|
|
133
133
|
const jwtLine = code.substring(jwtIndex, jwtEnd);
|
|
134
|
-
const jwtReplaced = "
|
|
134
|
+
const jwtReplaced = "_nMW = \"" + licenseResult.jwt + "\"";
|
|
135
135
|
code = code.replace(jwtLine, jwtReplaced);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -76,9 +76,10 @@ export type userSettings = {
|
|
|
76
76
|
/** Enable for verbose log output */
|
|
77
77
|
verbose?: boolean,
|
|
78
78
|
|
|
79
|
-
/** Set to a specific version of the Needle Build Pipeline.
|
|
80
|
-
*
|
|
81
|
-
* @
|
|
79
|
+
/** Set to a specific version of the Needle Build Pipeline used for local compression.
|
|
80
|
+
* Must be 3.x or newer (earlier versions don't support the required license auth).
|
|
81
|
+
* @default "3"
|
|
82
|
+
* @example "3.0.0"
|
|
82
83
|
*/
|
|
83
84
|
version?: string;
|
|
84
85
|
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
* (cloud was the implied intent and can't run without a token).
|
|
12
12
|
*
|
|
13
13
|
* @param {import('../types').userSettings | undefined | null} opts
|
|
14
|
-
* @param {{ isCI?: boolean }} [env]
|
|
14
|
+
* @param {{ isCI?: boolean, cloudToken?: string }} [env] `cloudToken` is the NEEDLE_CLOUD_TOKEN
|
|
15
|
+
* env var fallback, used when `buildPipeline.accessToken` isn't set in the vite config.
|
|
15
16
|
* @returns {"cloud" | "local" | "skip-no-token"}
|
|
16
17
|
*/
|
|
17
18
|
export function resolveCompressionTarget(opts: import("../types").userSettings | undefined | null, env?: {
|
|
18
19
|
isCI?: boolean;
|
|
20
|
+
cloudToken?: string;
|
|
19
21
|
}): "cloud" | "local" | "skip-no-token";
|
|
20
22
|
/**
|
|
21
23
|
* This function can be used by other plugins to wait for the build pipeline to finish before doing some work in the closeBundle hook.
|
|
@@ -53,12 +53,19 @@ env:
|
|
|
53
53
|
* (cloud was the implied intent and can't run without a token).
|
|
54
54
|
*
|
|
55
55
|
* @param {import('../types').userSettings | undefined | null} opts
|
|
56
|
-
* @param {{ isCI?: boolean }} [env]
|
|
56
|
+
* @param {{ isCI?: boolean, cloudToken?: string }} [env] `cloudToken` is the NEEDLE_CLOUD_TOKEN
|
|
57
|
+
* env var fallback, used when `buildPipeline.accessToken` isn't set in the vite config.
|
|
57
58
|
* @returns {"cloud" | "local" | "skip-no-token"}
|
|
58
59
|
*/
|
|
59
60
|
export function resolveCompressionTarget(opts, env = {}) {
|
|
60
61
|
const isCI = env.isCI ?? false;
|
|
61
|
-
|
|
62
|
+
// A Needle Cloud access token can be configured two ways: buildPipeline.accessToken in the
|
|
63
|
+
// vite config, or the NEEDLE_CLOUD_TOKEN env var (the same var the license plugin reads —
|
|
64
|
+
// see common/license.js). buildPipeline.accessToken is not populated from the env var
|
|
65
|
+
// anywhere, so without this fallback an env-only token is invisible to the decision below:
|
|
66
|
+
// outside CI the build then selects local compression (no warning explaining why), and in
|
|
67
|
+
// CI it returns "skip-no-token".
|
|
68
|
+
const token = opts?.buildPipeline?.accessToken || env.cloudToken;
|
|
62
69
|
const hasToken = typeof token === "string" && token.length > 0;
|
|
63
70
|
const wantsLocal = opts?.buildPipeline?.compression === "local";
|
|
64
71
|
|
|
@@ -394,10 +401,11 @@ async function invokeBuildPipeline(opts, options = {}) {
|
|
|
394
401
|
|
|
395
402
|
// Cloud token used by `${NEEDLE_CLOUD_CLI_NAME} optimize --token <token>`.
|
|
396
403
|
// This is a Needle Cloud access token (created in the Needle Cloud UI), NOT a JWT.
|
|
397
|
-
|
|
404
|
+
// Falls back to NEEDLE_CLOUD_TOKEN (same source the license plugin uses) when not set in the config.
|
|
405
|
+
const cloudAccessToken = opts.buildPipeline?.accessToken || process.env.NEEDLE_CLOUD_TOKEN;
|
|
398
406
|
|
|
399
407
|
// Decide cloud vs local (see resolveCompressionTarget for the rules).
|
|
400
|
-
const compressionTarget = resolveCompressionTarget(opts, { isCI: !!process.env.CI });
|
|
408
|
+
const compressionTarget = resolveCompressionTarget(opts, { isCI: !!process.env.CI, cloudToken: process.env.NEEDLE_CLOUD_TOKEN });
|
|
401
409
|
if (compressionTarget === "skip-no-token") {
|
|
402
410
|
warn(`No cloud access token found. Set process.env.NEEDLE_CLOUD_TOKEN, or set buildPipeline.compression: "local" to compress on the build machine.`);
|
|
403
411
|
return false;
|
|
@@ -475,8 +483,9 @@ async function invokeBuildPipeline(opts, options = {}) {
|
|
|
475
483
|
}
|
|
476
484
|
}
|
|
477
485
|
}
|
|
478
|
-
// Otherwise
|
|
479
|
-
|
|
486
|
+
// Otherwise default to the latest 3.x release on npm. 3.x is required for the
|
|
487
|
+
// `--auth-token` JWT auth used below; the older `stable` dist-tag predates that option.
|
|
488
|
+
if (!version) version = "3";
|
|
480
489
|
|
|
481
490
|
resolvedPipelineVersion = version;
|
|
482
491
|
const versionInfo = versionSource ? `'${version}' (${versionSource})` : `'${version}'`;
|
|
@@ -652,9 +661,10 @@ async function invokeBuildPipeline(opts, options = {}) {
|
|
|
652
661
|
const pinned = resolvedPipelineVersion ? `@${resolvedPipelineVersion}` : "";
|
|
653
662
|
needleLog("needle-buildpipeline",
|
|
654
663
|
`The compression tool reported an unknown option, which means an older/incompatible ` +
|
|
655
|
-
`@needle-tools/gltf-build-pipeline ran
|
|
656
|
-
`
|
|
657
|
-
`
|
|
664
|
+
`@needle-tools/gltf-build-pipeline${pinned ? ` (${pinned})` : ""} ran. Likely causes: the pinned ` +
|
|
665
|
+
`version/tag itself predates this option (it must be 3.x or newer — set buildPipeline.version, ` +
|
|
666
|
+
`e.g. "3.0.0"), or a stale local install is shadowing it (check "npm ls @needle-tools/gltf-build-pipeline" ` +
|
|
667
|
+
`in your web project and remove the old copy, or ensure the pinned version is reachable from your npm registry).`,
|
|
658
668
|
"warn", { dimBody: false, showHeader: true, leadingNewline: true });
|
|
659
669
|
}
|
|
660
670
|
}
|
package/plugins/vite/license.js
CHANGED
|
@@ -49,12 +49,12 @@ export function needleLicense(command, config, userSettings) {
|
|
|
49
49
|
let modified = false;
|
|
50
50
|
|
|
51
51
|
// Replace license type
|
|
52
|
-
const index = src.indexOf("
|
|
52
|
+
const index = src.indexOf("__UoF");
|
|
53
53
|
if (index >= 0) {
|
|
54
54
|
const end = src.indexOf(";", index);
|
|
55
55
|
if (end >= 0) {
|
|
56
56
|
const line = src.substring(index, end);
|
|
57
|
-
const replaced = "
|
|
57
|
+
const replaced = "__UoF = \"" + licenseResult.type + "\"";
|
|
58
58
|
src = src.replace(line, replaced);
|
|
59
59
|
modified = true;
|
|
60
60
|
}
|
|
@@ -62,12 +62,12 @@ export function needleLicense(command, config, userSettings) {
|
|
|
62
62
|
|
|
63
63
|
// Replace license JWT (same pattern)
|
|
64
64
|
if (licenseResult.jwt) {
|
|
65
|
-
const jwtIndex = src.indexOf("
|
|
65
|
+
const jwtIndex = src.indexOf("_nMW");
|
|
66
66
|
if (jwtIndex >= 0) {
|
|
67
67
|
const jwtEnd = src.indexOf(";", jwtIndex);
|
|
68
68
|
if (jwtEnd >= 0) {
|
|
69
69
|
const jwtLine = src.substring(jwtIndex, jwtEnd);
|
|
70
|
-
const jwtReplaced = "
|
|
70
|
+
const jwtReplaced = "_nMW = \"" + licenseResult.jwt + "\"";
|
|
71
71
|
src = src.replace(jwtLine, jwtReplaced);
|
|
72
72
|
modified = true;
|
|
73
73
|
}
|
package/src/engine/api.ts
CHANGED
|
@@ -230,7 +230,7 @@ export * from "./engine_input.js";
|
|
|
230
230
|
export { InstancingUtil } from "./engine_instancing.js";
|
|
231
231
|
|
|
232
232
|
/** License checking utilities */
|
|
233
|
-
export {
|
|
233
|
+
export { Jkdun, _$apSvAt, _hyjgv } from "./engine_license.js";
|
|
234
234
|
|
|
235
235
|
|
|
236
236
|
// ============================================================================
|
|
@@ -8,7 +8,7 @@ import { initBuiltinTypes } from "./codegen/register_types.js";
|
|
|
8
8
|
import { initSpatialConsole } from "./debug/debug_spatial_console.js";
|
|
9
9
|
import { initAddressableSerializers } from "./engine_addressables.js";
|
|
10
10
|
import { ensureAudioContextIsResumed } from "./engine_audio.js";
|
|
11
|
-
import {
|
|
11
|
+
import { __NjkWq } from "./engine_license.js";
|
|
12
12
|
import { initNeedleLoader } from "./engine_loaders.js";
|
|
13
13
|
import { initPhysics } from "./engine_physics_rapier.js";
|
|
14
14
|
import { initBuiltinSerializers } from "./engine_serialization_builtin_serializer.js";
|
|
@@ -59,7 +59,7 @@ export function initEngine() {
|
|
|
59
59
|
initPhysics();
|
|
60
60
|
initXR();
|
|
61
61
|
initSpatialConsole();
|
|
62
|
-
|
|
62
|
+
__NjkWq();
|
|
63
63
|
|
|
64
64
|
// Must be last. customElements.define() upgrades existing <needle-engine>
|
|
65
65
|
// elements synchronously, which can trigger context.create() and dispatch
|