(bundleFileInfo, stripInternal, length)
| 27461 | } |
| 27462 | ts.createUnparsedSourceFile = createUnparsedSourceFile; |
| 27463 | function parseUnparsedSourceFile(bundleFileInfo, stripInternal, length) { |
| 27464 | var prologues; |
| 27465 | var helpers; |
| 27466 | var referencedFiles; |
| 27467 | var typeReferenceDirectives; |
| 27468 | var libReferenceDirectives; |
| 27469 | var prependChildren; |
| 27470 | var texts; |
| 27471 | var hasNoDefaultLib; |
| 27472 | for (var _i = 0, _a = bundleFileInfo ? bundleFileInfo.sections : ts.emptyArray; _i < _a.length; _i++) { |
| 27473 | var section = _a[_i]; |
| 27474 | switch (section.kind) { |
| 27475 | case "prologue" /* BundleFileSectionKind.Prologue */: |
| 27476 | prologues = ts.append(prologues, ts.setTextRange(ts.factory.createUnparsedPrologue(section.data), section)); |
| 27477 | break; |
| 27478 | case "emitHelpers" /* BundleFileSectionKind.EmitHelpers */: |
| 27479 | helpers = ts.append(helpers, ts.getAllUnscopedEmitHelpers().get(section.data)); |
| 27480 | break; |
| 27481 | case "no-default-lib" /* BundleFileSectionKind.NoDefaultLib */: |
| 27482 | hasNoDefaultLib = true; |
| 27483 | break; |
| 27484 | case "reference" /* BundleFileSectionKind.Reference */: |
| 27485 | referencedFiles = ts.append(referencedFiles, { pos: -1, end: -1, fileName: section.data }); |
| 27486 | break; |
| 27487 | case "type" /* BundleFileSectionKind.Type */: |
| 27488 | typeReferenceDirectives = ts.append(typeReferenceDirectives, { pos: -1, end: -1, fileName: section.data }); |
| 27489 | break; |
| 27490 | case "type-import" /* BundleFileSectionKind.TypeResolutionModeImport */: |
| 27491 | typeReferenceDirectives = ts.append(typeReferenceDirectives, { pos: -1, end: -1, fileName: section.data, resolutionMode: ts.ModuleKind.ESNext }); |
| 27492 | break; |
| 27493 | case "type-require" /* BundleFileSectionKind.TypeResolutionModeRequire */: |
| 27494 | typeReferenceDirectives = ts.append(typeReferenceDirectives, { pos: -1, end: -1, fileName: section.data, resolutionMode: ts.ModuleKind.CommonJS }); |
| 27495 | break; |
| 27496 | case "lib" /* BundleFileSectionKind.Lib */: |
| 27497 | libReferenceDirectives = ts.append(libReferenceDirectives, { pos: -1, end: -1, fileName: section.data }); |
| 27498 | break; |
| 27499 | case "prepend" /* BundleFileSectionKind.Prepend */: |
| 27500 | var prependTexts = void 0; |
| 27501 | for (var _b = 0, _c = section.texts; _b < _c.length; _b++) { |
| 27502 | var text = _c[_b]; |
| 27503 | if (!stripInternal || text.kind !== "internal" /* BundleFileSectionKind.Internal */) { |
| 27504 | prependTexts = ts.append(prependTexts, ts.setTextRange(ts.factory.createUnparsedTextLike(text.data, text.kind === "internal" /* BundleFileSectionKind.Internal */), text)); |
| 27505 | } |
| 27506 | } |
| 27507 | prependChildren = ts.addRange(prependChildren, prependTexts); |
| 27508 | texts = ts.append(texts, ts.factory.createUnparsedPrepend(section.data, prependTexts !== null && prependTexts !== void 0 ? prependTexts : ts.emptyArray)); |
| 27509 | break; |
| 27510 | case "internal" /* BundleFileSectionKind.Internal */: |
| 27511 | if (stripInternal) { |
| 27512 | if (!texts) |
| 27513 | texts = []; |
| 27514 | break; |
| 27515 | } |
| 27516 | // falls through |
| 27517 | case "text" /* BundleFileSectionKind.Text */: |
| 27518 | texts = ts.append(texts, ts.setTextRange(ts.factory.createUnparsedTextLike(section.data, section.kind === "internal" /* BundleFileSectionKind.Internal */), section)); |
| 27519 | break; |
| 27520 | default: |
no test coverage detected