{"id":27196,"library":"onejs-unity","title":"onejs-unity","description":"Unity integration utilities for OneJS (v0.2.13), providing asset loading, esbuild/PostCSS build plugins for USS transformation, and GPU compute APIs. Designed for Unity developers using OneJS to write UI and logic in JavaScript/TypeScript. Key differentiators: automatic path resolution between Editor and Build modes, npm package asset distribution without config, built-in Tailwind-like utility class generation for USS without external tailwindcss dependency, and ES6 import transformation for C# namespaces. Requires react ^18/^19, esbuild >=0.17, postcss >=8, tailwindcss >=3. Ships TypeScript types.","status":"active","version":"0.2.13","language":"javascript","source_language":"en","source_url":"https://github.com/Singtaa/onejs-unity","tags":["javascript","unity","onejs","esbuild","postcss","tailwindcss","uss","css-modules","gpu","typescript"],"install":[{"cmd":"npm install onejs-unity","lang":"bash","label":"npm"},{"cmd":"yarn add onejs-unity","lang":"bash","label":"yarn"},{"cmd":"pnpm add onejs-unity","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for React-based UI in OneJS","package":"react","optional":false},{"reason":"Peer dependency for build plugins","package":"esbuild","optional":false},{"reason":"Peer dependency for PostCSS plugin","package":"postcss","optional":false},{"reason":"Peer dependency for tailwindPlugin (though built-in USS generator may reduce need)","package":"tailwindcss","optional":false}],"imports":[{"note":"Named export from subpath module, not default.","wrong":"import loadImage from 'onejs-unity/assets'","symbol":"loadImage","correct":"import { loadImage } from 'onejs-unity/assets'"},{"note":"ESM-only package; CommonJS require will fail. Also, note the subpath '/esbuild'.","wrong":"const importTransformPlugin = require('onejs-unity/esbuild')","symbol":"importTransformPlugin","correct":"import { importTransformPlugin } from 'onejs-unity/esbuild'"},{"note":"Must import from 'onejs-unity/esbuild', not the main package.","wrong":"import { ussModulesPlugin } from 'onejs-unity'","symbol":"ussModulesPlugin","correct":"import { ussModulesPlugin } from 'onejs-unity/esbuild'"}],"quickstart":{"code":"import { loadImage } from 'onejs-unity/assets';\nimport { ussModulesPlugin, tailwindPlugin } from 'onejs-unity/esbuild';\n\n// Load an image asset\nconst logo = loadImage('images/logo.png');\n\n// esbuild config for USS plugins (e.g., in build script)\nconst esbuildConfig = {\n  plugins: [\n    ussModulesPlugin({ generateTypes: true }),\n    tailwindPlugin({ content: ['./src/**/*.{tsx,ts}'] }),\n  ],\n};","lang":"typescript","description":"Demonstrates asset loading and esbuild plugin setup for USS transformation with TypeScript."},"warnings":[{"fix":"You can install tailwindcss as a peer dep to satisfy the requirement, but it is not strictly needed for the USS generation.","message":"The tailwindPlugin does NOT require an external tailwindcss package; it generates USS classes internally. However, the peer dependency 'tailwindcss' is still listed, which may be confusing.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use assetExists() to check availability before loading, or wrap calls in try-catch blocks.","message":"Asset loading functions (loadImage, etc.) are synchronous and may throw if the asset does not exist. Ensure assetExists() checks before loading or wrap in try/catch.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure module names start with an uppercase letter (e.g., 'UnityEngine', not 'unityEngine').","message":"Import paths for C# namespaces are case-sensitive and must start with an uppercase letter for importTransformPlugin to work.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade Node or use a bundler that supports package.json exports.","message":"If using an older version of OneJS that does not support subpath imports (e.g., Node <16), require /esbuild or /assets subpaths may fail.","severity":"breaking","affected_versions":"<0.1.0"}],"env_vars":null,"search_vec":"'0.17':79 '18':76 '19':77 '3':83 '8':81 'api':22 'asset':11,48 'automat':38 'build':14,44 'built':53 'built-in':52 'c':72 'class':59 'comput':21 'config':51 'css':95 'css-modul':94 'depend':66 'design':23 'develop':26 'differenti':37 'distribut':49 'editor':42 'es6':68 'esbuild':78,90 'esbuild/postcss':13 'extern':64 'generat':60 'gpu':20,97 'import':69 'integr':5 'javascript':87 'javascript/typescript':35 'key':36 'like':57 'load':12 'logic':33 'mode':45 'modul':96 'namespac':73 'npm':46 'onej':2,8,28,89 'onejs-un':1 'packag':47 'path':39 'plugin':15 'postcss':80,91 'provid':10 'react':75 'requir':74 'resolut':40 'ship':84 'tailwind':56 'tailwind-lik':55 'tailwindcss':65,82,92 'transform':18,70 'type':86 'typescript':85,98 'ui':31 'uniti':3,4,25,88 'use':27 'uss':17,62,93 'util':6,58 'v0.2.13':9 'without':50,63 'write':30","created_at":"2026-05-01T17:45:00.196872+00:00","updated_at":"2026-05-01T17:45:00.196872+00:00","problems":[{"fix":"Ensure your bundler (esbuild, webpack, etc.) supports subpath exports. For Node scripts, use Node >=16. Alternatively, import from the main package if the subpath is not required.","cause":"Using a bundler or Node version that doesn't resolve package.json exports correctly.","error":"Cannot find module 'onejs-unity/esbuild'"},{"fix":"Use: import { loadImage } from 'onejs-unity/assets';","cause":"Misnamed import: likely imported as default instead of named.","error":"TypeError: loadImage is not a function"},{"fix":"Provide content glob array: tailwindPlugin({ content: ['./src/**/*.{tsx,ts}'] })","cause":"Missing content option when initializing tailwindPlugin.","error":"Error: [tailwindPlugin] content option is required"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/Singtaa/onejs-unity","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/onejs-unity","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}