es-module-loader
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -48,3 +48,3 @@ /* | ||
else if (typeof process != 'undefined' && process.cwd) { | ||
baseURI = 'file://' + (isWindows ? '/' : '') + process.cwd() + '/'; | ||
baseURI = 'file://' + (isWindows ? '/' : '') + process.cwd(); | ||
if (isWindows) | ||
@@ -57,2 +57,6 @@ baseURI = baseURI.replace(/\\/g, '/'); | ||
// ensure baseURI has trailing "/" | ||
if (baseURI[baseURI.length - 1] !== '/') | ||
baseURI += '/'; | ||
/* | ||
@@ -67,3 +71,3 @@ * LoaderError with chaining for loader stacks | ||
var message = (childErr.message || childErr) + '\n\t' + newMessage; | ||
var message = (childErr.message || childErr) + '\n ' + newMessage; | ||
@@ -78,6 +82,6 @@ var err; | ||
var stack = childErr.originalErr ? childErr.originalErr.stack : childErr.stack; | ||
if (isNode) | ||
// node doesn't show the message otherwise | ||
err.stack = message + '\n' + stack; | ||
err.stack = message + '\n ' + stack; | ||
else | ||
@@ -84,0 +88,0 @@ err.stack = stack; |
@@ -18,3 +18,3 @@ import { baseURI, addToError } from './common.js'; | ||
return arr.values(); | ||
if (typeof Symbol === 'undefined' || !Symbol.iterator) | ||
@@ -80,2 +80,3 @@ throw new Error('Cannot return values iterator unless Symbol.iterator is defined'); | ||
var loader = this; | ||
var registry = loader.registry._registry; | ||
@@ -88,3 +89,3 @@ var resolvedKey; | ||
.then(function(resolved) { | ||
var existingNamespace = loader.registry.get(resolved); | ||
var existingNamespace = registry[resolved]; | ||
@@ -200,3 +201,6 @@ if (existingNamespace) | ||
if (evaluate) | ||
ns._evaluate = evaluate; | ||
Object.defineProperty(ns, '$__evaluate', { | ||
value: evaluate, | ||
writable: true | ||
}); | ||
} | ||
@@ -206,2 +210,8 @@ | ||
ModuleNamespace.prototype[Symbol.toStringTag] = 'Module'; | ||
else | ||
Object.defineProperty(ModuleNamespace.prototype, 'toString', { | ||
value: function() { | ||
return '[object Module]'; | ||
} | ||
}); | ||
@@ -238,9 +248,6 @@ // 8.3.1 Reflect.Module | ||
Module.evaluate = function(ns) { | ||
if (!(ns instanceof ModuleNamespace)) | ||
throw new TypeError('Module.evaluate must be called on a Module Namespace'); | ||
if (ns._evaluate) { | ||
ns._evaluate(); | ||
ns._evaluate = undefined; | ||
if (ns.$__evaluate) { | ||
ns.$__evaluate(); | ||
ns.$__evaluate = undefined; | ||
} | ||
}; |
@@ -64,5 +64,6 @@ import { Loader, Module, InternalModuleNamespace as ModuleNamespace } from './loader-polyfill.js'; | ||
var loader = this; | ||
var registry = loader.registry._registry; | ||
// normalization shortpath if already in the registry or loading | ||
if (loader._registerRegistry[key] || loader.registry.has(key)) | ||
if (loader._registerRegistry[key] || registry[key]) | ||
return Promise.resolve(key); | ||
@@ -77,3 +78,3 @@ | ||
// we create the in-progress load record already here to store the normalization metadata | ||
if (!loader.registry.has(resolvedKey)) | ||
if (!registry[resolvedKey]) | ||
(loader._registerRegistry[resolvedKey] || createLoadRecord(loader, resolvedKey)).metadata = metadata; | ||
@@ -146,3 +147,3 @@ | ||
if (instantiation !== undefined) { | ||
loader.registry.set(key, instantiation); | ||
loader.registry._registry[key] = instantiation; | ||
loader._registerRegistry[key] = undefined; | ||
@@ -188,2 +189,3 @@ return instantiation; | ||
var instantiateDepsPromises = Array(esLinkRecord.dependencies.length); | ||
var registry = loader.registry._registry; | ||
@@ -203,3 +205,3 @@ // normalize dependencies | ||
var existingNamespace = loader.registry.get(resolvedDepKey); | ||
var existingNamespace = registry[resolvedDepKey]; | ||
if (existingNamespace) { | ||
@@ -442,3 +444,3 @@ esLinkRecord.dependencyInstantiations[i] = existingNamespace; | ||
load.module = new ModuleNamespace(esLinkRecord.moduleObj); | ||
loader.registry.set(load.key, load.module); | ||
loader.registry._registry[load.key] = load.module; | ||
@@ -445,0 +447,0 @@ // can clear link record now |
{ | ||
"name": "es-module-loader", | ||
"description": "An ES Module Loader shim", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"homepage": "https://github.com/ModuleLoader/es-module-loader", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -8,2 +8,5 @@ import { resolveUrlToParentIfNotPlain } from '../core/resolve.js'; | ||
}); | ||
it('Should resolve relative windows paths', function() { | ||
assert.equal(resolveUrlToParentIfNotPlain('./test.js', 'file:///C:/some/path/'), 'file:///C:/some/path/test.js'); | ||
}); | ||
it('Should resolve unix file paths as file:/// URLs', function() { | ||
@@ -63,3 +66,3 @@ assert.equal(resolveUrlToParentIfNotPlain('/some/file/path.js', 'file:///home/path/to/project'), 'file:///some/file/path.js'); | ||
describe('URL resolution selected WhatWG URL spec tests', function() { | ||
describe('URL resolution selected WhatWG URL spec tests', function() { | ||
var run = 0; | ||
@@ -133,2 +136,2 @@ testCases.forEach(function(test) { | ||
}); | ||
}); | ||
}); |
@@ -201,3 +201,3 @@ import assert from 'assert'; | ||
var err = await getImportError('./main.js'); | ||
assert.equal(err, 'Error: dep error\n\tEvaluating ' + testPath + 'deperror.js\n\tEvaluating ' + testPath + 'main.js\n\tLoading ./main.js'); | ||
assert.equal(err, 'Error: dep error\n Evaluating ' + testPath + 'deperror.js\n Evaluating ' + testPath + 'main.js\n Loading ./main.js'); | ||
}); | ||
@@ -207,3 +207,3 @@ | ||
var err = await getImportError('./deperror.js'); | ||
assert.equal(err, 'Error: dep error\n\tEvaluating ' + testPath + 'deperror.js\n\tLoading ./deperror.js'); | ||
assert.equal(err, 'Error: dep error\n Evaluating ' + testPath + 'deperror.js\n Loading ./deperror.js'); | ||
}); | ||
@@ -213,3 +213,3 @@ | ||
var err = await getImportError('./load-non-existent.js'); | ||
var lines = err.split('\n\t'); | ||
var lines = err.split('\n '); | ||
assert(lines[0].startsWith('Error: ')); | ||
@@ -224,2 +224,2 @@ assert(lines[0].endsWith('open \'' + testPath + 'non-existent.js\'')); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
231509
7913
2