@modern-js/module-tools 2.41.0 → 2.42.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.
- 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 +20 -15
- 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/types/esbuild.d.ts
CHANGED
|
@@ -5,103 +5,103 @@ import { FSWatcher } from '@modern-js/utils';
|
|
|
5
5
|
import { BaseBuildConfig } from './config';
|
|
6
6
|
import { ModuleTools, PluginAPI } from '.';
|
|
7
7
|
export interface SourceMap {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
mappings: string;
|
|
9
|
+
names: string[];
|
|
10
|
+
sources: (string | null)[];
|
|
11
|
+
version: number;
|
|
12
|
+
sourcesContent?: (string | null)[];
|
|
13
13
|
}
|
|
14
14
|
export type LoadResult = Pick<OnLoadResult, 'contents' | 'loader' | 'resolveDir'> & {
|
|
15
|
-
|
|
15
|
+
map?: SourceMap;
|
|
16
16
|
};
|
|
17
17
|
export interface BuilderHooks {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Equal to esbuild#onLoad
|
|
20
|
+
*/
|
|
21
|
+
load: AsyncSeriesBailHook<[OnLoadArgs], LoadResult | undefined | void>;
|
|
22
|
+
/**
|
|
23
|
+
* Transform code after it is loaded.
|
|
24
|
+
*/
|
|
25
|
+
transform: AsyncSeriesWaterfallHook<Source>;
|
|
26
|
+
/**
|
|
27
|
+
* Modify the chunk
|
|
28
|
+
*/
|
|
29
|
+
renderChunk: AsyncSeriesWaterfallHook<[Chunk]>;
|
|
30
30
|
}
|
|
31
31
|
export type Context = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
config: BaseBuildConfig;
|
|
33
|
+
watch: boolean;
|
|
34
|
+
root: string;
|
|
35
|
+
api: PluginAPI<ModuleTools>;
|
|
36
36
|
};
|
|
37
37
|
export interface ICompiler {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
38
|
+
reBuild: (type: 'link' | 'change', config: BaseBuildConfig) => Promise<void>;
|
|
39
|
+
css_resolve: (id: string, dir: string) => string;
|
|
40
|
+
node_resolve: (id: string, dir: string, kind: ImportKind) => string | false;
|
|
41
|
+
init: () => Promise<void>;
|
|
42
|
+
watcher?: FSWatcher;
|
|
43
|
+
instance?: BuildContext;
|
|
44
|
+
result?: BuildResult;
|
|
45
|
+
reBuildCount: number;
|
|
46
|
+
buildOptions: BuildOptions;
|
|
47
|
+
context: Context;
|
|
48
|
+
config: BaseBuildConfig;
|
|
49
|
+
hooks: BuilderHooks;
|
|
50
|
+
api: PluginAPI<ModuleTools>;
|
|
51
|
+
outputChunk: Map<string, Chunk>;
|
|
52
|
+
virtualModule: Map<string, string>;
|
|
53
|
+
build: (() => Promise<void>) & (() => Promise<void>);
|
|
54
|
+
emitAsset: ((name: string, chunk: AssetChunk) => void) & ((name: string, chunk: JsChunk) => void) & ((name: string, chunk: string) => void);
|
|
55
|
+
watchedFiles: Set<string>;
|
|
56
|
+
addWatchFile: (id: string) => void;
|
|
57
|
+
getTransformContext: (path: string) => ITransformContext;
|
|
58
|
+
getSourcemapContext: (path: string) => ISourcemapContext;
|
|
59
|
+
close: () => Promise<void>;
|
|
60
60
|
}
|
|
61
61
|
export interface ISourcemapContext {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
addSourceMap: (pluginId: number, map?: SourceMap) => void;
|
|
63
|
+
getInlineSourceMap: () => string;
|
|
64
|
+
getSourceMap: () => SourceMap | undefined;
|
|
65
|
+
getSourceMapChain: () => SourceMap[];
|
|
66
|
+
genPluginId: (id: string) => number;
|
|
67
67
|
}
|
|
68
68
|
export interface ITransformContext extends ISourcemapContext {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
addTransformResult: (pluginId: number, result: CacheValue) => void;
|
|
70
|
+
getValidCache: (pluginId: number, code: string) => undefined | CacheValue;
|
|
71
71
|
}
|
|
72
72
|
export type Source = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
code: string;
|
|
74
|
+
map?: SourceMap;
|
|
75
|
+
path: string;
|
|
76
|
+
loader?: string;
|
|
77
77
|
};
|
|
78
78
|
export interface CacheValue extends Source {
|
|
79
|
-
|
|
79
|
+
originCode: string;
|
|
80
80
|
}
|
|
81
81
|
export type AssetChunk = {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
type: 'asset';
|
|
83
|
+
contents: string | Buffer;
|
|
84
|
+
entryPoint?: string;
|
|
85
|
+
/**
|
|
86
|
+
* absolute file path
|
|
87
|
+
*/
|
|
88
|
+
fileName: string;
|
|
89
|
+
originalFileName?: string;
|
|
90
90
|
};
|
|
91
91
|
export type JsChunk = {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
type: 'chunk';
|
|
93
|
+
contents: string;
|
|
94
|
+
entryPoint?: string;
|
|
95
|
+
/**
|
|
96
|
+
* absolute file path
|
|
97
|
+
*/
|
|
98
|
+
fileName: string;
|
|
99
|
+
map?: SourceMap;
|
|
100
|
+
modules?: Record<string, any>;
|
|
101
|
+
originalFileName?: string;
|
|
102
102
|
};
|
|
103
103
|
export type Chunk = AssetChunk | JsChunk;
|
|
104
104
|
export declare const enum ChunkType {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
105
|
+
chunk = "chunk",
|
|
106
|
+
asset = "asset"
|
|
107
|
+
}
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -3,29 +3,29 @@ import { registerHook } from '../hooks';
|
|
|
3
3
|
import type { BaseBuildConfig, BuildConfig, BuildType } from './config';
|
|
4
4
|
import type { DevCommandOptions, BuildCommandOptions } from './command';
|
|
5
5
|
export interface BuildTaskResult {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
status: 'success' | 'fail';
|
|
7
|
+
message?: string;
|
|
8
|
+
config: BaseBuildConfig;
|
|
9
9
|
}
|
|
10
10
|
export interface BuildResult {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
status: 'success' | 'fail';
|
|
12
|
+
message?: string;
|
|
13
|
+
config: BuildConfig;
|
|
14
|
+
commandOptions: BuildCommandOptions;
|
|
15
|
+
totalDuration: number;
|
|
16
16
|
}
|
|
17
17
|
export interface BuildPlatformResult {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
status: 'success' | 'fail';
|
|
19
|
+
message: string | Error | null;
|
|
20
20
|
}
|
|
21
21
|
export type DevToolData = BaseDevToolData<DevCommandOptions>;
|
|
22
22
|
export type PromptResult = {
|
|
23
|
-
|
|
23
|
+
choiceDevTool: string;
|
|
24
24
|
} & Record<string, any>;
|
|
25
25
|
export type ModuleToolsHooks = typeof registerHook;
|
|
26
26
|
export interface WatchJsHookContext {
|
|
27
|
-
|
|
27
|
+
buildConfig: BaseBuildConfig;
|
|
28
28
|
}
|
|
29
29
|
export interface WatchDtsHookContext {
|
|
30
|
-
|
|
31
|
-
}
|
|
30
|
+
buildType: BuildType;
|
|
31
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,17 +11,17 @@ export * from './context';
|
|
|
11
11
|
export * from './esbuild';
|
|
12
12
|
export type { CliPlugin, IAppContext, PluginAPI } from '@modern-js/core';
|
|
13
13
|
export type ModuleTools = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
hooks: ModuleToolsHooks;
|
|
15
|
+
userConfig: ModuleExtraConfig;
|
|
16
|
+
normalizedConfig: Required<ModuleExtraConfig>;
|
|
17
17
|
};
|
|
18
18
|
export type LegacyModuleTools = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
hooks: ModuleToolsHooks;
|
|
20
|
+
userConfig: ModuleToolsLegacyUserConfig;
|
|
21
|
+
normalizedConfig: ModuleToolsLegacyNormalizedConfig;
|
|
22
22
|
};
|
|
23
23
|
export type ModuleUserConfig = UserConfig<ModuleTools>;
|
|
24
24
|
export type ModuleLegacyUserConfig = UserConfig<LegacyModuleTools>;
|
|
25
25
|
export type ModuleNormalizedConfig = NormalizedConfig<ModuleTools>;
|
|
26
26
|
export type ModuleLegacyNormalizedConfig = NormalizedConfig<LegacyModuleTools>;
|
|
27
|
-
export type ModuleConfigParams = ModuleUserConfig | Promise<ModuleUserConfig> | ((env: any) => ModuleUserConfig | Promise<ModuleUserConfig>);
|
|
27
|
+
export type ModuleConfigParams = ModuleUserConfig | Promise<ModuleUserConfig> | ((env: any) => ModuleUserConfig | Promise<ModuleUserConfig>);
|
|
@@ -5,16 +5,16 @@ export type { OutputLegacyUserConfig } from './output';
|
|
|
5
5
|
export type { SourceLegacyUserConfig } from './source';
|
|
6
6
|
export type { ToolsLegacyUserConfig } from './tools';
|
|
7
7
|
export interface RuntimeLegacyConfig {
|
|
8
|
-
|
|
8
|
+
[name: string]: any;
|
|
9
9
|
}
|
|
10
10
|
export interface RuntimeByEntriesLegacyConfig {
|
|
11
|
-
|
|
11
|
+
[name: string]: RuntimeLegacyConfig;
|
|
12
12
|
}
|
|
13
13
|
export type ModuleToolsLegacyUserConfig = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
source?: SourceLegacyUserConfig;
|
|
15
|
+
output?: OutputLegacyUserConfig;
|
|
16
|
+
tools?: ToolsLegacyUserConfig;
|
|
17
|
+
runtime?: RuntimeLegacyConfig;
|
|
18
|
+
legacy?: boolean;
|
|
19
19
|
};
|
|
20
|
-
export type ModuleToolsLegacyNormalizedConfig = Required<ModuleToolsLegacyUserConfig>;
|
|
20
|
+
export type ModuleToolsLegacyNormalizedConfig = Required<ModuleToolsLegacyUserConfig>;
|
|
@@ -5,57 +5,57 @@ export type LegacyTarget = 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2
|
|
|
5
5
|
export type LegacyBuildType = 'bundle' | 'bundleless';
|
|
6
6
|
export type LegacySourceMap = boolean | 'inline' | 'external';
|
|
7
7
|
export type LegacyBundleOptions = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
entry?: Record<string, string>;
|
|
9
|
+
platform?: Platform;
|
|
10
|
+
splitting?: boolean;
|
|
11
|
+
minify?: Minify;
|
|
12
|
+
externals?: Externals;
|
|
13
|
+
skipDeps?: boolean;
|
|
14
|
+
getModuleId?: (moduleName: string) => string | undefined;
|
|
15
15
|
};
|
|
16
16
|
export type LegacyBundlelessOptions = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
sourceDir?: string;
|
|
18
|
+
style?: {
|
|
19
|
+
compileMode?: 'all' | 'only-compiled-code' | /* may be will be deprecated */ 'only-source-code' | false;
|
|
20
|
+
path?: string;
|
|
21
|
+
};
|
|
22
|
+
static?: {
|
|
23
|
+
path?: string;
|
|
24
|
+
};
|
|
25
25
|
};
|
|
26
26
|
export type LegacyBaseBuildConfig = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
format?: LegacyFormat;
|
|
28
|
+
target?: LegacyTarget;
|
|
29
|
+
sourceMap?: LegacySourceMap;
|
|
30
|
+
buildType?: LegacyBuildType;
|
|
31
|
+
bundleOptions?: LegacyBundleOptions;
|
|
32
|
+
bundlelessOptions?: LegacyBundlelessOptions;
|
|
33
|
+
tsconfig?: string;
|
|
34
|
+
enableDts?: boolean;
|
|
35
|
+
dtsOnly?: boolean;
|
|
36
|
+
outputPath?: string;
|
|
37
37
|
};
|
|
38
38
|
export type LegacyBuildConfig = LegacyBaseBuildConfig | LegacyBaseBuildConfig[];
|
|
39
39
|
export type JsSyntaxType = 'CJS+ES6' | 'ESM+ES5' | 'ESM+ES6';
|
|
40
40
|
export interface PackageFields {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
main?: JsSyntaxType;
|
|
42
|
+
'jsnext:modern'?: JsSyntaxType;
|
|
43
|
+
module?: JsSyntaxType;
|
|
44
44
|
}
|
|
45
45
|
export type OutputLegacyUserConfig = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
46
|
+
jsPath?: string;
|
|
47
|
+
path?: string;
|
|
48
|
+
copy?: Array<Record<string, unknown> & {
|
|
49
|
+
from: string;
|
|
50
|
+
}>;
|
|
51
|
+
disableTsChecker?: boolean;
|
|
52
|
+
/** @deprecated Use the `buildConfig.bundlelessOptions.static.path` instead . */
|
|
53
|
+
assetsPath?: string;
|
|
54
|
+
/** @deprecated Use the `buildConfig.sourceMap` instead */
|
|
55
|
+
disableSourceMap?: boolean;
|
|
56
|
+
buildPreset?: LegacyBuildPreset;
|
|
57
|
+
buildConfig?: LegacyBuildConfig;
|
|
58
|
+
importStyle?: 'source-code' | 'compiled-code';
|
|
59
|
+
packageMode?: 'universal-js' | 'universal-js-lite' | 'browser-js' | 'browser-js-lite' | 'node-js';
|
|
60
|
+
packageFields?: PackageFields;
|
|
61
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { AliasOption } from '../config';
|
|
2
2
|
export type SourceLegacyUserConfig = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
3
|
+
alias?: AliasOption;
|
|
4
|
+
envVars?: Array<string>;
|
|
5
|
+
globalVars?: Record<string, string>;
|
|
6
|
+
jsxTransformRuntime?: 'automatic' | 'classic';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated designSystem is no longer required.
|
|
9
|
+
* If you are using Tailwind CSS, you can now use the `theme` option of Tailwind CSS, they are the same.
|
|
10
|
+
*/
|
|
11
|
+
designSystem?: Record<string, any>;
|
|
12
|
+
};
|
|
@@ -2,52 +2,52 @@ import type { JestConfig } from '@modern-js/types';
|
|
|
2
2
|
import type { AcceptedPlugin as PostCSSPlugin } from 'postcss';
|
|
3
3
|
import type { LessConfig, SassConfig } from '../config';
|
|
4
4
|
export type PostCSSOptions = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
to?: string;
|
|
6
|
+
from?: string;
|
|
7
|
+
map?: any;
|
|
8
|
+
syntax?: any;
|
|
9
|
+
parser?: any;
|
|
10
|
+
plugins?: PostCSSPlugin[];
|
|
11
|
+
stringifier?: any;
|
|
12
12
|
};
|
|
13
13
|
export type PostCSSLoaderOptions = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Enable PostCSS Parser support in CSS-in-JS. If you use JS styles the postcss-js parser, add the execute option.
|
|
16
|
+
*/
|
|
17
|
+
execute?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* By default generation of source maps depends on the devtool option. All values enable source map generation except eval and false value.
|
|
20
|
+
*/
|
|
21
|
+
sourceMap?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The special implementation option determines which implementation of PostCSS to use.
|
|
24
|
+
*/
|
|
25
|
+
implementation?: unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Allows to set PostCSS options and plugins.
|
|
28
|
+
*/
|
|
29
|
+
postcssOptions?: PostCSSOptions;
|
|
30
30
|
};
|
|
31
31
|
export type PostCSSConfigUtils = {
|
|
32
|
-
|
|
32
|
+
addPlugins: (plugins: PostCSSPlugin | PostCSSPlugin[]) => void;
|
|
33
33
|
};
|
|
34
34
|
interface ToolsConfig {
|
|
35
|
-
|
|
35
|
+
speedy?: any | ((config: any) => any);
|
|
36
36
|
}
|
|
37
37
|
export type PostCSSFunction = (options: PostCSSLoaderOptions, utils: PostCSSConfigUtils) => PostCSSLoaderOptions | void;
|
|
38
38
|
export type ToolsLegacyUserConfig = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
babel?: any;
|
|
40
|
+
less?: LessConfig;
|
|
41
|
+
lodash?: any;
|
|
42
|
+
postcss?: PostCSSLoaderOptions | PostCSSFunction;
|
|
43
|
+
sass?: SassConfig;
|
|
44
|
+
speedy?: ToolsConfig['speedy'] | Array<NonNullable<ToolsConfig['speedy']>>;
|
|
45
|
+
/**
|
|
46
|
+
* The configuration of `tools.tailwindcss` is provided by `tailwindcss` plugin.
|
|
47
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
48
|
+
* @requires `tailwindcss` plugin
|
|
49
|
+
*/
|
|
50
|
+
tailwindcss?: Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
|
|
51
|
+
jest?: JestConfig | ((jestConfig: JestConfig) => JestConfig);
|
|
52
52
|
};
|
|
53
|
-
export {};
|
|
53
|
+
export {};
|
package/dist/utils/assert.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export declare function isStyleExt(path: string): boolean;
|
|
|
2
2
|
export declare function isJsExt(path: string): boolean;
|
|
3
3
|
export declare function isJsLoader(loader?: string): boolean;
|
|
4
4
|
export declare function isTsExt(path: string): boolean;
|
|
5
|
-
export declare function isTsLoader(loader?: string): boolean;
|
|
5
|
+
export declare function isTsLoader(loader?: string): boolean;
|
package/dist/utils/builder.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { ExternalHelpers } from '../types/config';
|
|
2
2
|
type Query = Record<string, string | boolean>;
|
|
3
3
|
type ResolveResult = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
originalFilePath: string;
|
|
5
|
+
query: Query;
|
|
6
|
+
rawQuery?: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const getAllDeps: <T>(appDirectory: string, options?: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
dependencies?: boolean;
|
|
10
|
+
devDependencies?: boolean;
|
|
11
|
+
peerDependencies?: boolean;
|
|
12
12
|
}) => Promise<string[]>;
|
|
13
13
|
export declare const checkSwcHelpers: (options: {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
appDirectory: string;
|
|
15
|
+
externalHelpers: ExternalHelpers;
|
|
16
16
|
}) => Promise<void>;
|
|
17
17
|
export declare const normalizeSlashes: (file: string) => string;
|
|
18
18
|
export declare const resolvePathAndQuery: (originalPath: string) => ResolveResult;
|
|
19
|
-
export {};
|
|
19
|
+
export {};
|
package/dist/utils/common.d.ts
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* transform ['a', 'b'] to { a: undefined, b: undefined }
|
|
3
3
|
*/
|
|
4
4
|
export declare const transformUndefineObject: (arr: string[]) => Record<string, undefined>;
|
|
5
|
-
export declare function mapValue<T = any, U = any>(obj: Record<string, T>, mapper: (x: T) => U): Record<string, U>;
|
|
5
|
+
export declare function mapValue<T = any, U = any>(obj: Record<string, T>, mapper: (x: T) => U): Record<string, U>;
|
package/dist/utils/dts.d.ts
CHANGED
|
@@ -1,39 +1,9 @@
|
|
|
1
1
|
import type { ITsconfig, GeneratorDtsConfig, BuildType, TsTarget } from '../types';
|
|
2
2
|
export declare const getProjectTsconfig: (tsconfigPath: string) => Promise<ITsconfig>;
|
|
3
|
-
export declare const generateDtsInfo: (config: GeneratorDtsConfig) => Promise<{
|
|
4
|
-
userTsconfig: ITsconfig;
|
|
5
|
-
tempTsconfigPath: string;
|
|
6
|
-
tempDistAbsRootPath: string;
|
|
7
|
-
tempDistAbsSrcPath: string;
|
|
8
|
-
}>;
|
|
9
3
|
export declare const getTscBinPath: (appDirectory: string) => Promise<string>;
|
|
10
|
-
export declare const
|
|
11
|
-
userTsconfig: ITsconfig;
|
|
12
|
-
tempTsconfigPath: string;
|
|
13
|
-
tempDistAbsRootPath: string;
|
|
14
|
-
tempDistAbsSrcPath: string;
|
|
15
|
-
}, watchFilenames?: string[]) => Promise<{
|
|
16
|
-
path: string;
|
|
17
|
-
content: string;
|
|
18
|
-
}[]>;
|
|
19
|
-
export declare const writeDtsFiles: (config: GeneratorDtsConfig, options: {
|
|
20
|
-
userTsconfig: ITsconfig;
|
|
21
|
-
tempTsconfigPath: string;
|
|
22
|
-
tempDistAbsRootPath: string;
|
|
23
|
-
tempDistAbsSrcPath: string;
|
|
24
|
-
}, result: {
|
|
25
|
-
path: string;
|
|
26
|
-
content: string;
|
|
27
|
-
}[]) => Promise<void>;
|
|
28
|
-
export declare const addBannerAndFooter: (result: {
|
|
29
|
-
path: string;
|
|
30
|
-
content: string;
|
|
31
|
-
}[], banner?: string, footer?: string) => {
|
|
32
|
-
path: string;
|
|
33
|
-
content: string;
|
|
34
|
-
}[];
|
|
4
|
+
export declare const processDtsFilesAfterTsc: (config: GeneratorDtsConfig) => Promise<void>;
|
|
35
5
|
export declare const printOrThrowDtsErrors: (error: unknown, options: {
|
|
36
|
-
|
|
37
|
-
|
|
6
|
+
abortOnError?: boolean;
|
|
7
|
+
buildType: BuildType;
|
|
38
8
|
}) => Promise<void>;
|
|
39
|
-
export declare const tsTargetAtOrAboveES2022: (target: TsTarget) => boolean;
|
|
9
|
+
export declare const tsTargetAtOrAboveES2022: (target: TsTarget) => boolean;
|