json-minimizer-webpack-plugin
Advanced tools
Comparing version 3.2.0 to 3.3.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
const { | ||
validate | ||
} = require("schema-utils"); | ||
var _schemaUtils = require("schema-utils"); | ||
const schema = require("./options.json"); | ||
var _options = _interopRequireDefault(require("./options.json")); | ||
var _minify = require("./minify"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const { | ||
minify | ||
} = require("./minify"); | ||
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */ | ||
@@ -58,2 +54,4 @@ | ||
*/ | ||
class JsonMinimizerPlugin { | ||
@@ -64,5 +62,5 @@ /** | ||
constructor(options = {}) { | ||
(0, _schemaUtils.validate)( | ||
validate( | ||
/** @type {Schema} */ | ||
_options.default, options, { | ||
schema, options, { | ||
name: "Json Minimizer Plugin", | ||
@@ -181,3 +179,3 @@ baseDataPath: "options" | ||
try { | ||
output = await (0, _minify.minify)(options); | ||
output = await minify(options); | ||
} catch (error) { | ||
@@ -237,3 +235,2 @@ compilation.errors.push( | ||
var _default = JsonMinimizerPlugin; | ||
exports.default = _default; | ||
module.exports = JsonMinimizerPlugin; |
@@ -36,2 +36,4 @@ "use strict"; | ||
module.exports.minify = minify; | ||
module.exports = { | ||
minify | ||
}; |
{ | ||
"name": "json-minimizer-webpack-plugin", | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"description": "json minimizer plugin for Webpack", | ||
@@ -14,4 +14,4 @@ "license": "MIT", | ||
}, | ||
"main": "dist/cjs.js", | ||
"types": "types/cjs.d.ts", | ||
"main": "dist/index.js", | ||
"types": "types/index.d.ts", | ||
"engines": { | ||
@@ -22,3 +22,3 @@ "node": ">= 12.13.0" | ||
"start": "npm run build -- -w", | ||
"clean": "del-cli dist", | ||
"clean": "del-cli dist types", | ||
"prebuild": "npm run clean", | ||
@@ -25,0 +25,0 @@ "build:types": "tsc --declaration --emitDeclarationOnly --outDir types && prettier \"types/**/*.ts\" --write", |
@@ -1,29 +0,2 @@ | ||
export default JsonMinimizerPlugin; | ||
export type Schema = import("schema-utils/declarations/validate").Schema; | ||
export type Compiler = import("webpack").Compiler; | ||
export type Compilation = import("webpack").Compilation; | ||
export type Asset = import("webpack").Asset; | ||
export type WebpackError = import("webpack").WebpackError; | ||
export type Rule = RegExp | string; | ||
export type Rules = Rule[] | Rule; | ||
export type JSONOptions = { | ||
replacer?: | ||
| ((this: any, key: string, value: any) => any | (number | string)[] | null) | ||
| undefined; | ||
space?: string | number | undefined; | ||
}; | ||
export type BasePluginOptions = { | ||
test?: Rules | undefined; | ||
include?: Rules | undefined; | ||
exclude?: Rules | undefined; | ||
minimizerOptions?: JSONOptions | undefined; | ||
}; | ||
export type MinimizedResult = { | ||
code: string; | ||
}; | ||
export type InternalOptions = { | ||
input: string; | ||
minimizerOptions?: JSONOptions | undefined; | ||
}; | ||
export type InternalPluginOptions = BasePluginOptions; | ||
export = JsonMinimizerPlugin; | ||
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */ | ||
@@ -91,1 +64,44 @@ /** @typedef {import("webpack").Compiler} Compiler */ | ||
} | ||
declare namespace JsonMinimizerPlugin { | ||
export { | ||
Schema, | ||
Compiler, | ||
Compilation, | ||
Asset, | ||
WebpackError, | ||
Rule, | ||
Rules, | ||
JSONOptions, | ||
BasePluginOptions, | ||
MinimizedResult, | ||
InternalOptions, | ||
InternalPluginOptions, | ||
}; | ||
} | ||
type Compiler = import("webpack").Compiler; | ||
type BasePluginOptions = { | ||
test?: Rules | undefined; | ||
include?: Rules | undefined; | ||
exclude?: Rules | undefined; | ||
minimizerOptions?: JSONOptions | undefined; | ||
}; | ||
type Schema = import("schema-utils/declarations/validate").Schema; | ||
type Compilation = import("webpack").Compilation; | ||
type Asset = import("webpack").Asset; | ||
type WebpackError = import("webpack").WebpackError; | ||
type Rule = RegExp | string; | ||
type Rules = Rule[] | Rule; | ||
type JSONOptions = { | ||
replacer?: | ||
| ((this: any, key: string, value: any) => any | (number | string)[] | null) | ||
| undefined; | ||
space?: string | number | undefined; | ||
}; | ||
type MinimizedResult = { | ||
code: string; | ||
}; | ||
type InternalOptions = { | ||
input: string; | ||
minimizerOptions?: JSONOptions | undefined; | ||
}; | ||
type InternalPluginOptions = BasePluginOptions; |
456
21553
8