@modern-js/module-tools 2.57.1 → 2.58.0
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.
|
@@ -215,8 +215,8 @@ const adapterPlugin = (compiler) => {
|
|
|
215
215
|
loader: result.loader
|
|
216
216
|
});
|
|
217
217
|
const ext = (0, import_path.extname)(args.path);
|
|
218
|
-
var _transformResult_loader;
|
|
219
|
-
const loader = (_transformResult_loader = transformResult.loader) !== null && _transformResult_loader !== void 0 ? _transformResult_loader : import_loader.loaderMap[ext];
|
|
218
|
+
var _transformResult_loader, _ref;
|
|
219
|
+
const loader = (_ref = (_transformResult_loader = transformResult.loader) !== null && _transformResult_loader !== void 0 ? _transformResult_loader : compiler.config.loader[ext]) !== null && _ref !== void 0 ? _ref : import_loader.loaderMap[ext];
|
|
220
220
|
const inlineSourceMap = context2.getInlineSourceMap();
|
|
221
221
|
var _result_resolveDir;
|
|
222
222
|
return {
|
|
@@ -51,10 +51,12 @@ class EsbuildCompiler {
|
|
|
51
51
|
(0, import_watch.initWatcher)(this);
|
|
52
52
|
}
|
|
53
53
|
const internal = await (0, import_feature.getInternalList)(this.context);
|
|
54
|
-
const
|
|
54
|
+
const before = this.config.hooks.filter((hook) => !hook.applyAfterBuiltIn);
|
|
55
|
+
const after = this.config.hooks.filter((hook) => hook.applyAfterBuiltIn);
|
|
55
56
|
this.hookList = [
|
|
56
|
-
...
|
|
57
|
-
...internal
|
|
57
|
+
...before,
|
|
58
|
+
...internal,
|
|
59
|
+
...after
|
|
58
60
|
];
|
|
59
61
|
await Promise.all(this.hookList.map((item) => item.apply(this)));
|
|
60
62
|
}
|
|
@@ -24,6 +24,7 @@ __export(swc_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(swc_exports);
|
|
25
25
|
var import_path = require("path");
|
|
26
26
|
var import_swc_plugins = require("@modern-js/swc-plugins");
|
|
27
|
+
var import_loader = require("../../constants/loader");
|
|
27
28
|
var import_utils = require("../../utils");
|
|
28
29
|
const name = "swc:transform";
|
|
29
30
|
const getSwcTarget = (target) => {
|
|
@@ -67,13 +68,16 @@ const swcTransform = (userTsconfig) => ({
|
|
|
67
68
|
} else {
|
|
68
69
|
useDefineForClassFields = true;
|
|
69
70
|
}
|
|
70
|
-
const { transformImport, transformLodash, externalHelpers } = compiler.config;
|
|
71
|
+
const { transformImport, transformLodash, externalHelpers, loader: userLoader } = compiler.config;
|
|
71
72
|
compiler.hooks.transform.tapPromise({
|
|
72
73
|
name
|
|
73
74
|
}, async (source) => {
|
|
74
75
|
const { path } = source;
|
|
75
76
|
const isTs = (0, import_utils.isTsLoader)(source.loader) || (0, import_utils.isTsExt)(path);
|
|
76
|
-
const
|
|
77
|
+
const ext = (0, import_path.extname)(path);
|
|
78
|
+
var _source_loader, _ref;
|
|
79
|
+
const loader = (_ref = (_source_loader = source.loader) !== null && _source_loader !== void 0 ? _source_loader : userLoader[ext]) !== null && _ref !== void 0 ? _ref : import_loader.loaderMap[ext];
|
|
80
|
+
const enableJsx = loader === "tsx" || loader === "jsx";
|
|
77
81
|
if ((0, import_utils.isJsExt)(path) || (0, import_utils.isJsLoader)(source.loader)) {
|
|
78
82
|
const { target, jsx } = compiler.config;
|
|
79
83
|
const swcCompilerOptions = {
|
package/dist/config/merge.js
CHANGED
|
@@ -122,8 +122,9 @@ const mergeDefaultBaseConfig = async (pConfig, options) => {
|
|
|
122
122
|
};
|
|
123
123
|
var _pConfig_esbuildOptions;
|
|
124
124
|
const esbuildOptions = (_pConfig_esbuildOptions = pConfig.esbuildOptions) !== null && _pConfig_esbuildOptions !== void 0 ? _pConfig_esbuildOptions : defaultConfig.esbuildOptions;
|
|
125
|
-
var _pConfig_shims, _pConfig_autoExtension, _pConfig_footer, _pConfig_banner, _pConfig_hooks, _pConfig_format, _pConfig_target, _pConfig_sourceMap, _pConfig_copy, _pConfig_outDir, _pConfig_jsx, _pConfig_splitting, _pConfig_minify, _pConfig_umdModuleName, _pConfig_sideEffects, _pConfig_style_inject, _pConfig_style_modules, _pConfig_style_autoModules, _pConfig_style_tailwindcss, _pConfig_externalHelpers, _pConfig_transformCache, _pConfig_transformImport, _pConfig_transformLodash, _pConfig_sourceType, _pConfig_disableSwcTransform;
|
|
125
|
+
var _pConfig_loader, _pConfig_shims, _pConfig_autoExtension, _pConfig_footer, _pConfig_banner, _pConfig_hooks, _pConfig_format, _pConfig_target, _pConfig_sourceMap, _pConfig_copy, _pConfig_outDir, _pConfig_jsx, _pConfig_splitting, _pConfig_minify, _pConfig_umdModuleName, _pConfig_sideEffects, _pConfig_style_inject, _pConfig_style_modules, _pConfig_style_autoModules, _pConfig_style_tailwindcss, _pConfig_externalHelpers, _pConfig_transformCache, _pConfig_transformImport, _pConfig_transformLodash, _pConfig_sourceType, _pConfig_disableSwcTransform;
|
|
126
126
|
return {
|
|
127
|
+
loader: (_pConfig_loader = pConfig.loader) !== null && _pConfig_loader !== void 0 ? _pConfig_loader : defaultConfig.loader,
|
|
127
128
|
shims: (_pConfig_shims = pConfig.shims) !== null && _pConfig_shims !== void 0 ? _pConfig_shims : defaultConfig.shims,
|
|
128
129
|
autoExtension: (_pConfig_autoExtension = pConfig.autoExtension) !== null && _pConfig_autoExtension !== void 0 ? _pConfig_autoExtension : defaultConfig.autoExtension,
|
|
129
130
|
footer: (_pConfig_footer = pConfig.footer) !== null && _pConfig_footer !== void 0 ? _pConfig_footer : defaultConfig.footer,
|
package/dist/constants/build.js
CHANGED
|
@@ -15,6 +15,7 @@ export * from './copy';
|
|
|
15
15
|
export type HookList = {
|
|
16
16
|
name: string;
|
|
17
17
|
apply: (compiler: ICompiler) => void;
|
|
18
|
+
applyAfterBuiltIn?: boolean;
|
|
18
19
|
}[];
|
|
19
20
|
export type EsbuildOptions = (options: BuildOptions) => BuildOptions;
|
|
20
21
|
export type BuildType = 'bundleless' | 'bundle';
|
|
@@ -109,6 +110,10 @@ export type BaseBuildConfig = Omit<Required<PartialBaseBuildConfig>, 'dts' | 'st
|
|
|
109
110
|
resolve: ResolveOptions;
|
|
110
111
|
};
|
|
111
112
|
export type PartialBaseBuildConfig = {
|
|
113
|
+
/**
|
|
114
|
+
* @experimental
|
|
115
|
+
*/
|
|
116
|
+
loader?: Record<string, string>;
|
|
112
117
|
shims?: boolean;
|
|
113
118
|
autoExtension?: boolean;
|
|
114
119
|
resolve?: Resolve;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/module-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.58.0",
|
|
4
4
|
"description": "Simple, powerful, high-performance modern npm package development solution.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"modern",
|
|
@@ -70,22 +70,22 @@
|
|
|
70
70
|
"tapable": "2.2.1",
|
|
71
71
|
"terser": "^5.31.1",
|
|
72
72
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
73
|
-
"@modern-js/core": "2.
|
|
74
|
-
"@modern-js/plugin": "2.
|
|
75
|
-
"@modern-js/plugin-changeset": "2.
|
|
76
|
-
"@modern-js/plugin-
|
|
77
|
-
"@modern-js/plugin-
|
|
78
|
-
"@modern-js/types": "2.
|
|
79
|
-
"@modern-js/utils": "2.
|
|
73
|
+
"@modern-js/core": "2.58.0",
|
|
74
|
+
"@modern-js/plugin": "2.58.0",
|
|
75
|
+
"@modern-js/plugin-changeset": "2.58.0",
|
|
76
|
+
"@modern-js/plugin-lint": "2.58.0",
|
|
77
|
+
"@modern-js/plugin-i18n": "2.58.0",
|
|
78
|
+
"@modern-js/types": "2.58.0",
|
|
79
|
+
"@modern-js/utils": "2.58.0"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@rsbuild/core": "1.0.1-beta.
|
|
82
|
+
"@rsbuild/core": "1.0.1-beta.9",
|
|
83
83
|
"@types/convert-source-map": "1.5.2",
|
|
84
84
|
"@types/node": "^14",
|
|
85
85
|
"typescript": "^5",
|
|
86
|
-
"@modern-js/self": "npm:@modern-js/module-tools@2.
|
|
87
|
-
"@scripts/build": "2.
|
|
88
|
-
"@scripts/vitest-config": "2.
|
|
86
|
+
"@modern-js/self": "npm:@modern-js/module-tools@2.58.0",
|
|
87
|
+
"@scripts/build": "2.58.0",
|
|
88
|
+
"@scripts/vitest-config": "2.58.0"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"typescript": "^4 || ^5"
|