Skip to content
Browse files

Added dependency to repository

  • Loading branch information...
1 parent 690bca7 commit 6c93bc12583c04d896f0f33952eeee8382c34997 @beatgammit committed
Showing with 65 additions and 0 deletions.
  1. +65 −0 dep/require-kiss.js
View
65 dep/require-kiss.js
@@ -0,0 +1,65 @@
+/*jslint onevar: true, undef: true, newcap: true, regexp: true, plusplus: true, bitwise: true, devel: true, maxerr: 50, indent: 2 */
+/*global module: true, exports: true, provide: true */
+var global = global || (function () { return this; }()),
+ __dirname = __dirname || '';
+(function () {
+ "use strict";
+
+ var thrownAlready = false;
+
+ function ssjsProvide(exports) {
+ //module.exports = exports || module.exports;
+ }
+
+ function resetModule() {
+ global.module = {};
+ global.exports = {};
+ global.module.exports = exports;
+ }
+
+ function normalize(name) {
+ if ('./' === name.substr(0,2)) {
+ name = name.substr(2);
+ }
+ return name;
+ }
+
+ function browserRequire(name) {
+ var mod,
+ msg = "One of the included scripts requires '" +
+ name + "', which is not loaded. " +
+ "\nTry including '<script src=\"" + name + ".js\"></script>'.\n";
+
+ name = normalize(name);
+ mod = global.__REQUIRE_KISS_EXPORTS[name] || global[name];
+
+ if ('undefined' === typeof mod && !thrownAlready) {
+ thrownAlready = true;
+ alert(msg);
+ throw new Error(msg);
+ }
+
+ return mod;
+ }
+
+ function browserProvide(name, new_exports) {
+ name = normalize(name);
+ global.__REQUIRE_KISS_EXPORTS[name] = new_exports || module.exports;
+ resetModule();
+ }
+
+ if (global.require) {
+ if (global.provide) {
+ return;
+ }
+ global.provide = ssjsProvide;
+ return;
+ }
+
+ global.__REQUIRE_KISS_EXPORTS = global.__REQUIRE_KISS_EXPORTS || {};
+ global.require = global.require || browserRequire;
+ global.provide = global.provide || browserProvide;
+ resetModule();
+
+ provide('require-kiss');
+}());

0 comments on commit 6c93bc1

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