Neverending Plethora of Modules
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

es2049scripts

0.0.19 • Public • Published

ECMAScript 2049 Scripts

ECMAScript 2049

ERASE THE PAST

© Harald Rudell created ECMAScript 2049 in December 2017. ISC License

This is the es2049scripts package

Repository links:
ECMAScript 2049 the monolithic repository
es2049package compile libraries and command-line utilities configuration-free with RollupJS
allspawn async spawn utility

Benefits

  • ECMAScript 2049 provides instant on-the-fly transpilation of ES.Next ECMAScript to a runnable format

  • ECMAScript 2049 transpilation is so fast that a users are not aware of it taking place

  • ECMAScript 2049 thereby offers use of ES.Next everywhere:

    • Production use of ECMAScript language features prior to standardization

    • Use of ECMAScript language features prior to their runtime implementation

    • As of December 31, 2017, offering ECMAScript 2018 with all BabelJS 6 Stage 0 experimental plugins runnable on Node.js v6 LTS

     

  • es2049scripts package allows for build scripts to be written in ES.Next, solving an issue of the last four years:

     Running the unrunnable ES.Next chicken-and-egg problem

     

  • ECMAScript 2049 aligns with Agile Method to produce the best possible design at that point in time

  • ECMAScript 2049 keeps developers and engineers happy and programming ECMAScript fun

  • ECMAScript 2049 offers venture capital investment opportunities in new technology, as opposed to building companies on technology that is old and obsolete

Features

  • es2049scripts package offering initial instant on-the-fly transpile for package.json scripts

  • es2049package package allows for configuration-free implementation of libraries and command-line utilities

  • Runtime environments target:

    • Default: Node.js 6.10 LTS maintenance, the version currently used by many deployment environments as of December 31, 2017

    • Active: Node.js 8.9 LTS Active

    • Current: Node.js v8.6+ executable using CommonJS module format

    • Latest: Node.js v8.6+ using native experimental modules with extension .mjs

    • Rollup: Pre-transpilation of RollupJS configuration data so that it, too, can be written is ES.Next

Usage

Typical use is to have a configes direcory of ES.Next code that is on-the-fly transpiled into the config directory by the scripts entry of package.json

Note: yarn is expected to be installed on the host

  1. Add es2049scripts to your project:

    yarn add es2049scripts --dev
  2. Add es2049scripts to a scripts entry in package.json:

    "scripts": {
     "start": "es2049scripts -- node config",
  3. Write some ES.Next code in configes/index.mjs:

    console.log('The next ReactJS version:')
    f()
    async function f () {
     for await (let v of [Promise.resolve(17)])
     console.log(v)
    }
  4. Run!

    yarn start
    yarn run v1.3.2
    $ es2049scripts -- node config
    The next ReactJS version:
    17
    Done in 0.73s.

A package.json using es2049scripts can be found here

es2049scripts transpiles .js and .mjs to .js or .mjs with target options ‑current ‑active ‑latest ‑rollup.

For more information, use:

yarn es2049scripts ‑help
es2049scripts [options] source-directory target-directory args…
  version: 0.0.11
 Transpiles from ES.Next to Node.js executable format
  Default target is Node.js 6.12.3 maintenance Long Term Support
  Transpiles .js and .mjs (may be renamed to .js), other files are copied
  Actions may be skipped based on modification date

 -active Target latest Node.js LTS: 8.9.4
 -current Target the executing Node.js version, must be v8.6+, CommonJS modules
 -latest Target the executing Node.js version --experimental-modules v8.6+
  Extension .mjs is kept on output
 -rollup Target transpile of rollup.config.js: for buble with import
 -- Skip options parsing to args parameter

 source-directory default: ./configes
 target-directory default: ./config
 args… Any command with arguments to be launched on transpile complete

Note om Rollup: rollup reading of configuration files does not support generators, therefore not async or dynamic imports. This means one cannot include ECMAScript containing generators for parsing, even if those are not used.

Internal Triple-Transpile

Compiling ZeroTranspiler

The ZeroTranspiler class is written in ES.Next and is only used by es2049scripts developers. The yarn transpilezero command uses the babel-cli package to transpile to Node 6 ECMAScript . The output, config/transpilezero.js is checked in.

Transpiling to config

As soon as the zero transpiler has been compiled, it is used to transpile ES.Next code in configes and configrollup using the proper babel environment, this result is also checked in. At this point, the es2049scripts project can be built.

Building es2049scripts

The project is built in the usual way using the transpiled code in config

Transpiling the Consuming Project

The consuming project invokes the es2049scripts executable that is built from the ES.Next code in src. The transpilation, typically into the consuming project’s config directory, uses modification dates to reduce work.

Requirements

To develop or compile the ECMAScript 2049 project Yarn 1+ and Node.js current (v8.5+) are required.

yarn test tests that the built executable is runnable:

yarn build

src/index.mjs → bin/es2049scripts...
created bin/es2049scripts in 1.6s
Done in 2.94s.
yarn test

Ran all test suites.
Done in 1.91s.

yarn testmjs tests that experimental module support appears to be working.

yarn testProject executes tests in the es2049scripts-test project:

yarn testProject

yarn install

yarn test

This file was transpiled with RollupJS and executed successfully.

yarn start
$ es2049scripts -- node config
The next ReactJS version:
17
ScriptsTester.test: code transpiled by es2049scripts executed successfully.
Done in 14.72s.

© Harald Rudell created ECMAScript 2049 in December 2017. ISC License

install

npm i es2049scripts

Downloadsweekly downloads

1

version

0.0.19

license

ISC

repository

githubgithub

last publish

collaborators

  • avatar