@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.2 → 3.9.0-ultramodern.3

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,20 @@
1
+ Copyright JS Foundation and other contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ 'Software'), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,76 @@
1
+ type BasePluginOptions<T> = {
2
+ /**
3
+ * include all assets that pass test assertion
4
+ */
5
+ test?: Rules | undefined;
6
+ /**
7
+ * include all assets matching any of these conditions
8
+ */
9
+ include?: Rules | undefined;
10
+ /**
11
+ * exclude all assets matching any of these conditions
12
+ */
13
+ exclude?: Rules | undefined;
14
+ /**
15
+ * only assets bigger than this size are processed, in bytes
16
+ */
17
+ threshold?: number | undefined;
18
+ /**
19
+ * only assets that compress better than this ratio are processed (`minRatio = Compressed Size / Original Size`)
20
+ */
21
+ minRatio?: number | undefined;
22
+ /**
23
+ * whether to delete the original assets or not
24
+ */
25
+ deleteOriginalAssets?: DeleteOriginalAssets | undefined;
26
+ /**
27
+ * the target asset filename
28
+ */
29
+ filename?: Filename | undefined;
30
+ };
31
+ type Rules = Rule[] | Rule;
32
+ type Rule = RegExp | string;
33
+ type DeleteOriginalAssets =
34
+ | boolean
35
+ | "keep-source-map"
36
+ | ((name: string) => boolean);
37
+ type Filename = string | ((fileData: PathData) => string);
38
+ type PathData = import('@rsbuild/core').Rspack.PathData;
39
+ type DefinedDefaultAlgorithmAndOptions<T> = T extends ZlibOptions
40
+ ? {
41
+ algorithm?: string | AlgorithmFunction<T> | undefined;
42
+ compressionOptions?: CompressionOptions<T> | undefined;
43
+ }
44
+ : {
45
+ algorithm: string | AlgorithmFunction<T>;
46
+ compressionOptions?: CompressionOptions<T> | undefined;
47
+ };
48
+ type ZlibOptions = import("zlib").ZlibOptions;
49
+ type AlgorithmFunction<T> = (
50
+ input: Buffer,
51
+ options: CompressionOptions<T>,
52
+ callback: (
53
+ error: Error | null | undefined,
54
+ result:
55
+ | WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>
56
+ | Uint8Array
57
+ | ReadonlyArray<number>
58
+ | WithImplicitCoercion<Uint8Array | ReadonlyArray<number> | string>
59
+ | WithImplicitCoercion<string>
60
+ | {
61
+ [Symbol.toPrimitive](hint: "string"): string;
62
+ },
63
+ ) => void,
64
+ ) => any;
65
+ type CompressionOptions<T> = InferDefaultType<T>;
66
+ type InferDefaultType<T> = T extends infer U ? U : CustomOptions;
67
+ type CustomOptions = {
68
+ [key: string]: EXPECTED_ANY;
69
+ };
70
+ type EXPECTED_ANY = any;
71
+ type WithImplicitCoercion<T> =
72
+ | T
73
+ | {
74
+ valueOf(): T;
75
+ };
76
+ export type CompressionPluginOptions = BasePluginOptions<ZlibOptions> & DefinedDefaultAlgorithmAndOptions<ZlibOptions>;
@@ -1,5 +1,4 @@
1
- import type CompressionPlugin from 'compression-webpack-plugin';
2
- type CompressionPluginOptions = NonNullable<ConstructorParameters<typeof CompressionPlugin>[0]>;
1
+ import type { CompressionPluginOptions } from '../../precompress/index.js';
3
2
  export type PrecompressCodecOptions = boolean | CompressionPluginOptions;
4
3
  export interface PrecompressConfig {
5
4
  /**
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.9.0-ultramodern.2",
20
+ "version": "3.9.0-ultramodern.3",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -134,18 +134,18 @@
134
134
  "@babel/traverse": "^8.0.4",
135
135
  "@babel/types": "^8.0.4",
136
136
  "@loadable/component": "5.16.7",
137
- "@modern-js/app-tools-extensions": "npm:@bleedingdev/modern-js-app-tools-extensions@3.9.0-ultramodern.2",
138
- "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.2",
139
- "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.9.0-ultramodern.2",
140
- "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.2",
141
- "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.2",
142
- "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.2",
143
- "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.9.0-ultramodern.2",
144
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.2",
145
- "@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.2",
146
- "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.2",
147
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.2",
148
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.2",
137
+ "@modern-js/app-tools-extensions": "npm:@bleedingdev/modern-js-app-tools-extensions@3.9.0-ultramodern.3",
138
+ "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.3",
139
+ "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.9.0-ultramodern.3",
140
+ "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.3",
141
+ "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.3",
142
+ "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.3",
143
+ "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.9.0-ultramodern.3",
144
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.3",
145
+ "@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.3",
146
+ "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.3",
147
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.3",
148
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.3",
149
149
  "@rsbuild/core": "2.2.3",
150
150
  "@swc/core": "1.16.2",
151
151
  "@swc/helpers": "^0.5.23",
package/rslib.config.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { rslibConfig } from '@modern-js/rslib';
2
2
  import { defineConfig } from '@rslib/core';
3
+ import { publicDeclarationsPlugin } from '../../../scripts/prebundle/ultramodern/public-declarations.mjs';
3
4
 
4
5
  const APP_TOOLS_CODE_ENTRY_GLOBS = [
5
6
  './src/**/*.{js,jsx,ts,tsx,mts,cts}',
@@ -8,6 +9,10 @@ const APP_TOOLS_CODE_ENTRY_GLOBS = [
8
9
 
9
10
  export default defineConfig({
10
11
  ...rslibConfig,
12
+ plugins: [
13
+ ...(rslibConfig.plugins ?? []),
14
+ publicDeclarationsPlugin('app-tools'),
15
+ ],
11
16
  lib: rslibConfig.lib?.map(libConfig => {
12
17
  return {
13
18
  ...libConfig,