JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3775
  • Score
    100M100P100Q109395F

JavaScript (ECMAScript) and Objective-J compiler with preprocessor

Package Exports

  • objj-transpiler
  • objj-transpiler/dist/objj-transpiler.cjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (objj-transpiler) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ObjJAcornCompiler

A tiny, fast JavaScript and/or Objective-J transpiler with built in preprocessor. Written in JavaScript.

It uses a parser extended from the Acorn JavaScript parser by Marijn Haverbeke.

Preprocessor

The parser has a built in C like preprocessor.

Example:

#define MAX(x, y) (x > y ? x : y)
var m1 = MAX(a, b);
var m2 = MAX(14, 20);

Will be compiled to:

var m1 = a > b ? a : b;
var m2 = 14 > 20 ? 14 : 20;

For more info see this blogpost on the Cappuccino website.

Usage

    --module                        Set the source type to module instead of script in
                                    the parser.

    --ecma5, --ecma8, --latest      Sets the set version of ECMAScript used be the parser.

    --loose                         Sets the parser to use loose mode.

    --preserve-paren                Tells the parser to preserve parentheses, even if
                                    unnecessary.

    --strict-semicolons             ???

    --no-allow-trailing-commas      ???

    --track-comments                ???

    --include-comment-line-break    ???

    --include-comments              ???

    --track-spaces                  ???

    --track-locations               ???

    --no-objj                       Turns off the parsing of Objective-J.

    --no-preprocess                 Turns off the parsing of preprocessor directives.

    --silent                        ???

    --old-safari-bug                ???

    --no-code                       ???

    --ast                           Generates the intermediate AST as a JSON file.

    --source-map                    ???

    --no-debug-symbols              ???

    --no-type-signatures            ???

    --no-inline-msgsend             ???

    --indent-width                  ???

    --indent-string                 ???

    --indent-tab                    ???

    --output, -o

    -D                              ???

    --help                          ???

    -                               ???

Limitations

It can't compile Objective-J code that depends on other Objective-J files. The Objective-J load and runtime is needed for this. But it will work as long as you declare any superclass in the same file.