@modern-js/plugin-swc 2.58.1 → 2.58.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AppTools, CliPlugin } from '@modern-js/app-tools';
|
|
2
|
-
import { PluginSwcOptions } from '@rsbuild/plugin-swc';
|
|
3
2
|
import type { ToolsUserConfig } from '@modern-js/app-tools/src/types/config/tools';
|
|
3
|
+
import { type PluginSwcOptions } from '@rsbuild/plugin-swc';
|
|
4
4
|
export declare function factory(name: string, modifySwcOptions: (options: PluginSwcOptions) => PluginSwcOptions): () => CliPlugin<AppTools>;
|
|
5
5
|
export declare function applyBuilderSwcConfig(swc: PluginSwcOptions, esbuild: ToolsUserConfig['esbuild'] | undefined, isSSR: boolean): PluginSwcOptions;
|
|
6
6
|
export declare const swcPlugin: () => CliPlugin<AppTools>;
|
package/dist/index.js
CHANGED
|
@@ -25,8 +25,8 @@ __export(src_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(src_exports);
|
|
27
27
|
var import_utils = require("@modern-js/utils");
|
|
28
|
-
var import_plugin_swc = require("@rsbuild/plugin-swc");
|
|
29
28
|
var import_logger = require("@modern-js/utils/logger");
|
|
29
|
+
var import_plugin_swc = require("@rsbuild/plugin-swc");
|
|
30
30
|
function factory(name, modifySwcOptions) {
|
|
31
31
|
return () => ({
|
|
32
32
|
name,
|
|
@@ -40,27 +40,27 @@ function factory(name, modifySwcOptions) {
|
|
|
40
40
|
const { esbuild, swc = {} } = config.tools;
|
|
41
41
|
const swcOptions = modifySwcOptions(swc);
|
|
42
42
|
const finalConfig = applyBuilderSwcConfig(swcOptions, esbuild, (0, import_utils.isSSR)(config));
|
|
43
|
-
var _config_performance_transformLodash;
|
|
44
43
|
context.builder.addPlugins([
|
|
45
|
-
(0, import_plugin_swc.pluginSwc)({
|
|
46
|
-
|
|
47
|
-
transformLodash
|
|
48
|
-
})
|
|
44
|
+
(0, import_plugin_swc.pluginSwc)(applyConfig(finalConfig, (swcConfig) => {
|
|
45
|
+
var _config_performance_transformLodash;
|
|
46
|
+
swcConfig.transformLodash = (_config_performance_transformLodash = config.performance.transformLodash) !== null && _config_performance_transformLodash !== void 0 ? _config_performance_transformLodash : true;
|
|
47
|
+
}))
|
|
49
48
|
]);
|
|
50
49
|
}
|
|
51
50
|
})
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
53
|
function applyBuilderSwcConfig(swc, esbuild, isSSR2) {
|
|
54
|
+
let swcConfig = swc;
|
|
55
55
|
if (isSSR2) {
|
|
56
|
-
|
|
56
|
+
swcConfig = applyConfig(swc, (config) => {
|
|
57
57
|
var _config;
|
|
58
58
|
var _extensions;
|
|
59
59
|
(_extensions = (_config = config).extensions) !== null && _extensions !== void 0 ? _extensions : _config.extensions = {};
|
|
60
60
|
config.extensions.loadableComponents = true;
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
return applyConfig(
|
|
63
|
+
return applyConfig(swcConfig, (config) => {
|
|
64
64
|
if (esbuild) {
|
|
65
65
|
if (config.jsMinify !== false && esbuild.minimize !== false) {
|
|
66
66
|
import_logger.logger.warn("You have enabled both esbuild minimizer and SWC minimizer, which will cause conflicts. Please remove `tools.esbuild` config and only use SWC to minimize your code.");
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"modern",
|
|
15
15
|
"modern.js"
|
|
16
16
|
],
|
|
17
|
-
"version": "2.58.
|
|
17
|
+
"version": "2.58.3",
|
|
18
18
|
"jsnext:source": "./src/index.ts",
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"main": "./dist/index.js",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@rsbuild/core": "1.0.1-beta.
|
|
35
|
-
"@rsbuild/plugin-swc": "1.0.1-beta.
|
|
34
|
+
"@rsbuild/core": "1.0.1-beta.14",
|
|
35
|
+
"@rsbuild/plugin-swc": "1.0.1-beta.14",
|
|
36
36
|
"@swc/helpers": "0.5.3",
|
|
37
|
-
"@modern-js/utils": "2.58.
|
|
37
|
+
"@modern-js/utils": "2.58.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/jest": "^29",
|
|
41
41
|
"@types/node": "^14",
|
|
42
42
|
"typescript": "^5",
|
|
43
|
-
"@modern-js/app-tools": "2.58.
|
|
44
|
-
"@modern-js/types": "2.58.
|
|
45
|
-
"@scripts/
|
|
46
|
-
"@scripts/
|
|
43
|
+
"@modern-js/app-tools": "2.58.3",
|
|
44
|
+
"@modern-js/types": "2.58.3",
|
|
45
|
+
"@scripts/jest-config": "2.58.3",
|
|
46
|
+
"@scripts/build": "2.58.3"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"registry": "https://registry.npmjs.org/",
|