|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1015 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Authors Ivan Kopeykin @vankop
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | /** @typedef {import("./Compiler")} Compiler */
|
|---|
| 9 | /** @typedef {import("./config/target").PlatformTargetProperties} PlatformTargetProperties */
|
|---|
| 10 |
|
|---|
| 11 | const PLUGIN_NAME = "PlatformPlugin";
|
|---|
| 12 |
|
|---|
| 13 | /**
|
|---|
| 14 | * Should be used only for "target === false" or
|
|---|
| 15 | * when you want to overwrite platform target properties
|
|---|
| 16 | */
|
|---|
| 17 | class PlatformPlugin {
|
|---|
| 18 | /**
|
|---|
| 19 | * Creates an instance of PlatformPlugin.
|
|---|
| 20 | * @param {Partial<PlatformTargetProperties>} platform target properties
|
|---|
| 21 | */
|
|---|
| 22 | constructor(platform) {
|
|---|
| 23 | /** @type {Partial<PlatformTargetProperties>} */
|
|---|
| 24 | this.platform = platform;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | /**
|
|---|
| 28 | * Applies the plugin by registering its hooks on the compiler.
|
|---|
| 29 | * @param {Compiler} compiler the compiler instance
|
|---|
| 30 | * @returns {void}
|
|---|
| 31 | */
|
|---|
| 32 | apply(compiler) {
|
|---|
| 33 | compiler.hooks.environment.tap(PLUGIN_NAME, () => {
|
|---|
| 34 | compiler.platform = {
|
|---|
| 35 | ...compiler.platform,
|
|---|
| 36 | ...this.platform
|
|---|
| 37 | };
|
|---|
| 38 | });
|
|---|
| 39 | }
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | module.exports = PlatformPlugin;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.