Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moving form bundled dependencies to graphquire based dependecy manage…

…ment.
  • Loading branch information...
commit 0cfeb263f704357c105432f4395def3d88881c47 1 parent 3761fb2
@Gozala authored
View
3  .gitignore
@@ -0,0 +1,3 @@
+http!*
+https!*
+node_modules
View
2  buffer.js
@@ -5,7 +5,7 @@
"use strict";
-const { Extendable } = require("./extendables");
+const { Extendable } = require('https!raw.github.com/Gozala/extendables/v0.2.0/extendables.js');
const { Cc, Ci, components: { Constructor: CC } } = require("chrome");
const Transcoder = CC("@mozilla.org/intl/scriptableunicodeconverter",
"nsIScriptableUnicodeConverter");
View
146 events.js
@@ -1,146 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 expandtab */
-/*jshint newcap: true undef: true es5: true node: true devel: true
- forin: true */
-/*global define: true */
-(typeof define !== "function" ? function($){ $(require, exports, module); } : define)(function(require, exports, module, undefined) {
-
-"use strict";
-
-var Extendable = require("./extendables").Extendable;
-var isArray = Array.isArray;
-
-// By default EventEmitters will print a warning if more than
-// 10 listeners are added to it. This is a useful default which
-// helps finding memory leaks.
-//
-// Obviously not all Emitters should be limited to 10. This function allows
-// that to be increased. Set to zero for unlimited.
-var MAX_LISTENERS = 10;
-var ERROR_TYEPE = 'error';
-
-exports.version = "0.1.1";
-exports.EventEmitter = Extendable.extend({
- setMaxListeners: function setMaxListeners(n) {
- if (!this._events) this._events = {};
- this._events.maxListeners = n;
- },
- emit: function emit(type) {
- var args = Array.prototype.slice.call(arguments, 1);
- var listeners = this.listeners(type);
- if (type === ERROR_TYEPE && !listeners.length)
- console.error(args[0]);
-
- listeners.forEach(function(listener) {
- try {
- listener.apply(this, args);
- } catch (error) {
- // We emit `error` event if listener threw an exception. If there are
- // no listeners for `error` events or if listener for `error` event
- // threw then we dump error directly to the console.
- if (type !== ERROR_TYEPE && this.listeners(ERROR_TYEPE).length)
- this.emit(ERROR_TYEPE, error);
- else
- console.error(error);
- }
- }, this);
- },
- on: function on(type, listener) {
- if (!this._events)
- this._events = {};
-
- // To avoid recursion in the case that type == "newListeners"! Before
- // adding it to the listeners, first emit "newListeners".
- this.emit('newListener', type, listener);
-
- var events = this._events[type];
- if (!events) {
- // Optimize the case of one listener. Don't need the extra array object.
- this._events[type] = listener;
-
- // If listener is an array and if listener is not registered yet.
- } else if (isArray(events) && !~events.indexOf(listener)) {
-
- // Check for listener leak
- if (!events.warned) {
- var m = events.maxListeners !== undefined ? events.maxListeners :
- MAX_LISTENERS;
-
- if (m && m > 0 && events.length > m) {
- events.warned = true;
- console.error('warning: possible EventEmitter memory ' +
- 'leak detected. %d listeners added. ' +
- 'Use emitter.setMaxListeners() to increase limit.',
- this._events[type].length);
- }
- }
-
- events.push(listener);
-
- // If it's not the same listener adding it
- } else if (events !== listener) {
- // Adding the second element, need to change to array.
- this._events[type] = [events, listener];
- }
-
- return this;
- },
- once: function once(type, listener) {
- var self = this;
- function g() {
- self.removeListener(type, g);
- listener.apply(self, arguments);
- }
-
- g.listener = listener;
- self.on(type, g);
- return this;
- },
- removeListener: function removeListener(type, listener) {
- if ('function' !== typeof listener) {
- throw new Error('removeListener only takes instances of Function');
- }
-
- // does not use listeners(), so no side effect of creating _events[type]
- if (!this._events || !this._events[type]) return this;
-
- var list = this._events[type];
-
- if (isArray(list)) {
- var position = -1;
- for (var i = 0, length = list.length; i < length; i++) {
- if (list[i] === listener ||
- (list[i].listener && list[i].listener === listener))
- {
- position = i;
- break;
- }
- }
-
- if (position < 0) return this;
- list.splice(position, 1);
- if (list.length === 0)
- delete this._events[type];
- } else if (list === listener ||
- (list.listener && list.listener === listener))
- {
- delete this._events[type];
- }
-
- return this;
- },
- removeAllListeners: function removeAllListeners(type) {
- // does not use listeners(), so no side effect of creating _events[type]
- if (type && this._events && this._events[type]) this._events[type] = null;
- return this;
- },
- listeners: function listeners(type) {
- if (!this._events) this._events = {};
- if (!this._events[type]) this._events[type] = [];
- if (!isArray(this._events[type])) {
- this._events[type] = [this._events[type]];
- }
- return this._events[type].slice(0);
- }
-});
-
-});
View
64 extendables.js
@@ -1,64 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 expandtab */
-/*jshint undef: true es5: true node: true devel: true
- forin: true latedef: false supernew: true */
-/*global define: true */
-
-(typeof define !== "function" ? function($){ $(require, exports, module); } : define)(function(require, exports, module, undefined) {
-
-"use strict";
-
-function getOwnPropertyDescriptors(object) {
- var descriptors = {};
- Object.getOwnPropertyNames(object).forEach(function(name) {
- descriptors[name] = Object.getOwnPropertyDescriptor(object, name);
- });
- return descriptors;
-}
-
-function supplement(target, source) {
- var descriptors = {};
- var names = Object.getOwnPropertyNames(target);
- Object.getOwnPropertyNames(source).forEach(function(name) {
- if (!~names.indexOf(name)) {
- descriptors[name] = Object.getOwnPropertyDescriptor(source, name);
- }
- });
- return Object.defineProperties(target, descriptors);
-}
-
-function Constructor(base) {
- return function Extendable() {
- var value, extendable = this;
- if (!(extendable instanceof Extendable))
- extendable = Object.create(Extendable.prototype);
-
- value = base.apply(extendable, arguments);
- return value === undefined ? extendable : value;
- };
-}
-function Extendable() {
- return this instanceof Extendable ? this : Object.create(Extendable.prototype);
-}
-
-Object.defineProperties(Extendable, {
- extend: {
- value: function extend(source) {
- var constructor, descriptors = getOwnPropertyDescriptors(source || {});
- // If `constructor` is not defined by `source` then we generate a default
- // `constructor` that delegates to the `constructor` of the base class.
- if (typeof descriptors.constructor !== "object")
- descriptors.constructor = { value: new Constructor(this) };
- // Copying all the non-existing properties to the decedent.
- constructor = supplement(descriptors.constructor.value, this);
- // Override prototype of the decedent.
- constructor.prototype = Object.create(this.prototype, descriptors);
- return constructor;
- },
- enumerable: true
- }
-});
-
-exports.Extendable = Extendable;
-exports.version = "0.1.2";
-
-});
View
4 fs.js
@@ -6,9 +6,9 @@ const { Cc, Ci, components: { Constructor: CC } } = require("chrome");
const { setTimeout } = require("timer");
const { Stream, InputStream, OutputStream } = require("./stream");
const { Buffer } = require("./buffer");
-const { Extendable } = require("./extendables");
+const { Extendable } = require('https!raw.github.com/Gozala/extendables/v0.2.0/extendables.js');
// `Namespace` declared by E4X so `const` fails.
-let { Namespace } = require("./namespace");
+let { Namespace } = require("https!raw.github.com/Gozala/namespace/v0.1.0/namespace.js");
const RawFile = CC("@mozilla.org/file/local;1", "nsILocalFile",
View
66 namespace.js
@@ -1,66 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 expandtab */
-/*jshint newcap: true undef: true es5: true node: true devel: true forin: true
- latedef: false supernew: true */
-/*global define: true */
-
-(typeof define === "undefined" ? function ($) { $(require, exports, module); } : define)(function (require, exports, module, undefined) {
-
-"use strict";
-
-function getOwnPropertyDescriptors(object) {
- var descriptors = {};
- Object.getOwnPropertyNames(object).forEach(function(name) {
- descriptors[name] = Object.getOwnPropertyDescriptor(object, name);
- });
- return descriptors;
-}
-
-/**
- * Returns `true` if given object has a given `namespace`.
- */
-function hasNamespace(object, namespace) {
- return object.valueOf(namespace).namespace === namespace;
-}
-exports.hasNamespace = hasNamespace;
-
-function createNamespace(object, namespace) {
- var descriptors = getOwnPropertyDescriptors(namespace.prototype);
- descriptors.namespace = { value: namespace };
- return Object.create(object, descriptors);
-}
-
-/**
- *
- */
-function defineNamespace(object, namespace) {
- var base = object.valueOf;
- var names = namespace || new Namespace;
- var namespaced = createNamespace(object, names);
- return Object.defineProperties(object, {
- valueOf: {
- value: function valueOf(namespace) {
- return namespace === names ? namespaced : base.apply(object, arguments);
- },
- configurable: true
- }
- }).valueOf(names);
-}
-
-/**
- * Function creates a new namespace. Optionally object `properties` may be
- * passed which will be defined under the given namespace.
- */
-function Namespace(prototype) {
- // Creating a `namespace` function that may be called on any object to return
- // a version with a properties in the given namespace.
- function namespace(object) {
- return hasNamespace(object, namespace) ? object.valueOf(namespace) :
- defineNamespace(object, namespace);
- }
- namespace.prototype = prototype || namespace.prototype;
- return namespace;
-}
-Namespace.hasNamespace = hasNamespace;
-exports.Namespace = Namespace;
-
-});
View
4 net.js
@@ -3,10 +3,10 @@
const { Cc, Ci, components: { Constructor: CC } } = require("chrome");
const { DuplexStream, InputStream, OutputStream } = require("./stream");
-const { EventEmitter } = require("./events");
+const { EventEmitter } = require("https!raw.github.com/Gozala/events/v0.2.0/events");
const { Buffer } = require("./buffer");
// `Namespace` declared by E4X so `const` fails.
-let { Namespace } = require("./namespace");
+let { Namespace } = require("https!raw.github.com/Gozala/namespace/v0.1.0/namespace.js");
const _ = new Namespace();
View
6 package.json
@@ -16,7 +16,11 @@
"directories": { "lib": "./" },
"main": "./io.js",
"devDependencies": {
- "test": ">=0.0.10"
+ "test": ">=0.0.10",
+ "graphquire": ">=0.6.1"
+ },
+ "scripts": {
+ "install": "graphquire --write --clean --cache-path ./"
},
"licenses": [{
"type": "MIT",
View
6 stream.js
@@ -2,11 +2,11 @@
"use strict";
-const { EventEmitter } = require("./events");
+const { EventEmitter } = require("https!raw.github.com/Gozala/events/v0.2.0/events");
const { Buffer } = require("./buffer");
-const { setTimeout } = require("timer")
+const { setTimeout } = require("timer");
// `Namespace` declared by E4X so `const` fails.
-let { Namespace } = require("./namespace");
+let { Namespace } = require("https!raw.github.com/Gozala/namespace/v0.1.0/namespace.js");
function isFunction(value) { return typeof value === "function"; }
const _ = new Namespace();
Please sign in to comment.
Something went wrong with that request. Please try again.