New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

webpack-virtual-modules

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-virtual-modules - npm Package Compare versions

Comparing version

to
0.1.3

26

index.js
var VirtualStats = require('./virtual-stats');
var RawSource = require("webpack-sources").RawSource;
var path = require('path');

@@ -50,5 +49,2 @@ var debug = require('debug')('webpack-virtual-modules');

self._timestamps = self._timestamps || {};
self._timestamps[modulePath] = time;
debug(self._compiler.name, "Write module:", modulePath, contents);

@@ -103,26 +99,4 @@

});
compiler.plugin("compilation", function(compilation) {
compilation.plugin("seal", function() {
self._sealTime = Date.now();
debug(compiler.name, "seal");
});
compilation.plugin("after-seal", function(callback) {
debug(compiler.name, "after-seal");
if (self._timestamps) {
compilation.modules.forEach(function(module) {
var time = self._timestamps[module.resource];
if (time && time > self._sealTime) {
var contents = compiler.inputFileSystem.readFileSync(module.resource).toString();
debug(compiler.name, "Replacing module:", module.resource, contents);
module._source = new RawSource(contents);
}
});
}
callback();
});
});
};
module.exports = VirtualModulesPlugin;

2

package.json
{
"name": "webpack-virtual-modules",
"version": "0.1.2",
"version": "0.1.3",
"description": "Webpack Virtual Modules",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -72,6 +72,2 @@ ## Webpack Virtual Modules

If `writeModule` happens after `seal` phase, but before `after-seal` phase the module contents will be replaced as is,
without using loaders. This is supported to let one update dynamic module contents when compilation has been finished
already.
## Inspiration

@@ -78,0 +74,0 @@ This project is inspired by: https://github.com/rmarscher/virtual-module-webpack-plugin