@node-minify/yui 7.1.0 → 8.0.0-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 YUI Compressor.
11
+ *
12
+ * @param {Object} settings
13
+ * @param {String} content
14
+ * @param {Function} callback
15
+ */
16
+ declare const minifyYUI: ({ settings, content, callback, index }: MinifierOptions) => any;
17
+
18
+ export { minifyYUI as default };
package/dist/index.js ADDED
@@ -0,0 +1,68 @@
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_path = __toESM(require("path"));
32
+ var import_utils = require("@node-minify/utils");
33
+ var import_run = require("@node-minify/run");
34
+ var binYui = import_path.default.normalize(__dirname + "/binaries/yuicompressor-2.4.7.jar");
35
+ var minifyYUI = ({ settings, content, callback, index }) => {
36
+ return (0, import_run.runCommandLine)({
37
+ args: yuiCommand(settings && settings.type, settings && settings.options),
38
+ data: content,
39
+ settings,
40
+ callback: (err, content2) => {
41
+ if (err) {
42
+ if (callback) {
43
+ return callback(err);
44
+ } else {
45
+ throw err;
46
+ }
47
+ }
48
+ if (settings && !settings.content) {
49
+ import_utils.utils.writeFile({ file: settings.output, content: content2, index });
50
+ }
51
+ if (callback) {
52
+ return callback(null, content2);
53
+ }
54
+ return content2;
55
+ }
56
+ });
57
+ };
58
+ var yuiCommand = (type = "js", options) => {
59
+ return ["-jar", "-Xss2048k", binYui, "--type", type].concat(import_utils.utils.buildArgs(options || {}));
60
+ };
61
+ var src_default = minifyYUI;
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {});
64
+ /*!
65
+ * node-minify
66
+ * Copyright(c) 2011-2022 Rodolphe Stoclin
67
+ * MIT Licensed
68
+ */
package/dist/index.mjs ADDED
@@ -0,0 +1,40 @@
1
+ // src/index.ts
2
+ import path from "path";
3
+ import { utils } from "@node-minify/utils";
4
+ import { runCommandLine } from "@node-minify/run";
5
+ var binYui = path.normalize(__dirname + "/binaries/yuicompressor-2.4.7.jar");
6
+ var minifyYUI = ({ settings, content, callback, index }) => {
7
+ return runCommandLine({
8
+ args: yuiCommand(settings && settings.type, settings && settings.options),
9
+ data: content,
10
+ settings,
11
+ callback: (err, content2) => {
12
+ if (err) {
13
+ if (callback) {
14
+ return callback(err);
15
+ } else {
16
+ throw err;
17
+ }
18
+ }
19
+ if (settings && !settings.content) {
20
+ utils.writeFile({ file: settings.output, content: content2, index });
21
+ }
22
+ if (callback) {
23
+ return callback(null, content2);
24
+ }
25
+ return content2;
26
+ }
27
+ });
28
+ };
29
+ var yuiCommand = (type = "js", options) => {
30
+ return ["-jar", "-Xss2048k", binYui, "--type", type].concat(utils.buildArgs(options || {}));
31
+ };
32
+ var src_default = minifyYUI;
33
+ export {
34
+ src_default as default
35
+ };
36
+ /*!
37
+ * node-minify
38
+ * Copyright(c) 2011-2022 Rodolphe Stoclin
39
+ * MIT Licensed
40
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/yui",
3
- "version": "7.1.0",
3
+ "version": "8.0.0-beta.0",
4
4
  "description": "yui - yahoo compressor plugin for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -11,16 +11,23 @@
11
11
  "author": "Rodolphe Stoclin <srodolphe@gmail.com>",
12
12
  "homepage": "https://github.com/srod/node-minify/tree/master/packages/yui#readme",
13
13
  "license": "MIT",
14
- "main": "lib/yui.js",
15
14
  "engines": {
16
15
  "node": ">=14.0.0"
17
16
  },
18
17
  "directories": {
19
- "lib": "lib",
18
+ "lib": "dist",
20
19
  "test": "__tests__"
21
20
  },
21
+ "main": "./dist/index.js",
22
+ "module": "./dist/index.mjs",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ "require": "./dist/index.js",
26
+ "import": "./dist/index.mjs",
27
+ "types": "./dist/index.d.ts"
28
+ },
22
29
  "files": [
23
- "lib"
30
+ "dist/**/*"
24
31
  ],
25
32
  "publishConfig": {
26
33
  "access": "public"
@@ -32,9 +39,17 @@
32
39
  "bugs": {
33
40
  "url": "https://github.com/srod/node-minify/issues"
34
41
  },
42
+ "scripts": {
43
+ "clean": "pnpm dlx rimraf dist",
44
+ "build": "npm run clean && tsup src/index.ts --format cjs,esm --dts --clean",
45
+ "prepublishOnly": "npm run build"
46
+ },
35
47
  "dependencies": {
36
- "@node-minify/run": "^7.1.0",
37
- "@node-minify/utils": "^7.1.0"
48
+ "@node-minify/run": "8.0.0-beta.0",
49
+ "@node-minify/utils": "8.0.0-beta.0"
50
+ },
51
+ "devDependencies": {
52
+ "@node-minify/types": "8.0.0-beta.0"
38
53
  },
39
- "gitHead": "94cef2d5d653c3bddc3e603b4e25c135b0b6f4b3"
54
+ "gitHead": "0507c6190577e1939997a8231b07952ba167a780"
40
55
  }
package/lib/yui.js DELETED
@@ -1,75 +0,0 @@
1
- "use strict";
2
-
3
- var _path = _interopRequireDefault(require("path"));
4
- var _utils = require("@node-minify/utils");
5
- var _run = require("@node-minify/run");
6
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7
- /*!
8
- * node-minify
9
- * Copyright(c) 2011-2022 Rodolphe Stoclin
10
- * MIT Licensed
11
- */
12
-
13
- /**
14
- * Module dependencies.
15
- */
16
-
17
- /**
18
- * Module variables.
19
- */
20
- const binYui = _path.default.normalize(__dirname + '/binaries/yuicompressor-2.4.7.jar');
21
-
22
- /**
23
- * Run YUI Compressor.
24
- *
25
- * @param {Object} settings
26
- * @param {String} content
27
- * @param {Function} callback
28
- */
29
-
30
- const minifyYUI = ({
31
- settings,
32
- content,
33
- callback,
34
- index
35
- }) => {
36
- return (0, _run.runCommandLine)({
37
- args: yuiCommand(settings.type, settings.options),
38
- data: content,
39
- settings,
40
- callback: (err, content) => {
41
- if (err) {
42
- if (callback) {
43
- return callback(err);
44
- } else {
45
- throw err;
46
- }
47
- }
48
- if (!settings.content) {
49
- _utils.utils.writeFile({
50
- file: settings.output,
51
- content,
52
- index
53
- });
54
- }
55
- if (callback) {
56
- return callback(null, content);
57
- }
58
- return content;
59
- }
60
- });
61
- };
62
-
63
- /**
64
- * YUI Compressor CSS command line.
65
- */
66
-
67
- const yuiCommand = (type = 'js', options) => {
68
- return ['-jar', '-Xss2048k', binYui, '--type', type].concat(_utils.utils.buildArgs(options || {}));
69
- };
70
-
71
- /**
72
- * Expose `minifyYUI()`.
73
- */
74
-
75
- module.exports = minifyYUI;