sourcemint-sdk-requirejs

These examples illustrate how to load [RequireJS](http://requirejs.org/) compatible code into the `Sourcemint Platform`.

npm install sourcemint-sdk-requirejs
14 downloads in the last week
44 downloads in the last month

These examples illustrate how to load RequireJS compatible code into the Sourcemint Platform.

The following RequireJS/AMD features are supported:

  • define();

The examples may be run via PINF if installed:

npm install -g pinf

For information on how to develop and bundle PINF applications see: github.com/sourcemint/guide/0/-docs/PINF

Hello World

  • Run in NodeJS: pinf run --platform nodejs github.com/sourcemint/sdk-requirejs/0/-raw/examples/RequireJS/README.md#helloworld
  • Run in Browser: pinf run --platform browser github.com/sourcemint/sdk-requirejs/0/-raw/examples/RequireJS/README.md#helloworld

    CODE: {"id": "helloworld"}

    /program.json ~ {

    "platforms": {
        "nodejs" "github.com/sourcemint/platform-nodejs/0",
        "browser": "github.com/sourcemint/platform-browser/0"
    },
    "packages": {
        "app/": "."
    },
    "boot": "app/"
    

    }

    /package.json ~ {

    "main": "./main.js",
    "config": {
        "github.com/sourcemint/loader-js/0/-meta/config/0": {
            "adapter": "github.com/sourcemint/sdk-requirejs/0"
        }
    }
    

    }

    /main.js ~ define(function(require, exports, module) {

    console.log("Hello World");
    

    }

RequireJS's tests/one.js

  • Run in NodeJS: pinf run --platform nodejs github.com/sourcemint/sdk-requirejs/0/-raw/examples/RequireJS/README.md#requirejs-tests-one
  • Run in Browser: pinf run --platform browser github.com/sourcemint/sdk-requirejs/0/-raw/examples/RequireJS/README.md#requirejs-tests-one

    CODE: {"id": "requirejs-tests-one"}

    /program.json ~ {

    "platforms": {
        "nodejs" "github.com/sourcemint/platform-nodejs/0",
        "browser": "github.com/sourcemint/platform-browser/0"
    },
    "packages": {
        "app/": ".",
        "github.com/jrburke/requirejs/1": {
            "pointer": "github.com/jrburke/requirejs/1.0.5",
            "descriptor": {
                "config": {
                    "github.com/sourcemint/loader-js/0/-meta/config/0": {
                        "adapter": "github.com/sourcemint/sdk-requirejs/0"
                    }
                }
            }
        }
    },
    "boot": "app/"
    

    }

    /package.json ~ {

    "mappings": {
        "requirejs": "github.com/jrburke/requirejs/1"
    },
    "main": "./main.js"
    

    }

    /main.js ~

    var ONE = require("requirejs/tests/one");

    if (ONE.size === "large" && ONE.doSomething().size === "small") {

    console.log("SUCCESS!");
    

    } else {

    console.log("FAIL!");
    

    }

npm loves you