Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

various changes and additions

  • Loading branch information...
commit 59139536d2ebdd369e80578b58b2c706f5ebebbe 1 parent 4843560
Christoph Dorn cadorn authored

Showing 101 changed files with 319 additions and 222 deletions. Show diff stats Hide diff stats

  1. +9 0 README.md
  2. 0  examples/{01-LoaderFeatureBundles → 01-CoreLoaderFeatureBundles}/main.js
  3. +1 1  examples/{01-LoaderFeatureBundles → 01-CoreLoaderFeatureBundles}/package.json
  4. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/01-HelloWorld/main.js
  5. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/01-HelloWorld/package.json
  6. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/02-ReturnExports/main.js
  7. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/02-ReturnExports/package.json
  8. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/03-SpecifyMain/init.js
  9. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/03-SpecifyMain/package.json
  10. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/04-PackageLocalDependencies/greetings.js
  11. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/04-PackageLocalDependencies/main.js
  12. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/04-PackageLocalDependencies/package.json
  13. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/04-PackageLocalDependencies/words/hello.js
  14. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/05-CrossPackageDependencies/main.js
  15. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/05-CrossPackageDependencies/package.json
  16. 0  ...2-NodeJSLoaderFeatures → 02-LoaderFeatures}/05-CrossPackageDependencies/packages/packageA/greetings.js
  17. 0  .../{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/05-CrossPackageDependencies/packages/packageA/logger.js
  18. 0  ...2-NodeJSLoaderFeatures → 02-LoaderFeatures}/05-CrossPackageDependencies/packages/packageA/package.json
  19. 0  ...2-NodeJSLoaderFeatures → 02-LoaderFeatures}/05-CrossPackageDependencies/packages/packageB/package.json
  20. 0  ...NodeJSLoaderFeatures → 02-LoaderFeatures}/05-CrossPackageDependencies/packages/packageB/words/hello.js
  21. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/05-CrossPackageDependencies/packages/packageC/H.js
  22. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/06-JsonModule/main.js
  23. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/06-JsonModule/package.json
  24. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/06-JsonModule/word.js
  25. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/07-TextModule/hello.txt
  26. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/07-TextModule/main.js
  27. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/07-TextModule/package.json
  28. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/08-ResourceURI/hello.txt
  29. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/08-ResourceURI/main.js
  30. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/08-ResourceURI/package.json
  31. +1 1  ...02-NodeJSLoaderFeatures/09-LoadBundle/ExtraBundle.js → 02-LoaderFeatures/09-LoadBundle/ExtraModule.js}
  32. +27 0 examples/02-LoaderFeatures/09-LoadBundle/main.js
  33. +1 1  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/09-LoadBundle/package.json
  34. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/10-Sandbox/SandboxedExtraBundle.js
  35. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/10-Sandbox/main.js
  36. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/10-Sandbox/package.json
  37. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/11-CrossDomain/main.js
  38. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/11-CrossDomain/package.json
  39. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/12-Environment/main.js
  40. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/12-Environment/package.json
  41. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/13-AssignExports/main.js
  42. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/13-AssignExports/package.json
  43. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/Avoid-VariableRequire/lib.js
  44. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/Avoid-VariableRequire/main.js
  45. 0  examples/{02-NodeJSLoaderFeatures → 02-LoaderFeatures}/Avoid-VariableRequire/package.json
  46. +0 27 examples/02-NodeJSLoaderFeatures/09-LoadBundle/main.js
  47. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/01-HelloWorld.js
  48. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/02-ReturnExports.js
  49. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/03-SpecifyMain.js
  50. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/04-PackageLocalDependencies.js
  51. +16 16 examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/05-CrossPackageDependencies.js
  52. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/06-JsonModule.js
  53. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/07-TextModule.js
  54. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/08-ResourceURI.js
  55. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/08-ResourceURI/hello.txt
  56. +5 5 examples/{04-NodeJSPlatformFeatures/02-BundlerMiddleware → 03-LoaderFeatureBundles}/dist/09-LoadBundle.js
  57. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/09-LoadBundle/ExtraBundle.js
  58. +18 0 examples/03-LoaderFeatureBundles/dist/09-LoadBundle/ExtraModule.js
  59. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/10-Sandbox.js
  60. 0  ...ples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/10-Sandbox/SandboxedExtraBundle.js
  61. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/11-CrossDomain.js
  62. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/12-Environment.js
  63. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/13-AssignExports.js
  64. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/Avoid-VariableRequire.js
  65. 0  examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/dist/Avoid-VariableRequire/lib.js
  66. +3 3 examples/{03-NodeJSLoaderFeatureBundles → 03-LoaderFeatureBundles}/main.js
  67. +14 0 examples/03-LoaderFeatureBundles/package.json
  68. +0 14 examples/03-NodeJSLoaderFeatureBundles/package.json
  69. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/01-Globals/main.js
  70. +1 1  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/01-Globals/package.json
  71. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/01-HelloWorld.js
  72. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/02-ReturnExports.js
  73. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/03-SpecifyMain.js
  74. 0  ...NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/04-PackageLocalDependencies.js
  75. +16 16 ...NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/05-CrossPackageDependencies.js
  76. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/06-JsonModule.js
  77. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/07-TextModule.js
  78. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/08-ResourceURI.js
  79. 0  ...s/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/08-ResourceURI/hello.txt
  80. +5 5 examples/{03-NodeJSLoaderFeatureBundles → 04-PlatformFeatures/02-BundlerMiddleware}/dist/09-LoadBundle.js
  81. 0  ...4-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/09-LoadBundle/ExtraBundle.js
  82. +18 0 examples/04-PlatformFeatures/02-BundlerMiddleware/dist/09-LoadBundle/ExtraModule.js
  83. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/10-Sandbox.js
  84. 0  ...JSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/10-Sandbox/SandboxedExtraBundle.js
  85. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/11-CrossDomain.js
  86. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/12-Environment.js
  87. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/dist/13-AssignExports.js
  88. +1 1  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/main.js
  89. +1 1  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/package.json
  90. +1 1  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/02-BundlerMiddleware/test.js
  91. 0  examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/main.js
  92. +3 2 examples/{04-NodeJSPlatformFeatures → 04-PlatformFeatures}/package.json
  93. +1 1  examples/{05-NodeJSPlatformFeatureBundles → 05-PlatformFeatureBundles}/dist/01-Globals.js
  94. +1 1  examples/{05-NodeJSPlatformFeatureBundles → 05-PlatformFeatureBundles}/main.js
  95. +1 1  examples/{05-NodeJSPlatformFeatureBundles → 05-PlatformFeatureBundles}/package.json
  96. +43 34 lib/bundler.js
  97. +5 0 loader.js
  98. +1 1  package.json
  99. +7 3 tests/adapter/vows.js
  100. +113 85 tests/examples.js
  101. +6 1 tests/test-helper.js
9 README.md
Source Rendered
@@ -12,6 +12,7 @@ Everything needed to use the [Sourcemint](http://sourcemint.com/) Ecosystem
12 12 * Sponsor: [Sourcemint](http://sourcemint.com/)
13 13 * Mailing list: [groups.google.com/group/sourcemint](http://groups.google.com/group/sourcemint)
14 14
  15 +
15 16 Usage
16 17 =====
17 18
@@ -20,4 +21,12 @@ Usage
20 21 npm install
21 22 npm test
22 23
  24 +
  25 +Examples
  26 +========
  27 +
  28 +There are various examples that double as unit tests in `./examples`.
  29 +
  30 +For end-user examples of common use-cases see [github.com/sourcemint/examples-js](http://github.com/sourcemint/examples-js/).
  31 +
23 32 More examples and documentation will be available in time.
0  examples/01-LoaderFeatureBundles/main.js → examples/01-CoreLoaderFeatureBundles/main.js
File renamed without changes
2  examples/01-LoaderFeatureBundles/package.json → examples/01-CoreLoaderFeatureBundles/package.json
... ... @@ -1,5 +1,5 @@
1 1 {
2   - "name": "sourcemint-platform-nodejs-examples-01-LoaderFeatureBundles",
  2 + "name": "sourcemint-platform-nodejs-examples-01-CoreLoaderFeatureBundles",
3 3 "version": "0.1.0",
4 4 "engines": {
5 5 "nodejs": "0.x"
0  ...les/02-NodeJSLoaderFeatures/01-HelloWorld/main.js → examples/02-LoaderFeatures/01-HelloWorld/main.js
File renamed without changes
0  ...2-NodeJSLoaderFeatures/01-HelloWorld/package.json → ...ples/02-LoaderFeatures/01-HelloWorld/package.json
File renamed without changes
0  .../02-NodeJSLoaderFeatures/02-ReturnExports/main.js → examples/02-LoaderFeatures/02-ReturnExports/main.js
File renamed without changes
0  ...odeJSLoaderFeatures/02-ReturnExports/package.json → ...s/02-LoaderFeatures/02-ReturnExports/package.json
File renamed without changes
0  ...es/02-NodeJSLoaderFeatures/03-SpecifyMain/init.js → examples/02-LoaderFeatures/03-SpecifyMain/init.js
File renamed without changes
0  ...-NodeJSLoaderFeatures/03-SpecifyMain/package.json → ...les/02-LoaderFeatures/03-SpecifyMain/package.json
File renamed without changes
0  ...Features/04-PackageLocalDependencies/greetings.js → ...Features/04-PackageLocalDependencies/greetings.js
File renamed without changes
0  ...oaderFeatures/04-PackageLocalDependencies/main.js → ...oaderFeatures/04-PackageLocalDependencies/main.js
File renamed without changes
0  ...Features/04-PackageLocalDependencies/package.json → ...Features/04-PackageLocalDependencies/package.json
File renamed without changes
0  ...atures/04-PackageLocalDependencies/words/hello.js → ...atures/04-PackageLocalDependencies/words/hello.js
File renamed without changes
0  ...oaderFeatures/05-CrossPackageDependencies/main.js → ...oaderFeatures/05-CrossPackageDependencies/main.js
File renamed without changes
0  ...Features/05-CrossPackageDependencies/package.json → ...Features/05-CrossPackageDependencies/package.json
File renamed without changes
0  ...ackageDependencies/packages/packageA/greetings.js → ...ackageDependencies/packages/packageA/greetings.js
File renamed without changes
0  ...ssPackageDependencies/packages/packageA/logger.js → ...ssPackageDependencies/packages/packageA/logger.js
File renamed without changes
0  ...ackageDependencies/packages/packageA/package.json → ...ackageDependencies/packages/packageA/package.json
File renamed without changes
0  ...ackageDependencies/packages/packageB/package.json → ...ackageDependencies/packages/packageB/package.json
File renamed without changes
0  ...kageDependencies/packages/packageB/words/hello.js → ...kageDependencies/packages/packageB/words/hello.js
File renamed without changes
0  ...5-CrossPackageDependencies/packages/packageC/H.js → ...5-CrossPackageDependencies/packages/packageC/H.js
File renamed without changes
0  ...les/02-NodeJSLoaderFeatures/06-JsonModule/main.js → examples/02-LoaderFeatures/06-JsonModule/main.js
File renamed without changes
0  ...2-NodeJSLoaderFeatures/06-JsonModule/package.json → ...ples/02-LoaderFeatures/06-JsonModule/package.json
File renamed without changes
0  ...les/02-NodeJSLoaderFeatures/06-JsonModule/word.js → examples/02-LoaderFeatures/06-JsonModule/word.js
File renamed without changes
0  ...s/02-NodeJSLoaderFeatures/07-TextModule/hello.txt → examples/02-LoaderFeatures/07-TextModule/hello.txt
File renamed without changes
0  ...les/02-NodeJSLoaderFeatures/07-TextModule/main.js → examples/02-LoaderFeatures/07-TextModule/main.js
File renamed without changes
0  ...2-NodeJSLoaderFeatures/07-TextModule/package.json → ...ples/02-LoaderFeatures/07-TextModule/package.json
File renamed without changes
0  .../02-NodeJSLoaderFeatures/08-ResourceURI/hello.txt → examples/02-LoaderFeatures/08-ResourceURI/hello.txt
File renamed without changes
0  ...es/02-NodeJSLoaderFeatures/08-ResourceURI/main.js → examples/02-LoaderFeatures/08-ResourceURI/main.js
File renamed without changes
0  ...-NodeJSLoaderFeatures/08-ResourceURI/package.json → ...les/02-LoaderFeatures/08-ResourceURI/package.json
File renamed without changes
2  ...NodeJSLoaderFeatures/09-LoadBundle/ExtraBundle.js → ...es/02-LoaderFeatures/09-LoadBundle/ExtraModule.js
@@ -3,5 +3,5 @@ var MAIN = require("./main.js");
3 3
4 4 exports.init = function()
5 5 {
6   - module.log(MAIN.getExtraBundleGreeting());
  6 + module.log(MAIN.getExtraModuleGreeting());
7 7 }
27 examples/02-LoaderFeatures/09-LoadBundle/main.js
... ... @@ -0,0 +1,27 @@
  1 +
  2 +var Q;
  3 +
  4 +exports.main = function(options)
  5 +{
  6 + Q = require.API.Q;
  7 +
  8 + var result = Q.defer();
  9 +
  10 + module.log("Hello from 09-LoadBundle!");
  11 +
  12 + var extraModuleID = "./ExtraModule";
  13 +
  14 + require.async(extraModuleID, function(EXTRA_MODULE)
  15 + {
  16 + EXTRA_MODULE.init();
  17 +
  18 + result.resolve();
  19 + });
  20 +
  21 + return result.promise;
  22 +}
  23 +
  24 +exports.getExtraModuleGreeting = function()
  25 +{
  26 + return "Hello from 09-LoadBundle/ExtraModule!";
  27 +}
2  ...2-NodeJSLoaderFeatures/09-LoadBundle/package.json → ...ples/02-LoaderFeatures/09-LoadBundle/package.json
@@ -5,7 +5,7 @@
5 5 "adapter": "github.com/sourcemint/platform-nodejs/0",
6 6 "resolvers": {
7 7 "/main.js": [
8   - "./ExtraBundle.js"
  8 + "./ExtraModule.js"
9 9 ]
10 10 }
11 11 }
0  ...LoaderFeatures/10-Sandbox/SandboxedExtraBundle.js → ...LoaderFeatures/10-Sandbox/SandboxedExtraBundle.js
File renamed without changes
0  examples/02-NodeJSLoaderFeatures/10-Sandbox/main.js → examples/02-LoaderFeatures/10-Sandbox/main.js
File renamed without changes
0  ...s/02-NodeJSLoaderFeatures/10-Sandbox/package.json → examples/02-LoaderFeatures/10-Sandbox/package.json
File renamed without changes
0  ...es/02-NodeJSLoaderFeatures/11-CrossDomain/main.js → examples/02-LoaderFeatures/11-CrossDomain/main.js
File renamed without changes
0  ...-NodeJSLoaderFeatures/11-CrossDomain/package.json → ...les/02-LoaderFeatures/11-CrossDomain/package.json
File renamed without changes
0  ...es/02-NodeJSLoaderFeatures/12-Environment/main.js → examples/02-LoaderFeatures/12-Environment/main.js
File renamed without changes
0  ...-NodeJSLoaderFeatures/12-Environment/package.json → ...les/02-LoaderFeatures/12-Environment/package.json
File renamed without changes
0  .../02-NodeJSLoaderFeatures/13-AssignExports/main.js → examples/02-LoaderFeatures/13-AssignExports/main.js
File renamed without changes
0  ...odeJSLoaderFeatures/13-AssignExports/package.json → ...s/02-LoaderFeatures/13-AssignExports/package.json
File renamed without changes
0  ...NodeJSLoaderFeatures/Avoid-VariableRequire/lib.js → ...es/02-LoaderFeatures/Avoid-VariableRequire/lib.js
File renamed without changes
0  ...odeJSLoaderFeatures/Avoid-VariableRequire/main.js → ...s/02-LoaderFeatures/Avoid-VariableRequire/main.js
File renamed without changes
0  ...LoaderFeatures/Avoid-VariableRequire/package.json → ...LoaderFeatures/Avoid-VariableRequire/package.json
File renamed without changes
27 examples/02-NodeJSLoaderFeatures/09-LoadBundle/main.js
... ... @@ -1,27 +0,0 @@
1   -
2   -var Q;
3   -
4   -exports.main = function(options)
5   -{
6   - Q = require.API.Q;
7   -
8   - var result = Q.defer();
9   -
10   - module.log("Hello from 09-LoadBundle!");
11   -
12   - var extraBundleID = "./ExtraBundle";
13   -
14   - require.async(extraBundleID, function(EXTRA_BUNDLE)
15   - {
16   - EXTRA_BUNDLE.init();
17   -
18   - result.resolve();
19   - });
20   -
21   - return result.promise;
22   -}
23   -
24   -exports.getExtraBundleGreeting = function()
25   -{
26   - return "Hello from 09-LoadBundle/ExtraBundle!";
27   -}
0  ...-NodeJSLoaderFeatureBundles/dist/01-HelloWorld.js → ...les/03-LoaderFeatureBundles/dist/01-HelloWorld.js
File renamed without changes
0  ...deJSLoaderFeatureBundles/dist/02-ReturnExports.js → .../03-LoaderFeatureBundles/dist/02-ReturnExports.js
File renamed without changes
0  ...NodeJSLoaderFeatureBundles/dist/03-SpecifyMain.js → ...es/03-LoaderFeatureBundles/dist/03-SpecifyMain.js
File renamed without changes
0  ...eatureBundles/dist/04-PackageLocalDependencies.js → ...eatureBundles/dist/04-PackageLocalDependencies.js
File renamed without changes
32 ...eatureBundles/dist/05-CrossPackageDependencies.js → ...eatureBundles/dist/05-CrossPackageDependencies.js
@@ -16,10 +16,10 @@ require.bundle("", function(require)
16 16 }
17 17
18 18 });
19   - require.memoize("7560b93e78b4e2a0c520988986f530a1c49b5229/greetings.js", function(require, exports, module)
  19 + require.memoize("c8fdbfb58ba344e241f350f4db644a5ca402b3bb/greetings.js", function(require, exports, module)
20 20 {
21   - var __filename = require.sandbox.id + "7560b93e78b4e2a0c520988986f530a1c49b5229/greetings.js";
22   - var __dirname = require.sandbox.id + "/7560b93e78b4e2a0c520988986f530a1c49b5229";
  21 + var __filename = require.sandbox.id + "c8fdbfb58ba344e241f350f4db644a5ca402b3bb/greetings.js";
  22 + var __dirname = require.sandbox.id + "/c8fdbfb58ba344e241f350f4db644a5ca402b3bb";
23 23
24 24 var HELLO = require("package/hello");
25 25
@@ -34,10 +34,10 @@ require.bundle("", function(require)
34 34 }
35 35
36 36 });
37   - require.memoize("7560b93e78b4e2a0c520988986f530a1c49b5229/logger.js", function(require, exports, module)
  37 + require.memoize("c8fdbfb58ba344e241f350f4db644a5ca402b3bb/logger.js", function(require, exports, module)
38 38 {
39   - var __filename = require.sandbox.id + "7560b93e78b4e2a0c520988986f530a1c49b5229/logger.js";
40   - var __dirname = require.sandbox.id + "/7560b93e78b4e2a0c520988986f530a1c49b5229";
  39 + var __filename = require.sandbox.id + "c8fdbfb58ba344e241f350f4db644a5ca402b3bb/logger.js";
  40 + var __dirname = require.sandbox.id + "/c8fdbfb58ba344e241f350f4db644a5ca402b3bb";
41 41
42 42 exports.log = function(message)
43 43 {
@@ -45,10 +45,10 @@ require.bundle("", function(require)
45 45 }
46 46
47 47 });
48   - require.memoize("19819d780486f6050197ad891f5e90ba86dbd38f/words/hello.js", function(require, exports, module)
  48 + require.memoize("8006e010fb60da2be1a5ad691d389c8a3146127e/words/hello.js", function(require, exports, module)
49 49 {
50   - var __filename = require.sandbox.id + "19819d780486f6050197ad891f5e90ba86dbd38f/words/hello.js";
51   - var __dirname = require.sandbox.id + "/19819d780486f6050197ad891f5e90ba86dbd38f/words";
  50 + var __filename = require.sandbox.id + "8006e010fb60da2be1a5ad691d389c8a3146127e/words/hello.js";
  51 + var __dirname = require.sandbox.id + "/8006e010fb60da2be1a5ad691d389c8a3146127e/words";
52 52
53 53 var GREETINGS = require("package/greetings");
54 54
@@ -63,10 +63,10 @@ require.bundle("", function(require)
63 63 }
64 64
65 65 });
66   - require.memoize("5390a08ebb853e94c69c041a471086f0d3e7d61f/H.js", function(require, exports, module)
  66 + require.memoize("91dc444cfecc833c728374ac4dc405a612d304f0/H.js", function(require, exports, module)
67 67 {
68   - var __filename = require.sandbox.id + "5390a08ebb853e94c69c041a471086f0d3e7d61f/H.js";
69   - var __dirname = require.sandbox.id + "/5390a08ebb853e94c69c041a471086f0d3e7d61f";
  68 + var __filename = require.sandbox.id + "91dc444cfecc833c728374ac4dc405a612d304f0/H.js";
  69 + var __dirname = require.sandbox.id + "/91dc444cfecc833c728374ac4dc405a612d304f0";
70 70
71 71 exports.getLetter = function()
72 72 {
@@ -74,8 +74,8 @@ require.bundle("", function(require)
74 74 }
75 75
76 76 });
77   - require.memoize("/package.json", {"main":"/main.js","mappings":{"helpers":"7560b93e78b4e2a0c520988986f530a1c49b5229"},"directories":{"lib":""}});
78   - require.memoize("7560b93e78b4e2a0c520988986f530a1c49b5229/package.json", {"mappings":{"package":"19819d780486f6050197ad891f5e90ba86dbd38f"},"directories":{"lib":""}});
79   - require.memoize("19819d780486f6050197ad891f5e90ba86dbd38f/package.json", {"mappings":{"package":"7560b93e78b4e2a0c520988986f530a1c49b5229","letters":"5390a08ebb853e94c69c041a471086f0d3e7d61f"},"directories":{"lib":"words"}});
80   - require.memoize("5390a08ebb853e94c69c041a471086f0d3e7d61f/package.json", {"directories":{"lib":""},"mappings":{}});
  77 + require.memoize("/package.json", {"main":"/main.js","mappings":{"helpers":"c8fdbfb58ba344e241f350f4db644a5ca402b3bb"},"directories":{"lib":""}});
  78 + require.memoize("c8fdbfb58ba344e241f350f4db644a5ca402b3bb/package.json", {"mappings":{"package":"8006e010fb60da2be1a5ad691d389c8a3146127e"},"directories":{"lib":""}});
  79 + require.memoize("8006e010fb60da2be1a5ad691d389c8a3146127e/package.json", {"mappings":{"package":"c8fdbfb58ba344e241f350f4db644a5ca402b3bb","letters":"91dc444cfecc833c728374ac4dc405a612d304f0"},"directories":{"lib":"words"}});
  80 + require.memoize("91dc444cfecc833c728374ac4dc405a612d304f0/package.json", {"directories":{"lib":""},"mappings":{}});
81 81 });
0  ...-NodeJSLoaderFeatureBundles/dist/06-JsonModule.js → ...les/03-LoaderFeatureBundles/dist/06-JsonModule.js
File renamed without changes
0  ...-NodeJSLoaderFeatureBundles/dist/07-TextModule.js → ...les/03-LoaderFeatureBundles/dist/07-TextModule.js
File renamed without changes
0  ...NodeJSLoaderFeatureBundles/dist/08-ResourceURI.js → ...es/03-LoaderFeatureBundles/dist/08-ResourceURI.js
File renamed without changes
0  ...oaderFeatureBundles/dist/08-ResourceURI/hello.txt → ...oaderFeatureBundles/dist/08-ResourceURI/hello.txt
File renamed without changes
10 ...atures/02-BundlerMiddleware/dist/09-LoadBundle.js → ...les/03-LoaderFeatureBundles/dist/09-LoadBundle.js
@@ -16,11 +16,11 @@ require.bundle("", function(require)
16 16
17 17 module.log("Hello from 09-LoadBundle!");
18 18
19   - var extraBundleID = "./ExtraBundle";
  19 + var extraModuleID = "./ExtraModule";
20 20
21   - require.async(extraBundleID, function(EXTRA_BUNDLE)
  21 + require.async(extraModuleID, function(EXTRA_MODULE)
22 22 {
23   - EXTRA_BUNDLE.init();
  23 + EXTRA_MODULE.init();
24 24
25 25 result.resolve();
26 26 });
@@ -28,9 +28,9 @@ require.bundle("", function(require)
28 28 return result.promise;
29 29 }
30 30
31   - exports.getExtraBundleGreeting = function()
  31 + exports.getExtraModuleGreeting = function()
32 32 {
33   - return "Hello from 09-LoadBundle/ExtraBundle!";
  33 + return "Hello from 09-LoadBundle/ExtraModule!";
34 34 }
35 35
36 36 });
0  ...rFeatureBundles/dist/09-LoadBundle/ExtraBundle.js → ...rFeatureBundles/dist/09-LoadBundle/ExtraBundle.js
File renamed without changes
18 examples/03-LoaderFeatureBundles/dist/09-LoadBundle/ExtraModule.js
... ... @@ -0,0 +1,18 @@
  1 +require.bundle("", function(require)
  2 +{
  3 +
  4 + require.memoize("/ExtraModule.js", function(require, exports, module)
  5 + {
  6 + var __filename = require.sandbox.id + "/ExtraModule.js";
  7 + var __dirname = require.sandbox.id + "";
  8 +
  9 + var MAIN = require("./main.js");
  10 +
  11 + exports.init = function()
  12 + {
  13 + module.log(MAIN.getExtraModuleGreeting());
  14 + }
  15 +
  16 + });
  17 + require.memoize("/package.json", {"main":"/ExtraModule.js","directories":{"lib":""},"mappings":{}});
  18 +});
0  .../03-NodeJSLoaderFeatureBundles/dist/10-Sandbox.js → examples/03-LoaderFeatureBundles/dist/10-Sandbox.js
File renamed without changes
0  ...reBundles/dist/10-Sandbox/SandboxedExtraBundle.js → ...reBundles/dist/10-Sandbox/SandboxedExtraBundle.js
File renamed without changes
0  ...NodeJSLoaderFeatureBundles/dist/11-CrossDomain.js → ...es/03-LoaderFeatureBundles/dist/11-CrossDomain.js
File renamed without changes
0  ...NodeJSLoaderFeatureBundles/dist/12-Environment.js → ...es/03-LoaderFeatureBundles/dist/12-Environment.js
File renamed without changes
0  ...deJSLoaderFeatureBundles/dist/13-AssignExports.js → .../03-LoaderFeatureBundles/dist/13-AssignExports.js
File renamed without changes
0  ...oaderFeatureBundles/dist/Avoid-VariableRequire.js → ...oaderFeatureBundles/dist/Avoid-VariableRequire.js
File renamed without changes
0  ...rFeatureBundles/dist/Avoid-VariableRequire/lib.js → ...rFeatureBundles/dist/Avoid-VariableRequire/lib.js
File renamed without changes
6 examples/03-NodeJSLoaderFeatureBundles/main.js → examples/03-LoaderFeatureBundles/main.js
... ... @@ -1,7 +1,7 @@
1 1
2   -var LOADER = require("sourcemint-platform-nodejs/lib/loader"),
  2 +var LOADER = require("sourcemint-platform-nodejs/loader"),
3 3 ERROR = require("sourcemint-platform-nodejs/lib/util/error"),
4   - BUNDLER = require("sourcemint-bundler-js/lib/bundler"),
  4 + BUNDLER = require("sourcemint-platform-nodejs/lib/bundler"),
5 5 EXAMPLES = require("sourcemint-loader-js/tests/examples"),
6 6 PATH = require("path"),
7 7 FS = require("fs");
@@ -11,7 +11,7 @@ exports.main = function()
11 11 {
12 12 var done = Q.ref();
13 13
14   - var basePath = __dirname + "/../02-NodeJSLoaderFeatures";
  14 + var basePath = __dirname + "/../02-LoaderFeatures";
15 15
16 16 FS.readdirSync(basePath).forEach(function(filename)
17 17 {
14 examples/03-LoaderFeatureBundles/package.json
... ... @@ -0,0 +1,14 @@
  1 +{
  2 + "name": "sourcemint-platform-nodejs-examples-03-LoaderFeatureBundles",
  3 + "version": "0.1.0",
  4 + "engines": {
  5 + "nodejs": "0.x"
  6 + },
  7 + "dependencies": {
  8 + "sourcemint-loader-js": "0.x",
  9 + "sourcemint-platform-nodejs": "0.x"
  10 + },
  11 + "scripts": {
  12 + "test": "node main"
  13 + }
  14 +}
14 examples/03-NodeJSLoaderFeatureBundles/package.json
... ... @@ -1,14 +0,0 @@
1   -{
2   - "name": "sourcemint-platform-nodejs-examples-03-NodeJSLoaderFeatureBundles",
3   - "version": "0.1.0",
4   - "engines": {
5   - "nodejs": "0.x"
6   - },
7   - "dependencies": {
8   - "sourcemint-platform-nodejs": "0.x",
9   - "sourcemint-bundler-js": "0.x"
10   - },
11   - "scripts": {
12   - "test": "node main"
13   - }
14   -}
0  ...ples/04-NodeJSPlatformFeatures/01-Globals/main.js → examples/04-PlatformFeatures/01-Globals/main.js
File renamed without changes
2  ...04-NodeJSPlatformFeatures/01-Globals/package.json → examples/04-PlatformFeatures/01-Globals/package.json
... ... @@ -1,5 +1,5 @@
1 1 {
2   - "name": "sourcemint-platform-nodejs-examples-04-NodeJSPlatformFeatures-01-Globals",
  2 + "name": "sourcemint-platform-nodejs-examples-04-PlatformFeatures-01-Globals",
3 3 "version": "0.1.0",
4 4 "engines": {
5 5 "nodejs": "0.x"
0  ...atures/02-BundlerMiddleware/dist/01-HelloWorld.js → ...atures/02-BundlerMiddleware/dist/01-HelloWorld.js
File renamed without changes
0  ...res/02-BundlerMiddleware/dist/02-ReturnExports.js → ...res/02-BundlerMiddleware/dist/02-ReturnExports.js
File renamed without changes
0  ...tures/02-BundlerMiddleware/dist/03-SpecifyMain.js → ...tures/02-BundlerMiddleware/dist/03-SpecifyMain.js
File renamed without changes
0  ...lerMiddleware/dist/04-PackageLocalDependencies.js → ...lerMiddleware/dist/04-PackageLocalDependencies.js
File renamed without changes
32 ...lerMiddleware/dist/05-CrossPackageDependencies.js → ...lerMiddleware/dist/05-CrossPackageDependencies.js
@@ -16,10 +16,10 @@ require.bundle("", function(require)
16 16 }
17 17
18 18 });
19   - require.memoize("32ab0c28393c3fbb23863556150045f2e480923f/greetings.js", function(require, exports, module)
  19 + require.memoize("9600bb1b572fba81a38e7d3c0eb638268e6a9d8d/greetings.js", function(require, exports, module)
20 20 {
21   - var __filename = require.sandbox.id + "32ab0c28393c3fbb23863556150045f2e480923f/greetings.js";
22   - var __dirname = require.sandbox.id + "/32ab0c28393c3fbb23863556150045f2e480923f";
  21 + var __filename = require.sandbox.id + "9600bb1b572fba81a38e7d3c0eb638268e6a9d8d/greetings.js";
  22 + var __dirname = require.sandbox.id + "/9600bb1b572fba81a38e7d3c0eb638268e6a9d8d";
23 23
24 24 var HELLO = require("package/hello");
25 25
@@ -34,10 +34,10 @@ require.bundle("", function(require)
34 34 }
35 35
36 36 });
37   - require.memoize("32ab0c28393c3fbb23863556150045f2e480923f/logger.js", function(require, exports, module)
  37 + require.memoize("9600bb1b572fba81a38e7d3c0eb638268e6a9d8d/logger.js", function(require, exports, module)
38 38 {
39   - var __filename = require.sandbox.id + "32ab0c28393c3fbb23863556150045f2e480923f/logger.js";
40   - var __dirname = require.sandbox.id + "/32ab0c28393c3fbb23863556150045f2e480923f";
  39 + var __filename = require.sandbox.id + "9600bb1b572fba81a38e7d3c0eb638268e6a9d8d/logger.js";
  40 + var __dirname = require.sandbox.id + "/9600bb1b572fba81a38e7d3c0eb638268e6a9d8d";
41 41
42 42 exports.log = function(message)
43 43 {
@@ -45,10 +45,10 @@ require.bundle("", function(require)
45 45 }
46 46
47 47 });
48   - require.memoize("981e9adad3c1288b46d8ca93853deddb17e4d55d/words/hello.js", function(require, exports, module)
  48 + require.memoize("80b6bcb59fc2b65675648d0e052b75b4620764ee/words/hello.js", function(require, exports, module)
49 49 {
50   - var __filename = require.sandbox.id + "981e9adad3c1288b46d8ca93853deddb17e4d55d/words/hello.js";
51   - var __dirname = require.sandbox.id + "/981e9adad3c1288b46d8ca93853deddb17e4d55d/words";
  50 + var __filename = require.sandbox.id + "80b6bcb59fc2b65675648d0e052b75b4620764ee/words/hello.js";
  51 + var __dirname = require.sandbox.id + "/80b6bcb59fc2b65675648d0e052b75b4620764ee/words";
52 52
53 53 var GREETINGS = require("package/greetings");
54 54
@@ -63,10 +63,10 @@ require.bundle("", function(require)
63 63 }
64 64
65 65 });
66   - require.memoize("bc674b2edd42208f9c5e2bae8e66aa32b6eda600/H.js", function(require, exports, module)
  66 + require.memoize("aa0b8cfbcfff960996a8692caee6ae43f33d6a67/H.js", function(require, exports, module)
67 67 {
68   - var __filename = require.sandbox.id + "bc674b2edd42208f9c5e2bae8e66aa32b6eda600/H.js";
69   - var __dirname = require.sandbox.id + "/bc674b2edd42208f9c5e2bae8e66aa32b6eda600";
  68 + var __filename = require.sandbox.id + "aa0b8cfbcfff960996a8692caee6ae43f33d6a67/H.js";
  69 + var __dirname = require.sandbox.id + "/aa0b8cfbcfff960996a8692caee6ae43f33d6a67";
70 70
71 71 exports.getLetter = function()
72 72 {
@@ -74,8 +74,8 @@ require.bundle("", function(require)
74 74 }
75 75
76 76 });
77   - require.memoize("/package.json", {"main":"/main.js","mappings":{"helpers":"32ab0c28393c3fbb23863556150045f2e480923f"},"directories":{"lib":""}});
78   - require.memoize("32ab0c28393c3fbb23863556150045f2e480923f/package.json", {"mappings":{"package":"981e9adad3c1288b46d8ca93853deddb17e4d55d"},"directories":{"lib":""}});
79   - require.memoize("981e9adad3c1288b46d8ca93853deddb17e4d55d/package.json", {"mappings":{"package":"32ab0c28393c3fbb23863556150045f2e480923f","letters":"bc674b2edd42208f9c5e2bae8e66aa32b6eda600"},"directories":{"lib":"words"}});
80   - require.memoize("bc674b2edd42208f9c5e2bae8e66aa32b6eda600/package.json", {"directories":{"lib":""},"mappings":{}});
  77 + require.memoize("/package.json", {"main":"/main.js","mappings":{"helpers":"9600bb1b572fba81a38e7d3c0eb638268e6a9d8d"},"directories":{"lib":""}});
  78 + require.memoize("9600bb1b572fba81a38e7d3c0eb638268e6a9d8d/package.json", {"mappings":{"package":"80b6bcb59fc2b65675648d0e052b75b4620764ee"},"directories":{"lib":""}});
  79 + require.memoize("80b6bcb59fc2b65675648d0e052b75b4620764ee/package.json", {"mappings":{"package":"9600bb1b572fba81a38e7d3c0eb638268e6a9d8d","letters":"aa0b8cfbcfff960996a8692caee6ae43f33d6a67"},"directories":{"lib":"words"}});
  80 + require.memoize("aa0b8cfbcfff960996a8692caee6ae43f33d6a67/package.json", {"directories":{"lib":""},"mappings":{}});
81 81 });
0  ...atures/02-BundlerMiddleware/dist/06-JsonModule.js → ...atures/02-BundlerMiddleware/dist/06-JsonModule.js
File renamed without changes
0  ...atures/02-BundlerMiddleware/dist/07-TextModule.js → ...atures/02-BundlerMiddleware/dist/07-TextModule.js
File renamed without changes
0  ...tures/02-BundlerMiddleware/dist/08-ResourceURI.js → ...tures/02-BundlerMiddleware/dist/08-ResourceURI.js
File renamed without changes
0  ...2-BundlerMiddleware/dist/08-ResourceURI/hello.txt → ...2-BundlerMiddleware/dist/08-ResourceURI/hello.txt
File renamed without changes
10 ...-NodeJSLoaderFeatureBundles/dist/09-LoadBundle.js → ...atures/02-BundlerMiddleware/dist/09-LoadBundle.js
@@ -16,11 +16,11 @@ require.bundle("", function(require)
16 16
17 17 module.log("Hello from 09-LoadBundle!");
18 18
19   - var extraBundleID = "./ExtraBundle";
  19 + var extraModuleID = "./ExtraModule";
20 20
21   - require.async(extraBundleID, function(EXTRA_BUNDLE)
  21 + require.async(extraModuleID, function(EXTRA_MODULE)
22 22 {
23   - EXTRA_BUNDLE.init();
  23 + EXTRA_MODULE.init();
24 24
25 25 result.resolve();
26 26 });
@@ -28,9 +28,9 @@ require.bundle("", function(require)
28 28 return result.promise;
29 29 }
30 30
31   - exports.getExtraBundleGreeting = function()
  31 + exports.getExtraModuleGreeting = function()
32 32 {
33   - return "Hello from 09-LoadBundle/ExtraBundle!";
  33 + return "Hello from 09-LoadBundle/ExtraModule!";
34 34 }
35 35
36 36 });
0  ...ndlerMiddleware/dist/09-LoadBundle/ExtraBundle.js → ...ndlerMiddleware/dist/09-LoadBundle/ExtraBundle.js
File renamed without changes
18 examples/04-PlatformFeatures/02-BundlerMiddleware/dist/09-LoadBundle/ExtraModule.js
... ... @@ -0,0 +1,18 @@
  1 +require.bundle("", function(require)
  2 +{
  3 +
  4 + require.memoize("/ExtraModule.js", function(require, exports, module)
  5 + {
  6 + var __filename = require.sandbox.id + "/ExtraModule.js";
  7 + var __dirname = require.sandbox.id + "";
  8 +
  9 + var MAIN = require("./main.js");
  10 +
  11 + exports.init = function()
  12 + {
  13 + module.log(MAIN.getExtraModuleGreeting());
  14 + }
  15 +
  16 + });
  17 + require.memoize("/package.json", {"main":"/ExtraModule.js","directories":{"lib":""},"mappings":{}});
  18 +});
0  ...mFeatures/02-BundlerMiddleware/dist/10-Sandbox.js → ...mFeatures/02-BundlerMiddleware/dist/10-Sandbox.js
File renamed without changes
0  ...iddleware/dist/10-Sandbox/SandboxedExtraBundle.js → ...iddleware/dist/10-Sandbox/SandboxedExtraBundle.js
File renamed without changes
0  ...tures/02-BundlerMiddleware/dist/11-CrossDomain.js → ...tures/02-BundlerMiddleware/dist/11-CrossDomain.js
File renamed without changes
0  ...tures/02-BundlerMiddleware/dist/12-Environment.js → ...tures/02-BundlerMiddleware/dist/12-Environment.js
File renamed without changes
0  ...res/02-BundlerMiddleware/dist/13-AssignExports.js → ...res/02-BundlerMiddleware/dist/13-AssignExports.js
File renamed without changes
2  ...deJSPlatformFeatures/02-BundlerMiddleware/main.js → .../04-PlatformFeatures/02-BundlerMiddleware/main.js
@@ -4,7 +4,7 @@ var PATH = require("path"),
4 4 BUNDLER = require("sourcemint-platform-nodejs/lib/bundler");
5 5
6 6
7   -var EXAMPLES_BASE_PATH = __dirname + "/../../02-NodeJSLoaderFeatures",
  7 +var EXAMPLES_BASE_PATH = __dirname + "/../../02-LoaderFeatures",
8 8 LOADER_BASE_PATH = PATH.dirname(PATH.dirname(PATH.dirname(require.resolve("sourcemint-loader-js/workspace/www/index.html"))));
9 9
10 10
2  ...latformFeatures/02-BundlerMiddleware/package.json → ...latformFeatures/02-BundlerMiddleware/package.json
... ... @@ -1,5 +1,5 @@
1 1 {
2   - "name": "sourcemint-platform-nodejs-examples-04-NodeJSPlatformFeatures-02-BundlerMiddleware",
  2 + "name": "sourcemint-platform-nodejs-examples-04-PlatformFeatures-02-BundlerMiddleware",
3 3 "version": "0.1.0",
4 4 "engines": {
5 5 "nodejs": "0.x"
2  ...deJSPlatformFeatures/02-BundlerMiddleware/test.js → .../04-PlatformFeatures/02-BundlerMiddleware/test.js
... ... @@ -1,5 +1,5 @@
1 1
2   -var HELPER = require("../../../tests/test-helper"),
  2 +var HELPER = require("sourcemint-platform-nodejs/tests/test-helper"),
3 3 ASSERT = require("assert"),
4 4 BROWSER = require("zombie");
5 5
0  examples/04-NodeJSPlatformFeatures/main.js → examples/04-PlatformFeatures/main.js
File renamed without changes
5 examples/04-NodeJSPlatformFeatures/package.json → examples/04-PlatformFeatures/package.json
... ... @@ -1,11 +1,12 @@
1 1 {
2   - "name": "sourcemint-platform-nodejs-examples-04-NodeJSPlatformFeatures",
  2 + "name": "sourcemint-platform-nodejs-examples-04-PlatformFeatures",
3 3 "version": "0.1.0",
4 4 "engines": {
5 5 "nodejs": "0.x"
6 6 },
7 7 "dependencies": {
8   - "q": "0.x"
  8 + "q": "0.x",
  9 + "sourcemint-platform-nodejs": "0.x"
9 10 },
10 11 "scripts": {
11 12 "test": "node main"
2  ...5-NodeJSPlatformFeatureBundles/dist/01-Globals.js → ...ples/05-PlatformFeatureBundles/dist/01-Globals.js
@@ -88,5 +88,5 @@ require.bundle("", function(require)
88 88 }
89 89
90 90 });
91   - require.memoize("/package.json", {"name":"sourcemint-platform-nodejs-examples-04-NodeJSPlatformFeatures-01-Globals","version":"0.1.0","engines":{"nodejs":"0.x"},"scripts":{"test":"node main"},"main":"/main.js","directories":{"lib":""},"mappings":{}});
  91 + require.memoize("/package.json", {"name":"sourcemint-platform-nodejs-examples-04-PlatformFeatures-01-Globals","version":"0.1.0","engines":{"nodejs":"0.x"},"scripts":{"test":"node main"},"main":"/main.js","directories":{"lib":""},"mappings":{}});
92 92 });
2  examples/05-NodeJSPlatformFeatureBundles/main.js → examples/05-PlatformFeatureBundles/main.js
@@ -11,7 +11,7 @@ exports.main = function()
11 11 {
12 12 var done = Q.ref();
13 13
14   - var basePath = __dirname + "/../04-NodeJSPlatformFeatures";
  14 + var basePath = __dirname + "/../04-PlatformFeatures";
15 15
16 16 FS.readdirSync(basePath).forEach(function(filename)
17 17 {
2  ...ples/05-NodeJSPlatformFeatureBundles/package.json → examples/05-PlatformFeatureBundles/package.json
... ... @@ -1,5 +1,5 @@
1 1 {
2   - "name": "sourcemint-platform-nodejs-examples-05-NodeJSPlatformFeatureBundles",
  2 + "name": "sourcemint-platform-nodejs-examples-05-PlatformFeatureBundles",
3 3 "version": "0.1.0",
4 4 "engines": {
5 5 "nodejs": "0.x"
77 lib/bundler.js
@@ -14,6 +14,10 @@ var FS = require("fs"),
14 14 // TODO: Use helper function from bundler where possible.
15 15 // TODO: Use AST to detect require statements.
16 16
  17 +exports.bundle = BUNDLER.bundle;
  18 +
  19 +
  20 +
17 21 exports.parseModule = function(path, options)
18 22 {
19 23 var deferred = Q.defer();
@@ -21,35 +25,38 @@ exports.parseModule = function(path, options)
21 25 Q.call(function()
22 26 {
23 27 var report = {};
24   -
25   - var code = FS.readFileSync(path).toString();
26   -
27   - report.staticLinks = {};
28   - report.dynamicLinks = {};
29   -
30   - // NOTE: We wrap the module code in a function to ensure we don't fail on top-level `return`s.
31   - var matches = DETECTIVE.find("((function(){" + code + "})());");
32 28
33   - matches.strings.forEach(function(id)
  29 + if (/\.js$/.test(path))
34 30 {
35   - report.staticLinks[id] = adjustStaticLink(path, id, options);
36   - });
37   -
38   - if (matches.expressions.length > 0)
39   - {
40   - // TODO: Ensure there are `` defined in the package descriptor of the package.
41   - // TODO: Throw in struct mode.
42   - // throw new Error("Found variable argument to require statement 'require(" + id + ")' in module '" + path + "'. 'require()' only accepts a string literal. Use 'require.async(" + id + ", function(EXPORTS) {})' instead.");
  31 + var code = FS.readFileSync(path).toString();
  32 +
  33 + report.staticLinks = {};
  34 + report.dynamicLinks = {};
  35 +
  36 + // NOTE: We wrap the module code in a function to ensure we don't fail on top-level `return`s.
  37 + var matches = DETECTIVE.find("((function(){" + code + "})());");
  38 +
  39 + matches.strings.forEach(function(id)
  40 + {
  41 + report.staticLinks[id] = adjustStaticLink(path, id, options);
  42 + });
  43 +
  44 + if (matches.expressions.length > 0)
  45 + {
  46 + // TODO: Ensure there are `` defined in the package descriptor of the package.
  47 + // TODO: Throw in struct mode.
  48 + // throw new Error("Found variable argument to require statement 'require(" + id + ")' in module '" + path + "'. 'require()' only accepts a string literal. Use 'require.async(" + id + ", function(EXPORTS) {})' instead.");
  49 + }
  50 +
  51 + // TODO: Use `detective` to find.
  52 + scrapeAsyncRequires(code).forEach(function(name)
  53 + {
  54 + report.dynamicLinks[name] = name;
  55 + });
  56 +
  57 + // TODO: Look for `require.resolve("<str>")` and `require.id("<str>")`.
43 58 }
44 59
45   - // TODO: Use `detective` to find.
46   - scrapeAsyncRequires(code).forEach(function(name)
47   - {
48   - report.dynamicLinks[name] = name;
49   - });
50   -
51   - // TODO: Look for `require.resolve("<str>")` and `require.id("<str>")`.
52   -
53 60 deferred.resolve(report);
54 61 }).fail(function(err)
55 62 {
@@ -177,15 +184,15 @@ exports.resolveUri = function(uri)
177 184 {
178 185 return Q.call(function()
179 186 {
180   - if (PATH.existsSync(uri))
181   - {
182   - return FS.realpathSync(uri);
183   - }
  187 + if (PATH.existsSync(uri + ".js"))
  188 + {
  189 + return FS.realpathSync(uri + ".js");
  190 + }
184 191 else
185   - if (PATH.existsSync(uri + ".js"))
186   - {
187   - return FS.realpathSync(uri + ".js");
188   - }
  192 + if (PATH.existsSync(uri))
  193 + {
  194 + return FS.realpathSync(uri);
  195 + }
189 196 else
190 197 if (/^nodejs\.org\/0\//.test(uri))
191 198 {
@@ -292,7 +299,9 @@ var Middleware = exports.Middleware = function(packagePath, distributionPath, op
292 299
293 300 if (middlewareInstances[key])
294 301 {
295   - return middlewareInstances[key];
  302 + if (options.rebuild !== true) {
  303 + return middlewareInstances[key];
  304 + }
296 305 }
297 306
298 307 return middlewareInstances[key] = new Middleware(packagePath, distributionPath, options);
5 loader.js
... ... @@ -0,0 +1,5 @@
  1 +
  2 +var LOADER = require("./lib/loader");
  3 +
  4 +for (var name in LOADER)
  5 + exports[name] = LOADER[name];
2  package.json
@@ -4,12 +4,12 @@
4 4 "dependencies": {
5 5 "q": "0.x",
6 6 "sourcemint-loader-js": "0.x",
  7 + "sourcemint-bundler-js": "0.x",
7 8 "detective": "0.x",
8 9 "connect": "1.x"
9 10 },
10 11 "devDependencies": {
11 12 "vows": "0.x",
12   - "sourcemint-bundler-js": "0.x",
13 13 "n-util": "0.x",
14 14 "zombie": "0.x"
15 15 },
10 tests/adapter/vows.js
... ... @@ -1,6 +1,7 @@
1 1
2 2 var VOWS = require("vows"),
3   - ASSERT = require("assert");
  3 + ASSERT = require("assert"),
  4 + EXAMPLES = require("../examples");
4 5
5 6
6 7 VOWS.describe("Tests").addBatch(
@@ -10,14 +11,17 @@ VOWS.describe("Tests").addBatch(
10 11 topic: function()
11 12 {
12 13 var self = this;
13   - require("../examples").main().then(function() {
  14 + EXAMPLES.main({
  15 + packageBasePath: __dirname + "/../..",
  16 + extraExamples: EXAMPLES.extraExamples
  17 + }).then(function() {
14 18 self.callback(true);
15 19 }, function(err) {
16 20 // NOTE: If this fires and `err` instanceof Error `vows` will fail this test.
17 21 self.callback(err);
18 22 });
19 23 },
20   - "all examples passed": function(status)
  24 + "all examples worked": function(status)
21 25 {
22 26 ASSERT.equal(status, true);
23 27 }
198 tests/examples.js
@@ -3,12 +3,23 @@ var Q = require("q"),
3 3 PATH = require("path"),
4 4 FS = require("fs"),
5 5 EXEC = require("child_process").exec,
6   - UTIL = require("n-util");
7   -
8   -const EXAMPLES_BASE_PATH = __dirname + "/../examples";
  6 + UTIL = require("n-util"),
  7 + ERROR = require("../lib/util/error");
9 8
10 9 exports.main = function(options)
11 10 {
  11 + const PACKAGE_BASE_PATH = FS.realpathSync(options.packageBasePath);
  12 + const EXAMPLES_BASE_PATH = PACKAGE_BASE_PATH + ((typeof options.examplesPath !== "undefined")?options.examplesPath:"/examples");
  13 +
  14 + var RELATIVE_PATH = "/..";
  15 + if (typeof options.examplesPath !== "undefined") {
  16 + if (options.examplesPath === "") {
  17 + RELATIVE_PATH = "";
  18 + } else {
  19 + throw new Error("NYI");
  20 + }
  21 + }
  22 +
12 23 return linkPackages().then(function(packages)
13 24 {
14 25 var done = Q.ref();
@@ -19,100 +30,117 @@ exports.main = function(options)
19 30 {
20 31 return installMissingDependencies(EXAMPLES_BASE_PATH + "/" + packageName).then(function()
21 32 {
22   - console.log("Running example: " + EXAMPLES_BASE_PATH + "/" + packageName);
23   -
24   - return require(EXAMPLES_BASE_PATH + "/" + packageName + "/main.js").main();
  33 + if (options.run === false) return;
  34 +
  35 + console.log("Running example: " + EXAMPLES_BASE_PATH + "/" + packageName);
  36 +
  37 + return require(EXAMPLES_BASE_PATH + "/" + packageName + "/main.js").main().fail(function(err) {
  38 + ERROR.logError(err);
  39 + throw err;
  40 + });
25 41 });
26 42 });
27 43 });
28 44
29 45 return done;
30 46 });
31   -}
32   -
33   -
34   -function installMissingDependencies(packageRootPath)
35   -{
36   - var deferred = Q.defer();
37   -
38   - EXEC("npm install", {
39   - cwd: packageRootPath
40   - }, function(err, stdout, stderr)
41   - {
42   - if (err) deferred.reject(err);
43   - else if (stderr) deferred.reject(stderr)
44   - else {
45   - process.stdout.write(stdout);
46   - deferred.resolve();
47   - }
48   - });
49   -
50   - return deferred.promise;
51   -}
52   -
53   -
54   -function linkPackages()
55   -{
56   - var packages = [];
57 47
58   - if (!PATH.existsSync(__dirname + "/../node_modules"))
  48 + function installMissingDependencies(packageRootPath)
59 49 {
60   - FS.mkdirSync(__dirname + "/../node_modules", 0775);
61   - }
62   - try {
63   - // TODO: Find a symlink test that does not throw if it does not exist.
64   - FS.lstatSync(__dirname + "/../node_modules/sourcemint-platform-nodejs");
65   - } catch(e) {
66   - FS.symlinkSync("..", __dirname + "/../node_modules/sourcemint-platform-nodejs");
  50 + var deferred = Q.defer();
  51 +
  52 + EXEC("npm install", {
  53 + cwd: packageRootPath
  54 + }, function(err, stdout, stderr)
  55 + {
  56 + if (err) deferred.reject(err);
  57 + else if (stderr) deferred.reject(stderr)
  58 + else {
  59 + process.stdout.write(stdout);
  60 + deferred.resolve();
  61 + }
  62 + });
  63 +
  64 + return deferred.promise;
67 65 }
68 66
69   - var ourDescriptor = JSON.parse(FS.readFileSync(__dirname + "/../package.json"));
70   -
71   - FS.readdirSync(EXAMPLES_BASE_PATH).concat([
72   - "04-NodeJSPlatformFeatures/02-BundlerMiddleware"
73   - ]).forEach(function(filename)
  67 + function linkPackages()
74 68 {
75   - var basePath = EXAMPLES_BASE_PATH + "/" + filename;
76   -
77   - if (PATH.existsSync(basePath + "/package.json"))
78   - {
79   - if (filename.split("/").length === 1) {
80   - packages.push(filename);
81   - }
82   -
83   - var descriptor = JSON.parse(FS.readFileSync(basePath + "/package.json"));
84   -
85   - if (!PATH.existsSync(basePath + "/node_modules"))
86   - {
87   - FS.mkdirSync(basePath + "/node_modules", 0775);
88   - }
89   -
90   - var deps = descriptor.devDependencies || {};
91   - UTIL.update(deps, descriptor.dependencies || {});
92   - Object.keys(deps).forEach(function(name)
93   - {
94   - if (name === "sourcemint-platform-nodejs" ||
95   - ourDescriptor.dependencies[name] === descriptor.dependencies[name] ||
96   - ourDescriptor.devDependencies[name] === descriptor.dependencies[name]
97   - ) {
98   - try {
99   - // TODO: Find a symlink test that does not throw if it does not exist.
100   - FS.lstatSync(basePath + "/node_modules/" + name);
101   - } catch(e) {
102   - FS.symlinkSync(filename.replace(/[^\/]+/g, "..") + "/../../node_modules/" + name, basePath + "/node_modules/" + name);
103   - }
104   - }
105   - });
106   - }
107   - });
108   -
109   - return Q.call(function() {
110   - return packages;
111   - });
  69 + var packages = [];
  70 +
  71 + if (!PATH.existsSync(PACKAGE_BASE_PATH + "/node_modules"))
  72 + {
  73 + FS.mkdirSync(PACKAGE_BASE_PATH + "/node_modules", 0775);
  74 + }
  75 +
  76 + var ourDescriptor = JSON.parse(FS.readFileSync(PACKAGE_BASE_PATH + "/package.json"));
  77 +
  78 + if (ourDescriptor.name === "sourcemint-platform-nodejs") {
  79 + try {
  80 + // TODO: Find a symlink test that does not throw if it does not exist.
  81 + FS.lstatSync(PACKAGE_BASE_PATH + "/node_modules/sourcemint-platform-nodejs");
  82 + } catch(e) {
  83 + FS.symlinkSync("..", PACKAGE_BASE_PATH + "/node_modules/sourcemint-platform-nodejs");
  84 + }
  85 + } else
  86 + if (ourDescriptor.name === "sourcemint-sdk-requirejs") {
  87 + try {
  88 + // TODO: Find a symlink test that does not throw if it does not exist.
  89 + FS.lstatSync(PACKAGE_BASE_PATH + "/node_modules/sourcemint-sdk-requirejs");
  90 + } catch(e) {
  91 + FS.symlinkSync("..", PACKAGE_BASE_PATH + "/node_modules/sourcemint-sdk-requirejs");
  92 + }
  93 + }
  94 +
  95 + FS.readdirSync(EXAMPLES_BASE_PATH).concat(options.extraExamples || []).forEach(function(filename)
  96 + {
  97 + var basePath = EXAMPLES_BASE_PATH + "/" + filename;
  98 +
  99 + if (PATH.existsSync(basePath + "/package.json"))
  100 + {
  101 + if (filename.split("/").length === 1) {
  102 + packages.push(filename);
  103 + }
  104 +
  105 + var descriptor = JSON.parse(FS.readFileSync(basePath + "/package.json"));
  106 +
  107 + if (!PATH.existsSync(basePath + "/node_modules"))
  108 + {
  109 + FS.mkdirSync(basePath + "/node_modules", 0775);
  110 + }
  111 +
  112 + var deps = descriptor.devDependencies || {};
  113 + UTIL.update(deps, descriptor.dependencies || {});
  114 + Object.keys(deps).forEach(function(name)
  115 + {
  116 + if (name === ourDescriptor.name ||
  117 + (ourDescriptor.dependencies && ourDescriptor.dependencies[name] === deps[name]) ||
  118 + (ourDescriptor.devDependencies && ourDescriptor.devDependencies[name] === deps[name])
  119 + ) {
  120 + try {
  121 + // TODO: Find a symlink test that does not throw if it does not exist.
  122 + FS.lstatSync(basePath + "/node_modules/" + name);
  123 + } catch(e) {
  124 + FS.symlinkSync(filename.replace(/[^\/]+/g, "..") + RELATIVE_PATH + "/../node_modules/" + name, basePath + "/node_modules/" + name);
  125 + }
  126 + }
  127 + });
  128 + }
  129 + });
  130 +
  131 + return Q.call(function() {
  132 + return packages;
  133 + });
  134 + }
112 135 }
113 136
  137 +exports.extraExamples = [
  138 + "04-PlatformFeatures/02-BundlerMiddleware"
  139 +];
114 140
115   -if (require.main === module)
116   -{
117   - exports.main();
  141 +if (require.main === module) {
  142 + exports.main({
  143 + packageBasePath: __dirname + "/..",
  144 + extraExamples: exports.extraExamples
  145 + });
118 146 }
7 tests/test-helper.js
@@ -44,7 +44,12 @@ exports.makeTest = function(REQUIRE, EXPORTS, MODULE, testCallback)
44 44 }
45 45
46 46 if (REQUIRE.main === MODULE) {
47   - EXPORTS.main().fail(ERROR.logError);
  47 + EXPORTS.main().fail(function(err) {
  48 + ERROR.logError(err);
  49 +
  50 + // TODO: Get rid of this once we know why the event loop sometimes hangs on error.
  51 + process.exit(0);
  52 + });
48 53 }
49 54 }
50 55

0 comments on commit 5913953

Please sign in to comment.
Something went wrong with that request. Please try again.