main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[79a0317] | 1 | /*
|
---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
| 3 | Author Tobias Koppers @sokra
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | "use strict";
|
---|
| 7 |
|
---|
| 8 | const Dependency = require("../Dependency");
|
---|
| 9 | const makeSerializable = require("../util/makeSerializable");
|
---|
| 10 |
|
---|
| 11 | /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
---|
| 12 | /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
---|
| 13 |
|
---|
| 14 | class FallbackDependency extends Dependency {
|
---|
| 15 | /**
|
---|
| 16 | * @param {string[]} requests requests
|
---|
| 17 | */
|
---|
| 18 | constructor(requests) {
|
---|
| 19 | super();
|
---|
| 20 | this.requests = requests;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * @returns {string | null} an identifier to merge equal requests
|
---|
| 25 | */
|
---|
| 26 | getResourceIdentifier() {
|
---|
| 27 | return `fallback ${this.requests.join(" ")}`;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | get type() {
|
---|
| 31 | return "fallback";
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | get category() {
|
---|
| 35 | return "esm";
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | /**
|
---|
| 39 | * @param {ObjectSerializerContext} context context
|
---|
| 40 | */
|
---|
| 41 | serialize(context) {
|
---|
| 42 | const { write } = context;
|
---|
| 43 | write(this.requests);
|
---|
| 44 | super.serialize(context);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | /**
|
---|
| 48 | * @param {ObjectDeserializerContext} context context
|
---|
| 49 | * @returns {FallbackDependency} deserialize fallback dependency
|
---|
| 50 | */
|
---|
| 51 | static deserialize(context) {
|
---|
| 52 | const { read } = context;
|
---|
| 53 | const obj = new FallbackDependency(read());
|
---|
| 54 | obj.deserialize(context);
|
---|
| 55 | return obj;
|
---|
| 56 | }
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | makeSerializable(
|
---|
| 60 | FallbackDependency,
|
---|
| 61 | "webpack/lib/container/FallbackDependency"
|
---|
| 62 | );
|
---|
| 63 |
|
---|
| 64 | module.exports = FallbackDependency;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.