🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

types-webpack-bundler

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

types-webpack-bundler - npm Package Compare versions

Comparing version

to
1.0.1

5

package.json
{
"name": "types-webpack-bundler",
"version": "1.0.0",
"version": "1.0.1",
"description": "This library takes separate declaration asset files generated by the webpack build process and bundles them into one single declaration file. However it does so by recomposing the separate declarations as if all the classes and interfaces were defined as an __internal module__. Therefor, using this plugin only makes sense if you expose the classes and interfaces to the global module space yourself.",
"main": "plugin.js",
"scripts": {
"build": "tsc"
"build": "tsc",
"postversion": "git push --tags && yarn publish . --tag $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
},

@@ -9,0 +10,0 @@ "author": "Royson <roysondsilva@gmail.com>",

55

plugin.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var webpack = __importStar(require("webpack"));
var DeclarationBundlerPlugin = /** @class */ (function () {

@@ -34,8 +14,9 @@ function DeclarationBundlerPlugin(options) {

var _this = this;
//when the compiler is ready to emit files
compiler.hooks.emit.tapAsync('DeclarationBundlerPlugin', function (compilation, callback) {
var webpack = compiler.webpack;
var Compilation = webpack.Compilation;
var RawSource = webpack.sources.RawSource;
compiler.hooks.thisCompilation.tap('DeclarationBundlerPlugin', function (compilation) {
compilation.hooks.processAssets.tap({
name: 'DeclarationBundlerPlugin',
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
additionalAssets: true
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
}, function (assets) {

@@ -48,3 +29,3 @@ //collect all generated declaration files

declarationFiles[filename] = assets[filename];
delete assets[filename];
compilation.deleteAsset(filename);
}

@@ -55,25 +36,3 @@ }

//and insert that back into the assets
assets[_this.out] = {
source: function () {
return combinedDeclaration;
},
size: function () {
return combinedDeclaration.length;
},
map: function () {
return {};
},
updateHash: function () { },
buffer: function () {
return Buffer.from(combinedDeclaration);
},
sourceAndMap: function () {
return {
map: {},
source: combinedDeclaration
};
}
};
//webpack may continue now
callback();
compilation.emitAsset(_this.out, new RawSource(combinedDeclaration));
});

@@ -80,0 +39,0 @@ });

@@ -20,9 +20,12 @@ import * as webpack from 'webpack'

apply(compiler: webpack.Compiler) {
//when the compiler is ready to emit files
compiler.hooks.emit.tapAsync('DeclarationBundlerPlugin', (compilation: webpack.Compilation, callback) => {
const { webpack } = compiler
const { Compilation } = webpack
const { RawSource } = webpack.sources
compiler.hooks.thisCompilation.tap('DeclarationBundlerPlugin', (compilation: webpack.Compilation) => {
compilation.hooks.processAssets.tap({
name: 'DeclarationBundlerPlugin',
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
additionalAssets: true
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
}, (assets) => {

@@ -35,3 +38,3 @@ //collect all generated declaration files

declarationFiles[filename] = assets[filename]
delete assets[filename]
compilation.deleteAsset(filename)
}

@@ -43,26 +46,3 @@ }

//and insert that back into the assets
assets[this.out] = {
source() {
return combinedDeclaration
},
size() {
return combinedDeclaration.length
},
map() {
return {}
},
updateHash() { },
buffer() {
return Buffer.from(combinedDeclaration)
},
sourceAndMap() {
return {
map: {},
source: combinedDeclaration
}
}
}
//webpack may continue now
callback();
compilation.emitAsset(this.out, new RawSource(combinedDeclaration))
})

@@ -69,0 +49,0 @@ });