Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// chokidar options.
this.isWatching = false;
this.isWatchReady = false;
this.appJSON = path.join(this.wxaConfigs.context, 'app.json');
this.wxaJSON = path.join(this.wxaConfigs.context, 'app'+this.wxaConfigs.resolve.ext);
this.progress = new ProgressTextBar(this.current, this.wxaConfigs);
this.hooks = {
entryOption: new SyncBailHook(['entry']),
beforeRun: new AsyncSeriesHook(['compiler']),
run: new AsyncSeriesHook(['compiler']),
done: new AsyncParallelHook(['compilation']),
rebuildModule: new AsyncSeriesHook(['changedModule']),
finishRebuildModule: new AsyncParallelHook(['compilation', 'changedModule']),
};
}
// chokidar options.
this.isWatching = false;
this.isWatchReady = false;
this.appJSON = path.join(this.wxaConfigs.context, 'app.json');
this.wxaJSON = path.join(this.wxaConfigs.context, 'app'+this.wxaConfigs.resolve.ext);
this.progress = new ProgressTextBar(this.current, this.wxaConfigs);
this.hooks = {
entryOption: new SyncBailHook(['entry']),
beforeRun: new AsyncSeriesHook(['compiler']),
run: new AsyncSeriesHook(['compiler']),
done: new AsyncParallelHook(['compilation']),
rebuildModule: new AsyncSeriesHook(['changedModule']),
finishRebuildModule: new AsyncParallelHook(['compilation', 'changedModule']),
};
}
public constructor() {
super();
// @see https://github.com/webpack/tapable#usage
this.hooks = {
/**
* 初始化异步任务,可并行:
* 1. initMap:初始化地图底图、相机
* 2. initRenderer:初始化渲染引擎
* 3. initWorker:初始化 Worker
*/
init: new AsyncParallelHook(['config']),
};
}
/** @type {SyncHook} */
thisCompilation: new SyncHook(["compilation", "params"]),
/** @type {SyncHook} */
compilation: new SyncHook(["compilation", "params"]),
/** @type {SyncHook} */
normalModuleFactory: new SyncHook(["normalModuleFactory"]),
/** @type {SyncHook} */
contextModuleFactory: new SyncHook(["contextModulefactory"]),
/** @type {AsyncSeriesHook} */
beforeCompile: new AsyncSeriesHook(["params"]),
/** @type {SyncHook} */
compile: new SyncHook(["params"]),
/** @type {AsyncParallelHook} */
make: new AsyncParallelHook(["compilation"]),
/** @type {AsyncSeriesHook} */
afterCompile: new AsyncSeriesHook(["compilation"]),
/** @type {AsyncSeriesHook} */
watchRun: new AsyncSeriesHook(["compiler"]),
/** @type {SyncHook} */
failed: new SyncHook(["error"]),
/** @type {SyncHook} */
invalid: new SyncHook(["filename", "changeTime"]),
/** @type {SyncHook} */
watchClose: new SyncHook([]),
// TODO the following hooks are weirdly located here
// TODO move them for webpack 5
/** @type {SyncHook} */
environment: new SyncHook([]),
/** @type {SyncHook} */
thisCompilation: new SyncHook(["compilation", "params"]),
/** @type {SyncHook} */
compilation: new SyncHook(["compilation", "params"]),
/** @type {SyncHook} */
normalModuleFactory: new SyncHook(["normalModuleFactory"]),
/** @type {SyncHook} */
contextModuleFactory: new SyncHook(["contextModulefactory"]),
/** @type {AsyncSeriesHook} */
beforeCompile: new AsyncSeriesHook(["params"]),
/** @type {SyncHook} */
compile: new SyncHook(["params"]),
/** @type {AsyncParallelHook} */
make: new AsyncParallelHook(["compilation"]),
/** @type {AsyncSeriesHook} */
afterCompile: new AsyncSeriesHook(["compilation"]),
/** @type {AsyncSeriesHook} */
watchRun: new AsyncSeriesHook(["compiler"]),
/** @type {SyncHook} */
failed: new SyncHook(["error"]),
/** @type {SyncHook} */
invalid: new SyncHook(["filename", "changeTime"]),
/** @type {SyncHook} */
watchClose: new SyncHook([]),
// TODO the following hooks are weirdly located here
// TODO move them for webpack 5
/** @type {SyncHook} */
environment: new SyncHook([]),
const DEFAULT_HOOKS = () => ({
// TODO: hooks paramaters
// beforeBuild: new SyncHook(),
// built: new SyncHook(),
created: new SyncHook(['outlet', 'caviarOptions']),
beforeRun: new AsyncParallelHook(['caviarOptions']),
run: new AsyncParallelHook(['returnValue', 'caviarOptions']),
config: new SyncHook(['config', 'caviarOptions'])
})
const createHooks = (): Hooks => ({
start: new AsyncParallelHook(),
defaultIconsStart: new AsyncParallelHook(['msg']),
defaultIconsGen: new SyncHook(['data']),
defaultIconsEnd: new AsyncParallelHook(),
appleTouchIconStart: new AsyncParallelHook(['msg']),
appleTouchIconGen: new SyncHook(['data']),
appleTouchIconEnd: new AsyncParallelHook(),
faviconStart: new AsyncParallelHook(['msg']),
faviconGen: new SyncHook(['data']),
faviconEnd: new AsyncParallelHook(),
msTileStart: new AsyncParallelHook(['msg']),
msTileGen: new SyncHook(['data']),
msTileEnd: new AsyncParallelHook(),
end: new AsyncParallelHook()
});
class WebpackPluginPWAManifest {
modifyConfig: new SyncWaterfallHook(['config']),
beforeShipIt: new SyncHook(),
afterAddToChangelog: new AsyncSeriesHook(['context']),
beforeCommitChangelog: new AsyncSeriesHook(['context']),
afterShipIt: new AsyncParallelHook(['version', 'commits', 'context']),
afterRelease: new AsyncParallelHook(['releaseInfo']),
onCreateRelease: new SyncHook(['options']),
onCreateChangelog: new SyncHook(['changelog', 'version']),
onCreateLogParse: new SyncHook(['logParse']),
getAuthor: new AsyncSeriesBailHook(),
getPreviousVersion: new AsyncSeriesBailHook(),
getRepository: new AsyncSeriesBailHook(),
version: new AsyncParallelHook(['version']),
afterVersion: new AsyncParallelHook(),
publish: new AsyncParallelHook(['version']),
afterPublish: new AsyncParallelHook(),
canary: new AsyncSeriesBailHook(['canaryVersion', 'postFix']),
next: new AsyncSeriesWaterfallHook(['preReleaseVersions', 'bump'])
});
public constructor(providersIn: TUserAccountProviders) {
this.hooks = {
beforeRelay: new AsyncParallelHook(['beforeRelay']),
relayError: new AsyncParallelHook(['error']),
afterRelay: new AsyncParallelHook(['transaction']),
beforeConfirmed: new AsyncParallelHook(['transaction']),
confirmedError: new AsyncParallelHook(['transaction', 'error']),
afterConfirmed: new AsyncParallelHook(['transaction', 'receipt']),
afterCall: new AsyncParallelHook(['receipt']),
callError: new AsyncParallelHook(['error']),
};
const providersArray = Object.values(providersIn);
const providerIn =
providersArray.find((provider) => provider.getCurrentAccount() !== undefined) ||
(providersArray[0] as UserAccountProvider | undefined);
if (providerIn === undefined) {
throw new Error('At least one provider is required');
}
if (Object.entries(providersIn).some(([type, provider]) => type !== provider.type)) {
throw new Error('Provider keys must be named the same as their type');
const createHooks = (): Hooks => ({
start: new AsyncParallelHook(),
defaultIconsStart: new AsyncParallelHook(['msg']),
defaultIconsGen: new SyncHook(['data']),
defaultIconsEnd: new AsyncParallelHook(),
appleTouchIconStart: new AsyncParallelHook(['msg']),
appleTouchIconGen: new SyncHook(['data']),
appleTouchIconEnd: new AsyncParallelHook(),
faviconStart: new AsyncParallelHook(['msg']),
faviconGen: new SyncHook(['data']),
faviconEnd: new AsyncParallelHook(),
msTileStart: new AsyncParallelHook(['msg']),
msTileGen: new SyncHook(['data']),
msTileEnd: new AsyncParallelHook(),
end: new AsyncParallelHook()
});
class WebpackPluginPWAManifest {