MCPcopy
hub / github.com/ajaxorg/ace / write

Function write

Makefile.dryice.js:412–461  ·  view source on GitHub ↗
(err, result)

Source from the content-addressed store, hash-verified

410 };
411
412 function write(err, result) {
413 if (cache && key && !(cache.configs && cache.configs[key])) {
414 cache.configs = cache.configs || Object.create(null);
415 cache.configs[key] = result;
416 result.sources = result.sources.map(function(pkg) {
417 return {deps: pkg.deps};
418 });
419 }
420
421 if (!opts.outputFile)
422 return callback(err, result);
423
424 var code = result.code;
425 if (opts.compress) {
426 if (!result.codeMin)
427 result.codeMin = compress(result.code);
428 code = result.codeMin;
429 }
430
431 var targetDir = getTargetDir(opts);
432
433 var to = /^([\\/]|\w:)/.test(opts.outputFile)
434 ? opts.outputFile
435 : path.join(opts.outputFolder || targetDir, opts.outputFile);
436
437 var filters = [];
438
439 var ns = opts.ns || "ace";
440 if (opts.filters)
441 filters = filters.concat(opts.filters);
442
443 if (opts.noconflict)
444 filters.push(namespace(ns));
445 var projectType = opts.projectType;
446 if (projectType !== "worker") {
447 filters.push(exportAce(ns, opts.require[0],
448 opts.noconflict ? ns : "", projectType !== "main"));
449 }
450
451 filters.push(normalizeLineEndings);
452
453 filters.forEach(function(f) { code = f(code); });
454
455 build.writeToFile({code: code}, {
456 outputFolder: path.dirname(to),
457 outputFile: path.basename(to)
458 }, function() {});
459
460 callback && callback(err, result);
461 }
462
463 build(opts.require, {
464 cache: cache,

Callers 1

buildAceModuleInternalFunction · 0.70

Calls 10

compressFunction · 0.85
getTargetDirFunction · 0.85
namespaceFunction · 0.85
mapMethod · 0.80
pushMethod · 0.80
exportAceFunction · 0.70
callbackFunction · 0.50
fFunction · 0.50
joinMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…