UNPKG

872 BJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports.default = _default;
5
6function _default(source) {
7 // all it does is adding BaseContext to list of exports
8 return source.replace(/export\s+{([^}]+)}/m, (match, exportList) => {
9 // return `export { ${exportList}, BaseContext }`
10 if (/[,\s]BaseContext[,\s]/.test(exportList)) {
11 // If BaseContext is already in export list - do nothing.
12 // At the time of writing this, BaseContext is not exported,
13 // but this can change in future version of @reach/router
14 // and we don't want to export same thing multiple times
15 // as this would cause parsing errors:
16 // "Module parse failed: Duplicate export 'BaseContext'"
17 return match;
18 } else {
19 return `export { ${exportList}, BaseContext }`;
20 }
21 });
22}
23//# sourceMappingURL=reach-router-add-basecontext-export-loader.js.map
\No newline at end of file