@needle-tools/engine 3.37.15-alpha → 3.37.15-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/dist/needle-engine.js +10 -6
- package/dist/needle-engine.light.js +10 -6
- package/dist/needle-engine.light.min.js +2 -2
- package/dist/needle-engine.light.umd.cjs +2 -2
- package/dist/needle-engine.min.js +2 -2
- package/dist/needle-engine.umd.cjs +2 -2
- package/package.json +2 -2
- package/plugins/common/license.cjs +1 -3
- package/plugins/vite/license.js +26 -38
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "3.37.15-alpha",
|
|
3
|
+
"version": "3.37.15-alpha.1",
|
|
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.umd.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@dimforge/rapier3d-compat": "^0.12.0",
|
|
62
|
-
"@needle-tools/gltf-progressive": "^1.0.0-alpha.
|
|
62
|
+
"@needle-tools/gltf-progressive": "^1.0.0-alpha.14",
|
|
63
63
|
"@webxr-input-profiles/motion-controllers": "^1.0.0",
|
|
64
64
|
"flatbuffers": "2.0.4",
|
|
65
65
|
"md5": "^2.3.0",
|
|
@@ -45,8 +45,6 @@ const LICENSE_ENDPOINT = `https://urls.needle.tools/license-endpoint`
|
|
|
45
45
|
* @returns {Promise<string | null>}
|
|
46
46
|
*/
|
|
47
47
|
module.exports.resolveLicense = async function (license) {
|
|
48
|
-
console.log("\n");
|
|
49
|
-
|
|
50
48
|
if (typeof license !== "object") {
|
|
51
49
|
return license;
|
|
52
50
|
}
|
|
@@ -60,7 +58,7 @@ module.exports.resolveLicense = async function (license) {
|
|
|
60
58
|
return null;
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
console.log("Resolve license for " + license.id + "::" + license.key);
|
|
61
|
+
console.log("INFO: Resolve license for " + license.id + "::" + license.key);
|
|
64
62
|
const url = await fetch(LICENSE_ENDPOINT, { method: "GET" });
|
|
65
63
|
if (!url.ok) {
|
|
66
64
|
console.warn("WARN: Failed to fetch license URL from endpoint. " + url.statusText);
|
package/plugins/vite/license.js
CHANGED
|
@@ -8,57 +8,45 @@ import { loadConfig } from './config.js';
|
|
|
8
8
|
* @param {import('../types/userconfig.js').userSettings}
|
|
9
9
|
*/
|
|
10
10
|
export const needleLicense = (command, config, userSettings) => {
|
|
11
|
+
let license = undefined;
|
|
12
|
+
|
|
11
13
|
return {
|
|
12
14
|
name: "needle-license",
|
|
13
15
|
enforce: 'pre',
|
|
16
|
+
async configResolved() {
|
|
17
|
+
if (userSettings.license) {
|
|
18
|
+
// we only accept a license object here
|
|
19
|
+
if (typeof userSettings.license === "object")
|
|
20
|
+
license = await resolveLicense(userSettings.license);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const needleConfig = await loadConfig();
|
|
24
|
+
if (needleConfig) {
|
|
25
|
+
license = await resolveLicense(needleConfig.license);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
14
29
|
async transform(src, id) {
|
|
15
30
|
const isNeedleEngineFile = id.includes("engine/engine_license") || id.includes("needle-tools_engine");
|
|
16
31
|
// sometimes the actual license parameter is in a unnamed chunk file
|
|
17
32
|
const isViteChunkFile = id.includes("chunk") && id.includes(".vite");
|
|
18
33
|
if (isNeedleEngineFile || isViteChunkFile) {
|
|
19
34
|
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
if (typeof userSettings.license === "object")
|
|
23
|
-
await applyLicense(userSettings.license);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
const needleConfig = await loadConfig();
|
|
27
|
-
if (needleConfig) {
|
|
28
|
-
await applyLicense(needleConfig.license);
|
|
29
|
-
}
|
|
35
|
+
if (!license) {
|
|
36
|
+
return;
|
|
30
37
|
}
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// TODO: remove allowing to apply a string license here
|
|
42
|
-
|
|
43
|
-
if (typeof license !== "string") {
|
|
44
|
-
license = await resolveLicense(license).catch(err => {
|
|
45
|
-
console.error("Error resolving license", err.message);
|
|
46
|
-
return null;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const index = src.indexOf("NEEDLE_ENGINE_LICENSE_TYPE");
|
|
51
|
-
if (index >= 0) {
|
|
52
|
-
const end = src.indexOf(";", index);
|
|
53
|
-
if (end >= 0) {
|
|
54
|
-
const line = src.substring(index, end);
|
|
55
|
-
const replaced = "NEEDLE_ENGINE_LICENSE_TYPE = \"" + license + "\"";
|
|
56
|
-
src = src.replace(line, replaced);
|
|
57
|
-
return { code: src, map: null }
|
|
58
|
-
}
|
|
39
|
+
const index = src.indexOf("NEEDLE_ENGINE_LICENSE_TYPE");
|
|
40
|
+
if (index >= 0) {
|
|
41
|
+
const end = src.indexOf(";", index);
|
|
42
|
+
if (end >= 0) {
|
|
43
|
+
const line = src.substring(index, end);
|
|
44
|
+
const replaced = "NEEDLE_ENGINE_LICENSE_TYPE = \"" + license + "\"";
|
|
45
|
+
src = src.replace(line, replaced);
|
|
46
|
+
return { code: src, map: null }
|
|
59
47
|
}
|
|
60
48
|
}
|
|
61
49
|
}
|
|
62
50
|
}
|
|
63
51
|
}
|
|
64
|
-
};
|
|
52
|
+
};
|