MCPcopy Create free account
hub / github.com/nodejs/node / createUnparsedSourceFile

Function createUnparsedSourceFile

test/fixtures/snapshot/typescript.js:27413–27461  ·  view source on GitHub ↗
(textOrInputFiles, mapPathOrType, mapTextOrStripInternal)

Source from the content-addressed store, hash-verified

27411 };
27412 ts.factory = createNodeFactory(4 /* NodeFactoryFlags.NoIndentationOnFreshPropertyAccess */, syntheticFactory);
27413 function createUnparsedSourceFile(textOrInputFiles, mapPathOrType, mapTextOrStripInternal) {
27414 var stripInternal;
27415 var bundleFileInfo;
27416 var fileName;
27417 var text;
27418 var length;
27419 var sourceMapPath;
27420 var sourceMapText;
27421 var getText;
27422 var getSourceMapText;
27423 var oldFileOfCurrentEmit;
27424 if (!ts.isString(textOrInputFiles)) {
27425 ts.Debug.assert(mapPathOrType === "js" || mapPathOrType === "dts");
27426 fileName = (mapPathOrType === "js" ? textOrInputFiles.javascriptPath : textOrInputFiles.declarationPath) || "";
27427 sourceMapPath = mapPathOrType === "js" ? textOrInputFiles.javascriptMapPath : textOrInputFiles.declarationMapPath;
27428 getText = function () { return mapPathOrType === "js" ? textOrInputFiles.javascriptText : textOrInputFiles.declarationText; };
27429 getSourceMapText = function () { return mapPathOrType === "js" ? textOrInputFiles.javascriptMapText : textOrInputFiles.declarationMapText; };
27430 length = function () { return getText().length; };
27431 if (textOrInputFiles.buildInfo && textOrInputFiles.buildInfo.bundle) {
27432 ts.Debug.assert(mapTextOrStripInternal === undefined || typeof mapTextOrStripInternal === "boolean");
27433 stripInternal = mapTextOrStripInternal;
27434 bundleFileInfo = mapPathOrType === "js" ? textOrInputFiles.buildInfo.bundle.js : textOrInputFiles.buildInfo.bundle.dts;
27435 oldFileOfCurrentEmit = textOrInputFiles.oldFileOfCurrentEmit;
27436 }
27437 }
27438 else {
27439 fileName = "";
27440 text = textOrInputFiles;
27441 length = textOrInputFiles.length;
27442 sourceMapPath = mapPathOrType;
27443 sourceMapText = mapTextOrStripInternal;
27444 }
27445 var node = oldFileOfCurrentEmit ?
27446 parseOldFileOfCurrentEmit(ts.Debug.checkDefined(bundleFileInfo)) :
27447 parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
27448 node.fileName = fileName;
27449 node.sourceMapPath = sourceMapPath;
27450 node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
27451 if (getText && getSourceMapText) {
27452 Object.defineProperty(node, "text", { get: getText });
27453 Object.defineProperty(node, "sourceMapText", { get: getSourceMapText });
27454 }
27455 else {
27456 ts.Debug.assert(!oldFileOfCurrentEmit);
27457 node.text = text !== null && text !== void 0 ? text : "";
27458 node.sourceMapText = sourceMapText;
27459 }
27460 return node;
27461 }
27462 ts.createUnparsedSourceFile = createUnparsedSourceFile;
27463 function parseUnparsedSourceFile(bundleFileInfo, stripInternal, length) {
27464 var prologues;

Callers

nothing calls this directly

Calls 5

getTextFunction · 0.85
parseUnparsedSourceFileFunction · 0.85
assertMethod · 0.80
definePropertyMethod · 0.45

Tested by

no test coverage detected