main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
894 bytes
|
Rev | Line | |
---|
[79a0317] | 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 | /**
|
---|
| 12 | * Should be used only for "target === false" or
|
---|
| 13 | * when you want to overwrite platform target properties
|
---|
| 14 | */
|
---|
| 15 | class PlatformPlugin {
|
---|
| 16 | /**
|
---|
| 17 | * @param {Partial<PlatformTargetProperties>} platform target properties
|
---|
| 18 | */
|
---|
| 19 | constructor(platform) {
|
---|
| 20 | /** @type {Partial<PlatformTargetProperties>} */
|
---|
| 21 | this.platform = platform;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * Apply the plugin
|
---|
| 26 | * @param {Compiler} compiler the compiler instance
|
---|
| 27 | * @returns {void}
|
---|
| 28 | */
|
---|
| 29 | apply(compiler) {
|
---|
| 30 | compiler.hooks.environment.tap("PlatformPlugin", () => {
|
---|
| 31 | compiler.platform = {
|
---|
| 32 | ...compiler.platform,
|
---|
| 33 | ...this.platform
|
---|
| 34 | };
|
---|
| 35 | });
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | module.exports = PlatformPlugin;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.