Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
955 bytes
|
Line | |
---|
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 | class FallbackDependency extends Dependency {
|
---|
12 | constructor(requests) {
|
---|
13 | super();
|
---|
14 | this.requests = requests;
|
---|
15 | }
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * @returns {string | null} an identifier to merge equal requests
|
---|
19 | */
|
---|
20 | getResourceIdentifier() {
|
---|
21 | return `fallback ${this.requests.join(" ")}`;
|
---|
22 | }
|
---|
23 |
|
---|
24 | get type() {
|
---|
25 | return "fallback";
|
---|
26 | }
|
---|
27 |
|
---|
28 | get category() {
|
---|
29 | return "esm";
|
---|
30 | }
|
---|
31 |
|
---|
32 | serialize(context) {
|
---|
33 | const { write } = context;
|
---|
34 | write(this.requests);
|
---|
35 | super.serialize(context);
|
---|
36 | }
|
---|
37 |
|
---|
38 | static deserialize(context) {
|
---|
39 | const { read } = context;
|
---|
40 | const obj = new FallbackDependency(read());
|
---|
41 | obj.deserialize(context);
|
---|
42 | return obj;
|
---|
43 | }
|
---|
44 | }
|
---|
45 |
|
---|
46 | makeSerializable(
|
---|
47 | FallbackDependency,
|
---|
48 | "webpack/lib/container/FallbackDependency"
|
---|
49 | );
|
---|
50 |
|
---|
51 | module.exports = FallbackDependency;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.