Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,18 @@ you full control of what is loaded initially and what is loaded at runtime
through code splitting. It can also make your code chunks **cache
friendly** by using hashes.

### Developer Tools

If you're working on webpack itself, or building advanced plugins or integrations, the tools below can help you explore internal mechanics, debug plugin life-cycles, and build custom tooling.

#### Instrumentation

| Name | Status | Description |
| --------------------------------------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| [tapable-tracer](https://github.com/ertgl/tapable-tracer) | ![tapable-tracer-npm] | Traces tapable hook execution in real-time and collects structured stack frames. Can export to UML for generating visualizations. |

[tapable-tracer-npm]: https://img.shields.io/npm/v/tapable-tracer.svg

<h2>Contributing</h2>

**We want contributing to webpack to be fun, enjoyable, and educational for anyone, and everyone.** We have a [vibrant ecosystem](https://medium.com/webpack/contributors-guide/home) that spans beyond this single repo. We welcome you to check out any of the repositories in [our organization](https://github.com/webpack) or [webpack-contrib organization](https://github.com/webpack-contrib) which houses all of our loaders and plugins.
Expand Down
40 changes: 39 additions & 1 deletion lib/ConcatenationScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ class ConcatenationScope {
/**
* @param {ModuleInfo[] | Map<Module, ModuleInfo>} modulesMap all module info by module
* @param {ConcatenatedModuleInfo} currentModule the current module info
* @param {Set<string>} usedNames all used names
*/
constructor(modulesMap, currentModule) {
constructor(modulesMap, currentModule, usedNames) {
this._currentModule = currentModule;
if (Array.isArray(modulesMap)) {
const map = new Map();
Expand All @@ -40,6 +41,7 @@ class ConcatenationScope {
}
modulesMap = map;
}
this.usedNames = usedNames;
this._modulesMap = modulesMap;
}

Expand Down Expand Up @@ -77,13 +79,49 @@ class ConcatenationScope {
}
}

/**
* @param {string} exportName name of the export
* @returns {string | undefined} the expression of the export
*/
getRawExport(exportName) {
if (!this._currentModule.rawExportMap) {
return undefined;
}
return this._currentModule.rawExportMap.get(exportName);
}

/**
* @param {string} exportName name of the export
* @param {string} expression expression to be used
*/
setRawExportMap(exportName, expression) {
if (!this._currentModule.rawExportMap) {
this._currentModule.rawExportMap = new Map();
}
if (this._currentModule.rawExportMap.has(exportName)) {
this._currentModule.rawExportMap.set(exportName, expression);
}
}

/**
* @param {string} symbol identifier of the export in source code
*/
registerNamespaceExport(symbol) {
this._currentModule.namespaceExportSymbol = symbol;
}

/**
* @param {string} symbol identifier of the export in source code
* @returns {boolean} registered success
*/
registerUsedName(symbol) {
if (this.usedNames.has(symbol)) {
return false;
}
this.usedNames.add(symbol);
return true;
}

/**
* @param {Module} module the referenced module
* @param {Partial<ModuleReferenceOptions>} options options
Expand Down
Loading
Loading