Skip to content

Commit

Permalink
Release 3.9.14
Browse files Browse the repository at this point in the history
  • Loading branch information
XmiliaH committed Feb 5, 2023
1 parent fe3ab68 commit 066afd1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v3.9.14 (2023-02-05)
--------------------
[new] Support conditional export resolution with custom resolver. (nick-klaviyo)

v3.9.13 (2022-12-08)
--------------------
[fix] Fix typescript errors in index.d.ts
Expand Down
2 changes: 1 addition & 1 deletion lib/resolver-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ function resolverFromOptions(vm, options, override, compiler) {
if (!resolved) return undefined;
if (typeof resolved === 'string') {
if (externals) externals.push(new RegExp('^' + escapeRegExp(resolved)));
return resolver.loadAsFileOrDirecotry(resolved, extList);
return resolver.loadAsFileOrDirectory(resolved, extList);
}
const {module=x, path: resolvedPath} = resolved;
if (externals) externals.push(new RegExp('^' + escapeRegExp(resolvedPath)));
Expand Down
12 changes: 6 additions & 6 deletions lib/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class DefaultResolver extends Resolver {
// 2. If X begins with '/'
if (this.pathIsAbsolute(x)) {
// a. set Y to be the filesystem root
f = this.loadAsFileOrDirecotry(x, extList);
f = this.loadAsFileOrDirectory(x, extList);
if (f) return f;

// c. THROW "not found"
Expand All @@ -256,21 +256,21 @@ class DefaultResolver extends Resolver {
for (let i = 0; i < paths.length; i++) {
// a. LOAD_AS_FILE(Y + X)
// b. LOAD_AS_DIRECTORY(Y + X)
f = this.loadAsFileOrDirecotry(this.pathConcat(paths[i], x), extList);
f = this.loadAsFileOrDirectory(this.pathConcat(paths[i], x), extList);
if (f) return f;
}
} else if (paths === undefined) {
// a. LOAD_AS_FILE(Y + X)
// b. LOAD_AS_DIRECTORY(Y + X)
f = this.loadAsFileOrDirecotry(this.pathConcat(path, x), extList);
f = this.loadAsFileOrDirectory(this.pathConcat(path, x), extList);
if (f) return f;
} else {
throw new VMError('Invalid options.paths option.');
}
} else {
// a. LOAD_AS_FILE(Y + X)
// b. LOAD_AS_DIRECTORY(Y + X)
f = this.loadAsFileOrDirecotry(this.pathConcat(path, x), extList);
f = this.loadAsFileOrDirectory(this.pathConcat(path, x), extList);
if (f) return f;
}

Expand Down Expand Up @@ -315,7 +315,7 @@ class DefaultResolver extends Resolver {
return super.resolveFull(mod, x, options, ext, direct);
}

loadAsFileOrDirecotry(x, extList) {
loadAsFileOrDirectory(x, extList) {
// a. LOAD_AS_FILE(X)
const f = this.loadAsFile(x, extList);
if (f) return f;
Expand Down Expand Up @@ -555,7 +555,7 @@ class DefaultResolver extends Resolver {
} else {
// a. LOAD_AS_FILE(RESOLVED_PATH)
// b. LOAD_AS_DIRECTORY(RESOLVED_PATH)
f = this.loadAsFileOrDirecotry(resolvedPath, extList);
f = this.loadAsFileOrDirectory(resolvedPath, extList);
}
if (f) return f;
// 5. THROW "not found"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"alcatraz",
"contextify"
],
"version": "3.9.13",
"version": "3.9.14",
"main": "index.js",
"sideEffects": false,
"repository": "github:patriksimek/vm2",
Expand Down

0 comments on commit 066afd1

Please sign in to comment.