* Returns the source types available for this module. * @param {NormalModule} module fresh module * @returns {SourceTypes} available types (do not mutate)
(module)
| 616 | * @returns {SourceTypes} available types (do not mutate) |
| 617 | */ |
| 618 | getTypes(module) { |
| 619 | const exportType = /** @type {CssModule} */ (module).exportType || "link"; |
| 620 | if (exportType === "style") { |
| 621 | return JAVASCRIPT_TYPES; |
| 622 | } |
| 623 | |
| 624 | let hasJs = false; |
| 625 | let hasCssText = false; |
| 626 | const connections = this._moduleGraph.getIncomingConnections(module); |
| 627 | |
| 628 | for (const connection of connections) { |
| 629 | if (hasJs && hasCssText) break; |
| 630 | if ( |
| 631 | exportType === "link" && |
| 632 | connection.dependency instanceof CssImportDependency |
| 633 | ) { |
| 634 | continue; |
| 635 | } |
| 636 | |
| 637 | if (connection.dependency instanceof HarmonyImportSideEffectDependency) { |
| 638 | continue; |
| 639 | } |
| 640 | |
| 641 | // HTML inline styles consume CSS_TEXT_TYPE directly. |
| 642 | if ( |
| 643 | connection.dependency && |
| 644 | (connection.dependency.category === "html-style" || |
| 645 | connection.dependency.category === "html-style-attribute") |
| 646 | ) { |
| 647 | hasCssText = true; |
| 648 | continue; |
| 649 | } |
| 650 | |
| 651 | if (!connection.originModule) { |
| 652 | continue; |
| 653 | } |
| 654 | |
| 655 | if (!connection.originModule.type.startsWith(CSS_TYPE_PREFIX)) { |
| 656 | hasJs = true; |
| 657 | } else { |
| 658 | const originModule = /** @type {CssModule} */ connection.originModule; |
| 659 | const originExportType = |
| 660 | /** @type {CssModule} */ (originModule).exportType || "link"; |
| 661 | if (originExportType !== "link") { |
| 662 | hasJs = true; |
| 663 | } |
| 664 | } |
| 665 | } |
| 666 | if (this._exportsOnly || exportType !== "link") { |
| 667 | if (hasJs && hasCssText) return JAVASCRIPT_AND_CSS_TEXT_TYPES; |
| 668 | if (hasJs) return JAVASCRIPT_TYPES; |
| 669 | if (hasCssText) return CSS_TEXT_TYPES; |
| 670 | return NO_TYPES; |
| 671 | } |
| 672 | if (hasJs) { |
| 673 | return JAVASCRIPT_AND_CSS_TYPES; |
| 674 | } |
| 675 | return CSS_TYPES; |
nothing calls this directly
no test coverage detected