@modern-js/module-tools 2.41.0 → 2.42.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/dist/build.d.ts +1 -1
- package/dist/builder/build.d.ts +7 -7
- package/dist/builder/build.js +3 -1
- package/dist/builder/clear.d.ts +1 -2
- package/dist/builder/clear.js +2 -8
- package/dist/builder/copy.d.ts +9 -9
- package/dist/builder/dts/index.d.ts +1 -1
- package/dist/builder/dts/rollup.d.ts +1 -13
- package/dist/builder/dts/tsc.d.ts +1 -1
- package/dist/builder/dts/tsc.js +38 -17
- package/dist/builder/esbuild/adapter.d.ts +1 -1
- package/dist/builder/esbuild/hook.d.ts +1 -1
- package/dist/builder/esbuild/index.d.ts +28 -28
- package/dist/builder/esbuild/resolve.d.ts +9 -9
- package/dist/builder/esbuild/sourcemap.d.ts +14 -14
- package/dist/builder/esbuild/transform.d.ts +4 -4
- package/dist/builder/esbuild/watch.d.ts +1 -1
- package/dist/builder/esbuild/write-file.d.ts +1 -1
- package/dist/builder/feature/asset.d.ts +5 -5
- package/dist/builder/feature/format-cjs.d.ts +3 -3
- package/dist/builder/feature/index.d.ts +1 -1
- package/dist/builder/feature/json.d.ts +3 -3
- package/dist/builder/feature/redirect.d.ts +3 -3
- package/dist/builder/feature/style/index.d.ts +3 -3
- package/dist/builder/feature/style/lessAliasPlugin.d.ts +7 -7
- package/dist/builder/feature/style/lessRender.d.ts +1 -1
- package/dist/builder/feature/style/postcssTransformer.d.ts +3 -3
- package/dist/builder/feature/style/postcssUrlPlugin.d.ts +3 -3
- package/dist/builder/feature/style/sassRender.d.ts +1 -1
- package/dist/builder/feature/style/transformStyle.d.ts +7 -7
- package/dist/builder/feature/style/utils.d.ts +3 -3
- package/dist/builder/feature/swc.d.ts +5 -5
- package/dist/builder/feature/terser.d.ts +3 -3
- package/dist/builder/index.d.ts +4 -4
- package/dist/builder/index.js +0 -1
- package/dist/builder/platform.d.ts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/command.d.ts +1 -1
- package/dist/config/defineConfig.d.ts +1 -1
- package/dist/config/merge.d.ts +4 -4
- package/dist/config/normalize.d.ts +3 -3
- package/dist/config/transformLegacyConfig.d.ts +1 -1
- package/dist/config/valid.d.ts +1 -1
- package/dist/constants/build.d.ts +1 -1
- package/dist/constants/color.d.ts +1 -1
- package/dist/constants/dts.d.ts +0 -1
- package/dist/constants/dts.js +0 -3
- package/dist/constants/file.d.ts +1 -1
- package/dist/constants/legacy-preset.d.ts +11 -11
- package/dist/constants/loader.d.ts +1 -1
- package/dist/constants/log.d.ts +1 -1
- package/dist/constants/preset.d.ts +5 -5
- package/dist/debug.d.ts +1 -1
- package/dist/dev.d.ts +1 -1
- package/dist/error.d.ts +19 -19
- package/dist/hooks/build.d.ts +16 -16
- package/dist/hooks/dev.d.ts +11 -11
- package/dist/hooks/index.d.ts +29 -29
- package/dist/hooks/misc.d.ts +11 -11
- package/dist/index.d.ts +1 -1
- package/dist/locale/en.d.ts +40 -40
- package/dist/locale/index.d.ts +79 -79
- package/dist/locale/zh.d.ts +40 -40
- package/dist/plugins.d.ts +1 -1
- package/dist/types/color.d.ts +1 -1
- package/dist/types/command.d.ts +9 -9
- package/dist/types/config/copy.d.ts +10 -10
- package/dist/types/config/dev.d.ts +4 -4
- package/dist/types/config/index.d.ts +106 -106
- package/dist/types/config/style.d.ts +37 -37
- package/dist/types/context.d.ts +4 -4
- package/dist/types/dts.d.ts +39 -38
- package/dist/types/esbuild.d.ts +77 -77
- package/dist/types/hooks.d.ts +14 -14
- package/dist/types/index.d.ts +7 -7
- package/dist/types/legacyConfig/index.d.ts +8 -8
- package/dist/types/legacyConfig/output.d.ts +44 -44
- package/dist/types/legacyConfig/source.d.ts +10 -10
- package/dist/types/legacyConfig/tools.d.ts +39 -39
- package/dist/utils/assert.d.ts +1 -1
- package/dist/utils/builder.d.ts +9 -9
- package/dist/utils/common.d.ts +1 -1
- package/dist/utils/dts.d.ts +4 -34
- package/dist/utils/dts.js +71 -93
- package/dist/utils/hash.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.js +0 -2
- package/dist/utils/input.d.ts +5 -8
- package/dist/utils/log.d.ts +1 -1
- package/dist/utils/map.d.ts +5 -5
- package/dist/utils/onExit.d.ts +1 -1
- package/dist/utils/outExtension.d.ts +6 -6
- package/dist/utils/print.d.ts +3 -3
- package/dist/utils/style.d.ts +7 -7
- package/package.json +14 -20
- package/dist/utils/tspath.d.ts +0 -15
- package/dist/utils/tspath.js +0 -114
package/dist/build.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import type { ModuleTools, ModuleContext, BuildCommandOptions } from './types';
|
|
3
|
-
export declare const build: (api: PluginAPI<ModuleTools>, options: BuildCommandOptions, context: ModuleContext) => Promise<void>;
|
|
3
|
+
export declare const build: (api: PluginAPI<ModuleTools>, options: BuildCommandOptions, context: ModuleContext) => Promise<void>;
|
package/dist/builder/build.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { BuildCommandOptions, BaseBuildConfig, ModuleTools, PluginAPI, DTSOptions, ModuleContext } from '../types';
|
|
2
2
|
export declare const runBuildTask: (options: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
buildConfig: BaseBuildConfig;
|
|
4
|
+
buildCmdOptions: BuildCommandOptions;
|
|
5
|
+
context: ModuleContext;
|
|
6
6
|
}, api: PluginAPI<ModuleTools>) => Promise<void>;
|
|
7
7
|
export declare const generatorDts: (config: BaseBuildConfig, api: PluginAPI<ModuleTools>, options: {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
watch: boolean;
|
|
9
|
+
dts: DTSOptions;
|
|
10
10
|
}) => Promise<void>;
|
|
11
11
|
export declare const buildLib: (config: BaseBuildConfig, api: PluginAPI<ModuleTools>, options: {
|
|
12
|
-
|
|
13
|
-
}) => Promise<void>;
|
|
12
|
+
watch: boolean;
|
|
13
|
+
}) => Promise<void>;
|
package/dist/builder/build.js
CHANGED
|
@@ -84,6 +84,7 @@ const generatorDts = async (config, api, options) => {
|
|
|
84
84
|
root: appDirectory,
|
|
85
85
|
autoExtension
|
|
86
86
|
});
|
|
87
|
+
const userTsconfig = await (0, import_utils2.getProjectTsconfig)(tsconfigPath);
|
|
87
88
|
const generatorDtsConfig = {
|
|
88
89
|
distPath,
|
|
89
90
|
watch,
|
|
@@ -97,7 +98,8 @@ const generatorDts = async (config, api, options) => {
|
|
|
97
98
|
banner,
|
|
98
99
|
alias,
|
|
99
100
|
sourceDir,
|
|
100
|
-
dtsExtension
|
|
101
|
+
dtsExtension,
|
|
102
|
+
userTsconfig
|
|
101
103
|
};
|
|
102
104
|
const prevTime = Date.now();
|
|
103
105
|
(0, import_debug.debug)(`${(0, import_debug.label)("dts")} Build Start`);
|
package/dist/builder/clear.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import type { BaseBuildConfig } from '../types';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const clearBuildConfigPaths: (configs: BaseBuildConfig[], projectAbsRootPath: string) => Promise<void>;
|
|
2
|
+
export declare const clearBuildConfigPaths: (configs: BaseBuildConfig[], projectAbsRootPath: string) => Promise<void>;
|
package/dist/builder/clear.js
CHANGED
|
@@ -18,16 +18,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var clear_exports = {};
|
|
20
20
|
__export(clear_exports, {
|
|
21
|
-
clearBuildConfigPaths: () => clearBuildConfigPaths
|
|
22
|
-
clearDtsTemp: () => clearDtsTemp
|
|
21
|
+
clearBuildConfigPaths: () => clearBuildConfigPaths
|
|
23
22
|
});
|
|
24
23
|
module.exports = __toCommonJS(clear_exports);
|
|
25
24
|
var import_utils = require("@modern-js/utils");
|
|
26
25
|
var import_locale = require("../locale");
|
|
27
|
-
var import_dts = require("../constants/dts");
|
|
28
|
-
const clearDtsTemp = async () => {
|
|
29
|
-
await import_utils.fs.remove(import_dts.dtsTempDirectory);
|
|
30
|
-
};
|
|
31
26
|
const clearBuildConfigPaths = async (configs, projectAbsRootPath) => {
|
|
32
27
|
for (const config of configs) {
|
|
33
28
|
if (projectAbsRootPath === config.outDir) {
|
|
@@ -39,6 +34,5 @@ const clearBuildConfigPaths = async (configs, projectAbsRootPath) => {
|
|
|
39
34
|
};
|
|
40
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
36
|
0 && (module.exports = {
|
|
42
|
-
clearBuildConfigPaths
|
|
43
|
-
clearDtsTemp
|
|
37
|
+
clearBuildConfigPaths
|
|
44
38
|
});
|
package/dist/builder/copy.d.ts
CHANGED
|
@@ -2,16 +2,16 @@ import { watch } from '@modern-js/utils';
|
|
|
2
2
|
import type { CopyOptions, CopyPattern } from '../types/config/copy';
|
|
3
3
|
import type { BaseBuildConfig } from '../types/config';
|
|
4
4
|
export declare const runPatterns: (pattern: CopyPattern, options: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
appDirectory: string;
|
|
6
|
+
enableCopySync?: boolean;
|
|
7
|
+
outDir: string;
|
|
8
|
+
defaultContext: string;
|
|
9
|
+
watch?: boolean;
|
|
10
10
|
}) => Promise<void>;
|
|
11
11
|
export declare const watchCopyFiles: (options: {
|
|
12
|
-
|
|
12
|
+
appDirectory: string;
|
|
13
13
|
}, copyConfig: CopyOptions) => Promise<void>;
|
|
14
14
|
export declare const copyTask: (buildConfig: BaseBuildConfig, options: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}) => Promise<void>;
|
|
15
|
+
appDirectory: string;
|
|
16
|
+
watch?: boolean;
|
|
17
|
+
}) => Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { runRollup } from './rollup';
|
|
2
|
-
export { runTsc } from './tsc';
|
|
2
|
+
export { runTsc } from './tsc';
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import type { RollupWatcher } from '../../../compiled/rollup';
|
|
2
2
|
import type { GeneratorDtsConfig, PluginAPI, ModuleTools } from '../../types';
|
|
3
3
|
export type { RollupWatcher };
|
|
4
|
-
export declare const runRollup: (api: PluginAPI<ModuleTools>, {
|
|
5
|
-
distPath,
|
|
6
|
-
tsconfigPath,
|
|
7
|
-
externals,
|
|
8
|
-
input,
|
|
9
|
-
watch,
|
|
10
|
-
abortOnError,
|
|
11
|
-
respectExternal,
|
|
12
|
-
appDirectory,
|
|
13
|
-
footer,
|
|
14
|
-
banner,
|
|
15
|
-
dtsExtension
|
|
16
|
-
}: GeneratorDtsConfig) => Promise<RollupWatcher | import("../../../compiled/rollup").RollupBuild | null>;
|
|
4
|
+
export declare const runRollup: (api: PluginAPI<ModuleTools>, { distPath, tsconfigPath, externals, input, watch, abortOnError, respectExternal, appDirectory, footer, banner, dtsExtension, }: GeneratorDtsConfig) => Promise<RollupWatcher | import("../../../compiled/rollup").RollupBuild | null>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { GeneratorDtsConfig, PluginAPI, ModuleTools } from '../../types';
|
|
2
2
|
export declare const removeTscLogTime: (log: string) => string;
|
|
3
|
-
export declare const runTsc: (api: PluginAPI<ModuleTools>, config: GeneratorDtsConfig) => Promise<void>;
|
|
3
|
+
export declare const runTsc: (api: PluginAPI<ModuleTools>, config: GeneratorDtsConfig) => Promise<void>;
|
package/dist/builder/dts/tsc.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var tsc_exports = {};
|
|
20
30
|
__export(tsc_exports, {
|
|
@@ -22,6 +32,7 @@ __export(tsc_exports, {
|
|
|
22
32
|
runTsc: () => runTsc
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(tsc_exports);
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
25
36
|
var import_utils = require("@modern-js/utils");
|
|
26
37
|
var import_utils2 = require("../../utils");
|
|
27
38
|
var import_dts = require("../../constants/dts");
|
|
@@ -45,21 +56,36 @@ const resolveLog = async (childProgress, options) => {
|
|
|
45
56
|
import_utils.logger.error(chunk.toString());
|
|
46
57
|
});
|
|
47
58
|
};
|
|
48
|
-
const runTscBin = async (api, config
|
|
49
|
-
const { appDirectory, watch = false, abortOnError = true } = config;
|
|
50
|
-
const { tempTsconfigPath } = info;
|
|
59
|
+
const runTscBin = async (api, config) => {
|
|
60
|
+
const { appDirectory, watch = false, abortOnError = true, tsconfigPath, userTsconfig, distPath } = config;
|
|
51
61
|
const tscBinFile = await (0, import_utils2.getTscBinPath)(appDirectory);
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
const params = [];
|
|
63
|
+
if (userTsconfig.references) {
|
|
64
|
+
var _userTsconfig;
|
|
65
|
+
params.push("-b", tsconfigPath);
|
|
66
|
+
var _compilerOptions;
|
|
67
|
+
(_compilerOptions = (_userTsconfig = userTsconfig).compilerOptions) !== null && _compilerOptions !== void 0 ? _compilerOptions : _userTsconfig.compilerOptions = {};
|
|
68
|
+
const { baseUrl = ".", outDir = "dist" } = userTsconfig.compilerOptions;
|
|
69
|
+
const abosultBaseUrl = import_path.default.isAbsolute(baseUrl) ? baseUrl : import_path.default.join(import_path.default.dirname(tsconfigPath), baseUrl);
|
|
70
|
+
if (import_path.default.resolve(abosultBaseUrl, outDir) !== distPath) {
|
|
71
|
+
userTsconfig.compilerOptions.outDir = import_path.default.relative(abosultBaseUrl, distPath);
|
|
72
|
+
import_utils.fs.writeFileSync(tsconfigPath, JSON.stringify(userTsconfig, null, 2));
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
params.push("-p", tsconfigPath, "--outDir", distPath);
|
|
76
|
+
}
|
|
77
|
+
if (watch) {
|
|
78
|
+
params.push("-w");
|
|
79
|
+
}
|
|
55
80
|
const childProgress = (0, import_utils.execa)(tscBinFile, [
|
|
56
|
-
|
|
57
|
-
tempTsconfigPath,
|
|
81
|
+
...params,
|
|
58
82
|
/* Required parameter, use it stdout have color */
|
|
59
83
|
"--pretty",
|
|
60
84
|
// https://github.com/microsoft/TypeScript/issues/21824
|
|
61
85
|
"--preserveWatchOutput",
|
|
62
|
-
|
|
86
|
+
// Only emit d.ts files
|
|
87
|
+
"--declaration",
|
|
88
|
+
"--emitDeclarationOnly"
|
|
63
89
|
], {
|
|
64
90
|
stdio: "pipe",
|
|
65
91
|
cwd: appDirectory
|
|
@@ -68,9 +94,7 @@ const runTscBin = async (api, config, info) => {
|
|
|
68
94
|
resolveLog(childProgress, {
|
|
69
95
|
watch,
|
|
70
96
|
watchFn: async () => {
|
|
71
|
-
|
|
72
|
-
const dtsFiles = (0, import_utils2.addBannerAndFooter)(result, config.banner, config.footer);
|
|
73
|
-
await (0, import_utils2.writeDtsFiles)(config, info, dtsFiles);
|
|
97
|
+
await (0, import_utils2.processDtsFilesAfterTsc)(config);
|
|
74
98
|
runner.buildWatchDts({
|
|
75
99
|
buildType: "bundleless"
|
|
76
100
|
});
|
|
@@ -86,11 +110,8 @@ const runTscBin = async (api, config, info) => {
|
|
|
86
110
|
}
|
|
87
111
|
};
|
|
88
112
|
const runTsc = async (api, config) => {
|
|
89
|
-
|
|
90
|
-
await
|
|
91
|
-
const result = await (0, import_utils2.resolveAlias)(config, generatedDtsInfo);
|
|
92
|
-
const dtsFiles = (0, import_utils2.addBannerAndFooter)(result, config.banner, config.footer);
|
|
93
|
-
await (0, import_utils2.writeDtsFiles)(config, generatedDtsInfo, dtsFiles);
|
|
113
|
+
await runTscBin(api, config);
|
|
114
|
+
await (0, import_utils2.processDtsFilesAfterTsc)(config);
|
|
94
115
|
await (0, import_utils2.addDtsFiles)(config.distPath, config.appDirectory);
|
|
95
116
|
};
|
|
96
117
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as tapable from 'tapable';
|
|
2
2
|
import { Source, Chunk, ICompiler } from '../../types';
|
|
3
3
|
export declare function createTransformHook(compiler: ICompiler): tapable.AsyncSeriesWaterfallHook<Source, tapable.UnsetAdditionalOptions>;
|
|
4
|
-
export declare function createRenderChunkHook(compiler: ICompiler): tapable.AsyncSeriesWaterfallHook<Chunk, tapable.UnsetAdditionalOptions>;
|
|
4
|
+
export declare function createRenderChunkHook(compiler: ICompiler): tapable.AsyncSeriesWaterfallHook<Chunk, tapable.UnsetAdditionalOptions>;
|
|
@@ -4,32 +4,32 @@ import { BaseBuildConfig, BuilderHooks, Chunk, ICompiler, ModuleTools, PluginAPI
|
|
|
4
4
|
import { TransformContext } from './transform';
|
|
5
5
|
import { SourcemapContext } from './sourcemap';
|
|
6
6
|
export declare class EsbuildCompiler implements ICompiler {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
7
|
+
instance?: BuildContext;
|
|
8
|
+
result?: BuildResult;
|
|
9
|
+
hookList?: HookList;
|
|
10
|
+
reBuildCount: number;
|
|
11
|
+
buildOptions: BuildOptions;
|
|
12
|
+
context: Context;
|
|
13
|
+
config: BaseBuildConfig;
|
|
14
|
+
hooks: BuilderHooks;
|
|
15
|
+
api: PluginAPI<ModuleTools>;
|
|
16
|
+
outputChunk: Map<string, Chunk>;
|
|
17
|
+
watchedFiles: Set<string>;
|
|
18
|
+
css_resolve: (id: string, dir: string) => string;
|
|
19
|
+
node_resolve: (id: string, dir: string, kind: ImportKind) => string | false;
|
|
20
|
+
watcher?: FSWatcher;
|
|
21
|
+
virtualModule: Map<string, string>;
|
|
22
|
+
private transformContextMap;
|
|
23
|
+
private sourcemapContextMap;
|
|
24
|
+
constructor(context: Context);
|
|
25
|
+
init(): Promise<void>;
|
|
26
|
+
addWatchFile(id: string): void;
|
|
27
|
+
convertConfigToEsbuild(config: BaseBuildConfig): BuildOptions;
|
|
28
|
+
getTransformContext(path: string): TransformContext;
|
|
29
|
+
getSourcemapContext(path: string): SourcemapContext;
|
|
30
|
+
emitAsset(name: string, chunk: string | Chunk): void;
|
|
31
|
+
close(): Promise<void>;
|
|
32
|
+
build(): Promise<void>;
|
|
33
|
+
reBuild(type: 'link' | 'change', config: BaseBuildConfig): Promise<void>;
|
|
34
34
|
}
|
|
35
|
-
export declare const createCompiler: (context: Context) => Promise<EsbuildCompiler>;
|
|
35
|
+
export declare const createCompiler: (context: Context) => Promise<EsbuildCompiler>;
|
|
@@ -6,13 +6,13 @@ export declare const cssExtensions: string[];
|
|
|
6
6
|
export declare const createJsResolver: (options: ResolverOptions) => (id: string, dir: string, kind?: ImportKind) => string | false;
|
|
7
7
|
export declare const createCssResolver: (options: ResolverOptions) => (id: string, dir: string, kind?: ImportKind) => string;
|
|
8
8
|
interface ResolverOptions {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
platform: Platform;
|
|
10
|
+
resolveType: 'js' | 'css';
|
|
11
|
+
extensions: string[];
|
|
12
|
+
root: string;
|
|
13
|
+
alias: Record<string, string>;
|
|
14
|
+
tsconfig: string;
|
|
15
|
+
mainFields: string[];
|
|
16
|
+
preferRelative?: boolean;
|
|
17
17
|
}
|
|
18
|
-
export {};
|
|
18
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { SourceMap, ISourcemapContext } from '../../types';
|
|
2
2
|
export declare class SourcemapContext implements ISourcemapContext {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
3
|
+
private enableSourceMap?;
|
|
4
|
+
private sourceMapChain;
|
|
5
|
+
private sourceMapDirty;
|
|
6
|
+
private cachedInlineSourceMap;
|
|
7
|
+
private cachedSourceMap;
|
|
8
|
+
private pluginIdMap;
|
|
9
|
+
constructor(enableSourceMap?: boolean | undefined);
|
|
10
|
+
private markSourceMapStatus;
|
|
11
|
+
addSourceMap(pluginId: number, map?: SourceMap): void;
|
|
12
|
+
getInlineSourceMap(): string;
|
|
13
|
+
getSourceMap(): SourceMap | undefined;
|
|
14
|
+
getSourceMapChain(): SourceMap[];
|
|
15
|
+
genPluginId(name: string): number;
|
|
16
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ITransformContext, CacheValue } from '../../types';
|
|
2
2
|
import { SourcemapContext } from './sourcemap';
|
|
3
3
|
export declare class TransformContext extends SourcemapContext implements ITransformContext {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
private cachedTransformResult;
|
|
5
|
+
addTransformResult(pluginId: number, result: CacheValue): void;
|
|
6
|
+
getValidCache(pluginId: number, code: string): CacheValue | undefined;
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ICompiler } from '../../types';
|
|
2
|
-
export declare const initWatcher: (compiler: ICompiler) => void;
|
|
2
|
+
export declare const initWatcher: (compiler: ICompiler) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ICompiler } from '../../types';
|
|
2
|
-
export declare const writeFile: (compiler: ICompiler) => Promise<void>;
|
|
2
|
+
export declare const writeFile: (compiler: ICompiler) => Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ICompiler, LoadResult, SvgrOptions } from '../../types';
|
|
3
3
|
export declare const asset: {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
name: string;
|
|
5
|
+
apply(compiler: ICompiler): void;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -13,7 +13,7 @@ export declare const asset: {
|
|
|
13
13
|
* @returns dataurl or path
|
|
14
14
|
*/
|
|
15
15
|
export declare function getAssetContents(this: ICompiler, assetPath: string, rebaseFrom: string, calledOnLoad?: boolean): Promise<{
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
contents: string | Buffer;
|
|
17
|
+
loader: "copy" | "text";
|
|
18
18
|
}>;
|
|
19
|
-
export declare function loadSvgr(path: string, options: boolean | SvgrOptions): Promise<LoadResult | undefined>;
|
|
19
|
+
export declare function loadSvgr(path: string, options: boolean | SvgrOptions): Promise<LoadResult | undefined>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { HookList, Context } from '../../types';
|
|
2
|
-
export declare function getInternalList(context: Context): Promise<HookList>;
|
|
2
|
+
export declare function getInternalList(context: Context): Promise<HookList>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ICompiler } from '../../../types';
|
|
2
2
|
interface Options {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
compiler: ICompiler;
|
|
4
|
+
stdinDir: string;
|
|
5
5
|
}
|
|
6
6
|
export default class LessAliasesPlugin {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
compiler: ICompiler;
|
|
8
|
+
stdinDir: string;
|
|
9
|
+
constructor(options: Options);
|
|
10
|
+
install(less: any, pluginManager: any): void;
|
|
11
11
|
}
|
|
12
|
-
export {};
|
|
12
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PreprocessRender } from './transformStyle';
|
|
2
|
-
export declare const lessRender: PreprocessRender;
|
|
2
|
+
export declare const lessRender: PreprocessRender;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ICompiler } from '../../../types';
|
|
2
2
|
export declare const isCssModule: (filePath: string, autoModules: boolean | RegExp) => boolean;
|
|
3
3
|
export declare const postcssTransformer: (css: string, entryPath: string, compilation: ICompiler) => Promise<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}>;
|
|
4
|
+
code: string;
|
|
5
|
+
loader: 'js' | 'css';
|
|
6
|
+
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PreprocessRender } from './transformStyle';
|
|
2
|
-
export declare const sassRender: PreprocessRender;
|
|
2
|
+
export declare const sassRender: PreprocessRender;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { PartialMessage } from 'esbuild';
|
|
3
3
|
import { ICompiler, Source } from '../../../types';
|
|
4
4
|
export type PreprocessRender = (content: string, stdinPath: string, stdinDir: string, preprocessOptions: any, resolvePathMap: Map<string, string>, implementation?: object | string) => Promise<{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
css: Buffer | string;
|
|
6
|
+
errors?: PartialMessage[];
|
|
7
|
+
warnings?: PartialMessage[];
|
|
8
|
+
map?: Buffer | string;
|
|
9
9
|
}>;
|
|
10
10
|
export declare function transformStyle(this: ICompiler, source: Source): Promise<{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}>;
|
|
11
|
+
code: string;
|
|
12
|
+
loader: "js" | "css";
|
|
13
|
+
}>;
|
|
@@ -11,8 +11,8 @@ type CssUrlReplacer = (url: string, importer?: string) => string | Promise<strin
|
|
|
11
11
|
* root file as base.
|
|
12
12
|
*/
|
|
13
13
|
export declare function rebaseUrls(filepath: string, rootDir: string, resolver: (id: string, dir: string) => string): Promise<{
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
file: string;
|
|
15
|
+
contents?: string;
|
|
16
16
|
}>;
|
|
17
17
|
export declare function rewriteCssUrls(css: string, type: false | string, replacer: CssUrlReplacer): Promise<string>;
|
|
18
|
-
export {};
|
|
18
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ICompiler, ITsconfig } from '../../types';
|
|
2
2
|
export declare const swcTransform: (userTsconfig: ITsconfig) => {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
name: string;
|
|
4
|
+
apply(compiler: ICompiler): void;
|
|
5
5
|
};
|
|
6
6
|
export declare const swcRenderChunk: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
7
|
+
name: string;
|
|
8
|
+
apply(compiler: ICompiler): void;
|
|
9
|
+
};
|
package/dist/builder/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { PluginAPI } from '@modern-js/core';
|
|
|
2
2
|
import type { ModuleContext } from '../types/context';
|
|
3
3
|
import type { BuildCommandOptions, BaseBuildConfig, ModuleTools } from '../types';
|
|
4
4
|
export declare const run: (options: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}, api: PluginAPI<ModuleTools>) => Promise<void>;
|
|
5
|
+
cmdOptions: BuildCommandOptions;
|
|
6
|
+
normalizedBuildConfig: BaseBuildConfig[];
|
|
7
|
+
context: ModuleContext;
|
|
8
|
+
}, api: PluginAPI<ModuleTools>) => Promise<void>;
|
package/dist/builder/index.js
CHANGED
|
@@ -49,7 +49,6 @@ const run = async (options, api) => {
|
|
|
49
49
|
await (0, import_clear.clearBuildConfigPaths)(normalizedBuildConfig, context.appDirectory);
|
|
50
50
|
(0, import_debug.debug)("clear output paths done");
|
|
51
51
|
}
|
|
52
|
-
await (0, import_clear.clearDtsTemp)();
|
|
53
52
|
if (watch) {
|
|
54
53
|
import_utils.logger.info("Start build in watch mode...");
|
|
55
54
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import { ModuleContext } from '../types/context';
|
|
3
3
|
import { BuildCommandOptions, ModuleTools } from '../types';
|
|
4
|
-
export declare const buildPlatform: (options: BuildCommandOptions, api: PluginAPI<ModuleTools>, context: ModuleContext) => Promise<void>;
|
|
4
|
+
export declare const buildPlatform: (options: BuildCommandOptions, api: PluginAPI<ModuleTools>, context: ModuleContext) => Promise<void>;
|
package/dist/cli.d.ts
CHANGED
package/dist/command.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ import type { ModuleTools } from './types';
|
|
|
4
4
|
export declare const buildCommand: (program: Command, api: PluginAPI<ModuleTools>) => Promise<void>;
|
|
5
5
|
export declare const devCommand: (program: Command, api: PluginAPI<ModuleTools>) => Promise<void>;
|
|
6
6
|
export declare const newCommand: (program: Command) => Promise<void>;
|
|
7
|
-
export declare const upgradeCommand: (program: Command) => Promise<void>;
|
|
7
|
+
export declare const upgradeCommand: (program: Command) => Promise<void>;
|
|
@@ -5,4 +5,4 @@ export declare const defineConfig: (config: UserConfigExport<ModuleConfigParams>
|
|
|
5
5
|
* @deprecated
|
|
6
6
|
* Using defineConfig first.
|
|
7
7
|
*/
|
|
8
|
-
export declare const defineLegacyConfig: (config: ModuleLegacyUserConfig) => ModuleLegacyUserConfig;
|
|
8
|
+
export declare const defineLegacyConfig: (config: ModuleLegacyUserConfig) => ModuleLegacyUserConfig;
|