@node-minify/jsonminify 7.1.0 → 8.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ import { MinifierOptions } from '@node-minify/types';
2
+
3
+ /*!
4
+ * node-minify
5
+ * Copyright(c) 2011-2022 Rodolphe Stoclin
6
+ * MIT Licensed
7
+ */
8
+
9
+ /**
10
+ * Run jsonminify.
11
+ *
12
+ * @param {Object} settings
13
+ * @param {String} content
14
+ * @param {Function} callback
15
+ */
16
+ declare const minifyJsonMinify: ({ settings, content, callback, index }: MinifierOptions) => any;
17
+
18
+ export { minifyJsonMinify as default };
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+
25
+ // src/index.ts
26
+ var src_exports = {};
27
+ __export(src_exports, {
28
+ default: () => src_default
29
+ });
30
+ module.exports = __toCommonJS(src_exports);
31
+ var import_jsonminify = __toESM(require("jsonminify"));
32
+ var import_utils = require("@node-minify/utils");
33
+ var minifyJsonMinify = ({ settings, content, callback, index }) => {
34
+ const contentMinified = (0, import_jsonminify.default)(content || "");
35
+ if (settings && !settings.content) {
36
+ import_utils.utils.writeFile({ file: settings.output, content: contentMinified, index });
37
+ }
38
+ if (callback) {
39
+ return callback(null, contentMinified);
40
+ }
41
+ return contentMinified;
42
+ };
43
+ var src_default = minifyJsonMinify;
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {});
46
+ /*!
47
+ * node-minify
48
+ * Copyright(c) 2011-2022 Rodolphe Stoclin
49
+ * MIT Licensed
50
+ */
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2022 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport jsonminify from 'jsonminify';\nimport { utils } from '@node-minify/utils';\nimport { MinifierOptions } from '@node-minify/types';\n\n// interface Options {\n// sourceMap?: boolean;\n// _sourceMap?: { url: string } | boolean;\n// }\n\n// interface Settings {\n// options: Options;\n// content: string;\n// output: string;\n// }\n\n// interface MinifierOptions {\n// settings: Settings;\n// content: string;\n// callback: Function;\n// index: number;\n// }\n\n/**\n * Run jsonminify.\n *\n * @param {Object} settings\n * @param {String} content\n * @param {Function} callback\n */\nconst minifyJsonMinify = ({ settings, content, callback, index }: MinifierOptions) => {\n const contentMinified = jsonminify(content || '');\n if (settings && !settings.content) {\n utils.writeFile({ file: settings.output, content: contentMinified, index });\n }\n if (callback) {\n return callback(null, contentMinified);\n }\n return contentMinified;\n};\n\n/**\n * Expose `minifyJsonMinify()`.\n */\nexport default minifyJsonMinify;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,wBAAuB;AACvB,mBAAsB;AA4BtB,IAAM,mBAAmB,CAAC,EAAE,UAAU,SAAS,UAAU,MAAM,MAAuB;AACpF,QAAM,sBAAkB,kBAAAA,SAAW,WAAW,EAAE;AAChD,MAAI,YAAY,CAAC,SAAS,SAAS;AACjC,uBAAM,UAAU,EAAE,MAAM,SAAS,QAAQ,SAAS,iBAAiB,MAAM,CAAC;AAAA,EAC5E;AACA,MAAI,UAAU;AACZ,WAAO,SAAS,MAAM,eAAe;AAAA,EACvC;AACA,SAAO;AACT;AAKA,IAAO,cAAQ;","names":["jsonminify"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,23 @@
1
+ // src/index.ts
2
+ import jsonminify from "jsonminify";
3
+ import { utils } from "@node-minify/utils";
4
+ var minifyJsonMinify = ({ settings, content, callback, index }) => {
5
+ const contentMinified = jsonminify(content || "");
6
+ if (settings && !settings.content) {
7
+ utils.writeFile({ file: settings.output, content: contentMinified, index });
8
+ }
9
+ if (callback) {
10
+ return callback(null, contentMinified);
11
+ }
12
+ return contentMinified;
13
+ };
14
+ var src_default = minifyJsonMinify;
15
+ export {
16
+ src_default as default
17
+ };
18
+ /*!
19
+ * node-minify
20
+ * Copyright(c) 2011-2022 Rodolphe Stoclin
21
+ * MIT Licensed
22
+ */
23
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2022 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport jsonminify from 'jsonminify';\nimport { utils } from '@node-minify/utils';\nimport { MinifierOptions } from '@node-minify/types';\n\n// interface Options {\n// sourceMap?: boolean;\n// _sourceMap?: { url: string } | boolean;\n// }\n\n// interface Settings {\n// options: Options;\n// content: string;\n// output: string;\n// }\n\n// interface MinifierOptions {\n// settings: Settings;\n// content: string;\n// callback: Function;\n// index: number;\n// }\n\n/**\n * Run jsonminify.\n *\n * @param {Object} settings\n * @param {String} content\n * @param {Function} callback\n */\nconst minifyJsonMinify = ({ settings, content, callback, index }: MinifierOptions) => {\n const contentMinified = jsonminify(content || '');\n if (settings && !settings.content) {\n utils.writeFile({ file: settings.output, content: contentMinified, index });\n }\n if (callback) {\n return callback(null, contentMinified);\n }\n return contentMinified;\n};\n\n/**\n * Expose `minifyJsonMinify()`.\n */\nexport default minifyJsonMinify;\n"],"mappings":";AASA,OAAO,gBAAgB;AACvB,SAAS,aAAa;AA4BtB,IAAM,mBAAmB,CAAC,EAAE,UAAU,SAAS,UAAU,MAAM,MAAuB;AACpF,QAAM,kBAAkB,WAAW,WAAW,EAAE;AAChD,MAAI,YAAY,CAAC,SAAS,SAAS;AACjC,UAAM,UAAU,EAAE,MAAM,SAAS,QAAQ,SAAS,iBAAiB,MAAM,CAAC;AAAA,EAC5E;AACA,MAAI,UAAU;AACZ,WAAO,SAAS,MAAM,eAAe;AAAA,EACvC;AACA,SAAO;AACT;AAKA,IAAO,cAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/jsonminify",
3
- "version": "7.1.0",
3
+ "version": "8.0.1-beta.0",
4
4
  "description": "jsonminify plugin for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -12,16 +12,23 @@
12
12
  "author": "Rodolphe Stoclin <srodolphe@gmail.com>",
13
13
  "homepage": "https://github.com/srod/node-minify/tree/master/packages/jsonminify#readme",
14
14
  "license": "MIT",
15
- "main": "lib/jsonminify.js",
16
15
  "engines": {
17
16
  "node": ">=14.0.0"
18
17
  },
19
18
  "directories": {
20
- "lib": "lib",
19
+ "lib": "dist",
21
20
  "test": "__tests__"
22
21
  },
22
+ "main": "./dist/index.js",
23
+ "module": "./dist/index.mjs",
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ "require": "./dist/index.js",
27
+ "import": "./dist/index.mjs",
28
+ "types": "./dist/index.d.ts"
29
+ },
23
30
  "files": [
24
- "lib"
31
+ "dist/**/*"
25
32
  ],
26
33
  "publishConfig": {
27
34
  "access": "public"
@@ -33,9 +40,18 @@
33
40
  "bugs": {
34
41
  "url": "https://github.com/srod/node-minify/issues"
35
42
  },
43
+ "scripts": {
44
+ "clean": "pnpm dlx rimraf dist",
45
+ "build": "npm run clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
46
+ "prepublishOnly": "npm run build"
47
+ },
36
48
  "dependencies": {
37
- "@node-minify/utils": "^7.1.0",
49
+ "@node-minify/utils": "8.0.1-beta.0",
38
50
  "jsonminify": "0.4.2"
39
51
  },
40
- "gitHead": "94cef2d5d653c3bddc3e603b4e25c135b0b6f4b3"
52
+ "devDependencies": {
53
+ "@node-minify/types": "8.0.1-beta.0",
54
+ "@types/jsonminify": "^0.4.1"
55
+ },
56
+ "gitHead": "35a8a41ec86a11cbec05d8a7db9113475ece2cef"
41
57
  }
package/lib/jsonminify.js DELETED
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- var _jsonminify = _interopRequireDefault(require("jsonminify"));
4
- var _utils = require("@node-minify/utils");
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
- /*!
7
- * node-minify
8
- * Copyright(c) 2011-2022 Rodolphe Stoclin
9
- * MIT Licensed
10
- */
11
-
12
- /**
13
- * Module dependencies.
14
- */
15
-
16
- /**
17
- * Run jsonminify.
18
- *
19
- * @param {Object} settings
20
- * @param {String} content
21
- * @param {Function} callback
22
- */
23
- const minifyJsonMinify = ({
24
- settings,
25
- content,
26
- callback,
27
- index
28
- }) => {
29
- const contentMinified = (0, _jsonminify.default)(content);
30
- if (!settings.content) {
31
- _utils.utils.writeFile({
32
- file: settings.output,
33
- content: contentMinified,
34
- index
35
- });
36
- }
37
- if (callback) {
38
- return callback(null, contentMinified);
39
- }
40
- return contentMinified;
41
- };
42
-
43
- /**
44
- * Expose `minifyJsonMinify()`.
45
- */
46
- module.exports = minifyJsonMinify;