MCPcopy
hub / github.com/meteor/meteor / compileOneJsResource

Method compileOneJsResource

tools/isobuild/compiler-plugin.js:1110–1152  ·  view source on GitHub ↗
(resource)

Source from the content-addressed store, hash-verified

1108 }
1109
1110 compileOneJsResource(resource) {
1111 const slot = this.makeResourceSlot({
1112 type: "source",
1113 extension: "js",
1114 // Need { data, path, hash } here, at least.
1115 ...resource,
1116 fileOptions: {
1117 lazy: true,
1118 ...resource.fileOptions,
1119 }
1120 });
1121
1122 if (slot) {
1123 // If the resource was not handled by a source processor, it will be
1124 // added directly to slot.jsOutputResources by makeResourceSlot,
1125 // meaning we do not need to compile it.
1126 if (slot.jsOutputResources.length > 0) {
1127 return slot.jsOutputResources
1128 }
1129
1130 const inputFile = new InputFile(slot);
1131 inputFile.supportsLazyCompilation = false;
1132
1133 if (slot.sourceProcessor) {
1134 const { userPlugin } = slot.sourceProcessor;
1135 if (userPlugin) {
1136 const markedMethod = buildmessage.markBoundary(
1137 userPlugin.processFilesForTarget,
1138 userPlugin
1139 );
1140 try {
1141 Promise.await(markedMethod([inputFile]));
1142 } catch (e) {
1143 buildmessage.exception(e);
1144 }
1145 }
1146 }
1147
1148 return slot.jsOutputResources;
1149 }
1150
1151 return [];
1152 }
1153
1154 makeResourceSlot(resource) {
1155 let sourceProcessor = null;

Callers

nothing calls this directly

Calls 2

makeResourceSlotMethod · 0.95
exceptionMethod · 0.80

Tested by

no test coverage detected