MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / filterPreload

Method filterPreload

tools/mcconfig.js:1088–1127  ·  view source on GitHub ↗
(preload)

Source from the content-addressed store, hash-verified

1086 this.creation = creation;
1087 }
1088 filterPreload(preload) {
1089 this.preloads = [];
1090 if (preload.length) {
1091 for (var file of [].concat(this.jsFiles, this.tsFiles, this.cdvFiles, this.nodered2mcuFiles)) {
1092 file.preload = false;
1093 }
1094 for (var pattern of preload) {
1095 pattern = this.resolvePrefix(pattern);
1096 pattern = this.resolveSlash(pattern);
1097 var star = pattern.lastIndexOf("*");
1098 if (star >= 0) {
1099 pattern = pattern.slice(0, star);
1100 for (var result of this.jsFiles) {
1101 var target = result.target.slice(0, star);
1102 if (target == pattern) {
1103 result.preload = true;
1104 this.preloads.push(result.target);
1105 }
1106 }
1107 }
1108 else {
1109 pattern += ".xsb";
1110 for (var result of [].concat(this.jsFiles, this.tsFiles)) {
1111 var target = result.target;
1112 if (target == pattern) {
1113 result.preload = true;
1114 this.preloads.push(result.target);
1115 }
1116 }
1117 for (var result of [].concat(this.cdvFiles, this.nodered2mcuFiles)) {
1118 const target = result.target + ".xsb";
1119 if (target == pattern) {
1120 result.preload = true;
1121 this.preloads.push(target);
1122 }
1123 }
1124 }
1125 }
1126 }
1127 }
1128 filterRecipe(name, pattern) {
1129 var star = pattern.lastIndexOf("*");
1130 if (star == 0 && pattern.length > 2 && '.' == pattern[1]) {

Callers 1

runMethod · 0.80

Calls 5

concatMethod · 0.65
sliceMethod · 0.65
resolvePrefixMethod · 0.45
resolveSlashMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected