nav tabs on admin dashboard
This commit is contained in:
36
node_modules/webpack/lib/ExportPropertyMainTemplatePlugin.js
generated
vendored
36
node_modules/webpack/lib/ExportPropertyMainTemplatePlugin.js
generated
vendored
@@ -4,24 +4,46 @@
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const ConcatSource = require("webpack-sources").ConcatSource;
|
||||
const { ConcatSource } = require("webpack-sources");
|
||||
|
||||
function accessorToObjectAccess(accessor) {
|
||||
/** @typedef {import("./Compilation")} Compilation */
|
||||
|
||||
/**
|
||||
* @param {string[]} accessor the accessor to convert to path
|
||||
* @returns {string} the path
|
||||
*/
|
||||
const accessorToObjectAccess = accessor => {
|
||||
return accessor.map(a => `[${JSON.stringify(a)}]`).join("");
|
||||
}
|
||||
};
|
||||
|
||||
class ExportPropertyMainTemplatePlugin {
|
||||
/**
|
||||
* @param {string|string[]} property the name of the property to export
|
||||
*/
|
||||
constructor(property) {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Compilation} compilation the compilation instance
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(compilation) {
|
||||
const mainTemplate = compilation.mainTemplate;
|
||||
compilation.templatesPlugin("render-with-entry", (source, chunk, hash) => {
|
||||
const { mainTemplate, chunkTemplate } = compilation;
|
||||
|
||||
const onRenderWithEntry = (source, chunk, hash) => {
|
||||
const postfix = `${accessorToObjectAccess([].concat(this.property))}`;
|
||||
return new ConcatSource(source, postfix);
|
||||
});
|
||||
mainTemplate.plugin("hash", hash => {
|
||||
};
|
||||
|
||||
for (const template of [mainTemplate, chunkTemplate]) {
|
||||
template.hooks.renderWithEntry.tap(
|
||||
"ExportPropertyMainTemplatePlugin",
|
||||
onRenderWithEntry
|
||||
);
|
||||
}
|
||||
|
||||
mainTemplate.hooks.hash.tap("ExportPropertyMainTemplatePlugin", hash => {
|
||||
hash.update("export property");
|
||||
hash.update(`${this.property}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user