Language reference · section 29

29. Build, CLI, and outputs

Feature: Build and tools

  Scenario: Compiling a source file writes TypeScript
    Given a file named name.pin
    When the author runs pin name.pin
    Then the compiler writes name.ts and name.ts.map

  Scenario: -o sets the main output path
    Given the option -o out.ts
    When the author compiles name.pin
    Then the compiler writes out.ts as the main module

  Scenario: A file with @wasm or @worker writes more files
    Given a file that uses @wasm or @worker
    When the author compiles it
    Then the compiler also writes name.impl.ts, and name.worker.ts for @worker

  Scenario: Compiling writes a declaration file
    Given a file named name.pin
    When the author compiles it
    Then the compiler writes name.pin.d.ts next to the source

  Scenario: A literate file compiles like a source file
    Given a file named name.pin.md with pin code in fences
    When the author compiles it
    Then the compiler writes name.ts and name.pin.d.ts, and line numbers in errors match the file

  Scenario: Generated files are ES modules
    Given any compiled file
    Then the output uses ES module syntax

  Scenario: pin test runs the test blocks of one file
    Given a file with test blocks
    When the author runs pin test file.pin
    Then the compiler runs the tests under Node, prints ok or FAIL for each test, and prints a count of passed and failed tests

Commands:

pin file.pin [-o out.ts]      # compile to TypeScript
pin test file.pin             # run the file's test blocks with Node
pin fmt file.pin              # format in place
pin fmt --check file.pin      # exit 1 if the file would change
pin fmt - < file.pin          # stdin to stdout