|
Last change
on this file since ae6cd79 was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | "use strict";
|
|---|
| 6 |
|
|---|
| 7 | const RuntimeGlobals = require("../RuntimeGlobals");
|
|---|
| 8 | const Template = require("../Template");
|
|---|
| 9 | const HelperRuntimeModule = require("./HelperRuntimeModule");
|
|---|
| 10 |
|
|---|
| 11 | /** @typedef {import("../Compilation")} Compilation */
|
|---|
| 12 |
|
|---|
| 13 | class CompatGetDefaultExportRuntimeModule extends HelperRuntimeModule {
|
|---|
| 14 | constructor() {
|
|---|
| 15 | super("compat get default export");
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | /**
|
|---|
| 19 | * Generates runtime code for this runtime module.
|
|---|
| 20 | * @returns {string | null} runtime code
|
|---|
| 21 | */
|
|---|
| 22 | generate() {
|
|---|
| 23 | const compilation = /** @type {Compilation} */ (this.compilation);
|
|---|
| 24 | const { runtimeTemplate } = compilation;
|
|---|
| 25 | const fn = RuntimeGlobals.compatGetDefaultExport;
|
|---|
| 26 | return Template.asString([
|
|---|
| 27 | "// getDefaultExport function for compatibility with non-harmony modules",
|
|---|
| 28 | `${fn} = ${runtimeTemplate.basicFunction("module", [
|
|---|
| 29 | "var getter = module && module.__esModule ?",
|
|---|
| 30 | Template.indent([
|
|---|
| 31 | `${runtimeTemplate.returningFunction("module['default']")} :`,
|
|---|
| 32 | `${runtimeTemplate.returningFunction("module")};`
|
|---|
| 33 | ]),
|
|---|
| 34 | `${RuntimeGlobals.definePropertyGetters}(getter, { a: getter });`,
|
|---|
| 35 | "return getter;"
|
|---|
| 36 | ])};`
|
|---|
| 37 | ]);
|
|---|
| 38 | }
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | module.exports = CompatGetDefaultExportRuntimeModule;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.