Registry / atom-ts-transpiler

atom-ts-transpiler

JSON →
library1.5.3jsnpmunverified

A custom transpiler for Atom packages that enables running TypeScript code directly in the Atom editor. The current stable version is 1.5.3 (released 2020-11-08). This package is in maintenance mode, as the Atom editor itself is now archived. It provides a simple interface between Atom and the TypeScript compiler, supporting TypeScript versions 1.6 through 4.x. Key differentiators: respects tsconfig.json automatically, minimal performance overhead after initial caching, and small footprint (~20 KB). Compared to alternatives like manual pre-transpilation, it allows distributing Atom packages as TypeScript source.

npm install atom-ts-transpiler
INSTALL
IMPORT
SIG · ATOM-TS-TRANSPILER
A
atom-ts-transpiler
javascriptv1.5.3
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.

atom-ts-transpiler
// In your Atom package's package.json: { "transpiler": "atom-ts-transpiler" }
const transpiler = require('atom-ts-transpiler')
This package is not required in code; it's configured in Atom's metadata. Common mistake: trying to import it programmatically.
TypeScript
import * as ts from 'typescript'
const ts = require('typescript')
TypeScript must be installed as a peer dependency. The import above works in both ESM and CJS contexts within Atom scripts.
Atom's transpiler interface
// Atom loads the transpiler automatically when configured in package.json
const { transpile } = require('atom-ts-transpiler')
The transpiler is only used internally by Atom; you don't import its functions directly.

Configures an Atom package to use atom-ts-transpiler, with a minimal TypeScript entry point.

// In your Atom package's root, create package.json with: { "name": "my-atom-package", "main": "./lib/main.ts", "transpiler": "atom-ts-transpiler", "activationCommands": { "atom-workspace": "my-package:toggle" }, "dependencies": { "atom-ts-transpiler": "^1.5.3", "typescript": "^4.0.0" } } // Then create lib/main.ts: export function activate(state: any) { console.log('Package activated'); } export function deactivate() {} export function serialize() { return {}; } // Run 'apm install' in the package directory. // Atom will transpile .ts files on first activation.
Debug
Known issues
deprecatedAtom editor is archived and no longer maintained.
fix
Consider migrating to VS Code or another editor.
affects: >=1.0.0
breakingVersion 1.5.0 was unpublished due to a critical regression causing cache corruption.
fix
Use 1.4.3 or >=1.5.1.
affects: 1.5.0
gotchaThe transpiler requires a TypeScript version >=1.6 and up to 4.x, but may not work with future TypeScript versions.
fix
Pin TypeScript to a supported version, e.g., 4.0.x or earlier.
affects: >=1.0.0
gotchaAtom caches transpiled files; after changing tsconfig or typescript version, you may need to clear Atom's cache (~/.atom/compile-cache) to force re-transpilation.
fix
rm -rf ~/.atom/compile-cache and restart Atom.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'typescript'
TypeScript is not installed as a dependency of the Atom package.
fix
Run 'apm install typescript' in the package directory, or add 'typescript' to the 'dependencies' in package.json.
TypeError: transpiler.getCacheKeyData is not a function
Using an incompatible version of atom-ts-transpiler (e.g., 1.5.0 with bug) or incorrect transpiler configuration.
fix
Upgrade to atom-ts-transpiler >=1.5.1 or downgrade to 1.4.3.
Error: ENOENT: no such file or directory, open '/path/to/tsconfig.json'
The transpiler tried to read tsconfig.json but it doesn't exist or is in a different location.
fix
Create a tsconfig.json in the root of your Atom package, or use the 'compilerOptions' property in the transpiler configuration (see docs).
Module build failed: TypeError: transpiler is not a constructor
Attempting to require('atom-ts-transpiler') and instantiate it manually, which is not the intended usage.
fix
Remove any require('atom-ts-transpiler') calls; only configure it via the 'transpiler' field in package.json.
Upgrade
Version history
1.5.3latest on npm
Audit
Dependencies
typescriptrequiredPeer dependency; the TypeScript compiler is used to transpile .ts files. Must be installed separately.
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
atom-ts-transpiler — npm install atom-ts-transpiler · libregistry