Skip to content

Commit

Permalink
use encodeURI, per aladdin-add
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Dec 14, 2021
1 parent f91a8e0 commit 996ae9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"rewire"
],
"dependencies": {
"resolvewithplus": "^0.5.0"
"resolvewithplus": "^0.5.1"
},
"devDependencies": {
"uvu": "0.5.2",
Expand All @@ -56,7 +56,7 @@
"sinon": "^12.0.1"
},
"scripts": {
"test-ava": "ava --node-arguments=\"--loader=./src/esmockLoader.mjs\" ./spec/ava/*spec.js",
"test-ava": "ava --node-arguments=\"--loader=./src/esmockLoader.mjs\" ./spec/ava/*.spec.js",
"test-uvu": "node --no-warnings --loader=./src/esmockLoader.mjs ./node_modules/uvu/bin.js ./spec/uvu/",
"test": "npm run test-ava && npm run test-uvu",
"test-no-warn": "ava --node-arguments=\"--loader=./src/esmockLoader.mjs --no-warnings\"",
Expand Down
3 changes: 1 addition & 2 deletions src/esmockLoader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const esmockGlobalsAndAfterRe = /\?esmockGlobals=.*/;
const esMockGlobalsAndBeforeRe = /.*\?esmockGlobals=/;
const esmockModuleKeysRe = /#esmockModuleKeys/;
const exportNamesRe = /.*exportNames=(.*)/;
const whitespaceRe = /%20/g;
const esmockKeyRe = /esmockKey=\d*/;
const withHashRe = /[^#]*#/;
const isesmRe = /isesm=true/;
Expand All @@ -38,7 +37,7 @@ const resolve = async (specifier, context, defaultResolve) => {
return defaultResolve(specifier, context, defaultResolve);

const resolved = defaultResolve(specifier, context, defaultResolve);
const resolvedurl = resolved.url.replace(whitespaceRe, ' ');
const resolvedurl = decodeURI(resolved.url);
const moduleKeyRe = new RegExp(
'.*(' + resolvedurl + '\\?' + esmockKeyParam + '[^#]*).*');

Expand Down

0 comments on commit 996ae9f

Please sign in to comment.