Registry / devops / nanosts-imports-transpiler

nanosts-imports-transpiler

JSON →
library0.0.7jsnpmunverified

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.

npm install nanosts-imports-transpiler
INSTALL
IMPORT
SIG · NANOSTS-IMPORTS-TR
N
nanosts-imports-transpiler
devopsjavascriptv0.0.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import { default as plugin } from 'nanosts-imports-transpiler'
const plugin = require('nanosts-imports-transpiler')
The package exports a single default function (a tstl transformer). ESM-only; no CommonJS require.
transformer
import transformer from 'nanosts-imports-transpiler'
import { transformer } from 'nanosts-imports-transpiler'
The default export is the transformer function itself, not under a named key.
TypeScript transformer
// In tstl config (tsconfig.json or lua-transformers): "nanosts-imports-transpiler"
In tstl, transformers are referenced by package name in the 'luaTransformers' array. No import needed in source code.

Shows installation, tstl configuration, and a basic import that gets transformed to a Package.Require call for NanosWorld.

// Ensure typescript-to-lua and nanosts-imports-transpiler are installed: // npm install --save-dev typescript-to-lua nanosts-imports-transpiler // In tsconfig.json: { "compilerOptions": { "types": ["typescript-to-lua"], "plugins": [ { "transform": "nanosts-imports-transpiler", "import": "transform" } ] } } // Example .ts file: import myModule from "./myModule.ts"; myModule.doSomething(); // Compile with tstl. The import becomes: // local ____importmap_1 = Package.Require("./myModule.lua") // local myModule = ____importmap_1.default // myModule.doSomething()
Debug
Known issues
breakingThe plugin expects .ts extension in import paths (e.g., './myModule.ts') to correctly rewrite to .lua.
fix
Always include the .ts extension in import statements; the plugin removes it and appends .lua.
affects: >=0.0.1
gotchaOnly default and named imports are supported; re-exports (export/import from) may not work correctly.
fix
Use explicit imports. Chain of re-exports is untested.
affects: >=0.0.1
gotchaThe plugin does not handle import side effects (import 'module') or dynamic imports (import()).
fix
Avoid these patterns if using NanosWorld Package.Require; use explicit variable assignment.
affects: >=0.0.1
breakingPackage name 'nanosts-imports-transpiler' is different from the npm scope 'nanosworld' (if any); ensure correct spelling.
fix
Double-check package name in package.json and import.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'nanosts-imports-transpiler'
Package not installed or incorrect path in tstl config.
fix
Run 'npm install --save-dev nanosts-imports-transpiler' and ensure the transform path in tsconfig.json is exactly the package name.
Error: The transformer 'nanosts-imports-transpiler' is not a valid transformer
The module does not export a default function (transformer) expected by tstl.
fix
Verify that the package's default export is a transformer function. Check that you are using the correct version.
Upgrade
Version history
0.0.7latest on npm
Audit
Dependencies
typescript-to-luarequiredThe plugin hooks into the tstl compiler transformation pipeline; users must have tstl installed and configured to use this plugin.
Agent activity
2 hits · last 30 days
node
2
Resources
nanosts-imports-transpiler — npm install nanosts-imports-transpiler · libregistry