0.1.0 • Published 4 years ago

formality-loader v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

formality-loader

formality-loader compiles imported Formality files into a JavaScript module.

Install

With webpack correctly installed, add formality-loader and formality-lang as dependencies:

$ npm install  formality-loader formality-lang --save-dev

Then add the loader to your webpack config file:

webpack.config.js

const formalityResolver = require('formality-loader').resolver

module.exports = {
  resolve: { plugins: [formalityResolver] },
  module: {
    rules: [
      {
        test: /\.fm$/,
        loader: 'formality-loader',
        options: {
          typeCheckMode: 'all' // Options: all, none, production, development. Default: all
        }
      }
    ]
  }
}

Using

In your JavaScript file, import (or require) your Formality files including the .fm extension.

src/index.js

import app from './App.fm' // import all terms of local file 'App.fm'
import main from './App.fm/main' // import term 'main' of local file 'App.fm'
import area from 'Area#o99z.fm' // all terms of global file 'Area#o99z.fm'
import circleArea from 'Area#o99z.fm/circle_area' // all term 'circle_area' global file 'Area#o99z.fm'

console.log(app.main(10))

src/App.fm

import Base#

main(n: Number) : Number
  2 .*. n

Check the example folder for more info.

0.1.0

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago