Skip to content

Commit

Permalink
[INTERNAL] ResourceInfoList: Re-add getDebugName function
Browse files Browse the repository at this point in the history
This reverts commit 6bbc8e9.
  • Loading branch information
RandomByte committed Nov 26, 2020
1 parent 6bbc8e9 commit 40d2994
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/lbt/resources/ResourceInfoList.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const ResourceInfo = require("./ResourceInfo");

const DEBUG_RESOURCES_PATTERN = /-dbg((?:\.view|\.fragment|\.controller|\.designtime|\.support)?\.js|\.css)$/;
const RESOURCES_PATTERN = /((?:\.view|\.fragment|\.controller|\.designtime|\.support)?\.js|\.css)$/;

/**
* A list of ResourceInfo objects, suitable for (but not dependent on) JSON serialization.
Expand Down Expand Up @@ -113,6 +114,15 @@ class ResourceInfoList {
}
return null;
}

static getDebugName(path) {
if ( RESOURCES_PATTERN.test(path) ) {
if (!path.replace(RESOURCES_PATTERN, "").endsWith("-dbg")) {
return path.replace( RESOURCES_PATTERN, "-dbg$1");
}
}
return null;
}
}

module.exports = ResourceInfoList;

0 comments on commit 40d2994

Please sign in to comment.