Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 6a8fdad

Browse files
committed
refactor: address comments
1 parent f8aa3a9 commit 6a8fdad

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Diff for: android-app-components-loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { convertSlashesInPath } = require("./projectHelpers");
33
module.exports = function (source) {
44
this.cacheable();
55
const { modules } = this.query;
6-
const imports = modules.map(m => convertSlashesInPath(m))
6+
const imports = modules.map(convertSlashesInPath)
77
.map(m => `require("${m}");`).join("\n");
88
const augmentedSource = `
99
if (!global["__snapshot"]) {

Diff for: xml-namespace-loader.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ module.exports = function (source) {
6868
parser.parse(source);
6969

7070
const moduleRegisters = namespaces
71-
.map(function (n) {
72-
let obj = n;
73-
obj.path = convertSlashesInPath(n.path);
74-
return obj;
75-
})
71+
.map(convertPath)
7672
.map(n =>
7773
`global.registerModule("${n.name}", function() { return require("${n.path}"); });`
7874
)
@@ -89,6 +85,11 @@ module.exports = function (source) {
8985
this.callback(null, wrapped);
9086
}
9187

88+
function convertPath(obj) {
89+
obj.path = convertSlashesInPath(obj.path);
90+
return obj;
91+
}
92+
9293
function tryResolve(path) {
9394
try {
9495
return require.resolve(path);

0 commit comments

Comments
 (0)