@node-minify/types 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/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # @node-minify/types
2
2
 
3
+ ## 10.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d722b73: test: verify OIDC publishing with fixed workflow config
8
+
9
+ ## 10.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - 4406c0c: ## v10.0.0
14
+
15
+ ### Breaking Changes
16
+
17
+ - **ESM Only**: The package is now pure ESM. Requires Node.js 20+.
18
+ - **Async API**: Callback support has been removed. All `minify()` calls must use `await` or `.then()`.
19
+ - **Named Exports**: All packages now use named exports (e.g., `import { minify } from '@node-minify/core'`).
20
+ - **Sync/Async Split**: Sync functions have been removed or split.
21
+ - **Deprecations**:
22
+ - `@node-minify/babel-minify` (deprecated)
23
+ - `@node-minify/uglify-es` (deprecated)
24
+ - `@node-minify/yui` (deprecated)
25
+ - `@node-minify/sqwish` (deprecated)
26
+ - `@node-minify/crass` (deprecated)
27
+
28
+ ### Features & Improvements
29
+
30
+ - **Build System**: Switched from `tsup` to `tsdown` for faster and more reliable builds.
31
+ - **Core**: Moved file I/O operations from compressors to core for better consistency.
32
+ - **Output**: Support for array output with input/output validation.
33
+ - **Security**: Replaced `html-minifier` with `html-minifier-next`.
34
+ - **Typings**: Improved TypeScript definitions and coverage.
35
+ - **Dependencies**: Updated all dependencies.
36
+
37
+ ### Bug Fixes
38
+
39
+ - Fixed various import issues and build warnings.
40
+ - Corrected explicit file extensions in imports.
41
+
3
42
  ## 10.0.0-next.0
4
43
 
5
44
  ### Major Changes
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/types"><img src="https://img.shields.io/npm/v/@node-minify/types.svg"></a>
8
8
  <a href="https://npmjs.org/package/@node-minify/types"><img src="https://img.shields.io/npm/dm/@node-minify/types.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
  # Types for node-minify
@@ -22,4 +22,4 @@ npm install --save-dev @node-minify/types
22
22
 
23
23
  ## License
24
24
 
25
- [MIT](https://github.com/srod/node-minify/blob/develop/LICENSE)
25
+ [MIT](https://github.com/srod/node-minify/blob/main/LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/types",
3
- "version": "10.0.0-next.0",
3
+ "version": "10.0.1",
4
4
  "description": "types for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -13,10 +13,10 @@
13
13
  "license": "MIT",
14
14
  "type": "module",
15
15
  "engines": {
16
- "node": ">=22.0.0"
16
+ "node": ">=20.0.0"
17
17
  },
18
- "main": "src/types.ts",
19
- "types": "src/types.ts",
18
+ "main": "src/types.d.ts",
19
+ "types": "src/types.d.ts",
20
20
  "publishConfig": {
21
21
  "access": "public"
22
22
  },
@@ -27,4 +27,4 @@
27
27
  "bugs": {
28
28
  "url": "https://github.com/srod/node-minify/issues"
29
29
  }
30
- }
30
+ }
package/src/types.d.ts ADDED
@@ -0,0 +1,192 @@
1
+ /*!
2
+ * node-minify
3
+ * Copyright(c) 2011-2025 Rodolphe Stoclin
4
+ * MIT Licensed
5
+ */
6
+
7
+ /**
8
+ * The return type of a compressor function.
9
+ * @deprecated Use `CompressorResult` instead. Will be removed in v11.
10
+ */
11
+ export type CompressorReturnType = string;
12
+
13
+ /**
14
+ * Result returned by a compressor function.
15
+ */
16
+ export type CompressorResult = {
17
+ code: string;
18
+ map?: string;
19
+ };
20
+
21
+ /**
22
+ * Base options that all compressors can accept.
23
+ * Specific compressors may extend this with their own options.
24
+ */
25
+ export type CompressorOptions = Record<string, unknown>;
26
+
27
+ /**
28
+ * A compressor function that minifies content.
29
+ * @param args - The minifier options including settings and content
30
+ * @returns A promise resolving to the compression result
31
+ */
32
+ export type Compressor<TOptions extends CompressorOptions = CompressorOptions> =
33
+ (args: MinifierOptions<TOptions>) => Promise<CompressorResult>;
34
+
35
+ /**
36
+ * File type for compressors that support multiple types (e.g., YUI).
37
+ */
38
+ export type FileType = "js" | "css";
39
+
40
+ /**
41
+ * User-facing settings for the minify function.
42
+ * This is what users pass when calling minify().
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * import { minify } from '@node-minify/core';
47
+ * import { terser } from '@node-minify/terser';
48
+ *
49
+ * await minify({
50
+ * compressor: terser,
51
+ * input: 'src/*.js',
52
+ * output: 'dist/bundle.min.js',
53
+ * options: { mangle: true }
54
+ * });
55
+ * ```
56
+ */
57
+ export type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
58
+ /**
59
+ * The compressor function to use for minification.
60
+ */
61
+ compressor: Compressor<TOptions>;
62
+
63
+ /**
64
+ * Optional label for the compressor (used in logging).
65
+ */
66
+ compressorLabel?: string;
67
+
68
+ /**
69
+ * Content to minify (for in-memory minification).
70
+ * If provided, input/output are not required.
71
+ */
72
+ content?: string;
73
+
74
+ /**
75
+ * Input file path(s) or glob pattern.
76
+ * Can be a single file, array of files, or wildcard pattern.
77
+ *
78
+ * @example
79
+ * - 'src/app.js'
80
+ * - ['src/a.js', 'src/b.js']
81
+ * - 'src/**\/*.js'
82
+ */
83
+ input?: string | string[];
84
+
85
+ /**
86
+ * Output file path.
87
+ * Use $1 as placeholder for input filename in multi-file scenarios.
88
+ * Can be a single file, array of files, or pattern with $1.
89
+ *
90
+ * @example
91
+ * - 'dist/bundle.min.js'
92
+ * - ['file1.min.js', 'file2.min.js']
93
+ * - '$1.min.js' (creates app.min.js from app.js)
94
+ */
95
+ output?: string | string[];
96
+
97
+ /**
98
+ * Compressor-specific options.
99
+ * See individual compressor documentation for available options.
100
+ */
101
+ options?: TOptions;
102
+
103
+ /**
104
+ * CLI option string (used by CLI only).
105
+ * @internal
106
+ */
107
+ option?: string;
108
+
109
+ /**
110
+ * Buffer size for file operations (in bytes).
111
+ * @default 1024000 (1MB)
112
+ */
113
+ buffer?: number;
114
+
115
+ /**
116
+ * File type for compressors that support multiple types.
117
+ * Required for YUI compressor.
118
+ */
119
+ type?: FileType;
120
+
121
+ /**
122
+ * Suppress console output.
123
+ * @default false
124
+ */
125
+ silence?: boolean;
126
+
127
+ /**
128
+ * Public folder to prepend to input paths.
129
+ *
130
+ * @example
131
+ * With publicFolder: 'public/js/' and input: 'app.js',
132
+ * the actual path becomes 'public/js/app.js'
133
+ */
134
+ publicFolder?: string;
135
+
136
+ /**
137
+ * Replace files in place instead of creating new output files.
138
+ * @default false
139
+ */
140
+ replaceInPlace?: boolean;
141
+ };
142
+
143
+ /**
144
+ * Options passed to compressor functions internally.
145
+ * This is what compressors receive, not what users pass.
146
+ */
147
+ export type MinifierOptions<
148
+ TOptions extends CompressorOptions = CompressorOptions,
149
+ > = {
150
+ /**
151
+ * The full settings object.
152
+ */
153
+ settings: Settings<TOptions>;
154
+
155
+ /**
156
+ * The content to minify.
157
+ */
158
+ content?: string;
159
+
160
+ /**
161
+ * Index of current file when processing multiple files.
162
+ */
163
+ index?: number;
164
+ };
165
+
166
+ /**
167
+ * Result returned after compression (used by CLI).
168
+ */
169
+ export type Result = {
170
+ /**
171
+ * Label of the compressor used.
172
+ */
173
+ compressorLabel: string;
174
+
175
+ /**
176
+ * Size of minified content (formatted string, e.g., "1.5 KB").
177
+ */
178
+ size: string;
179
+
180
+ /**
181
+ * Gzipped size of minified content (formatted string).
182
+ */
183
+ sizeGzip: string;
184
+ };
185
+
186
+ /**
187
+ * Type alias for user convenience.
188
+ * @deprecated Use `Settings` instead. Will be removed in v11.
189
+ */
190
+ export type MinifyOptions<
191
+ TOptions extends CompressorOptions = CompressorOptions,
192
+ > = Settings<TOptions>;
package/src/types.ts DELETED
@@ -1,62 +0,0 @@
1
- export type OptionsPossible =
2
- | string
3
- | boolean
4
- | Record<string, string>
5
- | object;
6
-
7
- export type Options = {
8
- [Key: string]:
9
- | string
10
- | string[]
11
- | boolean
12
- | Record<string, OptionsPossible>;
13
- };
14
-
15
- export type OptionsTest = Options & {
16
- minify: Settings;
17
- };
18
-
19
- type Compressor = (
20
- args: MinifierOptions
21
- ) => void | string | Promise<void | string | undefined>;
22
-
23
- export type Settings = {
24
- compressorLabel?: string;
25
- compressor?: string | Compressor;
26
- sync?: boolean;
27
- callback?: (err: unknown, minified?: string) => void;
28
- content?: string;
29
- input?: string | string[];
30
- output?: string;
31
- options?: Options;
32
- option?: string;
33
- buffer?: number;
34
- type?: "js" | "css" | "uglifyjs";
35
- silence?: boolean;
36
- publicFolder?: string;
37
- replaceInPlace?: boolean;
38
- };
39
-
40
- export type MinifierOptions = {
41
- settings?: Settings;
42
- content?: string;
43
- callback?: null | ((err?: unknown | null, result?: string) => void);
44
- compressor?: string | Compressor;
45
- index?: number;
46
- args?: string[];
47
- data?: string;
48
- sync?: boolean;
49
- input?: string | string[];
50
- output?: string;
51
- };
52
-
53
- export type Result = {
54
- compressor?: string | Compressor;
55
- compressorLabel: string | (() => void);
56
- size: string;
57
- sizeGzip: string;
58
- };
59
-
60
- export type Dictionary<T> = {
61
- [Key: string]: T;
62
- };