tresjs-nuxt 4.3.3 → 4.5.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/README.md CHANGED
@@ -5,25 +5,47 @@
5
5
  [![NPM downloads][badge-npm-downloads]][url-npm]
6
6
  [![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
7
7
 
8
- TresJS for Nuxt — a Nuxt module that auto-imports the TresJS core API, registers TresCanvas for client and server, and registers every installed @tresjs package's components and composables, with no devtools UI of its own.
8
+ A Nuxt module for TresJS that auto-imports the TresJS core API and registers TresCanvas for client and server. It registers the components and composables of every installed @tresjs package, and has no devtools UI of its own.
9
+
10
+ Design notes live in [the specs](https://github.com/Esposter/Esposter/tree/main/openspec/specs/tresjs-nuxt).
9
11
 
10
12
  ## Table of Contents
11
13
 
12
14
  - 🚀 [Getting Started](#getting-started)
13
- - 📖 [Documentation](#documentation)
15
+ - 🧩 [Key Exports](#key-exports)
14
16
  - ⚖️ [License](#license)
15
17
 
16
18
  ---
17
19
 
18
20
  ## <a name="getting-started">🚀 Getting Started</a>
19
21
 
22
+ 1. Install the package.
23
+
20
24
  ```bash
21
25
  pnpm i tresjs-nuxt
22
26
  ```
23
27
 
24
- ## <a name="documentation">📖 Documentation</a>
28
+ Check: `package.json` lists `tresjs-nuxt` in its dependencies.
29
+
30
+ 2. Add this to `nuxt.config.ts`.
31
+
32
+ ```ts
33
+ // nuxt.config.ts
34
+ export default defineNuxtConfig({
35
+ modules: ["tresjs-nuxt"],
36
+ // Loads the optional vite-plugin-glsl peer, which the app installs itself
37
+ tres: { glsl: true },
38
+ });
39
+ ```
40
+
41
+ Check: `pnpm dev` starts with no module error.
42
+
43
+ ## <a name="key-exports">🧩 Key Exports</a>
25
44
 
26
- We highly recommend you take a look at the [documentation](https://github.com/Esposter/Esposter/tree/main/openspec/specs/tresjs-nuxt) to level up.
45
+ | Export | Kind | Purpose |
46
+ | :-------------- | :-------- | :-------------------------------------------------------------------------------------------------------------------------------------- |
47
+ | `default` | const | The Nuxt module. It auto-imports the TresJS core API, and registers `TresCanvas` and the exports of each installed `@tresjs/*` package. |
48
+ | `ModuleOptions` | interface | The `tres` config key. `glsl` loads the `vite-plugin-glsl` peer. `modules` names extra packages whose exports register. |
27
49
 
28
50
  ## <a name="license">⚖️ License</a>
29
51
 
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import { CORE_PACKAGE_NAME, GLSL_PACKAGE_NAME, THREE_PACKAGE_NAME, TRES_CANVAS_NAME } from "./services/constants.js";
1
+ import { MODULE_NAME } from "./runtime/constants.js";
2
2
  import { checkIsTresCustomElement } from "./services/checkIsTresCustomElement.js";
3
+ import { CORE_PACKAGE_NAME, GLSL_PACKAGE_NAME, THREE_PACKAGE_NAME, TRES_CANVAS_NAME } from "./services/constants.js";
3
4
  import { getExportNames } from "./services/getExportNames.js";
4
5
  import { getTresPackageNames } from "./services/getTresPackageNames.js";
5
6
  import { addComponent, addImports, addVitePlugin, createResolver, defineNuxtModule, resolvePath } from "@nuxt/kit";
@@ -14,7 +15,7 @@ const tresjsModule = defineNuxtModule({
14
15
  meta: {
15
16
  compatibility: { nuxt: ">=5.0.0-0" },
16
17
  configKey: "tres",
17
- name: "tresjs-nuxt"
18
+ name: MODULE_NAME
18
19
  },
19
20
  async setup(options, nuxt) {
20
21
  const { resolve } = createResolver(import.meta.url);
@@ -1,9 +1,10 @@
1
+ import { TRES_CANVAS_NAME } from "../services/constants.js";
1
2
  import { TresCanvas } from "@tresjs/core";
2
3
  import { defineComponent, h } from "vue";
3
4
  // src/runtime/TresCanvas.client.ts
4
5
  const tresCanvasClient = defineComponent({
5
6
  inheritAttrs: false,
6
- name: "TresCanvas",
7
+ name: TRES_CANVAS_NAME,
7
8
  setup(_props, { attrs, slots }) {
8
9
  return () => h(TresCanvas, attrs, slots);
9
10
  }
@@ -1,7 +1,8 @@
1
+ import { TRES_CANVAS_NAME } from "../services/constants.js";
1
2
  import { defineComponent, h } from "vue";
2
3
  // src/runtime/TresCanvas.server.ts
3
4
  const tresCanvasServer = defineComponent({
4
- name: "TresCanvas",
5
+ name: TRES_CANVAS_NAME,
5
6
  setup: () => () => h("span")
6
7
  });
7
8
  export { tresCanvasServer as default };
@@ -0,0 +1 @@
1
+ export declare const MODULE_NAME = "tresjs-nuxt";
@@ -0,0 +1,3 @@
1
+ // src/runtime/constants.ts
2
+ const MODULE_NAME = "tresjs-nuxt";
3
+ export { MODULE_NAME };
@@ -5,7 +5,7 @@ const THREE_PACKAGE_NAME = "three";
5
5
  const TRES_CANVAS_NAME = "TresCanvas";
6
6
  const TRES_PACKAGE_SCOPE = "@tresjs/";
7
7
  const TRES_CORE_COMPONENT_NAMES = [
8
- "TresCanvas",
8
+ TRES_CANVAS_NAME,
9
9
  "TresCanvasContext",
10
10
  "TresLeches",
11
11
  "TresPortal",
@@ -0,0 +1,8 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ // src/services/getDependencyNames.ts
4
+ const getDependencyNames = async (directory) => {
5
+ const manifest = JSON.parse(await readFile(join(directory, "package.json"), "utf8"));
6
+ return [...Object.keys(manifest.dependencies ?? {}), ...Object.keys(manifest.devDependencies ?? {})];
7
+ };
8
+ export { getDependencyNames };
@@ -1,12 +1,8 @@
1
1
  import "./constants.js";
2
- import { readFile } from "node:fs/promises";
3
- import { existsSync } from "node:fs";
2
+ import { getDependencyNames } from "./getDependencyNames.js";
4
3
  import { dirname, join } from "node:path";
4
+ import { existsSync } from "node:fs";
5
5
  // src/services/getTresPackageNames.ts
6
- const getDependencyNames = async (directory) => {
7
- const manifest = JSON.parse(await readFile(join(directory, "package.json"), "utf8"));
8
- return [...Object.keys(manifest.dependencies ?? {}), ...Object.keys(manifest.devDependencies ?? {})];
9
- };
10
6
  const getTresPackageNames = async (rootDirectory) => {
11
7
  const parentDirectory = dirname(rootDirectory);
12
8
  const directories = existsSync(join(parentDirectory, "package.json")) ? [rootDirectory, parentDirectory] : [rootDirectory];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tresjs-nuxt",
3
- "version": "4.3.3",
3
+ "version": "4.5.0",
4
4
  "description": "TresJS for Nuxt — a Nuxt module that auto-imports the TresJS core API, registers TresCanvas for client and server, and registers every installed @tresjs package's components and composables, with no devtools UI of its own.",
5
5
  "keywords": [
6
6
  "nuxt",
@@ -31,8 +31,6 @@
31
31
  },
32
32
  "exports": {
33
33
  ".": "./dist/index.js",
34
- "./runtime/TresCanvas.client": "./dist/runtime/TresCanvas.client.js",
35
- "./runtime/TresCanvas.server": "./dist/runtime/TresCanvas.server.js",
36
34
  "./package.json": "./package.json"
37
35
  },
38
36
  "publishConfig": {
@@ -43,7 +41,7 @@
43
41
  "lint": "eslint .",
44
42
  "lint:fix": "eslint --fix .",
45
43
  "test": "vitest",
46
- "typecheck": "tsc"
44
+ "typecheck": "tsrs --fast"
47
45
  },
48
46
  "dependencies": {
49
47
  "@nuxt/kit": "npm:@nuxt/kit-nightly@5x",
@@ -52,14 +50,15 @@
52
50
  "mlly": "^1.8.2"
53
51
  },
54
52
  "devDependencies": {
55
- "@esposter/configuration": "4.3.3",
56
- "tsdown": "^0.23.1",
53
+ "@esposter/configuration": "4.5.0",
54
+ "@types/node": "^26.6.6",
55
+ "tsdown": "^0.23.5",
57
56
  "vite-plugin-glsl": "^1.6.2"
58
57
  },
59
58
  "peerDependencies": {
60
- "@tresjs/core": "^5.9.3",
59
+ "@tresjs/core": "^5.10.1",
61
60
  "nuxt": "npm:nuxt-nightly@5x",
62
- "three": "^0.186.1",
61
+ "three": "^0.187.0",
63
62
  "vite-plugin-glsl": "^1.6.2",
64
63
  "vue": "^3.5.44"
65
64
  },
@@ -68,5 +67,5 @@
68
67
  "optional": true
69
68
  }
70
69
  },
71
- "gitHead": "955bbc130ad9b28877fd4ae8efc73a045141ce01"
70
+ "gitHead": "e30c001f3b4b15693e75fb53092d62a97ade4d2b"
72
71
  }