MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / apply

Method apply

scripts/manifest-helper.js:48–63  ·  view source on GitHub ↗
(compiler)

Source from the content-addressed store, hash-verified

46 }
47
48 apply(compiler) {
49 compiler.hooks.afterEmit.tap(this.constructor.name, async compilation => {
50 const dist = compilation.outputOptions.path;
51 const path = `${dist}/manifest.json`;
52 const manifest = await buildManifest();
53 const bgId = 'background/index';
54 const bgEntry = compilation.entrypoints.get(bgId);
55 const scripts = bgEntry.chunks.flatMap(c => [...c.files]);
56 if (`${manifest.background.scripts}` !== `${scripts}`) {
57 manifest.background.scripts = scripts;
58 await fs.writeFile(path,
59 JSON.stringify(manifest, null, this.minify ? 0 : 2),
60 { encoding: 'utf8' });
61 }
62 });
63 }
64}
65
66exports.readManifest = readManifest;

Callers 3

debouncedFunctionFunction · 0.45
throttledFunctionFunction · 0.45
buffer2stringFunction · 0.45

Calls 2

buildManifestFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected