@reactunity/renderer 0.24.0 → 0.26.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.
@@ -1,5 +1,5 @@
1
- import { a as Textable, n as BaseElements, o as SVGEelement, s as ReactUnity } from "./base-FL2QIa13.js";
2
- import { _ as Toggle, a as Button, b as View, c as Image, d as Scroll, f as Slider, g as TextField, h as Text, i as Bindable, l as Portal, m as Svg, o as IMGUI, s as Icon, t as Anchor, u as Range, y as ValueComponent } from "./components-BL4KGbQ4.js";
1
+ import { a as Textable, n as BaseElements, o as SVGEelement, s as ReactUnity } from "./base-BdOJBAjh.js";
2
+ import { _ as Toggle, a as Button, b as View, c as Image, d as Scroll, f as Slider, g as TextField, h as Text, i as Bindable, l as Portal, m as Svg, o as IMGUI, s as Icon, t as Anchor, u as Range, y as ValueComponent } from "./components-Dyz9O4hQ.js";
3
3
  import * as rc from "react";
4
4
  type Children<T = any> = {
5
5
  children?: T;
@@ -54,4 +54,4 @@ declare namespace JSX {
54
54
  }
55
55
  //#endregion
56
56
  export { UIToolkitElements as n, JSX as t };
57
- //# sourceMappingURL=jsx-C3umXnyu.d.ts.map
57
+ //# sourceMappingURL=jsx-6SH2J8lk.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { n as UnityEngine, r as System } from "./unity-CqyiwXyf.js";
2
- import { a as Textable, n as BaseElements, o as SVGEelement, s as ReactUnity } from "./base-FL2QIa13.js";
3
- import { _ as Toggle, a as Button, b as View, c as Image, f as Slider, g as TextField, i as Bindable, m as Svg, n as BaseField, o as IMGUI, t as Anchor, u as Range, y as ValueComponent } from "./components-BL4KGbQ4.js";
2
+ import { a as Textable, n as BaseElements, o as SVGEelement, s as ReactUnity } from "./base-BdOJBAjh.js";
3
+ import { _ as Toggle, a as Button, b as View, c as Image, f as Slider, g as TextField, i as Bindable, m as Svg, n as BaseField, o as IMGUI, t as Anchor, u as Range, y as ValueComponent } from "./components-Dyz9O4hQ.js";
4
4
  import * as rc from "react";
5
5
  //#region src/models/editor/components.d.ts
6
6
  interface EnumProps extends BaseField<number> {
@@ -111,4 +111,4 @@ declare namespace JSX {
111
111
  }
112
112
  //#endregion
113
113
  export { ObjectProps as a, EnumProps as i, JSX as n, DialogProps as r, EditorElements as t };
114
- //# sourceMappingURL=jsx-pk0p8f7A.d.ts.map
114
+ //# sourceMappingURL=jsx-C4D-jFq9.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { n as UnityEngine } from "./unity-CqyiwXyf.js";
2
- import { A as AssetReference, Ct as AnchorTarget, Tt as ScrollDirection, a as Textable, i as ContentSrcProps, j as AssetReferenceOrHttp, n as BaseElements, o as SVGEelement, r as BaseEvents, s as ReactUnity, t as BaseCmpProps } from "./base-FL2QIa13.js";
2
+ import { A as AssetReference, At as ScrollDirection, Ot as AnchorTarget, a as Textable, i as ContentSrcProps, j as AssetReferenceOrHttp, n as BaseElements, o as SVGEelement, r as BaseEvents, s as ReactUnity, t as BaseCmpProps } from "./base-BdOJBAjh.js";
3
3
  import { RefAttributes } from "react";
4
4
  //#region src/models/ugui/events.d.ts
5
5
  type BaseCmp$1 = ReactUnity.UGUI.UGUIComponent;
@@ -229,4 +229,4 @@ declare namespace JSX {
229
229
  }
230
230
  //#endregion
231
231
  export { BaseEventCallback as A, SvgImage as C, View as D, Video as E, KeyEventCallback as M, PointerEventCallback as N, ActionCallback as O, ResizeEventCallback as P, Svg as S, Toggle as T, Portal as _, Input as a, Render as b, TextSelectionEvent as c, BaseImage as d, Button as f, Object$1 as g, Label as h, ContentType as i, Events as j, AxisEventCallback as k, TouchScreenKeyboardType as l, Image as m, UGUIElements as n, InputEvent as o, Icon as p, CharacterValidation as r, LineType as s, JSX as t, Anchor as u, Prefab as v, Text as w, Scroll as x, RawImage as y };
232
- //# sourceMappingURL=jsx-BRwefwcW.d.ts.map
232
+ //# sourceMappingURL=jsx-CclP7PDw.d.ts.map
@@ -1,3 +1,3 @@
1
- import { A as BaseEventCallback, C as SvgImage, D as View, E as Video, M as KeyEventCallback, N as PointerEventCallback, O as ActionCallback, P as ResizeEventCallback, S as Svg, T as Toggle, _ as Portal, a as Input, b as Render, c as TextSelectionEvent, d as BaseImage, f as Button, g as Object$1, h as Label, i as ContentType, j as Events, k as AxisEventCallback, l as TouchScreenKeyboardType, m as Image, n as UGUIElements, o as InputEvent, p as Icon, r as CharacterValidation, s as LineType, t as JSX, u as Anchor, v as Prefab, w as Text, x as Scroll, y as RawImage } from "../jsx-BRwefwcW.js";
2
- import "../index-CEmZZAHV.js";
1
+ import { A as BaseEventCallback, C as SvgImage, D as View, E as Video, M as KeyEventCallback, N as PointerEventCallback, O as ActionCallback, P as ResizeEventCallback, S as Svg, T as Toggle, _ as Portal, a as Input, b as Render, c as TextSelectionEvent, d as BaseImage, f as Button, g as Object$1, h as Label, i as ContentType, j as Events, k as AxisEventCallback, l as TouchScreenKeyboardType, m as Image, n as UGUIElements, o as InputEvent, p as Icon, r as CharacterValidation, s as LineType, t as JSX, u as Anchor, v as Prefab, w as Text, x as Scroll, y as RawImage } from "../jsx-CclP7PDw.js";
2
+ import "../index-BjHMY1xn.js";
3
3
  export { ActionCallback, Anchor, AxisEventCallback, BaseEventCallback, BaseImage, Button, CharacterValidation, ContentType, Events, Icon, Image, Input, InputEvent, JSX, KeyEventCallback, Label, LineType, Object$1 as Object, PointerEventCallback, Portal, Prefab, RawImage, Render, ResizeEventCallback, Scroll, Svg, SvgImage, Text, TextSelectionEvent, Toggle, TouchScreenKeyboardType, UGUIElements, Video, View };
@@ -1,3 +1,3 @@
1
- import { t as JSX } from "../jsx-BRwefwcW.js";
1
+ import { t as JSX } from "../jsx-CclP7PDw.js";
2
2
  import { Fragment, JSXSource, jsxDEV } from "react/jsx-dev-runtime";
3
3
  export { Fragment, type JSX, type JSXSource, jsxDEV };
@@ -1,3 +1,3 @@
1
- import { t as JSX } from "../jsx-BRwefwcW.js";
1
+ import { t as JSX } from "../jsx-CclP7PDw.js";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  export { Fragment, type JSX, jsx, jsxs };
@@ -1,3 +1,3 @@
1
- import { C as Events, S as BaseEventCallback, _ as Toggle, a as Button, b as View, c as Image, d as Scroll, f as Slider, g as TextField, h as Text, i as Bindable, l as Portal, m as Svg, n as BaseField, o as IMGUI, p as StringField, r as BaseSlider, s as Icon, t as Anchor, u as Range, v as ToggleEvent, w as Handler, x as ActionCallback, y as ValueComponent } from "../components-BL4KGbQ4.js";
2
- import { n as UIToolkitElements, t as JSX } from "../jsx-C3umXnyu.js";
1
+ import { C as Events, S as BaseEventCallback, _ as Toggle, a as Button, b as View, c as Image, d as Scroll, f as Slider, g as TextField, h as Text, i as Bindable, l as Portal, m as Svg, n as BaseField, o as IMGUI, p as StringField, r as BaseSlider, s as Icon, t as Anchor, u as Range, v as ToggleEvent, w as Handler, x as ActionCallback, y as ValueComponent } from "../components-Dyz9O4hQ.js";
2
+ import { n as UIToolkitElements, t as JSX } from "../jsx-6SH2J8lk.js";
3
3
  export { ActionCallback, Anchor, BaseEventCallback, BaseField, BaseSlider, Bindable, Button, Events, Handler, IMGUI, Icon, Image, JSX, Portal, Range, Scroll, Slider, StringField, Svg, Text, TextField, Toggle, ToggleEvent, UIToolkitElements, ValueComponent, View };
@@ -1,3 +1,3 @@
1
- import { t as JSX } from "../jsx-C3umXnyu.js";
1
+ import { t as JSX } from "../jsx-6SH2J8lk.js";
2
2
  import { Fragment, JSXSource, jsxDEV } from "react/jsx-dev-runtime";
3
3
  export { Fragment, type JSX, type JSXSource, jsxDEV };
@@ -1,3 +1,3 @@
1
- import { t as JSX } from "../jsx-C3umXnyu.js";
1
+ import { t as JSX } from "../jsx-6SH2J8lk.js";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  export { Fragment, type JSX, jsx, jsxs };
package/dist/vite.mjs CHANGED
@@ -144,7 +144,6 @@ function reactUnity(options = {}) {
144
144
  reactUnityClean(options)
145
145
  ];
146
146
  }
147
- const LIGHTNINGCSS_LIGHT_DARK = 1 << 20;
148
147
  function reactUnityConfig(options) {
149
148
  const assetPath = options.assetPath ?? DEFAULT_ASSET_PATH;
150
149
  let message;
@@ -176,7 +175,7 @@ function reactUnityConfig(options) {
176
175
  }
177
176
  if (config.build?.assetsInlineLimit === void 0) build.assetsInlineLimit = 0;
178
177
  if (config.build?.cssTarget === void 0) build.cssTarget = ["chrome87"];
179
- if (config.css?.lightningcss?.exclude === void 0) patch.css = { lightningcss: { exclude: LIGHTNINGCSS_LIGHT_DARK } };
178
+ if (config.css?.lightningcss?.exclude === void 0) patch.css = { lightningcss: { exclude: 1572864 } };
180
179
  if (options.clean !== false && config.build?.emptyOutDir === void 0) build.emptyOutDir = false;
181
180
  const output = config.build?.rolldownOptions?.output ?? config.build?.rollupOptions?.output;
182
181
  if (!options.hashFileNames && output === void 0 && !config.build?.lib) {
package/dist/vite.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.mjs","names":[],"sources":["../src/vite/clean.ts","../src/vite/unity-project.ts","../src/vite/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nconst META = '.meta';\n\n/**\n * Empties the output directory but keeps every `.meta` file.\n *\n * Unity writes a `.meta` beside each asset and the GUID inside it is what scenes,\n * prefabs and asset references point at. Deleting one makes Unity mint a new GUID for\n * the file that replaces it, which silently breaks every reference to it -- so a build\n * clears the output it produced last time and leaves the metas for the files coming back.\n * The ones nothing comes back for are dropped afterwards by `removeOrphanMetaFiles`.\n */\nexport function cleanOutDir(outDir: string, preserve: readonly string[] = []): void {\n if (!fs.existsSync(outDir)) return;\n\n const keep = new Set(preserve.map((entry) => path.resolve(outDir, entry)));\n cleanDir(outDir, keep);\n}\n\n// Returns whether anything survived, so the caller can drop a directory that did not.\nfunction cleanDir(dir: string, keep: Set<string>): boolean {\n let survivors = 0;\n\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, entry.name);\n\n if (keep.has(full) || entry.name.endsWith(META)) {\n survivors++;\n continue;\n }\n\n if (entry.isDirectory()) {\n // A directory holding metas (or something preserved) has to stay for them.\n if (cleanDir(full, keep)) survivors++;\n else fs.rmSync(full, { recursive: true, force: true });\n } else {\n fs.rmSync(full, { force: true });\n }\n }\n\n return survivors > 0;\n}\n\n/**\n * Drops the `.meta` files whose asset did not come back, and the directories the build\n * left empty. Run after the bundle is written, so what remains describes only real files.\n */\nexport function removeOrphanMetaFiles(outDir: string): void {\n if (!fs.existsSync(outDir)) return;\n sweep(outDir, true);\n}\n\n// Returns whether the directory is still wanted.\nfunction sweep(dir: string, isRoot: boolean): boolean {\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n if (sweep(full, false)) continue;\n\n // A directory's own meta lives in its parent, and goes with it.\n fs.rmSync(full, { recursive: true, force: true });\n fs.rmSync(full + META, { force: true });\n } else if (entry.name.endsWith(META) && !fs.existsSync(full.slice(0, -META.length))) {\n fs.rmSync(full, { force: true });\n }\n }\n\n return isRoot || fs.readdirSync(dir).length > 0;\n}\n\n/**\n * Describes why `outDir` must not be cleaned, or nothing when it is safe.\n *\n * The clean deletes everything it finds, so it refuses anything that is not plausibly a\n * build output folder: a Unity project root, a package, or the sources themselves.\n */\nexport function unsafeOutDirReason(outDir: string, root: string): string | undefined {\n const dir = path.resolve(outDir);\n\n if (path.dirname(dir) === dir) return 'it is a filesystem root';\n\n // `Assets` itself rather than a folder inside it: no marker below would catch that one.\n if (path.basename(dir) === 'Assets') return 'it is a Unity Assets folder';\n\n const relative = path.relative(dir, path.resolve(root));\n if (!relative || (!relative.startsWith('..') && !path.isAbsolute(relative))) return 'the project root is inside it';\n\n for (const marker of ['package.json', '.git', 'ProjectSettings']) {\n if (fs.existsSync(path.join(dir, marker))) return `it contains ${marker}`;\n }\n\n return undefined;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\n// How far up the tree to look before giving up. Deep enough for any sane layout, shallow\n// enough that a React app outside a Unity project does not walk to the filesystem root.\nconst MAX_DEPTH = 10;\n\n/**\n * A folder is a Unity project when it has an `Assets` directory beside a\n * `ProjectSettings/ProjectVersion.txt`. The version stamp is what tells a real project\n * from any folder that happens to be called `Assets`.\n */\nexport function isUnityProject(dir: string): boolean {\n return isDirectory(path.join(dir, 'Assets')) && fs.existsSync(path.join(dir, 'ProjectSettings', 'ProjectVersion.txt'));\n}\n\n/**\n * Finds the Unity project a React app belongs to, starting at `from` and walking up.\n *\n * Each ancestor is tested itself and then one level down, so both documented layouts are\n * found: the app inside the project (`MyGame/react`) and the app beside it\n * (`workspace/{MyGame,ui}`).\n */\nexport function findUnityProject(from: string): string | undefined {\n let dir = path.resolve(from);\n\n for (let depth = 0; depth < MAX_DEPTH; depth++) {\n if (isUnityProject(dir)) return dir;\n\n const nested = findUnityProjectIn(dir);\n if (nested) return nested;\n\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n return undefined;\n}\n\nfunction findUnityProjectIn(dir: string): string | undefined {\n for (const entry of readDir(dir)) {\n // node_modules and dot-directories cannot hold a Unity project, and both are large.\n if (!entry.isDirectory() || entry.name.startsWith('.') || entry.name === 'node_modules') continue;\n\n const candidate = path.join(dir, entry.name);\n if (isUnityProject(candidate)) return candidate;\n }\n\n return undefined;\n}\n\nfunction readDir(dir: string): fs.Dirent[] {\n try {\n return fs.readdirSync(dir, { withFileTypes: true });\n } catch {\n // Unreadable directories are simply not the project we are looking for.\n return [];\n }\n}\n\nfunction isDirectory(dir: string): boolean {\n try {\n return fs.statSync(dir).isDirectory();\n } catch {\n return false;\n }\n}\n","import path from 'node:path';\nimport react from '@vitejs/plugin-react';\nimport type { Plugin, PluginOption, UserConfig } from 'vite';\nimport { cleanOutDir, removeOrphanMetaFiles, unsafeOutDirReason } from './clean.ts';\nimport { findUnityProject } from './unity-project.ts';\n\ntype ReactOptions = Parameters<typeof react>[0];\n\nconst DEFAULT_ASSET_PATH = 'Assets/Resources/react';\n\nexport interface ReactUnityOptions {\n /**\n * The Unity project to build into, absolute or relative to the Vite root. Discovered by\n * walking up from the Vite root when omitted.\n */\n unityProject?: string;\n\n /** Output folder inside the Unity project. Defaults to `Assets/Resources/react`. */\n assetPath?: string;\n\n /** Empty the output directory before each build, keeping its `.meta` files. Default `true`. */\n clean?: boolean;\n\n /** Paths inside the output directory, relative to it, that the clean never deletes. */\n preserve?: readonly string[];\n\n /**\n * Content hashes in output filenames. Default `false`: a hash renames the file on every\n * build, which costs it its `.meta` and so its Unity GUID.\n */\n hashFileNames?: boolean;\n\n /** Options for `@vitejs/plugin-react`, or `false` to add the React plugin yourself. */\n react?: ReactOptions | false;\n\n /**\n * Resolve a bare `@import \"tailwindcss\"` to `@reactunity/renderer/tailwind.css`, which is the\n * same thing with a Preflight written for what ReactUnity renders. Default `true`; `false`\n * leaves the import alone. Only the bare specifier is aliased -- `tailwindcss/theme.css` and\n * the rest keep resolving to the package, which is where that entry gets them from.\n */\n tailwind?: boolean;\n}\n\nconst TAILWIND_ENTRY = '@reactunity/renderer/tailwind.css';\n\n/**\n * Vite preset for a ReactUnity app: React Fast Refresh, output into the Unity project's\n * `Assets/Resources/react`, a clean that keeps Unity's `.meta` files, and a Tailwind entry with\n * ReactUnity's Preflight in place of the browser one.\n *\n * ```ts\n * export default defineConfig({ plugins: [reactUnity()] });\n * ```\n */\nexport function reactUnity(options: ReactUnityOptions = {}): PluginOption[] {\n const reactOptions = options.react ?? {};\n\n return [reactOptions === false ? null : react(reactOptions), reactUnityConfig(options), reactUnityClean(options)];\n}\n\n// Lightning CSS's `Features.LightDark`. The package is Vite's dependency rather than ours, so the\n// flag is spelled out; it has held this value since the feature was added.\nconst LIGHTNINGCSS_LIGHT_DARK = 1 << 20;\n\nfunction reactUnityConfig(options: ReactUnityOptions): Plugin {\n const assetPath = options.assetPath ?? DEFAULT_ASSET_PATH;\n let message: { level: 'info' | 'warn'; text: string } | undefined;\n\n return {\n name: 'reactunity',\n\n config(config) {\n const patch: UserConfig = {};\n\n // Neither has anything to render against: Unity is not a browser, and an error\n // overlay drawn into a page nobody looks at only hides the console message.\n if (config.devtools === undefined) patch.devtools = false;\n\n const hmr = config.server?.hmr;\n if (hmr !== false && (hmr === undefined || (typeof hmr === 'object' && hmr.overlay === undefined))) {\n patch.server = { hmr: { overlay: false } };\n }\n\n // Tailwind's own Preflight resets a document, and there is no document here. Aliasing the\n // entry is what lets an app write the one line its docs tell it to. `@tailwindcss/vite`\n // resolves `@import` through Vite's resolver, so it sees this the way an app's own CSS does.\n if (options.tailwind !== false) {\n patch.resolve = { alias: [{ find: /^tailwindcss$/, replacement: TAILWIND_ENTRY }] };\n }\n\n const build: UserConfig['build'] = {};\n\n if (config.build?.outDir === undefined) {\n const root = path.resolve(config.root ?? process.cwd());\n const project = options.unityProject ? path.resolve(root, options.unityProject) : findUnityProject(root);\n\n if (project) {\n build.outDir = path.join(project, assetPath);\n message = { level: 'info', text: `[reactunity] Unity output directory: ${build.outDir}` };\n } else {\n message = {\n level: 'warn',\n text: '[reactunity] no Unity project found above the Vite root. Set the unityProject option or build.outDir.',\n };\n }\n }\n\n // Unity resolves an asset URL through its own loaders, and a small file inlined as a\n // data: URI never reaches them the same way -- react-unity-scripts pinned the same\n // limit to 0 rather than take CRA's 10 kB.\n if (config.build?.assetsInlineLimit === undefined) build.assetsInlineLimit = 0;\n\n // ReactUnity's CSS subset is roughly a 2020 browser: no oklch, color-mix or nesting.\n // Naming an old target is what makes Lightning CSS lower them on the way out.\n if (config.build?.cssTarget === undefined) build.cssTarget = ['chrome87'];\n\n // light-dark() is the one thing that target lowers which ReactUnity reads itself, and the\n // lowered form only works next to a color-scheme declaration in the same sheet.\n if (config.css?.lightningcss?.exclude === undefined) {\n patch.css = { lightningcss: { exclude: LIGHTNINGCSS_LIGHT_DARK } };\n }\n\n // Vite's own emptying would take the .meta files with it, and warns about an outDir\n // outside the root besides. The clean plugin below does the job instead.\n if (options.clean !== false && config.build?.emptyOutDir === undefined) build.emptyOutDir = false;\n\n // Library mode names its own output, and an entryFileNames here would override it.\n const output = config.build?.rolldownOptions?.output ?? config.build?.rollupOptions?.output;\n if (!options.hashFileNames && output === undefined && !config.build?.lib) {\n const dir = config.build?.assetsDir ?? 'assets';\n build.rolldownOptions = {\n output: {\n entryFileNames: `${dir}/[name].js`,\n chunkFileNames: `${dir}/[name].js`,\n // Doubled on purpose. Unity keys a resource on its path minus the last extension, so\n // index.js and index.css both answer to `assets/index` and asking for one can hand you\n // the other. index.css.css keeps its type in the name it is looked up by.\n assetFileNames: `${dir}/[name][extname][extname]`,\n },\n };\n }\n\n if (Object.keys(build).length) patch.build = build;\n\n return patch;\n },\n\n configResolved(config) {\n // The config hook has no logger, so anything it decided is reported from here.\n if (message) config.logger[message.level](message.text);\n message = undefined;\n },\n };\n}\n\nfunction reactUnityClean(options: ReactUnityOptions): Plugin {\n const cleaned = new Set<string>();\n let written = false;\n let outDir = '';\n let root = '';\n let write = true;\n let logger: { warn: (message: string) => void } | undefined;\n\n return {\n name: 'reactunity:clean',\n apply: 'build',\n\n configResolved(config) {\n root = config.root;\n logger = config.logger;\n write = config.build.write !== false;\n outDir = path.resolve(config.root, config.build.outDir);\n },\n\n // Before renderStart, which is where Vite empties the outDir and copies publicDir\n // into it -- cleaning any later would delete files this build had just put there.\n buildStart() {\n if (options.clean === false || !write || cleaned.has(outDir)) return;\n cleaned.add(outDir);\n\n const unsafe = unsafeOutDirReason(outDir, root);\n if (unsafe) {\n logger?.warn(`[reactunity] not cleaning ${outDir} because ${unsafe}.`);\n return;\n }\n\n cleanOutDir(outDir, options.preserve);\n },\n\n // Only on success: closeBundle runs after a failed build too, and sweeping then\n // would delete every meta the clean had just set aside -- losing the GUIDs of files\n // the next successful build brings straight back.\n writeBundle() {\n written = true;\n },\n\n closeBundle() {\n // Cleared rather than kept, so a watch rebuild cleans again.\n cleaned.delete(outDir);\n const succeeded = written;\n written = false;\n if (options.clean === false || !write || !succeeded) return;\n\n removeOrphanMetaFiles(out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AO;EAEP,eAAe,QAAQ;GACrB,OAAO,OAAO;GACd,SAAS,OAAO;GAChB,QAAQ,OAAO,MAAM,UAAU;GAC/B,SAAS,KAAK,QAAQ,OAAO,MAAM,OAAO,MAAM,MAAM;EACxD;EAIA,aAAa;GACX,IAAI,QAAQ,UAAU,SAAS,CAAC,SAAS,QAAQ,IAAI,MAAM,GAAG;GAC9D,QAAQ,IAAI,MAAM;GAElB,MAAM,SAAS,mBAAmB,QAAQ,IAAI;GAC9C,IAAI,QAAQ;IACV,QAAQ,KAAK,6BAA6B,OAAO,WAAW,OAAO,EAAE;IACrE;GACF;GAEA,YAAY,QAAQ,QAAQ,QAAQ;EACtC;EAKA,cAAc;GACZ,UAAU;EACZ;EAEA,cAAc;GAEZ,QAAQ,OAAO,MAAM;GACrB,MAAM,YAAY;GAClB,UAAU;GACV,IAAI,QAAQ,UAAU,SAAS,CAAC,SAAS,CAAC,WAAW;GAErD,sBAAsB,MAAM;EAC9B;CACF;AACF"}
1
+ {"version":3,"file":"vite.mjs","names":[],"sources":["../src/vite/clean.ts","../src/vite/unity-project.ts","../src/vite/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nconst META = '.meta';\n\n/**\n * Empties the output directory but keeps every `.meta` file.\n *\n * Unity writes a `.meta` beside each asset and the GUID inside it is what scenes,\n * prefabs and asset references point at. Deleting one makes Unity mint a new GUID for\n * the file that replaces it, which silently breaks every reference to it -- so a build\n * clears the output it produced last time and leaves the metas for the files coming back.\n * The ones nothing comes back for are dropped afterwards by `removeOrphanMetaFiles`.\n */\nexport function cleanOutDir(outDir: string, preserve: readonly string[] = []): void {\n if (!fs.existsSync(outDir)) return;\n\n const keep = new Set(preserve.map((entry) => path.resolve(outDir, entry)));\n cleanDir(outDir, keep);\n}\n\n// Returns whether anything survived, so the caller can drop a directory that did not.\nfunction cleanDir(dir: string, keep: Set<string>): boolean {\n let survivors = 0;\n\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, entry.name);\n\n if (keep.has(full) || entry.name.endsWith(META)) {\n survivors++;\n continue;\n }\n\n if (entry.isDirectory()) {\n // A directory holding metas (or something preserved) has to stay for them.\n if (cleanDir(full, keep)) survivors++;\n else fs.rmSync(full, { recursive: true, force: true });\n } else {\n fs.rmSync(full, { force: true });\n }\n }\n\n return survivors > 0;\n}\n\n/**\n * Drops the `.meta` files whose asset did not come back, and the directories the build\n * left empty. Run after the bundle is written, so what remains describes only real files.\n */\nexport function removeOrphanMetaFiles(outDir: string): void {\n if (!fs.existsSync(outDir)) return;\n sweep(outDir, true);\n}\n\n// Returns whether the directory is still wanted.\nfunction sweep(dir: string, isRoot: boolean): boolean {\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n if (sweep(full, false)) continue;\n\n // A directory's own meta lives in its parent, and goes with it.\n fs.rmSync(full, { recursive: true, force: true });\n fs.rmSync(full + META, { force: true });\n } else if (entry.name.endsWith(META) && !fs.existsSync(full.slice(0, -META.length))) {\n fs.rmSync(full, { force: true });\n }\n }\n\n return isRoot || fs.readdirSync(dir).length > 0;\n}\n\n/**\n * Describes why `outDir` must not be cleaned, or nothing when it is safe.\n *\n * The clean deletes everything it finds, so it refuses anything that is not plausibly a\n * build output folder: a Unity project root, a package, or the sources themselves.\n */\nexport function unsafeOutDirReason(outDir: string, root: string): string | undefined {\n const dir = path.resolve(outDir);\n\n if (path.dirname(dir) === dir) return 'it is a filesystem root';\n\n // `Assets` itself rather than a folder inside it: no marker below would catch that one.\n if (path.basename(dir) === 'Assets') return 'it is a Unity Assets folder';\n\n const relative = path.relative(dir, path.resolve(root));\n if (!relative || (!relative.startsWith('..') && !path.isAbsolute(relative))) return 'the project root is inside it';\n\n for (const marker of ['package.json', '.git', 'ProjectSettings']) {\n if (fs.existsSync(path.join(dir, marker))) return `it contains ${marker}`;\n }\n\n return undefined;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\n// How far up the tree to look before giving up. Deep enough for any sane layout, shallow\n// enough that a React app outside a Unity project does not walk to the filesystem root.\nconst MAX_DEPTH = 10;\n\n/**\n * A folder is a Unity project when it has an `Assets` directory beside a\n * `ProjectSettings/ProjectVersion.txt`. The version stamp is what tells a real project\n * from any folder that happens to be called `Assets`.\n */\nexport function isUnityProject(dir: string): boolean {\n return isDirectory(path.join(dir, 'Assets')) && fs.existsSync(path.join(dir, 'ProjectSettings', 'ProjectVersion.txt'));\n}\n\n/**\n * Finds the Unity project a React app belongs to, starting at `from` and walking up.\n *\n * Each ancestor is tested itself and then one level down, so both documented layouts are\n * found: the app inside the project (`MyGame/react`) and the app beside it\n * (`workspace/{MyGame,ui}`).\n */\nexport function findUnityProject(from: string): string | undefined {\n let dir = path.resolve(from);\n\n for (let depth = 0; depth < MAX_DEPTH; depth++) {\n if (isUnityProject(dir)) return dir;\n\n const nested = findUnityProjectIn(dir);\n if (nested) return nested;\n\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n return undefined;\n}\n\nfunction findUnityProjectIn(dir: string): string | undefined {\n for (const entry of readDir(dir)) {\n // node_modules and dot-directories cannot hold a Unity project, and both are large.\n if (!entry.isDirectory() || entry.name.startsWith('.') || entry.name === 'node_modules') continue;\n\n const candidate = path.join(dir, entry.name);\n if (isUnityProject(candidate)) return candidate;\n }\n\n return undefined;\n}\n\nfunction readDir(dir: string): fs.Dirent[] {\n try {\n return fs.readdirSync(dir, { withFileTypes: true });\n } catch {\n // Unreadable directories are simply not the project we are looking for.\n return [];\n }\n}\n\nfunction isDirectory(dir: string): boolean {\n try {\n return fs.statSync(dir).isDirectory();\n } catch {\n return false;\n }\n}\n","import path from 'node:path';\nimport react from '@vitejs/plugin-react';\nimport type { Plugin, PluginOption, UserConfig } from 'vite';\nimport { cleanOutDir, removeOrphanMetaFiles, unsafeOutDirReason } from './clean.ts';\nimport { findUnityProject } from './unity-project.ts';\n\ntype ReactOptions = Parameters<typeof react>[0];\n\nconst DEFAULT_ASSET_PATH = 'Assets/Resources/react';\n\nexport interface ReactUnityOptions {\n /**\n * The Unity project to build into, absolute or relative to the Vite root. Discovered by\n * walking up from the Vite root when omitted.\n */\n unityProject?: string;\n\n /** Output folder inside the Unity project. Defaults to `Assets/Resources/react`. */\n assetPath?: string;\n\n /** Empty the output directory before each build, keeping its `.meta` files. Default `true`. */\n clean?: boolean;\n\n /** Paths inside the output directory, relative to it, that the clean never deletes. */\n preserve?: readonly string[];\n\n /**\n * Content hashes in output filenames. Default `false`: a hash renames the file on every\n * build, which costs it its `.meta` and so its Unity GUID.\n */\n hashFileNames?: boolean;\n\n /** Options for `@vitejs/plugin-react`, or `false` to add the React plugin yourself. */\n react?: ReactOptions | false;\n\n /**\n * Resolve a bare `@import \"tailwindcss\"` to `@reactunity/renderer/tailwind.css`, which is the\n * same thing with a Preflight written for what ReactUnity renders. Default `true`; `false`\n * leaves the import alone. Only the bare specifier is aliased -- `tailwindcss/theme.css` and\n * the rest keep resolving to the package, which is where that entry gets them from.\n */\n tailwind?: boolean;\n}\n\nconst TAILWIND_ENTRY = '@reactunity/renderer/tailwind.css';\n\n/**\n * Vite preset for a ReactUnity app: React Fast Refresh, output into the Unity project's\n * `Assets/Resources/react`, a clean that keeps Unity's `.meta` files, and a Tailwind entry with\n * ReactUnity's Preflight in place of the browser one.\n *\n * ```ts\n * export default defineConfig({ plugins: [reactUnity()] });\n * ```\n */\nexport function reactUnity(options: ReactUnityOptions = {}): PluginOption[] {\n const reactOptions = options.react ?? {};\n\n return [reactOptions === false ? null : react(reactOptions), reactUnityConfig(options), reactUnityClean(options)];\n}\n\n// Lightning CSS's `Features`. The package is Vite's dependency rather than ours, so the flags are\n// spelled out; both have held these values since the features were added.\nconst LIGHTNINGCSS_LOGICAL_PROPERTIES = 1 << 19;\nconst LIGHTNINGCSS_LIGHT_DARK = 1 << 20;\n\nfunction reactUnityConfig(options: ReactUnityOptions): Plugin {\n const assetPath = options.assetPath ?? DEFAULT_ASSET_PATH;\n let message: { level: 'info' | 'warn'; text: string } | undefined;\n\n return {\n name: 'reactunity',\n\n config(config) {\n const patch: UserConfig = {};\n\n // Neither has anything to render against: Unity is not a browser, and an error\n // overlay drawn into a page nobody looks at only hides the console message.\n if (config.devtools === undefined) patch.devtools = false;\n\n const hmr = config.server?.hmr;\n if (hmr !== false && (hmr === undefined || (typeof hmr === 'object' && hmr.overlay === undefined))) {\n patch.server = { hmr: { overlay: false } };\n }\n\n // Tailwind's own Preflight resets a document, and there is no document here. Aliasing the\n // entry is what lets an app write the one line its docs tell it to. `@tailwindcss/vite`\n // resolves `@import` through Vite's resolver, so it sees this the way an app's own CSS does.\n if (options.tailwind !== false) {\n patch.resolve = { alias: [{ find: /^tailwindcss$/, replacement: TAILWIND_ENTRY }] };\n }\n\n const build: UserConfig['build'] = {};\n\n if (config.build?.outDir === undefined) {\n const root = path.resolve(config.root ?? process.cwd());\n const project = options.unityProject ? path.resolve(root, options.unityProject) : findUnityProject(root);\n\n if (project) {\n build.outDir = path.join(project, assetPath);\n message = { level: 'info', text: `[reactunity] Unity output directory: ${build.outDir}` };\n } else {\n message = {\n level: 'warn',\n text: '[reactunity] no Unity project found above the Vite root. Set the unityProject option or build.outDir.',\n };\n }\n }\n\n // Unity resolves an asset URL through its own loaders, and a small file inlined as a\n // data: URI never reaches them the same way -- react-unity-scripts pinned the same\n // limit to 0 rather than take CRA's 10 kB.\n if (config.build?.assetsInlineLimit === undefined) build.assetsInlineLimit = 0;\n\n // ReactUnity's CSS subset is roughly a 2020 browser: no oklch, color-mix or nesting.\n // Naming an old target is what makes Lightning CSS lower them on the way out.\n if (config.build?.cssTarget === undefined) build.cssTarget = ['chrome87'];\n\n // Two things that target lowers which ReactUnity reads itself. light-dark()'s lowered form\n // only works next to a color-scheme declaration in the same sheet; a logical property becomes\n // a `:-webkit-any(:lang(ae),:lang(ar),...)` pair naming every RTL language, which parses here\n // as a custom state and so never matches -- where `border-start-start-radius` is resolved\n // against the element's own direction. Only the radii reach that lowering at chrome87, the\n // rest of the logical properties being older than it.\n if (config.css?.lightningcss?.exclude === undefined) {\n patch.css = { lightningcss: { exclude: LIGHTNINGCSS_LIGHT_DARK | LIGHTNINGCSS_LOGICAL_PROPERTIES } };\n }\n\n // Vite's own emptying would take the .meta files with it, and warns about an outDir\n // outside the root besides. The clean plugin below does the job instead.\n if (options.clean !== false && config.build?.emptyOutDir === undefined) build.emptyOutDir = false;\n\n // Library mode names its own output, and an entryFileNames here would override it.\n const output = config.build?.rolldownOptions?.output ?? config.build?.rollupOptions?.output;\n if (!options.hashFileNames && output === undefined && !config.build?.lib) {\n const dir = config.build?.assetsDir ?? 'assets';\n build.rolldownOptions = {\n output: {\n entryFileNames: `${dir}/[name].js`,\n chunkFileNames: `${dir}/[name].js`,\n // Doubled on purpose. Unity keys a resource on its path minus the last extension, so\n // index.js and index.css both answer to `assets/index` and asking for one can hand you\n // the other. index.css.css keeps its type in the name it is looked up by.\n assetFileNames: `${dir}/[name][extname][extname]`,\n },\n };\n }\n\n if (Object.keys(build).length) patch.build = build;\n\n return patch;\n },\n\n configResolved(config) {\n // The config hook has no logger, so anything it decided is reported from here.\n if (message) config.logger[message.level](message.text);\n message = undefined;\n },\n };\n}\n\nfunction reactUnityClean(options: ReactUnityOptions): Plugin {\n const cleaned = new Set<string>();\n let written = false;\n let outDir = '';\n let root = '';\n let write = true;\n let logger: { warn: (message: string) => void } | undefined;\n\n return {\n name: 'reactunity:clean',\n apply: 'build',\n\n configResolved(config) {\n root = config.root;\n logger = config.logger;\n write = config.build.write !== false;\n outDir = path.resolve(config.root, config.build.outDir);\n },\n\n // Before renderStart, which is where Vite empties the outDir and copies publicDir\n // into it -- cleaning any later would delete files this build had just put there.\n buildStart() {\n if (options.clean === false || !write || cleaned.has(outDir)) return;\n cleaned.add(outDir);\n\n const unsafe = unsafeOutDirReason(outDir, root);\n if (unsafe) {\n logger?.warn(`[reactunity] not cleaning ${outDir} because ${unsafe}.`);\n return;\n }\n\n cleanOutDir(outDir, options.preserve);\n },\n\n // Only on success: closeBundle runs after a failed build too, and sweeping then\n // would delete every meta the clean had just set aside -- losing the GUIDs of files\n // the next successful build brings straight back.\n writeBundle() {\n written = true;\n },\n\n closeBundle() {\n // Cleared rather than kept, so a watch rebuild cleans again.\n cleaned.delete(outDir);\n const succeeded = written;\n written = false;\n if (options.clean === false || !write || !succeeded) return;\n\n removeOrphanMetaFiles(outDir);\n },\n };\n}\n\nexport default reactUnity;\n"],"mappings":";;;;AAGA,MAAM,OAAO;;;;;;;;;;AAWb,SAAgB,YAAY,QAAgB,WAA8B,CAAC,GAAS;CAClF,IAAI,CAAC,GAAG,WAAW,MAAM,GAAG;CAG5B,SAAS,QAAQ,IADA,IAAI,SAAS,KAAK,UAAU,KAAK,QAAQ,QAAQ,KAAK,CAAC,CACpD,CAAC;AACvB;AAGA,SAAS,SAAS,KAAa,MAA4B;CACzD,IAAI,YAAY;CAEhB,KAAK,MAAM,SAAS,GAAG,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC,GAAG;EAChE,MAAM,OAAO,KAAK,KAAK,KAAK,MAAM,IAAI;EAEtC,IAAI,KAAK,IAAI,IAAI,KAAK,MAAM,KAAK,SAAS,IAAI,GAAG;GAC/C;GACA;EACF;EAEA,IAAI,MAAM,YAAY,GAEpB,IAAI,SAAS,MAAM,IAAI,GAAG;OACrB,GAAG,OAAO,MAAM;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;OAErD,GAAG,OAAO,MAAM,EAAE,OAAO,KAAK,CAAC;CAEnC;CAEA,OAAO,YAAY;AACrB;;;;;AAMA,SAAgB,sBAAsB,QAAsB;CAC1D,IAAI,CAAC,GAAG,WAAW,MAAM,GAAG;CAC5B,MAAM,QAAQ,IAAI;AACpB;AAGA,SAAS,MAAM,KAAa,QAA0B;CACpD,KAAK,MAAM,SAAS,GAAG,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC,GAAG;EAChE,MAAM,OAAO,KAAK,KAAK,KAAK,MAAM,IA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M,CAAC,QAAQ,IAAI;GACtD,UAAU,KAAA;EACZ;CACF;AACF;AAEA,SAAS,gBAAgB,SAAoC;CAC3D,MAAM,0BAAU,IAAI,IAAY;CAChC,IAAI,UAAU;CACd,IAAI,SAAS;CACb,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,IAAI;CAEJ,OAAO;EACL,MAAM;EACN,OAAO;EAEP,eAAe,QAAQ;GACrB,OAAO,OAAO;GACd,SAAS,OAAO;GAChB,QAAQ,OAAO,MAAM,UAAU;GAC/B,SAAS,KAAK,QAAQ,OAAO,MAAM,OAAO,MAAM,MAAM;EACxD;EAIA,aAAa;GACX,IAAI,QAAQ,UAAU,SAAS,CAAC,SAAS,QAAQ,IAAI,MAAM,GAAG;GAC9D,QAAQ,IAAI,MAAM;GAElB,MAAM,SAAS,mBAAmB,QAAQ,IAAI;GAC9C,IAAI,QAAQ;IACV,QAAQ,KAAK,6BAA6B,OAAO,WAAW,OAAO,EAAE;IACrE;GACF;GAEA,YAAY,QAAQ,QAAQ,QAAQ;EACtC;EAKA,cAAc;GACZ,UAAU;EACZ;EAEA,cAAc;GAEZ,QAAQ,OAAO,MAAM;GACrB,MAAM,YAAY;GAClB,UAAU;GACV,IAAI,QAAQ,UAAU,SAAS,CAAC,SAAS,CAAC,WAAW;GAErD,sBAAsB,MAAM;EAC9B;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactunity/renderer",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "React renderer for Unity3D",
5
5
  "types": "dist/index.d.ts",
6
6
  "typings": "dist/index.d.ts",
@@ -65,7 +65,7 @@
65
65
  }
66
66
  },
67
67
  "devDependencies": {
68
- "@reactunity/scripts": "^0.24.0",
68
+ "@reactunity/scripts": "^0.26.0",
69
69
  "@types/node": "^26.4.1",
70
70
  "@types/react-reconciler": "^0.33.0",
71
71
  "react-unity-webgl": "^10.2.0",
@@ -1 +0,0 @@
1
- import "./jsx-BRwefwcW.js";