npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

seon2js

v3.0.2

Published

transpile from seon to js

Downloads

36

Readme

seon2js

A transpiler from seon to js

See https://github.com/ayamada/seon2js

Usage

cli-seon2js-evaldump.mjs

npx seon2js -e '(console.log 1 2)'

To run seon2js code, like node -e '...'

npx seon2js -e '(console.log 1 2)' -d

To dump gcc(google-closure-compiler)-passed js code. Do not run.

npx seon2js -p '1 2 [3 4]'

To run and print last value, like node -p '...' (but this code be warned by gcc)

npx seon2js foo.s2mjs

To run this file, like node ... But this is experimental! Not yet supported command line arguments. You may use this with -d or -t. If you run certainly, you should transpile and run transpiled file.

See npx seon2js -h for more information.

cli-seon2js-build.mjs

npx seon2js-build --src-dir path/to/src --src-dir more/src --dst-dir path/to/html/mjs

To convert from all *.s2mjs and *.s2js files in --src-dir, to --dst-dir.

See npx seon2js-build -h for more information.

不具合情報

  • 現在のところ、 #"..." による正規表現記法内に出現するbackslash文字 \ は、 \\ のように二個入力する必要があります
    • 具体的には (.split "123\n456" #"\\n") のようにする事になります。これはclojureでの正規表現記法とは異なるので注意が必要です
    • これは正規表現記法の #"..." の内部のparse処理が、通常の文字列のtokenizerと共有しているのが原因です
    • 将来には直す予定ですが、その為にはseonのparserの大幅な改善が必要な為、当面はこの仕様のまま開発を進めます

分かりづらい用語&一時メモ

  • r0is r1is とは

    • revised N implementation of seon2js の略。要はschemeのRnRS相当
    • 互換性を大きく捨てて改善する際にNの数値を上げる
    • package.seon上のバージョンとの関係性についてはChangeLogを参照 (major versionが一対一でNに対応している訳ではない事に要注意)
  • seon2jsにおける transpilecompile の使い分け

    • 「seon2jsコードをseon2jsでjsに変換する」 → transpile
    • 「(seon2jsの吐き出した)jsコードをgccで変換する」 → compile
  • sp とは

    • special-form の略。lispのそれとほぼ同じ。macroもこれに含まれる
    • seon2jsはトランスパイラであり、コードの置換以外は基本何も行わないが、このspecial-form関連についてはトランスパイルのタイミングで何かしらの処理を実行する事ができる。もちろんユーザは好きなspを自分で追加できる
    • sp*.s2sp ファイルで定義を行い、s2spファイルは sp/import-s2sp によって読み込める
    • このsp定義は基本的にはtranspile時に全て解消し、transpile後のjsコードには残らない。なので通常の関数と大きく区別しやすい見た目の方がよい。 #() 形式や名前を全て大文字にする等を色々試したがいまいちで、結局 sp/ のprefix(専用namespace)をつけて区別するのが一番マシという結論になった。なので sp 定義は基本的に専用namespaceをつけるルールとしている
      • ただし標準提供しているものについてはあまりに基本機能なもの(例えば if とか)が多く、それらについては sp/if を提供すると同時にspなしの if も提供している。混乱しない範囲でこれらを使ってもよい(もし混乱するようならnamespace付きで使った方がよい)
  • s2mjs/s2spで書いたライブラリの追加方法について

    • seon2js-build には複数の --src-dir 指定ができるので、追加ライブラリの各ファイルの入ったpathを --src-dir で指定すればok
    • それらは全部 --dst-dir 内に出力されるので、 importsp/import-s2sp でのpath指定は --dst-dir 内での相対pathを指定する必要がある。ちょっとややっこしいが、基本的にはmjsでのモジュールと同じ感覚で扱える
    • 将来的には sp/import-s2sp でもjs同様に "foo/bar" のdot prefixなし指定の自動resolveをできるようにしたい(import の方はjsレイヤで動くので対応済)

ChangeLog

r1is

An experiment of namespaced special-forms

  • 3.0.2: 20240619

    • Hotfix a problem of 3.0.1
  • 3.0.1: 20240619

    • Fix problems caused by similar multiple --src-dir
    • Fix noisy log by delete non- js/mjs/s2js/s2mjs file in watched dir
  • 3.0.0: 20240616

    • BREAKING CHANGES: Remove src/seon2js/gcc.mjs and related codes
    • Add more options to npx seon2js-build
      • --bundle-out-file
      • --bundle-entry-point
      • --bundle-extra-args
    • Add js reserved words to seon2js.vim
  • 2.2.1: 20240401

    • Mark sp/str as like a fn for seon2js.vim
  • 2.2.0: 20240401

    • Refactor and compact special.mjs and sp.s2sp
    • Many improvements for seon2js.vim
  • 2.1.1: 20240330

    • Fix destructuring-bind like (const {(sp/??= a 123)} obj) to work
  • 2.1.0: 20240329

    • Add --src option to npx seon2js-build that is alias of --src-dir
    • Support to target one source file directly by --src-dir option in npx seon2js-build
    • Update version of google-closure-compiler
    • Improve npm run test-build a bit
  • 2.0.0: 20240315

    • Provide npx seon2js for tests and run one-liner
    • Provide npx seon2js-build for build
      • Provide many transpile options
    • Renew almost special-forms
      • Provide tests for almost special-forms
    • Renew mangling rules for symbols and keywords
    • Provide ftdetect/seon2js.vim for vim/neovim
      • Please add plugin managers of vim/neovim to "ayamada/seon2js"
    • Bump up version of seon to 5.0.0
    • Remove example/game01/ now, but may come new example games in future

r0is

The initial prototype

  • 0.1.2: 20231226

    • Bump up version of seon
    • Fix redundant error log
    • Fix test by npm run test-s2js-once
  • 0.1.1: 20231223

    • Move chokidar from devDependencies to dependencies for cli
  • 0.1.0: 20231223

    • Initial Release