@needle-tools/engine 4.16.0-next.bc4d35d → 4.16.1-next.98e87e6
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 +3 -0
- package/dist/{needle-engine.bundle-DT0VwGmo.umd.cjs → needle-engine.bundle-B2rk-2Z5.umd.cjs} +108 -108
- package/dist/{needle-engine.bundle-KyGODqE9.js → needle-engine.bundle-DdPHeBrV.js} +2885 -2877
- package/dist/{needle-engine.bundle-Cqmarm0m.min.js → needle-engine.bundle-_tTBG92u.min.js} +104 -104
- package/dist/needle-engine.d.ts +9 -3
- package/dist/needle-engine.js +2 -2
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/engine_context.js +2 -0
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +1 -1
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +1 -1
- package/lib/engine/webcomponents/needle-engine.js +21 -23
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +10 -3
- package/lib/engine-components/ReflectionProbe.js +34 -10
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/package.json +7 -6
- package/plugins/next/next.d.ts +8 -0
- package/plugins/next/next.js +7 -6
- package/plugins/vite/ai.d.ts +17 -0
- package/plugins/vite/ai.js +2 -2
- package/plugins/vite/alias.d.ts +8 -0
- package/plugins/vite/alias.js +5 -2
- package/plugins/vite/asap.d.ts +7 -0
- package/plugins/vite/asap.js +3 -3
- package/plugins/vite/build-pipeline.d.ts +15 -0
- package/plugins/vite/build-pipeline.js +5 -6
- package/plugins/vite/build.d.ts +7 -0
- package/plugins/vite/build.js +5 -2
- package/plugins/vite/buildinfo.d.ts +7 -0
- package/plugins/vite/buildinfo.js +4 -2
- package/plugins/vite/config.d.ts +13 -0
- package/plugins/vite/config.js +1 -1
- package/plugins/vite/copyfiles.d.ts +7 -0
- package/plugins/vite/copyfiles.js +4 -2
- package/plugins/vite/custom-element-data.d.ts +25 -0
- package/plugins/vite/custom-element-data.js +2 -1
- package/plugins/vite/defines.d.ts +10 -0
- package/plugins/vite/defines.js +4 -3
- package/plugins/vite/dependencies.d.ts +21 -0
- package/plugins/vite/dependencies.js +3 -1
- package/plugins/vite/dependency-watcher.d.ts +11 -0
- package/plugins/vite/dependency-watcher.js +2 -1
- package/plugins/vite/drop-client.d.ts +1 -0
- package/plugins/vite/drop.d.ts +7 -0
- package/plugins/vite/drop.js +4 -4
- package/plugins/vite/editor-connection.d.ts +8 -0
- package/plugins/vite/editor-connection.js +6 -2
- package/plugins/vite/facebook-instant-games.d.ts +7 -0
- package/plugins/vite/facebook-instant-games.js +4 -2
- package/plugins/vite/gzip.d.ts +6 -0
- package/plugins/vite/gzip.js +5 -0
- package/plugins/vite/imports-logger.d.ts +13 -0
- package/plugins/vite/imports-logger.js +2 -1
- package/plugins/vite/index.d.ts +54 -0
- package/plugins/vite/index.js +16 -15
- package/plugins/vite/license.d.ts +7 -0
- package/plugins/vite/license.js +6 -6
- package/plugins/vite/local-files-analysis.d.ts +95 -0
- package/plugins/vite/local-files-analysis.js +2 -1
- package/plugins/vite/local-files-core.d.ts +51 -0
- package/plugins/vite/local-files-core.js +2 -2
- package/plugins/vite/local-files-internals.d.ts +3 -0
- package/plugins/vite/local-files-utils.d.ts +77 -0
- package/plugins/vite/local-files.d.ts +2 -0
- package/plugins/vite/logger.d.ts +8 -0
- package/plugins/vite/logger.js +1 -1
- package/plugins/vite/logging.d.ts +31 -0
- package/plugins/vite/meta.d.ts +7 -0
- package/plugins/vite/meta.js +4 -3
- package/plugins/vite/needle-app.d.ts +7 -0
- package/plugins/vite/needle-app.js +1 -1
- package/plugins/vite/npm.d.ts +4 -0
- package/plugins/vite/npm.js +1 -1
- package/plugins/vite/peer.d.ts +7 -0
- package/plugins/vite/peer.js +3 -1
- package/plugins/vite/poster-client.d.ts +1 -0
- package/plugins/vite/poster.d.ts +8 -0
- package/plugins/vite/poster.js +5 -2
- package/plugins/vite/pwa.d.ts +7 -0
- package/plugins/vite/pwa.js +4 -4
- package/plugins/vite/reload-client.d.ts +1 -0
- package/plugins/vite/reload.d.ts +7 -0
- package/plugins/vite/reload.js +7 -6
- package/plugins/vite/server.d.ts +7 -0
- package/plugins/vite/server.js +5 -5
- package/plugins/vite/transform-codegen.d.ts +8 -0
- package/plugins/vite/transform-codegen.js +6 -4
- package/plugins/vite/transform.d.ts +5 -0
- package/plugins/vite/transform.js +1 -1
- package/plugins/vite/vite-4.4-hack.d.ts +8 -0
- package/plugins/vite/vite-4.4-hack.js +1 -1
- package/src/engine/engine_context.ts +1 -0
- package/src/engine/webcomponents/logo-element.ts +1 -1
- package/src/engine/webcomponents/needle-engine.ts +41 -47
- package/src/engine-components/ReflectionProbe.ts +38 -11
- package/plugins/types/next.d.ts +0 -3
- package/plugins/types/vite.d.ts +0 -14
|
@@ -4,14 +4,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { CubeTexture, EquirectangularReflectionMapping, LinearSRGBColorSpace, Texture, Vector3 } from "three";
|
|
7
|
+
import { Box3, CubeTexture, EquirectangularReflectionMapping, LinearSRGBColorSpace, Quaternion, Texture, Vector3 } from "three";
|
|
8
8
|
import { MaterialPropertyBlock } from "../engine/engine_materialpropertyblock.js";
|
|
9
9
|
import { loadPMREM } from "../engine/engine_pmrem.js";
|
|
10
10
|
import { serializable } from "../engine/engine_serialization.js";
|
|
11
11
|
import { getParam, resolveUrl } from "../engine/engine_utils.js";
|
|
12
|
-
import { BoxHelperComponent } from "./BoxHelperComponent.js";
|
|
13
12
|
import { Behaviour } from "./Component.js";
|
|
14
13
|
import { EventList } from "./EventList.js";
|
|
14
|
+
import { getBoundingBox } from "../engine/engine_three_utils.js";
|
|
15
|
+
import { CreateWireCube } from "../engine/engine_gizmos.js";
|
|
15
16
|
export const debug = getParam("debugreflectionprobe");
|
|
16
17
|
const disable = getParam("noreflectionprobe");
|
|
17
18
|
const $reflectionProbeKey = Symbol("reflectionProbeKey");
|
|
@@ -41,6 +42,10 @@ const $reflectionProbeKey = Symbol("reflectionProbeKey");
|
|
|
41
42
|
*/
|
|
42
43
|
export class ReflectionProbe extends Behaviour {
|
|
43
44
|
static _probes = new Map();
|
|
45
|
+
/** The bounding box for this component */
|
|
46
|
+
box = null;
|
|
47
|
+
static testBox = new Box3();
|
|
48
|
+
static _identityRotation = new Quaternion();
|
|
44
49
|
/**
|
|
45
50
|
* Checks if the given material is currently using a reflection probe. This is determined by checking for an override on the material's "envMap" property, which is set by the Renderer component when applying a reflection probe.
|
|
46
51
|
*/
|
|
@@ -144,18 +149,25 @@ export class ReflectionProbe extends Behaviour {
|
|
|
144
149
|
/**
|
|
145
150
|
* Defines the center and size of the reflection probe's influence area.
|
|
146
151
|
*/
|
|
147
|
-
center;
|
|
152
|
+
center = new Vector3();
|
|
148
153
|
/**
|
|
149
154
|
* Defines the size of the reflection probe's influence area. Objects within this box will be affected by the probe's reflections.
|
|
150
155
|
*/
|
|
151
|
-
size;
|
|
156
|
+
size = new Vector3(1, 1, 1);
|
|
152
157
|
/**
|
|
153
158
|
* Workaround for lightmap. Compensates for the fact that lightmaps are pre-multiplied by intensity, while reflection probes are not. This means that if you use both lightmaps and reflection probes, you may need to adjust this value to get the correct balance between them. The default value of `Math.PI` is a good starting point for most cases, but you may need to tweak it based on your specific lighting setup and artistic needs.
|
|
154
159
|
*/
|
|
155
160
|
__lightmapIntensityScale = true;
|
|
156
|
-
_boxHelper;
|
|
157
161
|
isInBox(obj) {
|
|
158
|
-
|
|
162
|
+
this.box ??= new Box3();
|
|
163
|
+
this.box.setFromCenterAndSize(this.gameObject.worldPosition.add(this.center), this.gameObject.worldScale.multiply(this.size));
|
|
164
|
+
getBoundingBox([obj], undefined, undefined, ReflectionProbe.testBox);
|
|
165
|
+
if (ReflectionProbe.testBox.isEmpty()) {
|
|
166
|
+
return this.box.containsPoint(obj.worldPosition);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
return this.box?.intersectsBox(ReflectionProbe.testBox);
|
|
170
|
+
}
|
|
159
171
|
}
|
|
160
172
|
constructor() {
|
|
161
173
|
super();
|
|
@@ -164,12 +176,14 @@ export class ReflectionProbe extends Behaviour {
|
|
|
164
176
|
}
|
|
165
177
|
ReflectionProbe._probes.get(this.context)?.push(this);
|
|
166
178
|
}
|
|
179
|
+
_gizmo = null;
|
|
180
|
+
_color = null;
|
|
167
181
|
/** @internal */
|
|
168
182
|
awake() {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
183
|
+
if (debug) {
|
|
184
|
+
this._gizmo = CreateWireCube(0x555500);
|
|
185
|
+
this.gameObject.add(this._gizmo);
|
|
186
|
+
}
|
|
173
187
|
if (this._texture) {
|
|
174
188
|
this._texture.mapping = EquirectangularReflectionMapping;
|
|
175
189
|
this._texture.colorSpace = LinearSRGBColorSpace;
|
|
@@ -177,6 +191,16 @@ export class ReflectionProbe extends Behaviour {
|
|
|
177
191
|
}
|
|
178
192
|
}
|
|
179
193
|
/** @internal */
|
|
194
|
+
update() {
|
|
195
|
+
if (this._gizmo) {
|
|
196
|
+
if (this.center)
|
|
197
|
+
this._gizmo.position.copy(this.center);
|
|
198
|
+
if (this.size)
|
|
199
|
+
this._gizmo.scale.copy(this.size);
|
|
200
|
+
this._gizmo.worldQuaternion = ReflectionProbe._identityRotation;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/** @internal */
|
|
180
204
|
onEnable() {
|
|
181
205
|
ReflectionProbe.onEnabled?.invoke(this);
|
|
182
206
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReflectionProbe.js","sourceRoot":"","sources":["../../src/engine-components/ReflectionProbe.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,gCAAgC,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ReflectionProbe.js","sourceRoot":"","sources":["../../src/engine-components/ReflectionProbe.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAS,WAAW,EAAE,gCAAgC,EAAE,oBAAoB,EAAoC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEzK,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAoB,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,sBAAsB,CAAC,CAAC;AACtD,MAAM,OAAO,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAE9C,MAAM,mBAAmB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAElC,MAAM,CAAC,OAAO,GAAoC,IAAI,GAAG,EAAE,CAAC;IACpE,0CAA0C;IAClC,GAAG,GAAgB,IAAI,CAAC;IACxB,MAAM,CAAC,OAAO,GAAS,IAAI,IAAI,EA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AkF;YAClF,SAAS,IAAI,IAAI,CAAC,EAAE,CAAC;QACzB,CAAC;QACD,aAAa,CAAC,WAAW,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,GAAa;QACjB,MAAM,KAAK,GAAG,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,KAAK,EAAE,CAAC;YACR,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;YACnD,IAAI,OAAO,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC3B,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;QACL,CAAC;IACL,CAAC;;AAxKD;IADC,YAAY,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;8CAoC/B;AAMD;IADC,YAAY,EAAE;kDACO;AAMtB;IADC,YAAY,CAAC,OAAO,CAAC;+CACU;AAMhC;IADC,YAAY,CAAC,OAAO,CAAC;6CACe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.1-next.98e87e6",
|
|
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": {
|
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
"./components.json": "./components.needle.json",
|
|
14
14
|
"./asap": "./lib/asap/needle-asap.js",
|
|
15
15
|
"./vite": {
|
|
16
|
-
"types": "./plugins/
|
|
16
|
+
"types": "./plugins/vite/index.d.ts",
|
|
17
17
|
"import": "./plugins/vite/index.js",
|
|
18
18
|
"require": "./plugins/vite/index.js"
|
|
19
19
|
},
|
|
20
20
|
"./next": {
|
|
21
|
-
"types": "./plugins/
|
|
21
|
+
"types": "./plugins/next/next.d.ts",
|
|
22
22
|
"import": "./plugins/next/index.js",
|
|
23
23
|
"require": "./plugins/next/index.js"
|
|
24
24
|
},
|
|
25
25
|
"./plugins/vite/index.js": {
|
|
26
|
-
"types": "./plugins/
|
|
26
|
+
"types": "./plugins/vite/index.d.ts",
|
|
27
27
|
"default": "./plugins/vite/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./plugins/next/index.js": {
|
|
30
|
-
"types": "./plugins/
|
|
30
|
+
"types": "./plugins/next/next.d.ts",
|
|
31
31
|
"default": "./plugins/next/index.js"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
@@ -48,10 +48,11 @@
|
|
|
48
48
|
"readme": "README.md",
|
|
49
49
|
"scripts": {
|
|
50
50
|
"dev": "npm-watch",
|
|
51
|
-
"build": "npm run build:src && npm run build:dist",
|
|
51
|
+
"build": "npm run build:plugin-types && npm run build:src && npm run build:dist",
|
|
52
52
|
"build:dist": "vite build",
|
|
53
53
|
"build:src": "tsc -p tsconfig.build.json --rootDir ./src --outDir ./lib --noEmit false --declaration",
|
|
54
54
|
"build:license": "node plugins/publish/create-license.mjs",
|
|
55
|
+
"build:plugin-types": "tsc -p tsconfig.plugins.json && cp .plugin-types-tmp/plugins/vite/*.d.ts plugins/vite/ && cp .plugin-types-tmp/plugins/next/*.d.ts plugins/next/ && rm -rf .plugin-types-tmp",
|
|
55
56
|
"build:components-data": "node plugins/publish/create-component-types.now.mjs",
|
|
56
57
|
"test": "node plugins/test/test.mjs",
|
|
57
58
|
"test:circular-imports": "node plugins/test/check-circular-imports.mjs",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Integrates Needle Engine into a Next.js project.
|
|
2
|
+
* Pass a nextConfig object in to add the needle specific settings.
|
|
3
|
+
* Optionally omit nextConfig and it will be created for you.
|
|
4
|
+
* @param {import('next').NextConfig} [nextConfig]
|
|
5
|
+
* @param {import('../types').userSettings} [userSettings]
|
|
6
|
+
* @returns {Promise<import('next').NextConfig>}
|
|
7
|
+
*/
|
|
8
|
+
export function needleNext(nextConfig?: any, userSettings?: import("../types").userSettings): Promise<any>;
|
package/plugins/next/next.js
CHANGED
|
@@ -12,13 +12,14 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
12
12
|
const __dirname = dirname(__filename);
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
/**
|
|
15
|
+
/** Integrates Needle Engine into a Next.js project.
|
|
16
|
+
* Pass a nextConfig object in to add the needle specific settings.
|
|
16
17
|
* Optionally omit nextConfig and it will be created for you.
|
|
17
|
-
* @param {import('next').NextConfig} nextConfig
|
|
18
|
-
* @param {import('../types').userSettings} userSettings
|
|
19
|
-
* @returns {import('next').NextConfig}
|
|
18
|
+
* @param {import('next').NextConfig} [nextConfig]
|
|
19
|
+
* @param {import('../types').userSettings} [userSettings]
|
|
20
|
+
* @returns {Promise<import('next').NextConfig>}
|
|
20
21
|
*/
|
|
21
|
-
export
|
|
22
|
+
export async function needleNext(nextConfig, userSettings) {
|
|
22
23
|
console.log("Apply 🌵 needle next config");
|
|
23
24
|
|
|
24
25
|
if (!nextConfig) {
|
|
@@ -138,4 +139,4 @@ export const needleNext = async (nextConfig, userSettings) => {
|
|
|
138
139
|
|
|
139
140
|
|
|
140
141
|
return nextConfig;
|
|
141
|
-
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Needle Engine Claude skill installer.
|
|
3
|
+
*
|
|
4
|
+
* Writes a Needle Engine skill to `.claude/skills/needle-engine/SKILL.md`.
|
|
5
|
+
* Claude Code auto-loads skills based on their description frontmatter, so
|
|
6
|
+
* Claude will automatically have Needle Engine context when working in the project.
|
|
7
|
+
*
|
|
8
|
+
* The skill is only written if `.claude/` already exists in the project root
|
|
9
|
+
* (i.e. the developer is already using Claude Code). Old skill files are
|
|
10
|
+
* always overwritten so the skill stays up to date with the engine version.
|
|
11
|
+
*
|
|
12
|
+
* @param {"build" | "serve"} command
|
|
13
|
+
* @param {{} | undefined | null} config
|
|
14
|
+
* @param {import('../types/index.js').userSettings} userSettings
|
|
15
|
+
* @returns {import('vite').Plugin | null}
|
|
16
|
+
*/
|
|
17
|
+
export function needleAI(command: "build" | "serve", config: {} | undefined | null, userSettings: import("../types/index.js").userSettings): import("vite").Plugin | null;
|
package/plugins/vite/ai.js
CHANGED
|
@@ -23,7 +23,7 @@ const pluginName = "needle-ai";
|
|
|
23
23
|
* @param {import('../types/index.js').userSettings} userSettings
|
|
24
24
|
* @returns {import('vite').Plugin | null}
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
26
|
+
export function needleAI(command, config, userSettings) {
|
|
27
27
|
return {
|
|
28
28
|
name: pluginName,
|
|
29
29
|
enforce: "pre",
|
|
@@ -34,7 +34,7 @@ export const needleAI = (command, config, userSettings) => {
|
|
|
34
34
|
installClaudeSkill();
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
38
|
|
|
39
39
|
function writeSkill(claudeDir) {
|
|
40
40
|
const skillDir = join(claudeDir, "skills", "needle-engine");
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {"build" | "serve"} command
|
|
3
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
4
|
+
* @param {import('../types').userSettings} userSettings
|
|
5
|
+
* @returns {import('vite').Plugin | import('vite').Plugin[] | undefined}
|
|
6
|
+
*/
|
|
7
|
+
export function needleViteAlias(command: "build" | "serve", config: import("../types/needleConfig").needleMeta | null | undefined, userSettings: import("../types").userSettings): import("vite").Plugin | import("vite").Plugin[] | undefined;
|
|
8
|
+
export type PackageResolveValue = "auto-resolve" | ((res: string, packageName: string, index: number, path: string) => string | null | void);
|
package/plugins/vite/alias.js
CHANGED
|
@@ -67,9 +67,12 @@ const packages_to_resolve = {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
+
* @param {"build" | "serve"} command
|
|
71
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
70
72
|
* @param {import('../types').userSettings} userSettings
|
|
73
|
+
* @returns {import('vite').Plugin | import('vite').Plugin[] | undefined}
|
|
71
74
|
*/
|
|
72
|
-
export
|
|
75
|
+
export function needleViteAlias(command, config, userSettings) {
|
|
73
76
|
|
|
74
77
|
if (config?.noAlias === true || userSettings?.noAlias === true)
|
|
75
78
|
return;
|
|
@@ -199,4 +202,4 @@ export const needleViteAlias = (command, config, userSettings) => {
|
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
204
|
}
|
|
202
|
-
}
|
|
205
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Injects needle asap script into the index.html for when the main needle engine bundle is still being downloaded.
|
|
2
|
+
* @param {"build" | "serve"} command
|
|
3
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
4
|
+
* @param {import('../types').userSettings} userSettings
|
|
5
|
+
* @returns {Promise<import('vite').Plugin[] | null>}
|
|
6
|
+
*/
|
|
7
|
+
export function needleAsap(command: "build" | "serve", config: import("../types/needleConfig").needleMeta | null | undefined, userSettings: import("../types").userSettings): Promise<import("vite").Plugin[] | null>;
|
package/plugins/vite/asap.js
CHANGED
|
@@ -9,13 +9,13 @@ const code = `import('@needle-tools/engine/src/asap/needle-asap.ts');`
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Injects needle asap script into the index.html for when the main needle engine bundle is still being downloaded
|
|
12
|
+
/** Injects needle asap script into the index.html for when the main needle engine bundle is still being downloaded.
|
|
14
13
|
* @param {"build" | "serve"} command
|
|
14
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
15
15
|
* @param {import('../types').userSettings} userSettings
|
|
16
16
|
* @returns {Promise<import('vite').Plugin[] | null>}
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export async function needleAsap(command, config, userSettings) {
|
|
19
19
|
|
|
20
20
|
if (userSettings.noAsap) return null;
|
|
21
21
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function waitForBuildPipelineToFinish(): Promise<void>;
|
|
2
|
+
/** Runs the needle build pipeline as part of the vite build process.
|
|
3
|
+
* @param {"build" | "serve"} command
|
|
4
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
5
|
+
* @param {import('../types').userSettings} userSettings
|
|
6
|
+
* @returns {import('vite').Plugin}
|
|
7
|
+
*/
|
|
8
|
+
export function needleBuildPipeline(command: "build" | "serve", config: import("../types/needleConfig").needleMeta | null | undefined, userSettings: import("../types").userSettings): import("vite").Plugin;
|
|
9
|
+
export type BuildPipelinePayload = {
|
|
10
|
+
event?: string;
|
|
11
|
+
phase?: string;
|
|
12
|
+
target?: string;
|
|
13
|
+
message?: string;
|
|
14
|
+
level?: string;
|
|
15
|
+
};
|
|
@@ -75,14 +75,13 @@ function increaseMaxWaitTime(debugLog) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* @param {
|
|
81
|
-
* @param {import('vite').UserConfig} config
|
|
78
|
+
/** Runs the needle build pipeline as part of the vite build process.
|
|
79
|
+
* @param {"build" | "serve"} command
|
|
80
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
82
81
|
* @param {import('../types').userSettings} userSettings
|
|
83
|
-
* @returns {
|
|
82
|
+
* @returns {import('vite').Plugin}
|
|
84
83
|
*/
|
|
85
|
-
export
|
|
84
|
+
export async function needleBuildPipeline(command, config, userSettings) {
|
|
86
85
|
|
|
87
86
|
// we only want to run compression here if this is a distribution build
|
|
88
87
|
// this is handled however in the `apply` hook
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {"build" | "serve"} command
|
|
3
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
4
|
+
* @param {import('../types').userSettings} userSettings
|
|
5
|
+
* @returns {import('vite').Plugin}
|
|
6
|
+
*/
|
|
7
|
+
export function needleBuild(command: "build" | "serve", config: import("../types/needleConfig").needleMeta | null | undefined, userSettings: import("../types").userSettings): import("vite").Plugin;
|
package/plugins/vite/build.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* @param {"build" | "serve"} command
|
|
4
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
5
|
+
* @param {import('../types').userSettings} userSettings
|
|
3
6
|
* @returns {import('vite').Plugin}
|
|
4
7
|
*/
|
|
5
|
-
export
|
|
8
|
+
export function needleBuild(command, config, userSettings) {
|
|
6
9
|
|
|
7
10
|
// TODO: need to set this when building a dist
|
|
8
11
|
const isDeployOnlyBuild = config?.deployOnly === true;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Create a buildinfo file in the build directory.
|
|
2
|
+
* @param {"build" | "serve"} command
|
|
3
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
4
|
+
* @param {import('../types').userSettings} userSettings
|
|
5
|
+
* @returns {import('vite').Plugin | null}
|
|
6
|
+
*/
|
|
7
|
+
export function needleBuildInfo(command: "build" | "serve", config: import("../types/needleConfig").needleMeta | null | undefined, userSettings: import("../types").userSettings): import("vite").Plugin | null;
|
|
@@ -6,11 +6,13 @@ import { needleBlue, needleDim, needleLog, needleSupportsColor } from './logging
|
|
|
6
6
|
|
|
7
7
|
let level = 0;
|
|
8
8
|
|
|
9
|
-
/** Create a buildinfo file in the build directory
|
|
9
|
+
/** Create a buildinfo file in the build directory.
|
|
10
|
+
* @param {"build" | "serve"} command
|
|
11
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
10
12
|
* @param {import('../types').userSettings} userSettings
|
|
11
13
|
* @returns {import('vite').Plugin | null}
|
|
12
14
|
*/
|
|
13
|
-
export
|
|
15
|
+
export function needleBuildInfo(command, config, userSettings) {
|
|
14
16
|
|
|
15
17
|
if (userSettings?.noBuildInfo) return null;
|
|
16
18
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Load the codegen meta file.
|
|
2
|
+
* @param {string | null} path
|
|
3
|
+
* @returns {Promise<import("../types/needleConfig").needleMeta | null>}
|
|
4
|
+
*/
|
|
5
|
+
export function loadConfig(path?: string | null): Promise<import("../types/needleConfig").needleMeta | null>;
|
|
6
|
+
/** get the needle.config.json
|
|
7
|
+
* @returns {import("../types/needleConfig").needleConfig | null}
|
|
8
|
+
*/
|
|
9
|
+
export function tryLoadProjectConfig(): import("../types/needleConfig").needleConfig | null;
|
|
10
|
+
/** "assets" -> the directory name inside the output directory to put e.g. glb files into */
|
|
11
|
+
export function builtAssetsDirectory(): string;
|
|
12
|
+
/** @returns the fullpath of the build */
|
|
13
|
+
export function getOutputDirectory(): string;
|
package/plugins/vite/config.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Copy files on build from assets to dist.
|
|
2
|
+
* @param {"build" | "serve"} command
|
|
3
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
4
|
+
* @param {import('../types').userSettings} userSettings
|
|
5
|
+
* @returns {import('vite').Plugin | null}
|
|
6
|
+
*/
|
|
7
|
+
export function needleCopyFiles(command: "build" | "serve", config: import("../types/needleConfig").needleMeta | null | undefined, userSettings: import("../types").userSettings): import("vite").Plugin | null;
|
|
@@ -8,11 +8,13 @@ import { needleBlue, needleDim, needleLog, needleSupportsColor } from './logging
|
|
|
8
8
|
const pluginName = "needle-copy-files";
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/** Copy files on build from assets to dist.
|
|
12
|
+
* @param {"build" | "serve"} command
|
|
13
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
12
14
|
* @param {import('../types').userSettings} userSettings
|
|
13
15
|
* @returns {import('vite').Plugin | null}
|
|
14
16
|
*/
|
|
15
|
-
export
|
|
17
|
+
export function needleCopyFiles(command, config, userSettings) {
|
|
16
18
|
|
|
17
19
|
if (config?.noCopy === true || userSettings?.noCopy === true) {
|
|
18
20
|
return null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure the repo workspace or .vscode settings include Needle Engine custom HTML data if they exist.
|
|
3
|
+
* Copies custom-elements.json to the project and merges with existing user content.
|
|
4
|
+
* - Copies/merges `custom-elements.json` to project root
|
|
5
|
+
* - Adds `./custom-elements.json` to `.code-workspace settings.html.customData`
|
|
6
|
+
* - Adds `./custom-elements.json` to `.vscode/settings.json html.customData`
|
|
7
|
+
* @param {"build" | "serve"} _command
|
|
8
|
+
* @param {import('../types').needleMeta | null} _config
|
|
9
|
+
* @param {import('../types').userSettings} userSettings
|
|
10
|
+
* @returns {import('vite').Plugin | null}
|
|
11
|
+
*/
|
|
12
|
+
export function needleCustomElementData(_command: "build" | "serve", _config: import("../types").needleMeta | null, userSettings?: import("../types").userSettings): import("vite").Plugin | null;
|
|
13
|
+
export default needleCustomElementData;
|
|
14
|
+
export type CustomElementData = {
|
|
15
|
+
version?: number;
|
|
16
|
+
tags?: {
|
|
17
|
+
name: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}[];
|
|
20
|
+
valueSets?: {
|
|
21
|
+
name: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}[];
|
|
24
|
+
globalAttributes?: unknown[];
|
|
25
|
+
};
|
|
@@ -64,8 +64,9 @@ function mergeCustomElementData(sourceData, targetData) {
|
|
|
64
64
|
* @param {"build" | "serve"} _command
|
|
65
65
|
* @param {import('../types').needleMeta | null} _config
|
|
66
66
|
* @param {import('../types').userSettings} userSettings
|
|
67
|
+
* @returns {import('vite').Plugin | null}
|
|
67
68
|
*/
|
|
68
|
-
export
|
|
69
|
+
export function needleCustomElementData(_command, _config, userSettings = {}) {
|
|
69
70
|
// Allow disabling the workspace updater
|
|
70
71
|
if (userSettings?.noCustomElementData === true) return null;
|
|
71
72
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** used to pass config variables into vite.config.define
|
|
2
|
+
* for example "useRapier"
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @param {"build" | "serve"} command
|
|
6
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} needleEngineConfig
|
|
7
|
+
* @param {import('../types').userSettings} userSettings
|
|
8
|
+
* @returns {import('vite').Plugin}
|
|
9
|
+
*/
|
|
10
|
+
export function needleDefines(command: "build" | "serve", needleEngineConfig: import("../types/needleConfig").needleMeta | null | undefined, userSettings: import("../types").userSettings): import("vite").Plugin;
|
package/plugins/vite/defines.js
CHANGED
|
@@ -12,11 +12,12 @@ import { needleLog } from "./logging.js";
|
|
|
12
12
|
// https://vitejs.dev/config/#using-environment-variables-in-config
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
15
|
+
* @param {"build" | "serve"} command
|
|
16
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} needleEngineConfig
|
|
17
17
|
* @param {import('../types').userSettings} userSettings
|
|
18
|
+
* @returns {import('vite').Plugin}
|
|
18
19
|
*/
|
|
19
|
-
export
|
|
20
|
+
export function needleDefines(command, needleEngineConfig, userSettings) {
|
|
20
21
|
|
|
21
22
|
if (!userSettings) userSettings = {};
|
|
22
23
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true when \`@needle-tools/engine\` is installed as a local package
|
|
3
|
+
* (i.e. it has its own nested `node_modules`). Vite's optimiser must skip such
|
|
4
|
+
* packages, otherwise it tries to pre-bundle source that was never meant to be
|
|
5
|
+
* pre-bundled and fails at dev-server start.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} [root] – project root; defaults to `process.cwd()`.
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
export function isLocalNeedleEngineInstalled(root?: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @param {"build" | "serve"} command
|
|
13
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
14
|
+
* @param {import('../types').userSettings} userSettings
|
|
15
|
+
* @returns {import('vite').Plugin[]}
|
|
16
|
+
*/
|
|
17
|
+
export function needleDependencies(command: "build" | "serve", config: import("../types/needleConfig").needleMeta | null | undefined, userSettings: import("../types").userSettings): import("vite").Plugin[];
|
|
18
|
+
/**
|
|
19
|
+
* @type {string[]}
|
|
20
|
+
*/
|
|
21
|
+
export const preloadScriptPaths: string[];
|
|
@@ -24,10 +24,12 @@ export function isLocalNeedleEngineInstalled(root = process.cwd()) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
+
* @param {"build" | "serve"} command
|
|
28
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
27
29
|
* @param {import('../types').userSettings} userSettings
|
|
28
30
|
* @returns {import('vite').Plugin[]}
|
|
29
31
|
*/
|
|
30
|
-
export
|
|
32
|
+
export function needleDependencies(command, config, userSettings) {
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* @type {import('vite').Plugin}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {"build" | "serve"} command
|
|
3
|
+
* @param {unknown} _config
|
|
4
|
+
* @param {import('../types').userSettings} userSettings
|
|
5
|
+
* @returns {import('vite').Plugin | null}
|
|
6
|
+
*/
|
|
7
|
+
export function needleDependencyWatcher(command: "build" | "serve", _config: unknown, userSettings: import("../types").userSettings): import("vite").Plugin | null;
|
|
8
|
+
export type PackageJson = {
|
|
9
|
+
dependencies?: Record<string, string>;
|
|
10
|
+
devDependencies?: Record<string, string>;
|
|
11
|
+
};
|
|
@@ -15,8 +15,9 @@ function log(...msg) {
|
|
|
15
15
|
* @param {"build" | "serve"} command
|
|
16
16
|
* @param {unknown} _config
|
|
17
17
|
* @param {import('../types').userSettings} userSettings
|
|
18
|
+
* @returns {import('vite').Plugin | null}
|
|
18
19
|
*/
|
|
19
|
-
export
|
|
20
|
+
export function needleDependencyWatcher(command, _config, userSettings) {
|
|
20
21
|
if (command === "build") return null;
|
|
21
22
|
|
|
22
23
|
if (userSettings?.noDependencyWatcher === true) return null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Experimental, allow dropping files from Unity into the running scene.
|
|
2
|
+
* @param {"build" | "serve"} command
|
|
3
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
4
|
+
* @param {import('../types/userconfig.js').userSettings} userSettings
|
|
5
|
+
* @returns {import('vite').Plugin | null | undefined}
|
|
6
|
+
*/
|
|
7
|
+
export function needleDrop(command: "build" | "serve", config: import("../types/needleConfig").needleMeta | null | undefined, userSettings: import("../types/userconfig.js").userSettings): import("vite").Plugin | null | undefined;
|
package/plugins/vite/drop.js
CHANGED
|
@@ -6,13 +6,13 @@ import { fileURLToPath } from 'url';
|
|
|
6
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = path.dirname(__filename);
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
* @param {string} command
|
|
9
|
+
/** Experimental, allow dropping files from Unity into the running scene.
|
|
10
|
+
* @param {"build" | "serve"} command
|
|
12
11
|
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
13
12
|
* @param {import('../types/userconfig.js').userSettings} userSettings
|
|
13
|
+
* @returns {import('vite').Plugin | null | undefined}
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export function needleDrop(command, config, userSettings) {
|
|
16
16
|
if (command === "build") return;
|
|
17
17
|
|
|
18
18
|
if(userSettings.useDrop !== true) return null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {"build" | "serve"} command
|
|
3
|
+
* @param {import('../types/needleConfig').needleMeta | null | undefined} config
|
|
4
|
+
* @param {import('../types').userSettings} userSettings
|
|
5
|
+
* @param {import('vite').Plugin[]} [pluginsArray]
|
|
6
|
+
* @returns {Promise<import('vite').Plugin | undefined>}
|
|
7
|
+
*/
|
|
8
|
+
export function editorConnection(command: "build" | "serve", config: import("../types/needleConfig").needleMeta | null | undefined, userSettings: import("../types").userSettings, pluginsArray?: import("vite").Plugin[]): Promise<import("vite").Plugin | undefined>;
|