@bleedingdev/modern-js-builder 3.2.0-ultramodern.120 → 3.2.0-ultramodern.122
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/dist/cjs/plugins/postcss.js +7 -44
- package/dist/cjs/rsdoctorConfig.js +18 -0
- package/dist/esm/plugins/postcss.mjs +5 -45
- package/dist/esm/rsdoctorConfig.mjs +0 -0
- package/dist/esm-node/plugins/postcss.mjs +5 -45
- package/dist/esm-node/rsdoctorConfig.mjs +1 -0
- package/dist/types/plugins/postcss.d.ts +1 -0
- package/dist/types/plugins/rsdoctor.d.ts +1 -1
- package/dist/types/rsdoctorConfig.d.ts +12 -0
- package/dist/types/shared/parseCommonConfig.d.ts +2 -1
- package/dist/types/types.d.ts +2 -13
- package/package.json +3 -4
|
@@ -40,6 +40,7 @@ var __webpack_require__ = {};
|
|
|
40
40
|
var __webpack_exports__ = {};
|
|
41
41
|
__webpack_require__.r(__webpack_exports__);
|
|
42
42
|
__webpack_require__.d(__webpack_exports__, {
|
|
43
|
+
loadPostcssPlugin: ()=>loadPostcssPlugin,
|
|
43
44
|
pluginPostcss: ()=>pluginPostcss
|
|
44
45
|
});
|
|
45
46
|
const external_node_module_namespaceObject = require("node:module");
|
|
@@ -51,14 +52,6 @@ const core_namespaceObject = require("@rsbuild/core");
|
|
|
51
52
|
const getCssSupport_js_namespaceObject = require("../shared/getCssSupport.js");
|
|
52
53
|
const builderRequire = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
53
54
|
const createRootRequire = (rootPath)=>(0, external_node_module_namespaceObject.createRequire)((0, external_node_url_namespaceObject.pathToFileURL)(external_node_path_default().join(rootPath, 'package.json')).href);
|
|
54
|
-
const loadByResolver = (resolveWith, name)=>{
|
|
55
|
-
try {
|
|
56
|
-
return resolveWith(name);
|
|
57
|
-
} catch (error) {
|
|
58
|
-
const resolved = resolveWith.resolve(name);
|
|
59
|
-
return resolveWith(resolved);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
55
|
const loadPostcssPlugin = (name, appRootPath)=>{
|
|
63
56
|
const resolvers = [
|
|
64
57
|
builderRequire,
|
|
@@ -67,34 +60,13 @@ const loadPostcssPlugin = (name, appRootPath)=>{
|
|
|
67
60
|
];
|
|
68
61
|
let firstError = null;
|
|
69
62
|
for (const resolveWith of resolvers)try {
|
|
70
|
-
return
|
|
63
|
+
return resolveWith(name);
|
|
71
64
|
} catch (error) {
|
|
72
65
|
firstError ??= error;
|
|
73
66
|
}
|
|
74
67
|
throw firstError;
|
|
75
68
|
};
|
|
76
69
|
const importPostcssPlugin = (name, appRootPath)=>Promise.resolve(loadPostcssPlugin(name, appRootPath));
|
|
77
|
-
const clonePostCSSConfig = (config)=>({
|
|
78
|
-
...config,
|
|
79
|
-
plugins: config.plugins ? [
|
|
80
|
-
...config.plugins
|
|
81
|
-
] : void 0
|
|
82
|
-
});
|
|
83
|
-
const postcssLoadConfig = builderRequire('postcss-load-config');
|
|
84
|
-
const userPostcssrcCache = new Map();
|
|
85
|
-
const loadUserPostcssrc = async (root)=>{
|
|
86
|
-
const cached = userPostcssrcCache.get(root);
|
|
87
|
-
if (cached) return clonePostCSSConfig(await cached);
|
|
88
|
-
const promise = postcssLoadConfig({}, root).catch((err)=>{
|
|
89
|
-
if (err?.message?.includes('No PostCSS Config found')) return {};
|
|
90
|
-
throw err;
|
|
91
|
-
});
|
|
92
|
-
userPostcssrcCache.set(root, promise);
|
|
93
|
-
return promise.then((config)=>{
|
|
94
|
-
userPostcssrcCache.set(root, config);
|
|
95
|
-
return clonePostCSSConfig(config);
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
70
|
const pluginPostcss = (options = {})=>({
|
|
99
71
|
name: 'builder:postcss-plugins',
|
|
100
72
|
pre: [
|
|
@@ -130,7 +102,6 @@ const pluginPostcss = (options = {})=>({
|
|
|
130
102
|
overrideBrowserslist: config.output.overrideBrowserslist
|
|
131
103
|
}, autoprefixer)))
|
|
132
104
|
]).then((results)=>results.filter(Boolean));
|
|
133
|
-
const userOptions = await loadUserPostcssrc(api.context.rootPath);
|
|
134
105
|
return mergeEnvironmentConfig({
|
|
135
106
|
tools: {
|
|
136
107
|
postcss: (opts)=>{
|
|
@@ -138,27 +109,19 @@ const pluginPostcss = (options = {})=>({
|
|
|
138
109
|
core_namespaceObject.logger.warn('unexpected function type postcssOptions, the default postcss plugins will not be applied.');
|
|
139
110
|
return opts;
|
|
140
111
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
...existingOptions
|
|
145
|
-
};
|
|
146
|
-
const userPlugins = userOptions.plugins ?? [];
|
|
147
|
-
const existingPlugins = existingOptions.plugins ?? [];
|
|
148
|
-
mergedOptions.plugins = [
|
|
149
|
-
...userPlugins,
|
|
150
|
-
...existingPlugins,
|
|
151
|
-
...plugins
|
|
152
|
-
];
|
|
153
|
-
opts.postcssOptions = mergedOptions;
|
|
112
|
+
opts.postcssOptions ??= {};
|
|
113
|
+
opts.postcssOptions.plugins ??= [];
|
|
114
|
+
opts.postcssOptions.plugins.push(...plugins);
|
|
154
115
|
}
|
|
155
116
|
}
|
|
156
117
|
}, config);
|
|
157
118
|
});
|
|
158
119
|
}
|
|
159
120
|
});
|
|
121
|
+
exports.loadPostcssPlugin = __webpack_exports__.loadPostcssPlugin;
|
|
160
122
|
exports.pluginPostcss = __webpack_exports__.pluginPostcss;
|
|
161
123
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
124
|
+
"loadPostcssPlugin",
|
|
162
125
|
"pluginPostcss"
|
|
163
126
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
164
127
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
@@ -6,14 +6,6 @@ import { logger } from "@rsbuild/core";
|
|
|
6
6
|
import { getCssSupport } from "../shared/getCssSupport.mjs";
|
|
7
7
|
const builderRequire = createRequire(import.meta.url);
|
|
8
8
|
const createRootRequire = (rootPath)=>createRequire(pathToFileURL(node_path.join(rootPath, 'package.json')).href);
|
|
9
|
-
const loadByResolver = (resolveWith, name)=>{
|
|
10
|
-
try {
|
|
11
|
-
return resolveWith(name);
|
|
12
|
-
} catch (error) {
|
|
13
|
-
const resolved = resolveWith.resolve(name);
|
|
14
|
-
return resolveWith(resolved);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
9
|
const loadPostcssPlugin = (name, appRootPath)=>{
|
|
18
10
|
const resolvers = [
|
|
19
11
|
builderRequire,
|
|
@@ -22,34 +14,13 @@ const loadPostcssPlugin = (name, appRootPath)=>{
|
|
|
22
14
|
];
|
|
23
15
|
let firstError = null;
|
|
24
16
|
for (const resolveWith of resolvers)try {
|
|
25
|
-
return
|
|
17
|
+
return resolveWith(name);
|
|
26
18
|
} catch (error) {
|
|
27
19
|
firstError ??= error;
|
|
28
20
|
}
|
|
29
21
|
throw firstError;
|
|
30
22
|
};
|
|
31
23
|
const importPostcssPlugin = (name, appRootPath)=>Promise.resolve(loadPostcssPlugin(name, appRootPath));
|
|
32
|
-
const clonePostCSSConfig = (config)=>({
|
|
33
|
-
...config,
|
|
34
|
-
plugins: config.plugins ? [
|
|
35
|
-
...config.plugins
|
|
36
|
-
] : void 0
|
|
37
|
-
});
|
|
38
|
-
const postcssLoadConfig = builderRequire('postcss-load-config');
|
|
39
|
-
const userPostcssrcCache = new Map();
|
|
40
|
-
const loadUserPostcssrc = async (root)=>{
|
|
41
|
-
const cached = userPostcssrcCache.get(root);
|
|
42
|
-
if (cached) return clonePostCSSConfig(await cached);
|
|
43
|
-
const promise = postcssLoadConfig({}, root).catch((err)=>{
|
|
44
|
-
if (err?.message?.includes('No PostCSS Config found')) return {};
|
|
45
|
-
throw err;
|
|
46
|
-
});
|
|
47
|
-
userPostcssrcCache.set(root, promise);
|
|
48
|
-
return promise.then((config)=>{
|
|
49
|
-
userPostcssrcCache.set(root, config);
|
|
50
|
-
return clonePostCSSConfig(config);
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
24
|
const pluginPostcss = (options = {})=>({
|
|
54
25
|
name: 'builder:postcss-plugins',
|
|
55
26
|
pre: [
|
|
@@ -85,7 +56,6 @@ const pluginPostcss = (options = {})=>({
|
|
|
85
56
|
overrideBrowserslist: config.output.overrideBrowserslist
|
|
86
57
|
}, autoprefixer)))
|
|
87
58
|
]).then((results)=>results.filter(Boolean));
|
|
88
|
-
const userOptions = await loadUserPostcssrc(api.context.rootPath);
|
|
89
59
|
return mergeEnvironmentConfig({
|
|
90
60
|
tools: {
|
|
91
61
|
postcss: (opts)=>{
|
|
@@ -93,23 +63,13 @@ const pluginPostcss = (options = {})=>({
|
|
|
93
63
|
logger.warn('unexpected function type postcssOptions, the default postcss plugins will not be applied.');
|
|
94
64
|
return opts;
|
|
95
65
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
...existingOptions
|
|
100
|
-
};
|
|
101
|
-
const userPlugins = userOptions.plugins ?? [];
|
|
102
|
-
const existingPlugins = existingOptions.plugins ?? [];
|
|
103
|
-
mergedOptions.plugins = [
|
|
104
|
-
...userPlugins,
|
|
105
|
-
...existingPlugins,
|
|
106
|
-
...plugins
|
|
107
|
-
];
|
|
108
|
-
opts.postcssOptions = mergedOptions;
|
|
66
|
+
opts.postcssOptions ??= {};
|
|
67
|
+
opts.postcssOptions.plugins ??= [];
|
|
68
|
+
opts.postcssOptions.plugins.push(...plugins);
|
|
109
69
|
}
|
|
110
70
|
}
|
|
111
71
|
}, config);
|
|
112
72
|
});
|
|
113
73
|
}
|
|
114
74
|
});
|
|
115
|
-
export { pluginPostcss };
|
|
75
|
+
export { loadPostcssPlugin, pluginPostcss };
|
|
File without changes
|
|
@@ -7,14 +7,6 @@ import { logger } from "@rsbuild/core";
|
|
|
7
7
|
import { getCssSupport } from "../shared/getCssSupport.mjs";
|
|
8
8
|
const builderRequire = createRequire(import.meta.url);
|
|
9
9
|
const createRootRequire = (rootPath)=>createRequire(pathToFileURL(node_path.join(rootPath, 'package.json')).href);
|
|
10
|
-
const loadByResolver = (resolveWith, name)=>{
|
|
11
|
-
try {
|
|
12
|
-
return resolveWith(name);
|
|
13
|
-
} catch (error) {
|
|
14
|
-
const resolved = resolveWith.resolve(name);
|
|
15
|
-
return resolveWith(resolved);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
10
|
const loadPostcssPlugin = (name, appRootPath)=>{
|
|
19
11
|
const resolvers = [
|
|
20
12
|
builderRequire,
|
|
@@ -23,34 +15,13 @@ const loadPostcssPlugin = (name, appRootPath)=>{
|
|
|
23
15
|
];
|
|
24
16
|
let firstError = null;
|
|
25
17
|
for (const resolveWith of resolvers)try {
|
|
26
|
-
return
|
|
18
|
+
return resolveWith(name);
|
|
27
19
|
} catch (error) {
|
|
28
20
|
firstError ??= error;
|
|
29
21
|
}
|
|
30
22
|
throw firstError;
|
|
31
23
|
};
|
|
32
24
|
const importPostcssPlugin = (name, appRootPath)=>Promise.resolve(loadPostcssPlugin(name, appRootPath));
|
|
33
|
-
const clonePostCSSConfig = (config)=>({
|
|
34
|
-
...config,
|
|
35
|
-
plugins: config.plugins ? [
|
|
36
|
-
...config.plugins
|
|
37
|
-
] : void 0
|
|
38
|
-
});
|
|
39
|
-
const postcssLoadConfig = builderRequire('postcss-load-config');
|
|
40
|
-
const userPostcssrcCache = new Map();
|
|
41
|
-
const loadUserPostcssrc = async (root)=>{
|
|
42
|
-
const cached = userPostcssrcCache.get(root);
|
|
43
|
-
if (cached) return clonePostCSSConfig(await cached);
|
|
44
|
-
const promise = postcssLoadConfig({}, root).catch((err)=>{
|
|
45
|
-
if (err?.message?.includes('No PostCSS Config found')) return {};
|
|
46
|
-
throw err;
|
|
47
|
-
});
|
|
48
|
-
userPostcssrcCache.set(root, promise);
|
|
49
|
-
return promise.then((config)=>{
|
|
50
|
-
userPostcssrcCache.set(root, config);
|
|
51
|
-
return clonePostCSSConfig(config);
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
25
|
const pluginPostcss = (options = {})=>({
|
|
55
26
|
name: 'builder:postcss-plugins',
|
|
56
27
|
pre: [
|
|
@@ -86,7 +57,6 @@ const pluginPostcss = (options = {})=>({
|
|
|
86
57
|
overrideBrowserslist: config.output.overrideBrowserslist
|
|
87
58
|
}, autoprefixer)))
|
|
88
59
|
]).then((results)=>results.filter(Boolean));
|
|
89
|
-
const userOptions = await loadUserPostcssrc(api.context.rootPath);
|
|
90
60
|
return mergeEnvironmentConfig({
|
|
91
61
|
tools: {
|
|
92
62
|
postcss: (opts)=>{
|
|
@@ -94,23 +64,13 @@ const pluginPostcss = (options = {})=>({
|
|
|
94
64
|
logger.warn('unexpected function type postcssOptions, the default postcss plugins will not be applied.');
|
|
95
65
|
return opts;
|
|
96
66
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
...existingOptions
|
|
101
|
-
};
|
|
102
|
-
const userPlugins = userOptions.plugins ?? [];
|
|
103
|
-
const existingPlugins = existingOptions.plugins ?? [];
|
|
104
|
-
mergedOptions.plugins = [
|
|
105
|
-
...userPlugins,
|
|
106
|
-
...existingPlugins,
|
|
107
|
-
...plugins
|
|
108
|
-
];
|
|
109
|
-
opts.postcssOptions = mergedOptions;
|
|
67
|
+
opts.postcssOptions ??= {};
|
|
68
|
+
opts.postcssOptions.plugins ??= [];
|
|
69
|
+
opts.postcssOptions.plugins.push(...plugins);
|
|
110
70
|
}
|
|
111
71
|
}
|
|
112
72
|
}, config);
|
|
113
73
|
});
|
|
114
74
|
}
|
|
115
75
|
});
|
|
116
|
-
export { pluginPostcss };
|
|
76
|
+
export { loadPostcssPlugin, pluginPostcss };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
import type { ToolsAutoprefixerConfig } from '../types';
|
|
3
|
+
export declare const loadPostcssPlugin: (name: string, appRootPath: string) => any;
|
|
3
4
|
export interface PluginPostcssOptions {
|
|
4
5
|
autoprefixer?: ToolsAutoprefixerConfig;
|
|
5
6
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type RsdoctorUserConfig = boolean | {
|
|
2
|
+
/**
|
|
3
|
+
* Force enable / disable Rsdoctor.
|
|
4
|
+
* When `performance.rsdoctor` is not configured, Rsdoctor is disabled.
|
|
5
|
+
*/
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Disable Rsdoctor client server and ensure build process exits after report generation.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
disableClientServer?: boolean;
|
|
12
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type RsbuildConfig, type RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RsdoctorUserConfig } from '../rsdoctorConfig';
|
|
3
|
+
import type { BuilderConfig, CreateBuilderCommonOptions } from '../types';
|
|
3
4
|
/** Determine if a file path is a CSS module when disableCssModuleExtension is enabled. */
|
|
4
5
|
export declare const isLooseCssModules: (path: string) => boolean;
|
|
5
6
|
export declare function parseCommonConfig(builderConfig: BuilderConfig, options?: CreateBuilderCommonOptions): Promise<{
|
package/dist/types/types.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import type { PluginSourceBuildOptions } from '@rsbuild/plugin-source-build';
|
|
|
10
10
|
import type { SvgDefaultExport } from '@rsbuild/plugin-svgr';
|
|
11
11
|
import type { PluginTypeCheckerOptions } from '@rsbuild/plugin-type-check';
|
|
12
12
|
import type { Options as AutoprefixerOptions } from 'autoprefixer';
|
|
13
|
+
import type { RsdoctorUserConfig } from './rsdoctorConfig';
|
|
14
|
+
export type { RsdoctorUserConfig } from './rsdoctorConfig';
|
|
13
15
|
export type CacheGroup = Rspack.OptimizationSplitChunksCacheGroup;
|
|
14
16
|
export type Stats = Omit<Rspack.Stats, '#private' | 'hash' | 'startTime' | 'endTime'>;
|
|
15
17
|
export type RspackConfig = Rspack.Configuration;
|
|
@@ -79,18 +81,6 @@ export type ToolsDevServerConfig = ConfigChain<{
|
|
|
79
81
|
watch?: boolean;
|
|
80
82
|
}>;
|
|
81
83
|
export type ToolsAutoprefixerConfig = ConfigChain<AutoprefixerOptions>;
|
|
82
|
-
export type RsdoctorUserConfig = boolean | {
|
|
83
|
-
/**
|
|
84
|
-
* Force enable / disable Rsdoctor.
|
|
85
|
-
* By default, Modern.js enables Rsdoctor in production builds.
|
|
86
|
-
*/
|
|
87
|
-
enabled?: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Disable Rsdoctor client server and ensure build process exits after report generation.
|
|
90
|
-
* @default true
|
|
91
|
-
*/
|
|
92
|
-
disableClientServer?: boolean;
|
|
93
|
-
};
|
|
94
84
|
export type BuilderExtraConfig = {
|
|
95
85
|
tools?: {
|
|
96
86
|
/**
|
|
@@ -284,4 +274,3 @@ export type BuilderConfig = {
|
|
|
284
274
|
[key: string]: EnvironmentConfig;
|
|
285
275
|
};
|
|
286
276
|
} & BuilderExtraConfig;
|
|
287
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bleedingdev/modern-js-builder",
|
|
3
|
-
"version": "3.2.0-ultramodern.
|
|
3
|
+
"version": "3.2.0-ultramodern.122",
|
|
4
4
|
"description": "A builder for Modern.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,14 +53,13 @@
|
|
|
53
53
|
"postcss-flexbugs-fixes": "5.0.2",
|
|
54
54
|
"postcss-font-variant": "5.0.0",
|
|
55
55
|
"postcss-initial": "4.0.1",
|
|
56
|
-
"postcss-load-config": "6.0.1",
|
|
57
56
|
"postcss-media-minmax": "5.0.0",
|
|
58
57
|
"postcss-nesting": "14.0.0",
|
|
59
58
|
"postcss-page-break": "3.0.4",
|
|
60
59
|
"rsbuild-plugin-rsc": "0.1.0",
|
|
61
60
|
"rspack-manifest-plugin": "5.2.2",
|
|
62
61
|
"ts-deepmerge": "8.0.0",
|
|
63
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.
|
|
62
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.122"
|
|
64
63
|
},
|
|
65
64
|
"devDependencies": {
|
|
66
65
|
"@rslib/core": "0.22.0",
|
|
@@ -68,7 +67,7 @@
|
|
|
68
67
|
"@types/lodash": "^4.17.24",
|
|
69
68
|
"react": "^19.2.7",
|
|
70
69
|
"terser": "^5.48.0",
|
|
71
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.
|
|
70
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.122",
|
|
72
71
|
"@scripts/rstest-config": "2.66.0"
|
|
73
72
|
},
|
|
74
73
|
"publishConfig": {
|