Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Array.from(
importedModules,
([module, { importVar, request, reexports }]) => {
const importStatement = runtimeTemplate.importStatement({
module,
request,
importVar,
originModule: module
});
return importStatement + reexports.join("\n");
}
)
);
// create source
const source = new RawSource(
[
'"use strict";',
"// Instantiate WebAssembly module",
"var wasmExports = __webpack_require__.w[module.i];",
!Array.isArray(module.usedExports)
? `__webpack_require__.r(${module.exportsArgument});`
: "",
// this must be before import for circular dependencies
"// export exports from WebAssembly module",
Array.isArray(module.usedExports) && !needExportsCopy
? `${module.moduleArgument}.exports = wasmExports;`
: "for(var name in wasmExports) " +
`if(name != ${JSON.stringify(initIdentifer)}) ` +
`${module.exportsArgument}[name] = wasmExports[name];`,
if (this.options.target === 'ali') {
ext = '.acss'
wxssCode += `
/* polyfill */
${readFileSync(join(__dirname, './ali/lib/base.acss'), 'utf8')}
`
}
entryNames.forEach((name) => {
let code = compilation.assets[name + ext]
if (code) {
wxssCode += `/************ ${name + ext} *************/\n`
wxssCode += code.source().toString()
}
})
return new RawSource(wxssCode)
}
if (hasWarnings && output.stats.minifiedSize === 0) {
return;
}
let newSource;
if (output.sourceMap) {
newSource = new SourceMapSource(
output.styles,
file,
// tslint:disable-next-line: no-any
output.sourceMap.toString() as any,
content,
map,
);
} else {
newSource = new RawSource(output.styles);
}
compilation.assets[file] = newSource;
});
compilation.hooks.additionalChunkAssets.tap(p, chunks => {
const entryManifest = chunks
.filter(x => x.name)
.reduce((result, x) => {
const names = getJavascriptChunkNames(x, compiler)
return names.length ? { ...result, [x.name]: names } : result
}, {})
compilation.assets['entry-manifest.json'] = new RawSource(JSON.stringify(entryManifest, null, 2))
})
})
chunk.files.forEach(file => {
if (file.endsWith('.bundle')) {
if (builder.sourceMap) {
const sourceListMap = new SourceListMap();
sourceListMap.add(vendorSourceListMap);
sourceListMap.add(
fromStringWithSourceMap(
compilation.assets[file].source(),
JSON.parse(compilation.assets[file + '.map'].source())
)
);
const sourceAndMap = sourceListMap.toStringWithSourceMap({ file });
compilation.assets[file] = new RawSource(sourceAndMap.source);
compilation.assets[file + '.map'] = new RawSource(JSON.stringify(sourceAndMap.map));
} else {
compilation.assets[file] = new ConcatSource(vendorSource, compilation.assets[file]);
}
}
});
});
.then(html => {
assets[htmlAssetName] = new sources.RawSource(html);
callback();
})
.catch(callback);
sourceMapUrl
)
);
}
assets[sourceMapFile] = compilation.assets[
sourceMapFile
] = new RawSource(sourceMapString);
chunk.files.push(sourceMapFile);
} else {
if (currentSourceMappingURLComment === false) {
throw new Error(
"SourceMapDevToolPlugin: append can't be false when no filename is provided"
);
}
assets[file] = compilation.assets[file] = new ConcatSource(
new RawSource(source),
currentSourceMappingURLComment
.replace(/\[map\]/g, () => sourceMapString)
.replace(
/\[url\]/g,
() =>
`data:application/json;charset=utf-8;base64,${Buffer.from(
sourceMapString,
"utf-8"
).toString("base64")}`
)
);
}
});
reportProgress(1.0);
return minify(input, postcssOptions).then(res => {
if (res.map) {
compilation.assets[file] = new SourceMapSource(
res.css,
file,
res.map.toJSON()
)
} else {
compilation.assets[file] = new RawSource(res.css)
}
})
})
})
);
vendorHashesJson = JSON.parse(
fs.readFileSync(path.join(builder.dllBuildDir, `${name}_dll_hashes.json`)).toString()
);
vendorSource = new RawSource(
fs.readFileSync(path.join(builder.dllBuildDir, vendorHashesJson.name)).toString() + '\n'
);
if (platform !== 'web') {
const vendorAssets = JSON.parse(
fs.readFileSync(path.join(builder.dllBuildDir, vendorHashesJson.name + '.assets')).toString()
);
config.plugins.push(new MobileAssetsPlugin(vendorAssets));
}
if (builder.sourceMap) {
vendorMap = new RawSource(
fs.readFileSync(path.join(builder.dllBuildDir, vendorHashesJson.name + '.map')).toString()
);
vendorSourceListMap = fromStringWithSourceMap(vendorSource.source(), JSON.parse(vendorMap.source()));
}
}
const compiler = webpack(config);
let awaitedAlready = false;
hookAsync(compiler, 'after-emit', (compilation, callback) => {
if (!awaitedAlready) {
if (hasBackend || builder.waitOn) {
let waitOnUrls;
const backendOption = builder.backendUrl || builder.backendUrl;
if (backendOption) {
const { protocol, hostname, port } = url.parse(backendOption.replace('{ip}', ip.address()));