Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jymfony/autoloader

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jymfony/autoloader - npm Package Compare versions

Comparing version 0.1.0-alpha.3 to 0.1.0-alpha.4

test/AutoloaderTest.js

4

package.json
{
"name": "@jymfony/autoloader",
"version": "0.1.0-alpha.3",
"version": "0.1.0-alpha.4",
"description": "Jymfony Autoloader",

@@ -21,3 +21,3 @@ "main": "index.js",

"dependencies": {
"@jymfony/util": "0.1.0-alpha.3"
"@jymfony/util": "0.1.0-alpha.4"
},

@@ -24,0 +24,0 @@ "devDependencies": {

@@ -1,3 +0,1 @@

global.__jymfony = global.__jymfony || {};
const Finder = require('./Finder');

@@ -8,9 +6,18 @@ const Namespace = require('./Namespace');

/**
* Main autoloader.
* Singleton class: the constructor returns always the
* same instance (in the same global context)
*
* @memberOf Jymfony.Component.Autoloader
* @type Autoloader
*/
module.exports = class Autoloader {
class Autoloader {
/**
* Constructor.
*
* @param {undefined|Jymfony.Component.Autoloader.Finder} finder
* @param {Object} globalObject
*/
constructor(finder = undefined, globalObject = global) {
if (globalObject.__jymfony.autoload) {
return;
if (globalObject.__jymfony && globalObject.__jymfony.autoload) {
return globalObject.__jymfony.autoload;
}

@@ -22,6 +29,30 @@

/**
* @type {boolean}
* @private
*/
this._debug = false;
/**
* @type {boolean}
* @private
*/
this._registered = false;
/**
* @type {Jymfony.Component.Autoloader.Finder}
* @private
*/
this._finder = finder;
/**
* @type {Object}
* @private
*/
this._global = globalObject;
this._global.__jymfony = this._global.__jymfony || {};
/**
* @type {Jymfony.Component.Autoloader.Autoloader}
*/
this._global.__jymfony.autoload = this;

@@ -145,2 +176,4 @@ }

}
};
}
module.exports = Autoloader;
/**
* @memberOf Jymfony.Component.Autoloader.Exception
* @type ClassNotFoundException
*/
module.exports = class ClassNotFoundException extends Error {
};
class ClassNotFoundException extends Error {
}
module.exports = ClassNotFoundException;
/**
* @memberOf Jymfony.Component.Autoloader.Exception
* @type ReflectionException
*/
module.exports = class ReflectionException extends Error {
};
class ReflectionException extends Error {
}
module.exports = ReflectionException;

@@ -6,5 +6,4 @@ let ClassNotFoundException = undefined;

* @memberOf Jymfony.Component.Autoloader
* @type Namespace
*/
module.exports = class Namespace {
class Namespace {
/**

@@ -244,2 +243,4 @@ * Namespace constructor

}
};
}
module.exports = Namespace;

@@ -408,14 +408,24 @@ const ReflectionException = require('../Exception/ReflectionException');

let part;
let original = parts.join('.');
parts = [ ...parts ].reverse();
while (part = parts.pop()) {
if (undefined === start) {
throw new ReflectionException('Requesting non-existent class ' + original);
// Save autoload debug flag.
let debug = __jymfony.autoload.debug;
__jymfony.autoload.debug = false;
try {
let original = parts.join('.');
parts = [ ...parts ].reverse();
while (part = parts.pop()) {
if (undefined === start) {
throw new ReflectionException('Requesting non-existent class ' + original);
}
start = start[part];
}
start = start[part];
return start;
} finally {
// Restore debug flag.
__jymfony.autoload.debug = debug;
}
return start;
}

@@ -422,0 +432,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc