atom-ts-transpiler

raw JSON →
1.5.3 verified Fri May 01 auth: no javascript maintenance

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.

error Error: Cannot find module 'typescript'
cause 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.
error TypeError: transpiler.getCacheKeyData is not a function
cause 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 Error: ENOENT: no such file or directory, open '/path/to/tsconfig.json'
cause 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).
error Module build failed: TypeError: transpiler is not a constructor
cause 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.
deprecated Atom editor is archived and no longer maintained.
fix Consider migrating to VS Code or another editor.
breaking Version 1.5.0 was unpublished due to a critical regression causing cache corruption.
fix Use 1.4.3 or >=1.5.1.
gotcha The 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.
gotcha Atom 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.
npm install atom-ts-transpiler
yarn add atom-ts-transpiler
pnpm add atom-ts-transpiler

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.