{"_id":"my","_rev":"16-7cef5d4a5b9d8862c721f2d79b78c31e","name":"my","description":"my JavaScript module system","dist-tags":{"latest":"0.3.3"},"versions":{"0.1.0":{"name":"my","version":"0.1.0","description":"my JavaScript module system","keywords":["module","loader","import","export"],"author":{"name":"Hax","email":"johnhax@gmail.com","url":"http://johnhax.net/"},"homepage":"http://github.com/hax/my.js","bugs":"http://github.com/hax/my.js/issues","bin":{"mym":"./cli.js"},"repository":{"type":"git","url":"http://github.com/hax/my.js.git"},"readme":"# my.js #\r\n\r\n\r\n### What is my.js ###\r\n\r\nThis project 'my.js' want to be the ultimate JavaScript module solution for \r\neveryone. It's now just some ideas (from long long ago to recently), but I \r\nwill start to implement some features in very soon.\r\n\r\n\r\n### Basic Ideas/Requirements ###\r\n\r\n* Let all js be my js\r\n\t* whatever module spec it follows (CommonJS, AMD, etc.)\r\n\t* whatever module system it adpoted (RequireJS, SeaJS, FlyJS, JSI, etc.)\r\n\t* whatever script loader it accustomed to (LabJS, JSAN, Google JSAPI ...)\r\n\t* whatever module pattern it used (function wrapper, eg. jQuery ...)\r\n\t* and even for the old \\<script\\> files\r\n\r\n* Easy to read, write and maitain the module definitions\r\n\t* define modules with a DSL which use a designed JavaScript syntax subset\r\n\t* support both centrelized and distributed module definition\r\n\t* support both local files/directories and web URLs\r\n\t* can build buddled packages for diff enviroments\r\n\t\t(eg. can generate diff deployment files for diff browsers)\r\n\t* minify the diffs of dev/product via resouce mapping rules\r\n\t* limited module version support (to avoid bad practice)\r\n\r\n* Follow ES6 module draft\r\n\t* Allow define imports/exports statically for the modules\r\n\t* require() is buzzy and lose the benifits of static bindings\r\n\r\n* Server-solution friendly\r\n\t* cross-origin proxy\r\n\t* scripts merge and minifier\r\n\t* AMD wrapper\r\n\t* alternative URLs from cdn\r\n\t \r\n* Add-ons\r\n\t* Allow to add code translators such as wrapper, preprocessor, \r\n\t  transformer, compiler, etc.\r\n\t* Example: module directive addon\r\n\t\tallow import/export/module/submoudle directives in diff styles\r\n\r\n\t\t\r\n### Usage ###\r\n\r\n* Browser:\r\n\r\n```html\r\n<head>\r\n\t...\r\n\t<script src=\"http://hax.github.com/my.js\" load=\"app.js\">\r\n\t...\r\n</head>\r\n```\r\n\r\n* Node.js or CommonJS\r\n\r\n```javascript\r\nrequire('my').load('app')\r\n```\r\n\r\n### DSL ###\r\n\r\n```javascript\r\n// define the module _traits_ from local file\r\nmodule ('traits'). at ('traits.js/lib/traits.js')\r\n\r\n// define the module _light_traits_ which follow AMD spec\r\nmodule ('light_traits'). at [AMD] ('traits.js/lib/traits.js')\r\n\r\n// define the module _qwrap_ as naked script and exports the name _QW_\r\nmodule ('qwrap'). at [SCRIPT] ('core_dom_youa.com.js#QW')\r\n\r\n// define the module from the web\r\nmodule ('gloader'). at [SCRIPT] ('https://www.google.com/jsapi#google')\r\n\r\n// define the module from data uri\r\n// NOTE: it makes building deployment version possible and easy,\r\n//       all we need to do is resource mapping\r\nmodule ('sample1'). at ('data:application/javascript,exports.Greeting = {hello:\"world\"}')\r\n\r\n// define another module which use last module\r\nmodule ('sample2'). at ('http://www.example.org/sample2.js')\r\n\r\n// define a cross-origin proxy, so all http requests will be routed to the proxy\r\nresource ('http://*'). from ('/proxy?url=$1')\r\n\r\n// so _sample2_ will be transformed, and just like u write:\r\nmodule ('sample2'). at ('/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl  \r\n//       it should be for encoded each mapping step\r\n\r\n// This will be transformed internally to AMD wrapper form just like u write:\r\nmodule ('sample2'). at [AMD] ('amdwrap:/proxy?url=http://www.example.org/sample2.js')\r\n\r\n// Normally, the _amdwrap_ derefernce will be called to wrap code dynamically,\r\n// but you can define a server-generated AMD wrapper\r\nresource ('amdwrap:*'). from ('/amdwrap?url=$1')\r\n\r\n// So, it will transform the _sample2_ to:\r\nmodule ('sample2'). at [AMD] ('/amdwrap?url=/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl \r\n//       it should be for encoded each mapping step\r\n\r\n\r\n// define a resouce mapping rule, so last module will load source from data URI!\r\nresource ('http://www.example.org/sample2.js'). from (\r\n\t\"data:,var G = require('sample1').Greeting; console.info(G.hello);\"\r\n)\r\n\r\n// define another module from legacy scripts\r\nmodule ('sample3'). \r\n\timports ('Global.console').\r\n\timports ('Greeting'). // which will be resolve to last _smaple1_ module\r\n\tinclude ('sample/legacy.js'). // content: console.info('Hello' + Greeting.hello)\r\nend\r\n\r\n// define a module delegate to directory, so the modules definitions can be distributed\r\nmodule ('geo'). at ('geo/*')\r\n```\r\n\t\t\r\n### Declare module, imports and exports ###\r\n\r\nThough my.js try to support all loaders and module system,\r\nbut I recommand you using my.js built-in module system.\r\nCurrently my.js support two styles of declarations in-box,\r\ndirective prologues (just like 'use strict'), and labeled module statements\r\n(inspired by <https://github.com/labeledmodules/labeled-modules-spec/wiki>)\r\n\r\n```javascript\r\n// math.js (directive prologues)\r\n\t\r\n'export {sum, pi}'\r\n\r\nfunction sum(x, y) {\r\n\treturn x + y\r\n}\r\nvar pi = 3.14159265\r\n```\t\r\n```javascript\r\n// math.js (labeled module statements)\r\n\r\nexports: function sum(x, y) {\r\n\treturn x + y\r\n}\r\nexports: var pi = 3.14159265\r\n```\r\n```javascript\t\r\n// simple client code (directive prologues)\r\n\r\n'import {sum, pi} from \"math.js\"'\r\n\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n```javascript\t\r\n// simple client code (labeled module statements)\r\n\r\nimports: {sum; pi} from: 'math.js'\r\n\t\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n\r\nCheat sheet:\r\n```\r\nES6 module statements        my.js directive prologues        my.js labeled module statements\r\n                             * prologues only can occur at    * suffix 's' to avoid reserved keywords\r\n                               the beginning of a file        * use ';' instead of ','\r\n```\r\n```javascript\r\nimport {a, b} from \"m.js\"    'import {a, b} from \"m.js\"'      imports: {a; b} from: \"m.js\"\r\n```\r\n```javascript\r\nimport {a:a1} from \"m1.js\"    'import {a:a1} from \"m1.js\"'    imports: {a:a1} from: \"m1.js\"\r\nimport {a:a2} from \"m2.js\"    'import {a:a2} from \"m2.js\"'    imports: {a:a2} from: \"m2.js\"\r\n```\r\n```javascript\r\nexport function f() {...}    'export f'                       exports: function f() {....}\r\n                             ...\r\n                             function f() {...}\r\n```\r\n```javascript\r\nexport var v                 'export v'                       exports: var v\r\n                             ...\r\n                             var v\t\t\t\t\t\t\t \r\n```\r\n```javascript\r\nvar a, b                     'export {a, b}'                  var a, b\r\n...                          ...                              ...\r\nexport {a, b}                var a, b                         exports: {a; b}\r\n```\r\n```javascript\r\nvar _a, _b                   'export {a: _a, b: _b}'          var _a, _b\r\n...                          ...                              ...\r\nexport {a: _a, b: _b}        var _a, _b                       exports: {a: _a; b: _b}\r\n```\r\n\r\n### Rational ###\r\n\r\nThere are three basic concept in this module solution:\r\n\r\n1. module\r\n\ta block of reusable code \r\n\r\n2. namespace\r\n\t\r\n3. resource\r\n\tthe code source\r\n\r\n\r\n### PS. ###\r\n\r\nQ:\tDoes the name 'my.js' have any other meaning?\r\n\r\nA:\tYes, there are many abbrev options, choose what you like,\r\n\tor you can suggest one.\r\n\r\n\t* Module Yes!\r\n\r\n\t* Make happY JavaScript!\r\n\t\r\n\t* Module Yoga for JavaScript  --- make your body flexible\r\n\t\r\n\t* Module Yammy!  --- take what match your taste\r\n\t\r\n\t* Module Yamiedie...\r\n\t\r\n \r\n ","_id":"my@0.1.0","dist":{"shasum":"59356439c545fcde6d0b7376490e22a30de60f98","tarball":"https://registry.npmjs.org/my/-/my-0.1.0.tgz","integrity":"sha512-K3NaGAFsgP84wOv8A+Bd/zc0lYuCZKfctxxNJZdASlG+ohNosvjdQtC8M2gbB/E95ssrjRjV2S07VjQAMMxfIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFjcAOEXsBBhPTt5fHl0iM7nmVCq197DuiqeF5HXEQmhAiEAgfPTpPaV8YBeMIbZkjk4ySVBBWngAvod19wfKQg3icc="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"hax","email":"hax@heshijun.net"},"maintainers":[{"name":"hax","email":"hax@heshijun.net"}]},"0.1.1":{"name":"my","version":"0.1.1","description":"my JavaScript module system","keywords":["module","loader","import","export"],"author":{"name":"Hax","email":"johnhax@gmail.com","url":"http://johnhax.net/"},"homepage":"http://github.com/hax/my.js","bugs":"http://github.com/hax/my.js/issues","bin":{"mym":"./cli.js"},"repository":{"type":"git","url":"http://github.com/hax/my.js.git"},"readme":"# my.js #\r\n\r\n\r\n### What is my.js ###\r\n\r\nThis project 'my.js' want to be the ultimate JavaScript module solution for \r\neveryone. It's now just some ideas (from long long ago to recently), but I \r\nwill start to implement some features in very soon.\r\n\r\n\r\n### Basic Ideas/Requirements ###\r\n\r\n* Let all js be my js\r\n\t* whatever module spec it follows (CommonJS, AMD, etc.)\r\n\t* whatever module system it adpoted (RequireJS, SeaJS, FlyJS, JSI, etc.)\r\n\t* whatever script loader it accustomed to (LabJS, JSAN, Google JSAPI ...)\r\n\t* whatever module pattern it used (function wrapper, eg. jQuery ...)\r\n\t* and even for the old \\<script\\> files\r\n\r\n* Easy to read, write and maitain the module definitions\r\n\t* define modules with a DSL which use a designed JavaScript syntax subset\r\n\t* support both centrelized and distributed module definition\r\n\t* support both local files/directories and web URLs\r\n\t* can build buddled packages for diff enviroments\r\n\t\t(eg. can generate diff deployment files for diff browsers)\r\n\t* minify the diffs of dev/product via resouce mapping rules\r\n\t* limited module version support (to avoid bad practice)\r\n\r\n* Follow ES6 module draft\r\n\t* Allow define imports/exports statically for the modules\r\n\t* require() is buzzy and lose the benifits of static bindings\r\n\r\n* Server-solution friendly\r\n\t* cross-origin proxy\r\n\t* scripts merge and minifier\r\n\t* AMD wrapper\r\n\t* alternative URLs from cdn\r\n\t \r\n* Add-ons\r\n\t* Allow to add code translators such as wrapper, preprocessor, \r\n\t  transformer, compiler, etc.\r\n\t* Example: module directive addon\r\n\t\tallow import/export/module/submoudle directives in diff styles\r\n\r\n\t\t\r\n### Usage ###\r\n\r\n* Browser:\r\n\r\n```html\r\n<head>\r\n\t...\r\n\t<script src=\"http://hax.github.com/my.js\" load=\"app.js\">\r\n\t...\r\n</head>\r\n```\r\n\r\n* Node.js or CommonJS\r\n\r\n```javascript\r\nrequire('my').load('app')\r\n```\r\n\r\n### DSL ###\r\n\r\n```javascript\r\n// define the module _traits_ from local file\r\nmodule ('traits'). at ('traits.js/lib/traits.js')\r\n\r\n// define the module _light_traits_ which follow AMD spec\r\nmodule ('light_traits'). at [AMD] ('traits.js/lib/traits.js')\r\n\r\n// define the module _qwrap_ as naked script and exports the name _QW_\r\nmodule ('qwrap'). at [SCRIPT] ('core_dom_youa.com.js#QW')\r\n\r\n// define the module from the web\r\nmodule ('gloader'). at [SCRIPT] ('https://www.google.com/jsapi#google')\r\n\r\n// define the module from data uri\r\n// NOTE: it makes building deployment version possible and easy,\r\n//       all we need to do is resource mapping\r\nmodule ('sample1'). at ('data:application/javascript,exports.Greeting = {hello:\"world\"}')\r\n\r\n// define another module which use last module\r\nmodule ('sample2'). at ('http://www.example.org/sample2.js')\r\n\r\n// define a cross-origin proxy, so all http requests will be routed to the proxy\r\nresource ('http://*'). from ('/proxy?url=$1')\r\n\r\n// so _sample2_ will be transformed, and just like u write:\r\nmodule ('sample2'). at ('/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl  \r\n//       it should be for encoded each mapping step\r\n\r\n// This will be transformed internally to AMD wrapper form just like u write:\r\nmodule ('sample2'). at [AMD] ('amdwrap:/proxy?url=http://www.example.org/sample2.js')\r\n\r\n// Normally, the _amdwrap_ derefernce will be called to wrap code dynamically,\r\n// but you can define a server-generated AMD wrapper\r\nresource ('amdwrap:*'). from ('/amdwrap?url=$1')\r\n\r\n// So, it will transform the _sample2_ to:\r\nmodule ('sample2'). at [AMD] ('/amdwrap?url=/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl \r\n//       it should be for encoded each mapping step\r\n\r\n\r\n// define a resouce mapping rule, so last module will load source from data URI!\r\nresource ('http://www.example.org/sample2.js'). from (\r\n\t\"data:,var G = require('sample1').Greeting; console.info(G.hello);\"\r\n)\r\n\r\n// define another module from legacy scripts\r\nmodule ('sample3'). \r\n\timports ('Global.console').\r\n\timports ('Greeting'). // which will be resolve to last _smaple1_ module\r\n\tinclude ('sample/legacy.js'). // content: console.info('Hello' + Greeting.hello)\r\nend\r\n\r\n// define a module delegate to directory, so the modules definitions can be distributed\r\nmodule ('geo'). at ('geo/*')\r\n```\r\n\t\t\r\n### Declare module, imports and exports ###\r\n\r\nThough my.js try to support all loaders and module system,\r\nbut I recommand you using my.js built-in module system.\r\nCurrently my.js support two styles of declarations in-box,\r\ndirective prologues (just like 'use strict'), and labeled module statements\r\n(inspired by <https://github.com/labeledmodules/labeled-modules-spec/wiki>)\r\n\r\n```javascript\r\n// math.js (directive prologues)\r\n\t\r\n'export {sum, pi}'\r\n\r\nfunction sum(x, y) {\r\n\treturn x + y\r\n}\r\nvar pi = 3.14159265\r\n```\t\r\n```javascript\r\n// math.js (labeled module statements)\r\n\r\nexports: function sum(x, y) {\r\n\treturn x + y\r\n}\r\nexports: var pi = 3.14159265\r\n```\r\n```javascript\t\r\n// simple client code (directive prologues)\r\n\r\n'import {sum, pi} from \"math.js\"'\r\n\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n```javascript\t\r\n// simple client code (labeled module statements)\r\n\r\nimports: {sum; pi} from: 'math.js'\r\n\t\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n\r\nCheat sheet:\r\n```\r\nES6 module statements        my.js directive prologues        my.js labeled module statements\r\n                             * prologues only can occur at    * suffix 's' to avoid reserved keywords\r\n                               the beginning of a file        * use ';' instead of ','\r\n```\r\n```javascript\r\nimport {a, b} from \"m.js\"    'import {a, b} from \"m.js\"'      imports: {a; b} from: \"m.js\"\r\n```\r\n```javascript\r\nimport {a:a1} from \"m1.js\"    'import {a:a1} from \"m1.js\"'    imports: {a:a1} from: \"m1.js\"\r\nimport {a:a2} from \"m2.js\"    'import {a:a2} from \"m2.js\"'    imports: {a:a2} from: \"m2.js\"\r\n```\r\n```javascript\r\nexport function f() {...}    'export f'                       exports: function f() {....}\r\n                             ...\r\n                             function f() {...}\r\n```\r\n```javascript\r\nexport var v                 'export v'                       exports: var v\r\n                             ...\r\n                             var v\t\t\t\t\t\t\t \r\n```\r\n```javascript\r\nvar a, b                     'export {a, b}'                  var a, b\r\n...                          ...                              ...\r\nexport {a, b}                var a, b                         exports: {a; b}\r\n```\r\n```javascript\r\nvar _a, _b                   'export {a: _a, b: _b}'          var _a, _b\r\n...                          ...                              ...\r\nexport {a: _a, b: _b}        var _a, _b                       exports: {a: _a; b: _b}\r\n```\r\n\r\n### Rational ###\r\n\r\nThere are three basic concept in this module solution:\r\n\r\n1. module\r\n\ta block of reusable code \r\n\r\n2. namespace\r\n\t\r\n3. resource\r\n\tthe code source\r\n\r\n\r\n### PS. ###\r\n\r\nQ:\tDoes the name 'my.js' have any other meaning?\r\n\r\nA:\tYes, there are many abbrev options, choose what you like,\r\n\tor you can suggest one.\r\n\r\n\t* Module Yes!\r\n\r\n\t* Make happY JavaScript!\r\n\t\r\n\t* Module Yoga for JavaScript  --- make your body flexible\r\n\t\r\n\t* Module Yammy!  --- take what match your taste\r\n\t\r\n\t* Module Yamiedie...\r\n\t\r\n \r\n ","_id":"my@0.1.1","dist":{"shasum":"f57b3c6965e41bcb12a377f4ac86e1ce42bdd3e3","tarball":"https://registry.npmjs.org/my/-/my-0.1.1.tgz","integrity":"sha512-jVJmtyhIapA6J9aecSVPUe9nrZqT55NW62XSd+qgTwnlyK5I7QbetJwRcyNb4cvdqp5x/6j4msalo1uNB6sVfA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCXnw0k8LgQC86A/o1KRw19lVfFbZLs+CLqLRE8va55CAIhANvhCyKzcXpeYMU00XjnEntp803n59zlfEk/MeCuHFOc"}]},"_npmVersion":"1.1.59","_npmUser":{"name":"hax","email":"hax@heshijun.net"},"maintainers":[{"name":"hax","email":"hax@heshijun.net"}]},"0.1.2":{"name":"my","version":"0.1.2","description":"my JavaScript module system","keywords":["module","loader","import","export"],"author":{"name":"Hax","email":"johnhax@gmail.com","url":"http://johnhax.net/"},"homepage":"http://github.com/hax/my.js","bugs":"http://github.com/hax/my.js/issues","main":"my.js","bin":{"mym":"./cli.js"},"repository":{"type":"git","url":"http://github.com/hax/my.js.git"},"readme":"# my.js #\r\n\r\n\r\n### What is my.js ###\r\n\r\nThis project 'my.js' want to be the ultimate JavaScript module solution for \r\neveryone. It's now just some ideas (from long long ago to recently), but I \r\nwill start to implement some features in very soon.\r\n\r\n\r\n### Basic Ideas/Requirements ###\r\n\r\n* Let all js be my js\r\n\t* whatever module spec it follows (CommonJS, AMD, etc.)\r\n\t* whatever module system it adpoted (RequireJS, SeaJS, FlyJS, JSI, etc.)\r\n\t* whatever script loader it accustomed to (LabJS, JSAN, Google JSAPI ...)\r\n\t* whatever module pattern it used (function wrapper, eg. jQuery ...)\r\n\t* and even for the old \\<script\\> files\r\n\r\n* Easy to read, write and maitain the module definitions\r\n\t* define modules with a DSL which use a designed JavaScript syntax subset\r\n\t* support both centrelized and distributed module definition\r\n\t* support both local files/directories and web URLs\r\n\t* can build buddled packages for diff enviroments\r\n\t\t(eg. can generate diff deployment files for diff browsers)\r\n\t* minify the diffs of dev/product via resouce mapping rules\r\n\t* limited module version support (to avoid bad practice)\r\n\r\n* Follow ES6 module draft\r\n\t* Allow define imports/exports statically for the modules\r\n\t* require() is buzzy and lose the benifits of static bindings\r\n\r\n* Server-solution friendly\r\n\t* cross-origin proxy\r\n\t* scripts merge and minifier\r\n\t* AMD wrapper\r\n\t* alternative URLs from cdn\r\n\t \r\n* Add-ons\r\n\t* Allow to add code translators such as wrapper, preprocessor, \r\n\t  transformer, compiler, etc.\r\n\t* Example: module directive addon\r\n\t\tallow import/export/module/submoudle directives in diff styles\r\n\r\n\t\t\r\n### Usage ###\r\n\r\n* Browser:\r\n\r\n```html\r\n<head>\r\n\t...\r\n\t<script src=\"http://hax.github.com/my.js\" load=\"app.js\">\r\n\t...\r\n</head>\r\n```\r\n\r\n* Node.js or CommonJS\r\n\r\n```javascript\r\nrequire('my').load('app')\r\n```\r\n\r\n### DSL ###\r\n\r\n```javascript\r\n// define the module _traits_ from local file\r\nmodule ('traits'). at ('traits.js/lib/traits.js')\r\n\r\n// define the module _light_traits_ which follow AMD spec\r\nmodule ('light_traits'). at [AMD] ('traits.js/lib/traits.js')\r\n\r\n// define the module _qwrap_ as naked script and exports the name _QW_\r\nmodule ('qwrap'). at [SCRIPT] ('core_dom_youa.com.js#QW')\r\n\r\n// define the module from the web\r\nmodule ('gloader'). at [SCRIPT] ('https://www.google.com/jsapi#google')\r\n\r\n// define the module from data uri\r\n// NOTE: it makes building deployment version possible and easy,\r\n//       all we need to do is resource mapping\r\nmodule ('sample1'). at ('data:application/javascript,exports.Greeting = {hello:\"world\"}')\r\n\r\n// define another module which use last module\r\nmodule ('sample2'). at ('http://www.example.org/sample2.js')\r\n\r\n// define a cross-origin proxy, so all http requests will be routed to the proxy\r\nresource ('http://*'). from ('/proxy?url=$1')\r\n\r\n// so _sample2_ will be transformed, and just like u write:\r\nmodule ('sample2'). at ('/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl  \r\n//       it should be for encoded each mapping step\r\n\r\n// This will be transformed internally to AMD wrapper form just like u write:\r\nmodule ('sample2'). at [AMD] ('amdwrap:/proxy?url=http://www.example.org/sample2.js')\r\n\r\n// Normally, the _amdwrap_ derefernce will be called to wrap code dynamically,\r\n// but you can define a server-generated AMD wrapper\r\nresource ('amdwrap:*'). from ('/amdwrap?url=$1')\r\n\r\n// So, it will transform the _sample2_ to:\r\nmodule ('sample2'). at [AMD] ('/amdwrap?url=/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl \r\n//       it should be for encoded each mapping step\r\n\r\n\r\n// define a resouce mapping rule, so last module will load source from data URI!\r\nresource ('http://www.example.org/sample2.js'). from (\r\n\t\"data:,var G = require('sample1').Greeting; console.info(G.hello);\"\r\n)\r\n\r\n// define another module from legacy scripts\r\nmodule ('sample3'). \r\n\timports ('Global.console').\r\n\timports ('Greeting'). // which will be resolve to last _smaple1_ module\r\n\tinclude ('sample/legacy.js'). // content: console.info('Hello' + Greeting.hello)\r\nend\r\n\r\n// define a module delegate to directory, so the modules definitions can be distributed\r\nmodule ('geo'). at ('geo/*')\r\n```\r\n\t\t\r\n### Declare module, imports and exports ###\r\n\r\nThough my.js try to support all loaders and module system,\r\nbut I recommand you using my.js built-in module system.\r\nCurrently my.js support two styles of declarations in-box,\r\ndirective prologues (just like 'use strict'), and labeled module statements\r\n(inspired by <https://github.com/labeledmodules/labeled-modules-spec/wiki>)\r\n\r\n```javascript\r\n// math.js (directive prologues)\r\n\t\r\n'export {sum, pi}'\r\n\r\nfunction sum(x, y) {\r\n\treturn x + y\r\n}\r\nvar pi = 3.14159265\r\n```\t\r\n```javascript\r\n// math.js (labeled module statements)\r\n\r\nexports: function sum(x, y) {\r\n\treturn x + y\r\n}\r\nexports: var pi = 3.14159265\r\n```\r\n```javascript\t\r\n// simple client code (directive prologues)\r\n\r\n'import {sum, pi} from \"math.js\"'\r\n\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n```javascript\t\r\n// simple client code (labeled module statements)\r\n\r\nimports: {sum; pi} from: 'math.js'\r\n\t\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n\r\nCheat sheet:\r\n```\r\nES6 module statements        my.js directive prologues        my.js labeled module statements\r\n                             * prologues only can occur at    * suffix 's' to avoid reserved keywords\r\n                               the beginning of a file        * use ';' instead of ','\r\n```\r\n```javascript\r\nimport {a, b} from \"m.js\"    'import {a, b} from \"m.js\"'      imports: {a; b} from: \"m.js\"\r\n```\r\n```javascript\r\nimport {a:a1} from \"m1.js\"    'import {a:a1} from \"m1.js\"'    imports: {a:a1} from: \"m1.js\"\r\nimport {a:a2} from \"m2.js\"    'import {a:a2} from \"m2.js\"'    imports: {a:a2} from: \"m2.js\"\r\n```\r\n```javascript\r\nexport function f() {...}    'export f'                       exports: function f() {....}\r\n                             ...\r\n                             function f() {...}\r\n```\r\n```javascript\r\nexport var v                 'export v'                       exports: var v\r\n                             ...\r\n                             var v\t\t\t\t\t\t\t \r\n```\r\n```javascript\r\nvar a, b                     'export {a, b}'                  var a, b\r\n...                          ...                              ...\r\nexport {a, b}                var a, b                         exports: {a; b}\r\n```\r\n```javascript\r\nvar _a, _b                   'export {a: _a, b: _b}'          var _a, _b\r\n...                          ...                              ...\r\nexport {a: _a, b: _b}        var _a, _b                       exports: {a: _a; b: _b}\r\n```\r\n\r\n### Rational ###\r\n\r\nThere are three basic concept in this module solution:\r\n\r\n1. module\r\n\ta block of reusable code \r\n\r\n2. namespace\r\n\t\r\n3. resource\r\n\tthe code source\r\n\r\n\r\n### PS. ###\r\n\r\nQ:\tDoes the name 'my.js' have any other meaning?\r\n\r\nA:\tYes, there are many abbrev options, choose what you like,\r\n\tor you can suggest one.\r\n\r\n\t* Module Yes!\r\n\r\n\t* Make happY JavaScript!\r\n\t\r\n\t* Module Yoga for JavaScript  --- make your body flexible\r\n\t\r\n\t* Module Yammy!  --- take what match your taste\r\n\t\r\n\t* Module Yamiedie...\r\n\t\r\n \r\n ","_id":"my@0.1.2","dist":{"shasum":"b2806273abf26ba57ced8228b41b2a97d386c89a","tarball":"https://registry.npmjs.org/my/-/my-0.1.2.tgz","integrity":"sha512-qxW2jqkMDmcJ3KUU/Xxq4JyBsmW69U8hONjbL4xMTzrlHDSxU2611rvzgCKP3c886I/4vx00E1gHCs1d7YviSw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCpEi9rINv229HyLQv+FxQ9pQTVrzOTvH/KnHACW9yWfAIgRM66Vz4tQS2+g1pap2C9CtOta0VPJdJZjAXu8PA/Q3g="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"hax","email":"hax@heshijun.net"},"maintainers":[{"name":"hax","email":"hax@heshijun.net"}]},"0.1.3":{"name":"my","version":"0.1.3","description":"my JavaScript module system","keywords":["module","loader","import","export"],"author":{"name":"Hax","email":"johnhax@gmail.com","url":"http://johnhax.net/"},"homepage":"http://github.com/hax/my.js","bugs":"http://github.com/hax/my.js/issues","main":"my.js","bin":{"mym":"./cli.js"},"repository":{"type":"git","url":"http://github.com/hax/my.js.git"},"readme":"# my.js #\r\n\r\n\r\n### What is my.js ###\r\n\r\nThis project 'my.js' want to be the ultimate JavaScript module solution for \r\neveryone. It's now just some ideas (from long long ago to recently), but I \r\nwill start to implement some features in very soon.\r\n\r\n\r\n### Basic Ideas/Requirements ###\r\n\r\n* Let all js be my js\r\n\t* whatever module spec it follows (CommonJS, AMD, etc.)\r\n\t* whatever module system it adpoted (RequireJS, SeaJS, FlyJS, JSI, etc.)\r\n\t* whatever script loader it accustomed to (LabJS, JSAN, Google JSAPI ...)\r\n\t* whatever module pattern it used (function wrapper, eg. jQuery ...)\r\n\t* and even for the old \\<script\\> files\r\n\r\n* Easy to read, write and maitain the module definitions\r\n\t* define modules with a DSL which use a designed JavaScript syntax subset\r\n\t* support both centrelized and distributed module definition\r\n\t* support both local files/directories and web URLs\r\n\t* can build buddled packages for diff enviroments\r\n\t\t(eg. can generate diff deployment files for diff browsers)\r\n\t* minify the diffs of dev/product via resouce mapping rules\r\n\t* limited module version support (to avoid bad practice)\r\n\r\n* Follow ES6 module draft\r\n\t* Allow define imports/exports statically for the modules\r\n\t* require() is buzzy and lose the benifits of static bindings\r\n\r\n* Server-solution friendly\r\n\t* cross-origin proxy\r\n\t* scripts merge and minifier\r\n\t* AMD wrapper\r\n\t* alternative URLs from cdn\r\n\t \r\n* Add-ons\r\n\t* Allow to add code translators such as wrapper, preprocessor, \r\n\t  transformer, compiler, etc.\r\n\t* Example: module directive addon\r\n\t\tallow import/export/module/submoudle directives in diff styles\r\n\r\n\t\t\r\n### Usage ###\r\n\r\n* Browser:\r\n\r\n```html\r\n<head>\r\n\t...\r\n\t<script src=\"http://hax.github.com/my.js\" load=\"app.js\">\r\n\t...\r\n</head>\r\n```\r\n\r\n* Node.js or CommonJS\r\n\r\n```javascript\r\nrequire('my').load('app')\r\n```\r\n\r\n### DSL ###\r\n\r\n```javascript\r\n// define the module _traits_ from local file\r\nmodule ('traits'). at ('traits.js/lib/traits.js')\r\n\r\n// define the module _light_traits_ which follow AMD spec\r\nmodule ('light_traits'). at [AMD] ('traits.js/lib/traits.js')\r\n\r\n// define the module _qwrap_ as naked script and exports the name _QW_\r\nmodule ('qwrap'). at [SCRIPT] ('core_dom_youa.com.js#QW')\r\n\r\n// define the module from the web\r\nmodule ('gloader'). at [SCRIPT] ('https://www.google.com/jsapi#google')\r\n\r\n// define the module from data uri\r\n// NOTE: it makes building deployment version possible and easy,\r\n//       all we need to do is resource mapping\r\nmodule ('sample1'). at ('data:application/javascript,exports.Greeting = {hello:\"world\"}')\r\n\r\n// define another module which use last module\r\nmodule ('sample2'). at ('http://www.example.org/sample2.js')\r\n\r\n// define a cross-origin proxy, so all http requests will be routed to the proxy\r\nresource ('http://*'). from ('/proxy?url=$1')\r\n\r\n// so _sample2_ will be transformed, and just like u write:\r\nmodule ('sample2'). at ('/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl  \r\n//       it should be for encoded each mapping step\r\n\r\n// This will be transformed internally to AMD wrapper form just like u write:\r\nmodule ('sample2'). at [AMD] ('amdwrap:/proxy?url=http://www.example.org/sample2.js')\r\n\r\n// Normally, the _amdwrap_ derefernce will be called to wrap code dynamically,\r\n// but you can define a server-generated AMD wrapper\r\nresource ('amdwrap:*'). from ('/amdwrap?url=$1')\r\n\r\n// So, it will transform the _sample2_ to:\r\nmodule ('sample2'). at [AMD] ('/amdwrap?url=/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl \r\n//       it should be for encoded each mapping step\r\n\r\n\r\n// define a resouce mapping rule, so last module will load source from data URI!\r\nresource ('http://www.example.org/sample2.js'). from (\r\n\t\"data:,var G = require('sample1').Greeting; console.info(G.hello);\"\r\n)\r\n\r\n// define another module from legacy scripts\r\nmodule ('sample3'). \r\n\timports ('Global.console').\r\n\timports ('Greeting'). // which will be resolve to last _smaple1_ module\r\n\tinclude ('sample/legacy.js'). // content: console.info('Hello' + Greeting.hello)\r\nend\r\n\r\n// define a module delegate to directory, so the modules definitions can be distributed\r\nmodule ('geo'). at ('geo/*')\r\n```\r\n\t\t\r\n### Declare module, imports and exports ###\r\n\r\nThough my.js try to support all loaders and module system,\r\nbut I recommand you using my.js built-in module system.\r\nCurrently my.js support two styles of declarations in-box,\r\ndirective prologues (just like 'use strict'), and labeled module statements\r\n(inspired by <https://github.com/labeledmodules/labeled-modules-spec/wiki>)\r\n\r\n```javascript\r\n// math.js (directive prologues)\r\n\t\r\n'export {sum, pi}'\r\n\r\nfunction sum(x, y) {\r\n\treturn x + y\r\n}\r\nvar pi = 3.14159265\r\n```\t\r\n```javascript\r\n// math.js (labeled module statements)\r\n\r\nexports: function sum(x, y) {\r\n\treturn x + y\r\n}\r\nexports: var pi = 3.14159265\r\n```\r\n```javascript\t\r\n// simple client code (directive prologues)\r\n\r\n'import {sum, pi} from \"math.js\"'\r\n\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n```javascript\t\r\n// simple client code (labeled module statements)\r\n\r\nimports: {sum; pi} from: 'math.js'\r\n\t\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n\r\nCheat sheet:\r\n```\r\nES6 module statements        my.js directive prologues        my.js labeled module statements\r\n                             * prologues only can occur at    * suffix 's' to avoid reserved keywords\r\n                               the beginning of a file        * use ';' instead of ','\r\n```\r\n```javascript\r\nimport {a, b} from \"m.js\"    'import {a, b} from \"m.js\"'      imports: {a; b} from: \"m.js\"\r\n```\r\n```javascript\r\nimport {a:a1} from \"m1.js\"    'import {a:a1} from \"m1.js\"'    imports: {a:a1} from: \"m1.js\"\r\nimport {a:a2} from \"m2.js\"    'import {a:a2} from \"m2.js\"'    imports: {a:a2} from: \"m2.js\"\r\n```\r\n```javascript\r\nexport function f() {...}    'export f'                       exports: function f() {....}\r\n                             ...\r\n                             function f() {...}\r\n```\r\n```javascript\r\nexport var v                 'export v'                       exports: var v\r\n                             ...\r\n                             var v\t\t\t\t\t\t\t \r\n```\r\n```javascript\r\nvar a, b                     'export {a, b}'                  var a, b\r\n...                          ...                              ...\r\nexport {a, b}                var a, b                         exports: {a; b}\r\n```\r\n```javascript\r\nvar _a, _b                   'export {a: _a, b: _b}'          var _a, _b\r\n...                          ...                              ...\r\nexport {a: _a, b: _b}        var _a, _b                       exports: {a: _a; b: _b}\r\n```\r\n\r\n### Rational ###\r\n\r\nThere are three basic concept in this module solution:\r\n\r\n1. module\r\n\ta block of reusable code \r\n\r\n2. namespace\r\n\t\r\n3. resource\r\n\tthe code source\r\n\r\n\r\n### PS. ###\r\n\r\nQ:\tDoes the name 'my.js' have any other meaning?\r\n\r\nA:\tYes, there are many abbrev options, choose what you like,\r\n\tor you can suggest one.\r\n\r\n\t* Module Yes!\r\n\r\n\t* Make happY JavaScript!\r\n\t\r\n\t* Module Yoga for JavaScript  --- make your body flexible\r\n\t\r\n\t* Module Yammy!  --- take what match your taste\r\n\t\r\n\t* Module Yamiedie...\r\n\t\r\n \r\n ","_id":"my@0.1.3","dist":{"shasum":"887120b8163cc43a7dd87a38ae7ced88c667a385","tarball":"https://registry.npmjs.org/my/-/my-0.1.3.tgz","integrity":"sha512-gsTUZaCcWgC639HVDGFUT1BH6tMlxnHgGe4ZjHcUvRnFsWkK/2T59jXM7JtwDWP1GHKB6Q2HRTCGTHeXliLL2w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC4ay4IFhVuG2EcUVnuFfUFSzqQyay0azsO17m68Tu5zAIhAKtpLtLaOHN2z/7ZHm+Z6rDydnyXuhiOHPCfXkCSz3TH"}]},"_npmVersion":"1.1.59","_npmUser":{"name":"hax","email":"hax@heshijun.net"},"maintainers":[{"name":"hax","email":"hax@heshijun.net"}]},"0.3.0":{"name":"my","version":"0.3.0","description":"my JavaScript module system","keywords":["module","loader","import","export"],"author":{"name":"Hax","email":"johnhax@gmail.com","url":"http://johnhax.net/"},"homepage":"http://github.com/hax/my.js","bugs":"http://github.com/hax/my.js/issues","main":"my.js","bin":{"mym":"./cli.js"},"repository":{"type":"git","url":"http://github.com/hax/my.js.git"},"readme":"# my.js #\r\n\r\n\r\n### What is my.js ###\r\n\r\nThis project 'my.js' want to be the ultimate JavaScript module solution\r\nfor everyone. It's based on my thought about module ecosystem from long\r\nlong ago to recent.\r\n\r\nIt's still in alpha phase, but I am working hard and a stable version\r\nwill be available soon.\r\n\r\n\r\n#### Implemented features ####\r\n\r\n* ES6-like module/imports/exports declarations\r\n* Core loader for Node.js\r\n* Core loader for browsers (IE 6+)\r\n\r\n#### Features in near future ####\r\n\r\n* support CommonJS 1.0\r\n* support CMD\r\n\r\n\r\n### Basic Ideas/Requirements ###\r\n\r\n* Let all js be my js\r\n\r\n\t- whatever module spec it follows (CommonJS, AMD, CMD, etc.)\r\n\t- whatever module system it adpoted (RequireJS, SeaJS, JSI, etc.)\r\n\t- whatever script loader it accustomed to (LabJS, JSAN, Google JSAPI ...)\r\n\t- whatever module pattern it used (function wrapper, eg. jQuery ...)\r\n\t- and even for the old module-less script tag\r\n\r\n* Future proof\r\n\r\n\t- based on ES6 module semantics, forward compatible with ES6\r\n\t- support module/imports/exports declarations in ES6-like syntax for ES3-5\r\n\t- auto translate require() to ES6-like imports,\r\n\t  since require() is buzzy and lose the benifits of static bindings\r\n\t- auto analyze exports for wrapped or even naked script,\r\n\t  aka. module-less scripts traditionally loaded by \\<script\\>\r\n\t- allow manually define modules if auto translating/analysis is not enough\r\n\t  accurate or not possible at all\r\n\r\n* Easy to read, write and maintain the module definitions\r\n\r\n\t- define modules with a DSL which use a designed ES3 syntax subset\r\n\t- support both centrelized and distributed module definitions\r\n\t- support both local files/directories and Web URLs\r\n\t- can build buddled packages for different enviroments\r\n\t\t(eg. can generate diff deployment files for diff browsers)\r\n\t- minify the diffs of dev/product via resource mapping rules\r\n\t- limited module version support (to avoid bad practice)\r\n\r\n* Server-solution friendly\r\n\r\n\t- cross-origin proxy\r\n\t- scripts merge and minifier\r\n\t- AMD/CMD wrapper\r\n\t- alternative URLs from cdn\r\n\r\n* Add-ons\r\n\r\n\t- Allow to add code translators such as wrapper, preprocessor, compiler, etc.\r\n\t- Example:\r\n\t\tmodule directive addon allow import/export/module/submodule directives in diff styles\r\n\t\tcoffeescript addon to support coffeescript\r\n\r\n\r\n### Usage ###\r\n\r\n* Browser:\r\n\r\n```html\r\n<head>\r\n\t...\r\n\t<script src=\"http://hax.github.com/my.js\" load=\"app.js\">\r\n\t...\r\n</head>\r\n```\r\n\r\n* Node.js or CommonJS\r\n\r\n```javascript\r\nrequire('my').load('app')\r\n```\r\n\r\n\r\n### Declare module, imports and exports in ES6-like syntax ###\r\n\r\nThough my.js try to support all popular loaders and module systems, I recommand\r\nyou start moving to my.js built-in ES6-like module system, because it is\r\nforward compatible with ES6 and can be auto migrate to ES6 with no pain.\r\nCurrently my.js support two styles of declarations in-box,\r\ndirective prologues (just like 'use strict'), and labeled module statements\r\n(inspired by <https://github.com/labeledmodules/labeled-modules-spec/wiki>)\r\n\r\n```javascript\r\n// math.js (directive prologues)\r\n\r\n'export {sum, pi}'\r\n\r\nfunction sum(x, y) {\r\n\treturn x + y\r\n}\r\nvar pi = 3.14159265\r\n```\r\n```javascript\r\n// math.js (labeled module statements)\r\n\r\nexports: function sum(x, y) {\r\n\treturn x + y\r\n}\r\nexports: var pi = 3.14159265\r\n```\r\n```javascript\r\n// simple client code (directive prologues)\r\n\r\n'import {sum, pi} from \"math.js\"'\r\n\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n```javascript\r\n// simple client code (labeled module statements)\r\n\r\nimports: {sum; pi} from: 'math.js'\r\n\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n\r\nCheat sheet:\r\n```\r\nES6 module statements        my.js directive prologues        my.js labeled module statements\r\n                             * prologues only can occur at    * suffix 's' to avoid reserved keywords\r\n                               the beginning of a file        * use ';' instead of ','\r\n```\r\n```javascript\r\nimport {a, b} from \"m.js\"    'import {a, b} from \"m.js\"'      imports: {a; b} from: \"m.js\"\r\n```\r\n```javascript\r\nimport {a:a1} from \"m1.js\"    'import {a:a1} from \"m1.js\"'    imports: {a:a1} from: \"m1.js\"\r\nimport {a:a2} from \"m2.js\"    'import {a:a2} from \"m2.js\"'    imports: {a:a2} from: \"m2.js\"\r\n```\r\n```javascript\r\nexport function f() {...}    'export f'                       exports: function f() {....}\r\n                             ...\r\n                             function f() {...}\r\n```\r\n```javascript\r\nexport var v                 'export v'                       exports: var v\r\n                             ...\r\n                             var v\r\n```\r\n```javascript\r\nvar a, b                     'export {a, b}'                  var a, b\r\n...                          ...                              ...\r\nexport {a, b}                var a, b                         exports: {a; b}\r\n```\r\n```javascript\r\nvar _a, _b                   'export {a: _a, b: _b}'          var _a, _b\r\n...                          ...                              ...\r\nexport {a: _a, b: _b}        var _a, _b                       exports: {a: _a; b: _b}\r\n```\r\n\r\n\r\n### DSL ###\r\n\r\n```javascript\r\n// define the module _traits_ from local file\r\nmodule ('traits'). at ('traits.js/lib/traits.js')\r\n\r\n// define the module _light_traits_ which follow AMD spec\r\nmodule ('light_traits'). at [AMD] ('traits.js/lib/traits.js')\r\n\r\n// define the module _qwrap_ as naked script and exports the name _QW_\r\nmodule ('qwrap'). at [SCRIPT] ('core_dom_youa.com.js#QW')\r\n\r\n// define the module from the web\r\nmodule ('gloader'). at [SCRIPT] ('https://www.google.com/jsapi#google')\r\n\r\n// define the module from data uri\r\n// NOTE: it makes building deployment version possible and easy,\r\n//       all we need to do is resource mapping\r\nmodule ('sample1'). at ('data:application/javascript,exports.Greeting = {hello:\"world\"}')\r\n\r\n// define another module which use last module\r\nmodule ('sample2'). at ('http://www.example.org/sample2.js')\r\n\r\n// define a cross-origin proxy, so all http requests will be routed to the proxy\r\nresource ('http://*'). from ('/proxy?url=$1')\r\n\r\n// so _sample2_ will be transformed, and just like u write:\r\nmodule ('sample2'). at ('/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl\r\n//       it should be for encoded each mapping step\r\n\r\n// This will be transformed internally to AMD wrapper form just like u write:\r\nmodule ('sample2'). at [AMD] ('amdwrap:/proxy?url=http://www.example.org/sample2.js')\r\n\r\n// Normally, the _amdwrap_ derefernce will be called to wrap code dynamically,\r\n// but you can define a server-generated AMD wrapper\r\nresource ('amdwrap:*'). from ('/amdwrap?url=$1')\r\n\r\n// So, it will transform the _sample2_ to:\r\nmodule ('sample2'). at [AMD] ('/amdwrap?url=/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl\r\n//       it should be for encoded each mapping step\r\n\r\n\r\n// define a resouce mapping rule, so last module will load source from data URI!\r\nresource ('http://www.example.org/sample2.js'). from (\r\n\t\"data:,var G = require('sample1').Greeting; console.info(G.hello);\"\r\n)\r\n\r\n// define another module from legacy scripts\r\nmodule ('sample3').\r\n\timports ('Global.console').\r\n\timports ('Greeting'). // which will be resolve to last _smaple1_ module\r\n\tinclude ('sample/legacy.js'). // content: console.info('Hello' + Greeting.hello)\r\nend\r\n\r\n// define a module delegate to directory, so the modules definitions can be distributed\r\nmodule ('geo'). at ('geo/*')\r\n```\r\n\r\n\r\n### Rational ###\r\n\r\n// TODO\r\n\r\n\r\n### PS. ###\r\n\r\nQ:\tDoes the name 'my.js' have any other meaning?\r\n\r\nA:\tYes, there are many abbrev options, choose what you like,\r\n\tor you can suggest one.\r\n\r\n\t* Module Yes!\r\n\r\n\t* Make happY JavaScript!\r\n\r\n\t* Module Yoga for JavaScript  --- make your body flexible\r\n\r\n\t* Module Yammy!  --- take what match your taste\r\n\r\n\t* Module Yamiedie...\r\n\r\n\r\n","_id":"my@0.3.0","dist":{"shasum":"22db1677007067b7bb73088e997447fc47f8f911","tarball":"https://registry.npmjs.org/my/-/my-0.3.0.tgz","integrity":"sha512-LENDQ1CxLWfe3/N9Tl11AEbc4tT8PkZyyFaEHu8J7uQPRODhc+ZM7NJm6WR+yNZnAyHlQOM39IszgI8qjDVWeA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHKzXQU5o0NMa0iwYIpCHXubRWpMCZpemK1oAqpmNfiaAiAkPpzgTzYfnrGzubcO99sO25Uu2IUEtoY3UzI/wV0kww=="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"hax","email":"hax@heshijun.net"},"maintainers":[{"name":"hax","email":"hax@heshijun.net"}]},"0.3.3":{"name":"my","version":"0.3.3","description":"my JavaScript module system","keywords":["module","loader","import","export"],"author":{"name":"Hax","email":"johnhax@gmail.com","url":"http://johnhax.net/"},"homepage":"http://github.com/hax/my.js","bugs":"http://github.com/hax/my.js/issues","main":"my.js","bin":{"mym":"./cli.js"},"repository":{"type":"git","url":"http://github.com/hax/my.js.git"},"readme":"# my.js #\r\n\r\n\r\n### What is my.js ###\r\n\r\nThis project 'my.js' want to be the ultimate JavaScript module solution\r\nfor everyone. It's based on my thought about module ecosystem from long\r\nlong ago to recent.\r\n\r\nIt's still in alpha phase, but I am working hard and a stable version\r\nwill be available soon.\r\n\r\n\r\n#### Implemented features ####\r\n\r\n* ES6-like module/imports/exports declarations\r\n* Core loader for Node.js\r\n* Core loader for browsers (IE 6+)\r\n\r\n#### Features in near future ####\r\n\r\n* support CommonJS 1.0\r\n* support CMD\r\n\r\n\r\n### Basic Ideas/Requirements ###\r\n\r\n* Let all js be my js\r\n\r\n\t- whatever module spec it follows (CommonJS, AMD, CMD, etc.)\r\n\t- whatever module system it adpoted (RequireJS, SeaJS, JSI, etc.)\r\n\t- whatever script loader it accustomed to (LabJS, JSAN, Google JSAPI ...)\r\n\t- whatever module pattern it used (function wrapper, eg. jQuery ...)\r\n\t- and even for the old module-less script tag\r\n\r\n* Future proof\r\n\r\n\t- based on ES6 module semantics, forward compatible with ES6\r\n\t- support module/imports/exports declarations in ES6-like syntax for ES3-5\r\n\t- auto translate require() to ES6-like imports,\r\n\t  since require() is buzzy and lose the benifits of static bindings\r\n\t- auto analyze exports for wrapped or even naked script,\r\n\t  aka. module-less scripts traditionally loaded by script tag\r\n\t- allow manually define modules if auto translating/analysis is not enough\r\n\t  accurate or not possible at all\r\n\r\n* Easy to read, write and maintain the module definitions\r\n\r\n\t- define modules with a DSL which use a designed ES3 syntax subset\r\n\t- support both centrelized and distributed module definitions\r\n\t- support both local files/directories and Web URLs\r\n\t- can build buddled packages for different enviroments\r\n\t\t(eg. can generate diff deployment files for diff browsers)\r\n\t- minify the diffs of dev/product via resource mapping rules\r\n\t- limited module version support (to avoid bad practice)\r\n\r\n* Server-solution friendly\r\n\r\n\t- cross-origin proxy\r\n\t- scripts merge and minifier\r\n\t- AMD/CMD wrapper\r\n\t- alternative URLs from cdn\r\n\r\n* Add-ons\r\n\r\n\t- Allow to add code translators such as wrapper, preprocessor, compiler, etc.\r\n\t- Example:\r\n\t\tmodule directive addon allow import/export/module/submodule directives in diff styles\r\n\t\tcoffeescript addon to support coffeescript\r\n\r\n\r\n### Usage ###\r\n\r\n* Browser:\r\n\r\n```html\r\n<head>\r\n\t...\r\n\t<script src=\"http://hax.github.com/my.js\" load=\"app.js\">\r\n\t...\r\n</head>\r\n```\r\n\r\n**NOTE:**\r\n\tBrowser feature is unfinished, currently you should use\r\n\t```<script src=\"./dist/my.browser.js\">```\r\n\tfor standard browsers (IE 9+), or\r\n\t```<script src=\"./dist/my.browser.legacy.js\">```\r\n\tfor legacy browsers (IE 6, 7, 8)\r\n\r\n\r\n* Node.js or CommonJS\r\n\r\n```javascript\r\nrequire('my').load('app')\r\n```\r\n\r\n\r\n### Declare module, imports and exports in ES6-like syntax ###\r\n\r\nThough my.js try to support all popular loaders and module systems, I recommand\r\nyou start moving to my.js built-in ES6-like module system, because it is\r\nforward compatible with ES6 and can be auto migrate to ES6 with no pain.\r\nCurrently my.js support two styles of declarations in-box,\r\ndirective prologues (just like 'use strict'), and labeled module statements\r\n(inspired by <https://github.com/labeledmodules/labeled-modules-spec/wiki>)\r\n\r\n**NOTE:\r\n\tCurrently (v0.3.3), only labeled module statements is implemented!\r\n\tDirective prologues will be added in next version!**\r\n\r\n```javascript\r\n// math.js (directive prologues)\r\n\r\n'export {sum, pi}'\r\n\r\nfunction sum(x, y) {\r\n\treturn x + y\r\n}\r\nvar pi = 3.14159265\r\n```\r\n```javascript\r\n// math.js (labeled module statements)\r\n\r\nexports: function sum(x, y) {\r\n\treturn x + y\r\n}\r\nexports: var pi = 3.14159265\r\n```\r\n```javascript\r\n// simple client code (directive prologues)\r\n\r\n'import {sum, pi} from \"math.js\"'\r\n\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n```javascript\r\n// simple client code (labeled module statements)\r\n\r\nimports: {sum; pi} from: 'math.js'\r\n\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n\r\nCheat sheet:\r\n```\r\nES6 module statements        my.js directive prologues        my.js labeled module statements\r\n                             * prologues only can occur at    * suffix 's' to avoid reserved keywords\r\n                               the beginning of a file        * use ';' instead of ','\r\n```\r\n```javascript\r\nimport {a, b} from \"m.js\"    'import {a, b} from \"m.js\"'      imports: {a; b} from: \"m.js\"\r\n```\r\n```javascript\r\nimport {a:a1} from \"m1.js\"    'import {a:a1} from \"m1.js\"'    imports: {a:a1} from: \"m1.js\"\r\nimport {a:a2} from \"m2.js\"    'import {a:a2} from \"m2.js\"'    imports: {a:a2} from: \"m2.js\"\r\n```\r\n```javascript\r\nexport function f() {...}    'export f'                       exports: function f() {....}\r\n                             ...\r\n                             function f() {...}\r\n```\r\n```javascript\r\nexport var v                 'export v'                       exports: var v\r\n                             ...\r\n                             var v\r\n```\r\n```javascript\r\nvar a, b                     'export {a, b}'                  var a, b\r\n...                          ...                              ...\r\nexport {a, b}                var a, b                         exports: {a; b}\r\n```\r\n```javascript\r\nvar _a, _b                   'export {a: _a, b: _b}'          var _a, _b\r\n...                          ...                              ...\r\nexport {a: _a, b: _b}        var _a, _b                       exports: {a: _a; b: _b}\r\n```\r\n\r\n\r\n### DSL ###\r\n\r\n**Not implemented yet!**\r\n\r\n```javascript\r\n// define the module _traits_ from local file\r\nmodule ('traits'). at ('traits.js/lib/traits.js')\r\n\r\n// define the module _light_traits_ which follow AMD spec\r\nmodule ('light_traits'). at [AMD] ('traits.js/lib/traits.js')\r\n\r\n// define the module _qwrap_ as naked script and exports the name _QW_\r\nmodule ('qwrap'). at [SCRIPT] ('core_dom_youa.com.js#QW')\r\n\r\n// define the module from the web\r\nmodule ('gloader'). at [SCRIPT] ('https://www.google.com/jsapi#google')\r\n\r\n// define the module from data uri\r\n// NOTE: it makes building deployment version possible and easy,\r\n//       all we need to do is resource mapping\r\nmodule ('sample1'). at ('data:application/javascript,exports.Greeting = {hello:\"world\"}')\r\n\r\n// define another module which use last module\r\nmodule ('sample2'). at ('http://www.example.org/sample2.js')\r\n\r\n// define a cross-origin proxy, so all http requests will be routed to the proxy\r\nresource ('http://*'). from ('/proxy?url=$1')\r\n\r\n// so _sample2_ will be transformed, and just like u write:\r\nmodule ('sample2'). at ('/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl\r\n//       it should be for encoded each mapping step\r\n\r\n// This will be transformed internally to AMD wrapper form just like u write:\r\nmodule ('sample2'). at [AMD] ('amdwrap:/proxy?url=http://www.example.org/sample2.js')\r\n\r\n// Normally, the _amdwrap_ derefernce will be called to wrap code dynamically,\r\n// but you can define a server-generated AMD wrapper\r\nresource ('amdwrap:*'). from ('/amdwrap?url=$1')\r\n\r\n// So, it will transform the _sample2_ to:\r\nmodule ('sample2'). at [AMD] ('/amdwrap?url=/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl\r\n//       it should be for encoded each mapping step\r\n\r\n\r\n// define a resouce mapping rule, so last module will load source from data URI!\r\nresource ('http://www.example.org/sample2.js'). from (\r\n\t\"data:,var G = require('sample1').Greeting; console.info(G.hello);\"\r\n)\r\n\r\n// define another module from legacy scripts\r\nmodule ('sample3').\r\n\timports ('Global.console').\r\n\timports ('Greeting'). // which will be resolve to last _smaple1_ module\r\n\tinclude ('sample/legacy.js'). // content: console.info('Hello' + Greeting.hello)\r\nend\r\n\r\n// define a module delegate to directory, so the modules definitions can be distributed\r\nmodule ('geo'). at ('geo/*')\r\n```\r\n\r\n\r\n### Rational ###\r\n\r\n// TODO\r\n\r\n\r\n### PS. ###\r\n\r\nQ:\tDoes the name 'my.js' have any other meaning?\r\n\r\nA:\tYes, there are many abbrev options, choose what you like,\r\n\tor you can suggest one.\r\n\r\n\t* Module Yes!\r\n\r\n\t* Make happY JavaScript!\r\n\r\n\t* Module Yoga for JavaScript  --- make your body flexible\r\n\r\n\t* Module Yammy!  --- take what match your taste\r\n\r\n\t* Module Yamiedie...\r\n\r\n\r\n","_id":"my@0.3.3","dist":{"shasum":"8b13ee137fd67a005176235b964a445c8ea60f4e","tarball":"https://registry.npmjs.org/my/-/my-0.3.3.tgz","integrity":"sha512-EszU32vCnnVtKOjngSJ7YVod/6ocsB04CU0Eo3UcyI7jWDWw1htWAupwnUcUhjpgEpBXMYUJSp+aB1q8W0IslA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD04w4OQio2pB8FgzW841daUIJDW2R4S/vtCj2dO7OZMgIhAK6WpYNyo/lwL7aQIdh36/joN02mcKZ2yCSnywJdY96D"}]},"_npmVersion":"1.1.59","_npmUser":{"name":"hax","email":"hax@heshijun.net"},"maintainers":[{"name":"hax","email":"hax@heshijun.net"}]}},"readme":"# my.js #\r\n\r\n\r\n### What is my.js ###\r\n\r\nThis project 'my.js' want to be the ultimate JavaScript module solution for \r\neveryone. It's now just some ideas (from long long ago to recently), but I \r\nwill start to implement some features in very soon.\r\n\r\n\r\n### Basic Ideas/Requirements ###\r\n\r\n* Let all js be my js\r\n\t* whatever module spec it follows (CommonJS, AMD, etc.)\r\n\t* whatever module system it adpoted (RequireJS, SeaJS, FlyJS, JSI, etc.)\r\n\t* whatever script loader it accustomed to (LabJS, JSAN, Google JSAPI ...)\r\n\t* whatever module pattern it used (function wrapper, eg. jQuery ...)\r\n\t* and even for the old \\<script\\> files\r\n\r\n* Easy to read, write and maitain the module definitions\r\n\t* define modules with a DSL which use a designed JavaScript syntax subset\r\n\t* support both centrelized and distributed module definition\r\n\t* support both local files/directories and web URLs\r\n\t* can build buddled packages for diff enviroments\r\n\t\t(eg. can generate diff deployment files for diff browsers)\r\n\t* minify the diffs of dev/product via resouce mapping rules\r\n\t* limited module version support (to avoid bad practice)\r\n\r\n* Follow ES6 module draft\r\n\t* Allow define imports/exports statically for the modules\r\n\t* require() is buzzy and lose the benifits of static bindings\r\n\r\n* Server-solution friendly\r\n\t* cross-origin proxy\r\n\t* scripts merge and minifier\r\n\t* AMD wrapper\r\n\t* alternative URLs from cdn\r\n\t \r\n* Add-ons\r\n\t* Allow to add code translators such as wrapper, preprocessor, \r\n\t  transformer, compiler, etc.\r\n\t* Example: module directive addon\r\n\t\tallow import/export/module/submoudle directives in diff styles\r\n\r\n\t\t\r\n### Usage ###\r\n\r\n* Browser:\r\n\r\n```html\r\n<head>\r\n\t...\r\n\t<script src=\"http://hax.github.com/my.js\" load=\"app.js\">\r\n\t...\r\n</head>\r\n```\r\n\r\n* Node.js or CommonJS\r\n\r\n```javascript\r\nrequire('my').load('app')\r\n```\r\n\r\n### DSL ###\r\n\r\n```javascript\r\n// define the module _traits_ from local file\r\nmodule ('traits'). at ('traits.js/lib/traits.js')\r\n\r\n// define the module _light_traits_ which follow AMD spec\r\nmodule ('light_traits'). at [AMD] ('traits.js/lib/traits.js')\r\n\r\n// define the module _qwrap_ as naked script and exports the name _QW_\r\nmodule ('qwrap'). at [SCRIPT] ('core_dom_youa.com.js#QW')\r\n\r\n// define the module from the web\r\nmodule ('gloader'). at [SCRIPT] ('https://www.google.com/jsapi#google')\r\n\r\n// define the module from data uri\r\n// NOTE: it makes building deployment version possible and easy,\r\n//       all we need to do is resource mapping\r\nmodule ('sample1'). at ('data:application/javascript,exports.Greeting = {hello:\"world\"}')\r\n\r\n// define another module which use last module\r\nmodule ('sample2'). at ('http://www.example.org/sample2.js')\r\n\r\n// define a cross-origin proxy, so all http requests will be routed to the proxy\r\nresource ('http://*'). from ('/proxy?url=$1')\r\n\r\n// so _sample2_ will be transformed, and just like u write:\r\nmodule ('sample2'). at ('/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl  \r\n//       it should be for encoded each mapping step\r\n\r\n// This will be transformed internally to AMD wrapper form just like u write:\r\nmodule ('sample2'). at [AMD] ('amdwrap:/proxy?url=http://www.example.org/sample2.js')\r\n\r\n// Normally, the _amdwrap_ derefernce will be called to wrap code dynamically,\r\n// but you can define a server-generated AMD wrapper\r\nresource ('amdwrap:*'). from ('/amdwrap?url=$1')\r\n\r\n// So, it will transform the _sample2_ to:\r\nmodule ('sample2'). at [AMD] ('/amdwrap?url=/proxy?url=http://www.example.org/sample2.js')\r\n// NOTE: url encode is missed here for easy to understand, but in real impl \r\n//       it should be for encoded each mapping step\r\n\r\n\r\n// define a resouce mapping rule, so last module will load source from data URI!\r\nresource ('http://www.example.org/sample2.js'). from (\r\n\t\"data:,var G = require('sample1').Greeting; console.info(G.hello);\"\r\n)\r\n\r\n// define another module from legacy scripts\r\nmodule ('sample3'). \r\n\timports ('Global.console').\r\n\timports ('Greeting'). // which will be resolve to last _smaple1_ module\r\n\tinclude ('sample/legacy.js'). // content: console.info('Hello' + Greeting.hello)\r\nend\r\n\r\n// define a module delegate to directory, so the modules definitions can be distributed\r\nmodule ('geo'). at ('geo/*')\r\n```\r\n\t\t\r\n### Declare module, imports and exports ###\r\n\r\nThough my.js try to support all loaders and module system,\r\nbut I recommand you using my.js built-in module system.\r\nCurrently my.js support two styles of declarations in-box,\r\ndirective prologues (just like 'use strict'), and labeled module statements\r\n(inspired by <https://github.com/labeledmodules/labeled-modules-spec/wiki>)\r\n\r\n```javascript\r\n// math.js (directive prologues)\r\n\t\r\n'export {sum, pi}'\r\n\r\nfunction sum(x, y) {\r\n\treturn x + y\r\n}\r\nvar pi = 3.14159265\r\n```\t\r\n```javascript\r\n// math.js (labeled module statements)\r\n\r\nexports: function sum(x, y) {\r\n\treturn x + y\r\n}\r\nexports: var pi = 3.14159265\r\n```\r\n```javascript\t\r\n// simple client code (directive prologues)\r\n\r\n'import {sum, pi} from \"math.js\"'\r\n\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n```javascript\t\r\n// simple client code (labeled module statements)\r\n\r\nimports: {sum; pi} from: 'math.js'\r\n\t\r\nalert(\"2π = \" + sum(pi, pi))\r\n```\r\n\r\nCheat sheet:\r\n```\r\nES6 module statements        my.js directive prologues        my.js labeled module statements\r\n                             * prologues only can occur at    * suffix 's' to avoid reserved keywords\r\n                               the beginning of a file        * use ';' instead of ','\r\n```\r\n```javascript\r\nimport {a, b} from \"m.js\"    'import {a, b} from \"m.js\"'      imports: {a; b} from: \"m.js\"\r\n```\r\n```javascript\r\nimport {a:a1} from \"m1.js\"    'import {a:a1} from \"m1.js\"'    imports: {a:a1} from: \"m1.js\"\r\nimport {a:a2} from \"m2.js\"    'import {a:a2} from \"m2.js\"'    imports: {a:a2} from: \"m2.js\"\r\n```\r\n```javascript\r\nexport function f() {...}    'export f'                       exports: function f() {....}\r\n                             ...\r\n                             function f() {...}\r\n```\r\n```javascript\r\nexport var v                 'export v'                       exports: var v\r\n                             ...\r\n                             var v\t\t\t\t\t\t\t \r\n```\r\n```javascript\r\nvar a, b                     'export {a, b}'                  var a, b\r\n...                          ...                              ...\r\nexport {a, b}                var a, b                         exports: {a; b}\r\n```\r\n```javascript\r\nvar _a, _b                   'export {a: _a, b: _b}'          var _a, _b\r\n...                          ...                              ...\r\nexport {a: _a, b: _b}        var _a, _b                       exports: {a: _a; b: _b}\r\n```\r\n\r\n### Rational ###\r\n\r\nThere are three basic concept in this module solution:\r\n\r\n1. module\r\n\ta block of reusable code \r\n\r\n2. namespace\r\n\t\r\n3. resource\r\n\tthe code source\r\n\r\n\r\n### PS. ###\r\n\r\nQ:\tDoes the name 'my.js' have any other meaning?\r\n\r\nA:\tYes, there are many abbrev options, choose what you like,\r\n\tor you can suggest one.\r\n\r\n\t* Module Yes!\r\n\r\n\t* Make happY JavaScript!\r\n\t\r\n\t* Module Yoga for JavaScript  --- make your body flexible\r\n\t\r\n\t* Module Yammy!  --- take what match your taste\r\n\t\r\n\t* Module Yamiedie...\r\n\t\r\n \r\n ","maintainers":[{"name":"hax","email":"hax@heshijun.net"}],"time":{"modified":"2022-06-20T15:32:57.345Z","created":"2012-08-28T06:35:46.935Z","0.1.0":"2012-08-28T06:35:52.295Z","0.1.1":"2012-08-28T06:41:34.299Z","0.1.2":"2012-08-28T06:51:06.148Z","0.1.3":"2012-08-28T08:25:17.199Z","0.3.0":"2012-09-21T06:21:29.463Z","0.3.3":"2012-09-24T12:04:04.773Z"},"author":{"name":"Hax","email":"johnhax@gmail.com","url":"http://johnhax.net/"},"repository":{"type":"git","url":"http://github.com/hax/my.js.git"},"users":{"theveil":true}}