{"id":25973,"library":"nanosts-imports-transpiler","title":"NanosWorld Imports Transpiler","description":"A tstl (TypeScript to Lua) compiler plugin that transforms standard TypeScript import statements into Package.Require calls compatible with the NanosWorld Lua sandbox. Version 0.0.7 is the latest stable release; the package has no formal release cadence and is likely in early development. It differentiates itself by bridging TypeScript's module system with NanosWorld's custom loading mechanism, enabling developers to write imports naturally while transpiling to package-relative requires.","status":"active","version":"0.0.7","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install nanosts-imports-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add nanosts-imports-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add nanosts-imports-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"The plugin hooks into the tstl compiler transformation pipeline; users must have tstl installed and configured to use this plugin.","package":"typescript-to-lua","optional":false}],"imports":[{"note":"The package exports a single default function (a tstl transformer). ESM-only; no CommonJS require.","wrong":"const plugin = require('nanosts-imports-transpiler')","symbol":"default","correct":"import { default as plugin } from 'nanosts-imports-transpiler'"},{"note":"The default export is the transformer function itself, not under a named key.","wrong":"import { transformer } from 'nanosts-imports-transpiler'","symbol":"transformer","correct":"import transformer from 'nanosts-imports-transpiler'"},{"note":"In tstl, transformers are referenced by package name in the 'luaTransformers' array. No import needed in source code.","wrong":"","symbol":"TypeScript transformer","correct":"// In tstl config (tsconfig.json or lua-transformers): \"nanosts-imports-transpiler\""}],"quickstart":{"code":"// Ensure typescript-to-lua and nanosts-imports-transpiler are installed:\n// npm install --save-dev typescript-to-lua nanosts-imports-transpiler\n\n// In tsconfig.json:\n{\n  \"compilerOptions\": {\n    \"types\": [\"typescript-to-lua\"],\n    \"plugins\": [\n      {\n        \"transform\": \"nanosts-imports-transpiler\",\n        \"import\": \"transform\"\n      }\n    ]\n  }\n}\n\n// Example .ts file:\nimport myModule from \"./myModule.ts\";\nmyModule.doSomething();\n\n// Compile with tstl. The import becomes:\n// local ____importmap_1 = Package.Require(\"./myModule.lua\")\n// local myModule = ____importmap_1.default\n// myModule.doSomething()","lang":"typescript","description":"Shows installation, tstl configuration, and a basic import that gets transformed to a Package.Require call for NanosWorld."},"warnings":[{"fix":"Always include the .ts extension in import statements; the plugin removes it and appends .lua.","message":"The plugin expects .ts extension in import paths (e.g., './myModule.ts') to correctly rewrite to .lua.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Use explicit imports. Chain of re-exports is untested.","message":"Only default and named imports are supported; re-exports (export/import from) may not work correctly.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Avoid these patterns if using NanosWorld Package.Require; use explicit variable assignment.","message":"The plugin does not handle import side effects (import 'module') or dynamic imports (import()).","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Double-check package name in package.json and import.","message":"Package name 'nanosts-imports-transpiler' is different from the npm scope 'nanosworld' (if any); ensure correct spelling.","severity":"breaking","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev nanosts-imports-transpiler' and ensure the transform path in tsconfig.json is exactly the package name.","cause":"Package not installed or incorrect path in tstl config.","error":"Cannot find module 'nanosts-imports-transpiler'"},{"fix":"Verify that the package's default export is a transformer function. Check that you are using the correct version.","cause":"The module does not export a default function (transformer) expected by tstl.","error":"Error: The transformer 'nanosts-imports-transpiler' is not a valid transformer"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}