Sha256: 659d3c34f4853dd1a4e37169af04e9171cb5a1e0b577beb532874b9e05c75616

Contents?: true

Size: 1.99 KB

Versions: 3

Compression:

Stored size: 1.99 KB

Contents

(defvar sibilant exports
        util     (require 'util)
        path     (require 'path)
        fs       (require 'fs)
        error    (lambda (str) (throw str))
        inspect  util.inspect)

(include "../include/functional")

(defun sibilant.package-info ()
  (defvar fs (require 'fs))
  (JSON.parse (fs.read-file-sync
               (concat **dirname "/../package.json"))))

(defun sibilant.version-string ()
  (defvar package (sibilant.package-info)
    path (require 'path))
  (concat package.name " version " package.version
                       "\n(at " (path.join **dirname "..") ")"))

(defun sibilant.strip-shebang (data)
  (data.replace /^#!.*\n/ ""))

(set sibilant
     'file 'eval.sibilant
     'dir  (process.cwd))

(defun with-dir-and-file (dir file fn)
  (defvar before { dir sibilant.dir
                   file sibilant.file })
  (set sibilant
       'dir  dir
       'file file)

  (defvar retval (fn))

  (set sibilant
       'dir  before.dir
       'file before.file)

  retval)


(defun sibilant.translate-file (file-name)
  (with-dir-and-file (path.dirname file-name)
                     file-name
                     (thunk
                       (sibilant.translate-all
                        (sibilant.strip-shebang
                         (fs.read-file-sync file-name "utf8"))))))


(defun sibilant.version ()
  (get (sibilant.package-info) 'version))

(set require.extensions ".sibilant"
     (lambda (module filename)
       (defvar content (sibilant.translate-file filename))
       (module.*compile content filename)))

(defun sibilant.include (file)
  (when (not (file.match (regex ".sibilant$")))
    (setf file (concat file ".sibilant")))

  (when (file.match (regex "^\.\.?/"))
    (setf file (concat sibilant.dir "/" file)))

  (defvar resolved (require.resolve file))

  (sibilant.translate-file resolved))


(include "../src/core")

(defun macros.include (file)
  (sibilant.include (eval (translate file))))

(sibilant.include (path.normalize (concat **dirname "/../include/macros")))

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sibilant-0.0.4 js/sibilant/src/sibilant.sibilant
sibilant-0.0.3 js/sibilant/src/sibilant.sibilant
sibilant-0.0.2 js/sibilant/src/sibilant.sibilant