Various command line applications use an Interpreter Directive to define how they should be run.
#! js -m foo
#! node foo
import {ran} from 'b'; | |
let ready; | |
// this function can be saved to a variable, but blows up if `b` has not run yet | |
export function onlyAvailableIfBHasRun() { | |
ready; | |
ran; | |
// ... | |
}; |
class LockingActor { | |
constructor(buffer, offset, bytes) { | |
let needle = offset; | |
// if our lock isn't aligned | |
if (needle % 4 !== 0) { | |
// align | |
needle += 4 - (needle % 4); | |
} | |
this.state = new Transitions(buffer, needle); | |
needle += this.lock.byteLength; |
Various command line applications use an Interpreter Directive to define how they should be run.
#! js -m foo
#! node foo
There has been no progress in working towards a single cohesive story for path resolution between Servers and Web. Notable discussion points relevant to this are:
resolve
based hook. (interest shown with desire for ~6 months of userland experimentation)module.exports = (...arguments) => { | |
// WHAT FRESH HELL IS THIS | |
with (arguments[0].exports) { | |
a = 123; | |
} | |
} |
// THIS *REQUIRES SLOPPY MODE* DO NOT USE STRICT | |
// loads all the necessary files synchronously that can be used synchronously by CJS, | |
// does *NOT* evaluate them | |
// closely resembles CJS bundles of today | |
document.currentScript.entries = { | |
"x.json": { | |
evaluate(module, exports) {this.exports = {x:true}; this.evaluate = () => {}}, | |
exports: undefined | |
} |
class Super { | |
constructor() { | |
this.log = new.target.DI('log'); | |
} | |
static DI(name) { | |
if (name === 'log') return console.log; | |
} | |
} | |
class Sub extends Super { | |
static DI(name) { |
While ES6 defines how to parse, link and execute a module, ES6 does not define when this parsing/linking/execution occurs. An additional extension to the HTML spec is required to say when a script is parsed as a module instead of normal global code. This work is ongoing. Currently, the following entry points for modules are being considered:
<script type="module">;
an overload to the Worker constructor;
an overload to the importScripts Worker API;
original:
let i = 0;
export let decrement = () => i--;
export let increment = () => i++;
sharded: