Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.9.14 #506

Merged
merged 1 commit into from
Feb 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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