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

Function buildAceModuleInternal

Makefile.dryice.js:397–478  ·  view source on GitHub ↗
(opts, callback)

Source from the content-addressed store, hash-verified

395}
396
397function buildAceModuleInternal(opts, callback) {
398 var cache = opts.cache == undefined ? CACHE : opts.cache;
399 var key = opts.require + "|" + opts.projectType;
400 if (cache && cache.configs && cache.configs[key])
401 return write(null, cache.configs[key]);
402
403 var pathConfig = {
404 paths: {
405 ace: ACE_HOME + "/lib/ace",
406 "kitchen-sink": ACE_HOME + "/demo/kitchen-sink",
407 build_support: ACE_HOME + "/build_support"
408 },
409 root: ACE_HOME
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

Callers

nothing calls this directly

Calls 2

buildFunction · 0.85
writeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…