onilabs / stratifiedjs Goto Github PK
View Code? Open in Web Editor NEWOni StratifiedJS (previously Apollo)
Home Page: http://onilabs.com/stratifiedjs
License: Other
Oni StratifiedJS (previously Apollo)
Home Page: http://onilabs.com/stratifiedjs
License: Other
Im having a problem loading a script:
try {
require('apollo:http').script('/support/vendor/json2.js');
} catch(e) {
console.log("ERROR(0)" + e);
}
(Underlying exception: Could not load script: '[object Arguments]'.)
Hi,
just to let you know, that apollo breaks with libraries, that rely on Common JS 1.1 Modules Spec. (most prominently underscore.js)
QUOTE FROM THE SPEC@ http://wiki.commonjs.org/wiki/Modules/1.1#Module_Context Section 1.3
In a module, there must be a free variable "module", that is an Object.
The "module" object must have a read-only, don't delete "id" property that is the top-level "id" of the module. The "id" property must be such that require(module.id) will return the exports object from which the module.id originated. (That is to say module.id can be passed to another module, and requiring that must return the original module).
The "module" object may have a "uri" String that is the fully-qualified URI to the resource from which the module was created. The "uri" property must not exist in a sandbox.
Hello :)
Just checking in on SJS and noticed activity on the website but couldn't find any demo code for stratified JS itself, and some of the old web content appears to be gone - https://web.archive.org/web/20210224042355/http://onilabs.com/stratifiedjs
I was wondering if it now runs on top of native JS (await/async etc.) without needing a custom JS interpreter (ok I'm a decade out of date!), or has some compiled-to-wasm thing of its own.
Are there any simple modern examples, ideally something I can run in ObservableHQ.com?
Hi, given below:
<script type="text/javascript" src="assets/vendor/onilabs/stratified.js" main="assets/frontend/bootstrap" require-prefix="oni"></script>
shows an error: Uncaught ReferenceError: require is not defined
I think the script should not error since the actual user script hasn't been loaded yet?
-- removing the main attr does not throw an exception though.
I've enjoyed experimenting with Apollo, but only having a minified version certainly makes it difficult to dive into the code. Could we get a non minified version please?
The following code gives an error:
__js {
X: for(var i=0; i<foo;++i) { ... continue X; }
}
The problem is that our compiler translates this to:
X: i=0; for(;i<foo;++i) { ... continue X; }
I.e. the variable initialization gets pulled out of the 'for' statement.
Under some circumstances when calling SJS code from JS, exceptions thrown by SJS will not get annotated with the correct filename:linenumber under IE and Chrome.
E.g. the following code:
will give an exception in the Chrome or IE consoles that is not annotated. In Firefox it works ok.
At the moment oni-apollo.js won't parse sjs script tags if loaded dynamically.
From https://groups.google.com/d/msg/oni-apollo/3GVnfQJQqu4/JSQnfoDC9w4J :
I also noted a problem using 'process.argv':
When I call Apollo with 'apollo test.sjs ./spec' then 'process.argv'
contains [test.sjs,./spec].
When I call nodejs with 'node test.js ./spec' then it contains
[node,D:...full-path to\test.sjs,./spec].
We should do the same as node, in order to determine whether a script is run or required:
if (require.main === module) { ... }
and maybe also
if (!module.parent) { ... }
The first seems to be more official: http://nodejs.org/docs/v0.4.8/api/modules.html#accessing_the_main_module
http://stackoverflow.com/questions/4981891/node-js-equivalent-of-pythons-if-name-main
if { ... without terminating brace yields a module compilation error about an unexpected ')'. We need to compile just the module source without wrapper function to avoid this
This code doesn't compile correctly:
__js {
for (i = 0; i < 10; i++) some_func (i);
}
See https://groups.google.com/d/msg/oni-apollo/KRAYXs_n9RY/Sn2M9FXmWZcJ
As in:
<script type="text/sjs" src="/js/myCode.js"></script>
First thanks for your great work on apollo.
While launching apollo under windows with command "node.exe apollo", the following error appears:
Uncaught: Error: Cannot load module 'apollo:nodejs/repl'. (Underlying exception: Error: ENOENT, open 'K:\apollo\apollo\modules\nodejs\repl.sjs'
and then
Error: ENOENT, open 'K:\apollo\apollo\modules\nodejs\repl' (in apollo-sys-nodejs.sjs:310)) (in apollo-sys-common.sjs:702)
The root directory of apollo is k:\apollo, so the correct path of repl.sjs should be k:\apollo\modules\nodejs\repl.sjs, but it resolves to K:\apollo\apollo\modules\nodejs\repl.sjs'
I have tried node 0.6.18 and 0.7.9 and get the same error.
Hi, base on the subject do you plan to have this feature somehow? I'm trying to use this: https://github.com/inorganik/digest-auth-request but just to ask if maybe stratified version already exists.
This would allow the users of languages that compile to Javascript to use StratifiedJS’s features more easily.
In my particular case, I’m trying to run JS‐compiled Ceylon as StratifiedJS, to be able to use StratfiedJS’s features and functions from Ceylon. Currently, everything works beautifully, but I have to manually change the compiled JS files’ extensions, and therefore have to serve them myself (I can’t use Ceylon modules directly from Ceylon’s repository, the Herd).
I propose to have a treatjs
attribute on required
.
It’d accept three values:
js
sjs-sjs
sjs-js
js
would act as it currently does today.
sjs-sjs
would treat .js
files as if they were .sjs
files.
sjs-js
would treat .js
files as if they were .sjs
files, but still resolve require
d resources as if they were .js
files (i.e. resolve them absolutey, as opposed to relatively).
Then, we could use a module from Herd:
<!doctype html>
<html>
<head>
<script src="[foo]/stratified.js"></script>
<script type="text/sjs">
require.treatjs = "sjs-js";
require.hubs.unshift(["herd:", "https://modules.ceylon-lang.org/repo/1/"]);
require("herd:my/mod/0/my.mod-0.js").run();
</script>
</head>
</html>
Thought you guys would want to review before I sent in the PR.
tomByrer/es6-tools@20a8ecd
However, when prepping this, I found the linked doc hard to read. Perhaps it could use spliting it &/or restructuring. So I'd like to hold off & fix that page so I don't have to re-submit the PR to Addy's Tools page.
It seems you have 3 sections that can be separate pages or better separated visually. Either way, I'd like Concurrency primitives & Syntax enhancements over JavaScript to get their own left-hand menu links. Not sure how to proceed...
Hi, Is there a way I can obfuscate / compile SJS scripts? I am embedding this to a node-webkit application and when the application runs, it extracts the .nw files to temp and all sources are available.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.