@node-minify/no-compress 10.0.0-next.0 → 10.0.1

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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Rodolphe Stoclin
3
+ Copyright (c) 2025 Rodolphe Stoclin
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -6,8 +6,8 @@
6
6
  <br>
7
7
  <a href="https://npmjs.org/package/@node-minify/no-compress"><img src="https://img.shields.io/npm/v/@node-minify/no-compress.svg"></a>
8
8
  <a href="https://npmjs.org/package/@node-minify/no-compress"><img src="https://img.shields.io/npm/dm/@node-minify/no-compress.svg"></a>
9
- <a href="https://github.com/srod/node-minify/actions"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fsrod%2Fnode-minify%2Fbadge%3Fref%3Ddevelop&style=flat" /></a>
10
- <a href="https://codecov.io/gh/srod/node-minify"><img src="https://codecov.io/gh/srod/node-minify/branch/develop/graph/badge.svg"></a>
9
+ <a href="https://github.com/srod/node-minify/actions"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fsrod%2Fnode-minify%2Fbadge%3Fref%3Dmain&style=flat" /></a>
10
+ <a href="https://codecov.io/gh/srod/node-minify"><img src="https://codecov.io/gh/srod/node-minify/branch/main/graph/badge.svg"></a>
11
11
  </p>
12
12
 
13
13
  # no-compress
@@ -23,14 +23,13 @@ npm install @node-minify/core @node-minify/no-compress
23
23
  ## Usage
24
24
 
25
25
  ```js
26
- const minify = require('@node-minify/core');
27
- const noCompress = require('@node-minify/no-compress');
26
+ import { minify } from '@node-minify/core';
27
+ import { noCompress } from '@node-minify/no-compress';
28
28
 
29
- minify({
29
+ await minify({
30
30
  compressor: noCompress,
31
31
  input: ['foo.js', 'foo2.js'],
32
- output: 'bar.js',
33
- callback: function (err, min) {}
32
+ output: 'bar.js'
34
33
  });
35
34
  ```
36
35
 
@@ -40,4 +39,4 @@ Visit https://node-minify.2clics.net/options.html#concatenate-files for full doc
40
39
 
41
40
  ## License
42
41
 
43
- [MIT](https://github.com/srod/node-minify/blob/develop/LICENSE)
42
+ [MIT](https://github.com/srod/node-minify/blob/main/LICENSE)
package/dist/index.d.ts CHANGED
@@ -1,15 +1,159 @@
1
- import { MinifierOptions } from '@node-minify/types';
1
+ //#region ../types/src/types.d.ts
2
2
 
3
- /*!
4
- * node-minify
5
- * Copyright(c) 2011-2024 Rodolphe Stoclin
6
- * MIT Licensed
3
+ /**
4
+ * Result returned by a compressor function.
7
5
  */
6
+ type CompressorResult = {
7
+ code: string;
8
+ map?: string;
9
+ };
10
+ /**
11
+ * Base options that all compressors can accept.
12
+ * Specific compressors may extend this with their own options.
13
+ */
14
+ type CompressorOptions = Record<string, unknown>;
15
+ /**
16
+ * A compressor function that minifies content.
17
+ * @param args - The minifier options including settings and content
18
+ * @returns A promise resolving to the compression result
19
+ */
20
+ type Compressor<TOptions extends CompressorOptions = CompressorOptions> = (args: MinifierOptions<TOptions>) => Promise<CompressorResult>;
21
+ /**
22
+ * File type for compressors that support multiple types (e.g., YUI).
23
+ */
24
+ type FileType = "js" | "css";
25
+ /**
26
+ * User-facing settings for the minify function.
27
+ * This is what users pass when calling minify().
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { minify } from '@node-minify/core';
32
+ * import { terser } from '@node-minify/terser';
33
+ *
34
+ * await minify({
35
+ * compressor: terser,
36
+ * input: 'src/*.js',
37
+ * output: 'dist/bundle.min.js',
38
+ * options: { mangle: true }
39
+ * });
40
+ * ```
41
+ */
42
+ type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
43
+ /**
44
+ * The compressor function to use for minification.
45
+ */
46
+ compressor: Compressor<TOptions>;
47
+
48
+ /**
49
+ * Optional label for the compressor (used in logging).
50
+ */
51
+ compressorLabel?: string;
52
+
53
+ /**
54
+ * Content to minify (for in-memory minification).
55
+ * If provided, input/output are not required.
56
+ */
57
+ content?: string;
58
+
59
+ /**
60
+ * Input file path(s) or glob pattern.
61
+ * Can be a single file, array of files, or wildcard pattern.
62
+ *
63
+ * @example
64
+ * - 'src/app.js'
65
+ * - ['src/a.js', 'src/b.js']
66
+ * - 'src/**\/*.js'
67
+ */
68
+ input?: string | string[];
69
+
70
+ /**
71
+ * Output file path.
72
+ * Use $1 as placeholder for input filename in multi-file scenarios.
73
+ * Can be a single file, array of files, or pattern with $1.
74
+ *
75
+ * @example
76
+ * - 'dist/bundle.min.js'
77
+ * - ['file1.min.js', 'file2.min.js']
78
+ * - '$1.min.js' (creates app.min.js from app.js)
79
+ */
80
+ output?: string | string[];
81
+
82
+ /**
83
+ * Compressor-specific options.
84
+ * See individual compressor documentation for available options.
85
+ */
86
+ options?: TOptions;
8
87
 
9
- declare const noCompress: {
10
- ({ settings, content, callback, index, }: MinifierOptions): string | void;
11
- default: any;
88
+ /**
89
+ * CLI option string (used by CLI only).
90
+ * @internal
91
+ */
92
+ option?: string;
93
+
94
+ /**
95
+ * Buffer size for file operations (in bytes).
96
+ * @default 1024000 (1MB)
97
+ */
98
+ buffer?: number;
99
+
100
+ /**
101
+ * File type for compressors that support multiple types.
102
+ * Required for YUI compressor.
103
+ */
104
+ type?: FileType;
105
+
106
+ /**
107
+ * Suppress console output.
108
+ * @default false
109
+ */
110
+ silence?: boolean;
111
+
112
+ /**
113
+ * Public folder to prepend to input paths.
114
+ *
115
+ * @example
116
+ * With publicFolder: 'public/js/' and input: 'app.js',
117
+ * the actual path becomes 'public/js/app.js'
118
+ */
119
+ publicFolder?: string;
120
+
121
+ /**
122
+ * Replace files in place instead of creating new output files.
123
+ * @default false
124
+ */
125
+ replaceInPlace?: boolean;
12
126
  };
127
+ /**
128
+ * Options passed to compressor functions internally.
129
+ * This is what compressors receive, not what users pass.
130
+ */
131
+ type MinifierOptions<TOptions extends CompressorOptions = CompressorOptions> = {
132
+ /**
133
+ * The full settings object.
134
+ */
135
+ settings: Settings<TOptions>;
136
+
137
+ /**
138
+ * The content to minify.
139
+ */
140
+ content?: string;
13
141
 
14
- export { noCompress as default };
15
- export = noCompress
142
+ /**
143
+ * Index of current file when processing multiple files.
144
+ */
145
+ index?: number;
146
+ };
147
+ //#endregion
148
+ //#region src/index.d.ts
149
+ /**
150
+ * No compression, just concatenation.
151
+ * @param content - Content to pass through
152
+ * @returns Unmodified content
153
+ */
154
+ declare function noCompress({
155
+ content
156
+ }: MinifierOptions): Promise<CompressorResult>;
157
+ //#endregion
158
+ export { noCompress };
159
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":["CompressorReturnType","CompressorResult","CompressorOptions","Record","Compressor","TOptions","MinifierOptions","Promise","FileType","Settings","Result","MinifyOptions"],"sources":["../../types/src/types.d.ts","../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * The return type of a compressor function.\n * @deprecated Use `CompressorResult` instead. Will be removed in v11.\n */\nexport type CompressorReturnType = string;\n\n/**\n * Result returned by a compressor function.\n */\nexport type CompressorResult = {\n code: string;\n map?: string;\n};\n\n/**\n * Base options that all compressors can accept.\n * Specific compressors may extend this with their own options.\n */\nexport type CompressorOptions = Record<string, unknown>;\n\n/**\n * A compressor function that minifies content.\n * @param args - The minifier options including settings and content\n * @returns A promise resolving to the compression result\n */\nexport type Compressor<TOptions extends CompressorOptions = CompressorOptions> =\n (args: MinifierOptions<TOptions>) => Promise<CompressorResult>;\n\n/**\n * File type for compressors that support multiple types (e.g., YUI).\n */\nexport type FileType = \"js\" | \"css\";\n\n/**\n * User-facing settings for the minify function.\n * This is what users pass when calling minify().\n *\n * @example\n * ```ts\n * import { minify } from '@node-minify/core';\n * import { terser } from '@node-minify/terser';\n *\n * await minify({\n * compressor: terser,\n * input: 'src/*.js',\n * output: 'dist/bundle.min.js',\n * options: { mangle: true }\n * });\n * ```\n */\nexport type Settings<TOptions extends CompressorOptions = CompressorOptions> = {\n /**\n * The compressor function to use for minification.\n */\n compressor: Compressor<TOptions>;\n\n /**\n * Optional label for the compressor (used in logging).\n */\n compressorLabel?: string;\n\n /**\n * Content to minify (for in-memory minification).\n * If provided, input/output are not required.\n */\n content?: string;\n\n /**\n * Input file path(s) or glob pattern.\n * Can be a single file, array of files, or wildcard pattern.\n *\n * @example\n * - 'src/app.js'\n * - ['src/a.js', 'src/b.js']\n * - 'src/**\\/*.js'\n */\n input?: string | string[];\n\n /**\n * Output file path.\n * Use $1 as placeholder for input filename in multi-file scenarios.\n * Can be a single file, array of files, or pattern with $1.\n *\n * @example\n * - 'dist/bundle.min.js'\n * - ['file1.min.js', 'file2.min.js']\n * - '$1.min.js' (creates app.min.js from app.js)\n */\n output?: string | string[];\n\n /**\n * Compressor-specific options.\n * See individual compressor documentation for available options.\n */\n options?: TOptions;\n\n /**\n * CLI option string (used by CLI only).\n * @internal\n */\n option?: string;\n\n /**\n * Buffer size for file operations (in bytes).\n * @default 1024000 (1MB)\n */\n buffer?: number;\n\n /**\n * File type for compressors that support multiple types.\n * Required for YUI compressor.\n */\n type?: FileType;\n\n /**\n * Suppress console output.\n * @default false\n */\n silence?: boolean;\n\n /**\n * Public folder to prepend to input paths.\n *\n * @example\n * With publicFolder: 'public/js/' and input: 'app.js',\n * the actual path becomes 'public/js/app.js'\n */\n publicFolder?: string;\n\n /**\n * Replace files in place instead of creating new output files.\n * @default false\n */\n replaceInPlace?: boolean;\n};\n\n/**\n * Options passed to compressor functions internally.\n * This is what compressors receive, not what users pass.\n */\nexport type MinifierOptions<\n TOptions extends CompressorOptions = CompressorOptions,\n> = {\n /**\n * The full settings object.\n */\n settings: Settings<TOptions>;\n\n /**\n * The content to minify.\n */\n content?: string;\n\n /**\n * Index of current file when processing multiple files.\n */\n index?: number;\n};\n\n/**\n * Result returned after compression (used by CLI).\n */\nexport type Result = {\n /**\n * Label of the compressor used.\n */\n compressorLabel: string;\n\n /**\n * Size of minified content (formatted string, e.g., \"1.5 KB\").\n */\n size: string;\n\n /**\n * Gzipped size of minified content (formatted string).\n */\n sizeGzip: string;\n};\n\n/**\n * Type alias for user convenience.\n * @deprecated Use `Settings` instead. Will be removed in v11.\n */\nexport type MinifyOptions<\n TOptions extends CompressorOptions = CompressorOptions,\n> = Settings<TOptions>;\n"],"mappings":";;AAwDA;;;AAI2BK,KA7CfJ,gBAAAA,GA6CeI;EAAXD,IAAAA,EAAAA,MAAAA;EAwCFC,GAAAA,CAAAA,EAAAA,MAAAA;CAkBHG;AA4BX;;;;AAMcC,KAhIFP,iBAAAA,GAAoBC,MAgIlBM,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;;;;AC3Id;;AAEG,KDgBSL,UChBT,CAAA,iBDgBqCF,iBChBrC,GDgByDA,iBChBzD,CAAA,GAA0B,CAAA,IAAA,EDiBlBI,eCjBkB,CDiBFD,QCjBE,CAAA,EAAA,GDiBYE,OCjBZ,CDiBoBN,gBCjBpB,CAAA;;;;KDsBjBO,QAAAA;;;;;;;;;;;;;;;;;;KAmBAC,0BAA0BP,oBAAoBA;;;;cAI1CE,WAAWC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAwCbA;;;;;;;;;;;;;;;;;;SAkBHG;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BCF,iCACSJ,oBAAoBA;;;;YAK3BO,SAASJ;;;;;;;;;;;;;;;;;;;AAnHXG,iBCxBU,UAAA,CDwBF;EAAA;AAAA,CAAA,ECtBjB,eDsBiB,CAAA,ECtBC,ODsBD,CCtBS,gBDsBT,CAAA"}
package/dist/index.js CHANGED
@@ -1,26 +1,14 @@
1
- // src/index.ts
2
- import { utils } from "@node-minify/utils";
3
- var noCompress = ({
4
- settings,
5
- content,
6
- callback,
7
- index
8
- }) => {
9
- if (settings && !settings.content && settings.output) {
10
- utils.writeFile({ file: settings.output, content, index });
11
- }
12
- if (callback) {
13
- return callback(null, content);
14
- }
15
- return content;
16
- };
17
- noCompress.default = noCompress;
18
- var src_default = noCompress;
19
- export {
20
- src_default as default
21
- };
22
- /*!
23
- * node-minify
24
- * Copyright(c) 2011-2024 Rodolphe Stoclin
25
- * MIT Licensed
26
- */
1
+ //#region src/index.ts
2
+ /**
3
+ * No compression, just concatenation.
4
+ * @param content - Content to pass through
5
+ * @returns Unmodified content
6
+ */
7
+ async function noCompress({ content }) {
8
+ if (typeof content !== "string") throw new Error("no-compress failed: empty result");
9
+ return { code: content };
10
+ }
11
+
12
+ //#endregion
13
+ export { noCompress };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport type { CompressorResult, MinifierOptions } from \"@node-minify/types\";\n\n/**\n * No compression, just concatenation.\n * @param content - Content to pass through\n * @returns Unmodified content\n */\nexport async function noCompress({\n content,\n}: MinifierOptions): Promise<CompressorResult> {\n if (typeof content !== \"string\") {\n throw new Error(\"no-compress failed: empty result\");\n }\n\n return { code: content };\n}\n"],"mappings":";;;;;;AAaA,eAAsB,WAAW,EAC7B,WAC2C;AAC3C,KAAI,OAAO,YAAY,SACnB,OAAM,IAAI,MAAM,mCAAmC;AAGvD,QAAO,EAAE,MAAM,SAAS"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/no-compress",
3
- "version": "10.0.0-next.0",
3
+ "version": "10.0.1",
4
4
  "description": "no compress plugin for @node-minify, only concatenate",
5
5
  "keywords": [
6
6
  "concatenate"
@@ -10,20 +10,19 @@
10
10
  "license": "MIT",
11
11
  "type": "module",
12
12
  "engines": {
13
- "node": ">=22.0.0"
13
+ "node": ">=20.0.0"
14
14
  },
15
15
  "directories": {
16
16
  "lib": "dist",
17
17
  "test": "__tests__"
18
18
  },
19
- "main": "./dist/index.cjs",
19
+ "types": "./dist/index.d.ts",
20
+ "main": "./dist/index.js",
20
21
  "exports": {
21
- "./package.json": "./package.json",
22
- ".": {
23
- "import": "./dist/index.js",
24
- "default": "./dist/index.cjs"
25
- }
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.js"
26
24
  },
25
+ "sideEffects": false,
27
26
  "files": [
28
27
  "dist/**/*"
29
28
  ],
@@ -38,14 +37,16 @@
38
37
  "url": "https://github.com/srod/node-minify/issues"
39
38
  },
40
39
  "scripts": {
41
- "build": "tsup src/index.ts --format cjs,esm --dts --clean && bunx fix-tsup-cjs",
42
- "check-exports": "attw --pack .",
40
+ "build": "tsdown src/index.ts",
41
+ "check-exports": "attw --pack . --profile esm-only",
43
42
  "format:check": "biome check .",
44
43
  "lint": "biome lint .",
45
44
  "prepublishOnly": "bun run build",
46
45
  "test": "vitest run",
47
46
  "test:ci": "vitest run --coverage",
48
- "test:watch": "vitest"
47
+ "test:watch": "vitest",
48
+ "typecheck": "tsc --noEmit",
49
+ "dev": "tsdown src/index.ts --watch"
49
50
  },
50
51
  "dependencies": {
51
52
  "@node-minify/utils": "workspace:*"
package/dist/index.cjs DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- default: () => src_default
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
- var import_utils = require("@node-minify/utils");
27
- var noCompress = ({
28
- settings,
29
- content,
30
- callback,
31
- index
32
- }) => {
33
- if (settings && !settings.content && settings.output) {
34
- import_utils.utils.writeFile({ file: settings.output, content, index });
35
- }
36
- if (callback) {
37
- return callback(null, content);
38
- }
39
- return content;
40
- };
41
- noCompress.default = noCompress;
42
- var src_default = noCompress;
43
- /*!
44
- * node-minify
45
- * Copyright(c) 2011-2024 Rodolphe Stoclin
46
- * MIT Licensed
47
- */
48
-
49
- // fix-cjs-exports
50
- if (module.exports.default) {
51
- Object.assign(module.exports.default, module.exports);
52
- module.exports = module.exports.default;
53
- delete module.exports.default;
54
- }
package/dist/index.d.cts DELETED
@@ -1,15 +0,0 @@
1
- import { MinifierOptions } from '@node-minify/types';
2
-
3
- /*!
4
- * node-minify
5
- * Copyright(c) 2011-2024 Rodolphe Stoclin
6
- * MIT Licensed
7
- */
8
-
9
- declare const noCompress: {
10
- ({ settings, content, callback, index, }: MinifierOptions): string | void;
11
- default: any;
12
- };
13
-
14
- export { noCompress as default };
15
- export = noCompress