kaeon-united-xp

1.0.5 • Public • Published

Kaeon United - It Just Works

What is Kaeon United?

Kaeon United (pronounced "KAI-on") is a multi-purpose API designed to provide a unified interface to all of the major software development tools defined in the Kaeon United Specification.

Functionality

The functionality that Kaeon United provides includes but is not limited to:

  • A free hosting service for serverless apps.

  • A script that provides dynamic client side access to CommonJS.

  • An npx CLI for various programming languages.

  • A CommonJS module that provides access to various JavaScript utilities.

As an extension of said functionality, the API provides utilities for the following languages:

  • The Kaeon FUSION programming language.

  • The ONE and ONE+ data interchange languages.

  • The Universal Preprocessor.

  • A C and C++ hybrid language called United C.

  • A machine code editing format called Character Separated Binary, or CSB for short.

  • An enhanced version of JavaScript called:

United JavaScript

United JavaScript is a minor modification to vanilla JavaScript with the following key attributes:

  • CommonJS shall be available regardless of the environment the program is running in.

  • Even in the browser, the CommonJS require function shall accept dynamically generated module paths.

  • CommonJS shall allow cross origin access to online modules via their URLs in both the browser and node.

  • The CommonJS require function shall allow for an optional second argument, an options object which shall allow said function to reload modules, to execute modules in the global scope, to load modules from strings in memory, and to load modules asynchronously.

  • If running in node, and the CommonJS require function is given the alias of an npm module which has not yet been installed, the program shall install said module at runtime.

  • "await" calls shall be usable at the root level of the program, outside of async functions.

As an example, observe the following code:

var puppeteer = require('puppeteer');

var browser = await puppeteer.launch();
var page = await browser.newPage();

await page.goto('https://www.npmjs.com/package/kaeon-united');
await page.screenshot({path: 'screenshot.png'});

await browser.close();

This code is a slightly modified version of the sample code provided on the puppeteer npm page.

If one were to place it into a file called "test.js" located in an otherwise empty directory, with puppeteer not installed either locally or globally, and were to execute the following command:

npx kaeon-united js open test.js

then puppeteer, along with several other dependencies, would be automatically installed locally, and the program would proceed to run normally, despite the awaits beings located outside of async functions.

After the program had finished running, a screenshot of the Kaeon United npm page would appear in the directory from which the command was executed.

API

Kaeon United is implemented as a single file, but it's written in such a way that its functionality differs according to how it's referenced.

As a CDN

See Kaeon United GhostHost.

As an HTML Script

To use Kaeon United as a script, reference it via jsDelivr or another similar service.

Kaeon United can be accessed through jsDelivr on its npm repository via the following URL:

https://cdn.jsdelivr.net/npm/kaeon-united@1.0.88/KaeonUnited.js

As a script, Kaeon United shall provide access to the United JavaScript version of CommonJS in the browser.

As a CLI

Kaeon United is available on npm under the alias "kaeon-united", and as such, it may be used as a command line utility via npx.

CLI Basics

A Kaeon United CLI command follows this general format:

npx kaeon-united [(1) operation] [(2*) "open" / "read"] [(3*) file / data] [(4*) export path / argument 1] [(5+*) argument 2+]

An asterisk indicates that the argument may or may not be necessary depending on the operation

All Kaeon United CLI commands operate on data which must either be imported from a file or specified literally.

The first argument specifies which operation to perform.

The second argument specifies whether the provided data will be imported from a file, in which case the argument shall be "open", or specified literally, in which case the argument shall be "read".

The third argument shall either specify the path to the file from which to import the data if the second argument was "open", or shall specify the literal data if the second argument was "read".

If a file path is specified, it may be in the form of a URL to a raw text file stored online.

The fourth argument shall specify a file path to export any output of the operation to.

Kaeon United operations are separated into the two categories, processor operations and translator operations.

Processor operations, each of which are associated with a specific programming language, may or may not have the second and third arguments, and the third argument may be followed by an indefinite number of other arguments.

If arguments two and three are provided, then they shall take the specified data and execute it as code in their respective language, with any additional arguments passed to said code as command line arguments. If arguments two and three are not provided, then they shall open a REPL for their respective language.

Translator operations, each of which are associated with two specific programming languages, an input language and an output language, must have the second and third arguments, and may or may not use a fourth argument to specify an export path.

They shall take the data specified by the second and third arguments as code in their respective input language and convert it to code in their respective output language.

If the fourth argument is present, they shall write the output to the file path specified by said argument, and if not, they shall write the output to the console.

The operations that Kaeon United supports are "js", "process", "parse", "preprocess", "ucc", "assemble", and "disassemble".

The JS Operation

The js operation is a processor operation for United JavaScript.

The Process Operation

The process operation is a processor operation for Kaeon FUSION.

The Parse Operation

The parse operation is a translator operation where ONE+ is the input language and ONE is the output language.

The Preprocess Operation

The preprocess operation is a translator operation where the Universal Preprocessor is the input language and raw text is the output language.

The UCC Operation

The UCC operation is a translator operation where United C is the input language and C is the output language.

The UCC operation should specify the input as a file path using "read".

The UCC operation requires both gcc and make to be installed.

The Assemble Operation

The assemble operation is a translator operation where CSB is the input language and binary is the output language.

The Disassemble Operation

The disassemble operation is a translator operation where binary is the input language and CSB is the output language.

The disassemble operation should specify the input as a file path using "read".

As a Module

If using United JavaScript through Kaeon United's CDN, Script, or CLI modes, then Kaeon United may be imported as a CommonJS style module through the KaeonUnited require function via the alias "Kaeon United" and "kaeon-united".

Said module shall take the form of a function which, when called with a string argument, shall return a module from the Kaeon Utilities with an alias matching said argument.

Calling said function without a string argument shall return a JSON object specfying the aliases of all modules available through the function.

For example:

var io = require("kaeon-united")("io");

shall load the io module and store it in a variable called "io", and:

console.log(require("kaeon-united")());

shall print the aforementioned JSON object.

The imported module may act also as a Kaeon FUSION interface, which shall load the most important Kaeon FUSION modules, including the standard module.

For example:

Use: Kaeon United; Log Line: 'Hello, world!'

shall log "Hello, world!" to the console.

Contact Info

For any questions or comments, please email the following address: kaeon.ace@gmail.com

Acknowledgements

The ability for Kaeon United to reference certain dependencies and utilities is dependent on a public CORS proxy.

Readme

Keywords

none

Package Sidebar

Install

npm i kaeon-united-xp

Weekly Downloads

0

Version

1.0.5

License

Apache-2.0

Unpacked Size

38.3 kB

Total Files

6

Last publish

Collaborators

  • kaeonace