保誠-保戶業務員媒合平台
Tomas
2022-05-19 957a1f10a06fdbb76f1a0ba94fe44126c613fee3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
const cachePrefix = require('.').cachePrefix;
const LoggerFactory = require('../loggerFactory');
 
exports.moduleFreezeError = (compilation, module, e) => {
  const loggerSerial = LoggerFactory.getLogger(compilation).from('serial');
  const compilerName = compilation.compiler.name;
  const compilerContext = compilation.compiler.options.context;
  const identifierPrefix = cachePrefix(compilation);
  const moduleIdentifier = module.identifier();
  const shortener = new (require('webpack/lib/RequestShortener'))(
    compilerContext,
  );
  const moduleReadable = module.readableIdentifier(shortener);
 
  loggerSerial.error(
    {
      id: 'serialization--error-freezing-module',
      identifierPrefix,
      compilerName,
      moduleIdentifier,
      moduleReadable,
      error: e,
      errorMessage: e.message,
      errorStack: e.stack,
    },
    `Unable to freeze module "${moduleReadable}${
      compilerName ? `" in compilation "${compilerName}` : ''
    }". An error occured serializing it into a string: ${e.message}`,
  );
};
 
exports.cacheNoParity = (compiler, { parityRoot }) => {
  const loggerSerial = new LoggerFactory(compiler).create().from('serial');
  loggerSerial.error(
    {
      id: 'serialzation--cache-incomplete',
      parityRoot,
    },
    [
      `Previous cache did not complete parity check. ${parityRoot.reason}`,
      'Resetting cache.',
    ].join('\n'),
  );
};
 
exports.serialBadCache = (compiler, error) => {
  const loggerSerial = new LoggerFactory(compiler).create().from('serial');
  loggerSerial.error(
    {
      id: 'serialzation--bad-cache',
    },
    ['Cache is corrupted.', error.stack || error.message || error].join('\n'),
  );
};
 
const logCore = compiler => new LoggerFactory(compiler).create().from('core');
 
exports.configHashSetButNotUsed = (compiler, { cacheDirectory }) => {
  const loggerCore = logCore(compiler);
  loggerCore.error(
    {
      id: 'confighash--directory-no-confighash',
      cacheDirectory: cacheDirectory,
    },
    'HardSourceWebpackPlugin cannot use [confighash] in cacheDirectory ' +
      'without configHash option being set and returning a non-falsy value.',
  );
};
 
exports.configHashFirstBuild = (compiler, { cacheDirPath, configHash }) => {
  const loggerCore = logCore(compiler);
  loggerCore.log(
    {
      id: 'confighash--new',
      cacheDirPath,
      configHash,
    },
    `HardSourceWebpackPlugin is writing to a new confighash path for the first time: ${cacheDirPath}`,
  );
};
 
exports.configHashBuildWith = (compiler, { cacheDirPath, configHash }) => {
  const loggerCore = logCore(compiler);
  loggerCore.log(
    {
      id: 'confighash--reused',
      cacheDirPath,
      configHash,
    },
    `HardSourceWebpackPlugin is reading from and writing to a confighash path: ${cacheDirPath}`,
  );
};
 
exports.deleteOldCaches = (compiler, { newTotalSize, oldTotalSize }) => {
  const loggerCore = logCore(compiler);
  const sizeMB = Math.ceil(newTotalSize / 1024 / 1024);
  const deletedSizeMB = Math.ceil(oldTotalSize / 1024 / 1024);
  loggerCore.log(
    {
      id: 'caches--delete-old',
      size: newTotalSize,
      sizeMB,
      deletedSize: oldTotalSize,
      deletedSizeMB,
    },
    `HardSourceWebpackPlugin is using ${sizeMB} MB of disk space after deleting ${deletedSizeMB} MB.`,
  );
};
 
exports.keepCaches = (compiler, { totalSize }) => {
  const loggerCore = logCore(compiler);
  const sizeMB = Math.ceil(totalSize / 1024 / 1024);
  loggerCore.log(
    {
      id: 'caches--keep',
      size: totalSize,
      sizeMB,
    },
    `HardSourceWebpackPlugin is using ${sizeMB} MB of disk space.`,
  );
};
 
exports.environmentInputs = (compiler, { inputs }) => {
  const loggerCore = logCore(compiler);
  loggerCore.log(
    {
      id: 'environment--inputs',
      inputs,
    },
    `Tracking environment changes with ${inputs.join(', ')}.`,
  );
};
 
exports.configHashChanged = compiler => {
  const loggerCore = logCore(compiler);
  loggerCore.warn(
    {
      id: 'environment--config-changed',
    },
    'Environment has changed (configuration was changed).\n' +
      'HardSourceWebpackPlugin will reset the cache and store a fresh one.',
  );
};
 
exports.environmentHashChanged = compiler => {
  const loggerCore = logCore(compiler);
  loggerCore.warn(
    {
      id: 'environment--changed',
    },
    'Environment has changed (node_modules was updated).\n' +
      'HardSourceWebpackPlugin will reset the cache and store a fresh one.',
  );
};
 
exports.hardSourceVersionChanged = compiler => {
  const loggerCore = logCore(compiler);
  loggerCore.warn(
    {
      id: 'environment--hardsource-changed',
    },
    'Installed HardSource version does not match the saved ' +
      'cache.\nHardSourceWebpackPlugin will reset the cache and store ' +
      'a fresh one.',
  );
};
 
exports.childCompilerWithoutCache = compilation => {
  var loggerUtil = LoggerFactory.getLogger(compilation).from('util');
  loggerUtil.error(
    {
      id: 'childcompiler--no-cache',
      compilerName: compilation.compiler.name,
    },
    [
      `A child compiler (${compilation.compiler.name}) does not`,
      "have a memory cache. Enable a memory cache with webpack's",
      '`cache` configuration option. HardSourceWebpackPlugin will be',
      'disabled for this child compiler until then.',
    ].join('\n'),
  );
};
 
exports.childCompilerUnnamedCache = compilation => {
  var loggerUtil = LoggerFactory.getLogger(compilation).from('util');
  loggerUtil.error(
    {
      id: 'childcompiler--unnamed-cache',
      compilerName: compilation.compiler.name,
    },
    [
      `A child compiler (${compilation.compiler.name}) has a`,
      'memory cache but its cache name is unknown.',
      'HardSourceWebpackPlugin will be disabled for this child',
      'compiler.',
    ].join('\n'),
  );
};
 
const logParallel = compiler =>
  new LoggerFactory(compiler).create().from('parallel');
 
exports.parallelStartWorkers = (compiler, options) => {
  const loggerParallel = logParallel(compiler);
  loggerParallel.log(
    {
      id: 'parallel--start-workers',
      numWorkers: options.numWorkers,
    },
    [`Start ${options.numWorkers} module workers.`].join('\n'),
  );
};
 
exports.parallelConfigMismatch = (compiler, options) => {
  const loggerParallel = logParallel(compiler);
  loggerParallel.error(
    {
      id: 'parallel--config-mismatch',
      ourHash: options.ourHash,
      theirHash: options.theirHash,
    },
    [
      `Child process's configuration does not match parent `,
      `configuration. Unable to parallelize webpack.`,
    ].join('\n'),
  );
};
 
exports.parallelErrorSendingJob = (compiler, error) => {
  const loggerParallel = logParallel(compiler);
  loggerParallel.error(
    {
      id: 'parallel--error-sending-job',
      error,
    },
    `Failed to send parallel module work. ${error.stack}`,
  );
};
 
exports.parallelRequireWebpack4 = compiler => {
  const loggerParallel = logParallel(compiler);
  loggerParallel.error(
    {
      id: 'parallel--webpack-4',
    },
    `Parallel Module Plugin requires webpack 4.`,
  );
};