@modern-js/module-tools 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/build.d.ts +1 -1
- package/dist/builder/build.d.ts +1 -1
- package/dist/builder/build.js +1 -1
- package/dist/builder/clear.js +1 -1
- package/dist/builder/copy.d.ts +1 -1
- package/dist/builder/copy.js +0 -1
- package/dist/builder/dts/rollup.d.ts +1 -1
- package/dist/builder/dts/tsc.d.ts +1 -1
- package/dist/builder/dts/tsc.js +1 -1
- package/dist/builder/esbuild/adapter.d.ts +1 -1
- package/dist/builder/esbuild/adapter.js +2 -2
- package/dist/builder/esbuild/hook.d.ts +1 -1
- package/dist/builder/esbuild/index.d.ts +4 -4
- package/dist/builder/esbuild/index.js +4 -4
- package/dist/builder/esbuild/resolve.d.ts +1 -1
- package/dist/builder/esbuild/sourcemap.d.ts +1 -1
- package/dist/builder/esbuild/sourcemap.js +1 -1
- package/dist/builder/esbuild/transform.d.ts +1 -1
- package/dist/builder/esbuild/watch.d.ts +1 -1
- package/dist/builder/esbuild/write-file.d.ts +1 -1
- package/dist/builder/feature/asset.js +2 -2
- package/dist/builder/feature/format-cjs.d.ts +1 -1
- package/dist/builder/feature/index.d.ts +1 -1
- package/dist/builder/feature/index.js +1 -1
- package/dist/builder/feature/json.d.ts +1 -1
- package/dist/builder/feature/redirect.d.ts +1 -1
- package/dist/builder/feature/redirect.js +2 -2
- package/dist/builder/feature/style/index.d.ts +1 -1
- package/dist/builder/feature/style/lessAliasPlugin.d.ts +1 -1
- package/dist/builder/feature/style/lessRender.d.ts +1 -1
- package/dist/builder/feature/style/lessRender.js +1 -1
- package/dist/builder/feature/style/postcssTransformer.d.ts +1 -1
- package/dist/builder/feature/style/postcssUrlPlugin.d.ts +2 -2
- package/dist/builder/feature/style/sassRender.d.ts +1 -1
- package/dist/builder/feature/style/transformStyle.d.ts +2 -2
- package/dist/builder/feature/style/transformStyle.js +1 -1
- package/dist/builder/feature/terser.d.ts +1 -1
- package/dist/builder/index.d.ts +1 -1
- package/dist/builder/platform.d.ts +3 -3
- package/dist/cli.js +1 -1
- package/dist/command.d.ts +1 -1
- package/dist/config/merge.d.ts +2 -2
- package/dist/config/merge.js +1 -1
- package/dist/config/normalize.d.ts +1 -1
- package/dist/config/normalize.js +1 -1
- package/dist/config/transformLegacyConfig.d.ts +1 -1
- package/dist/config/valid.d.ts +1 -1
- package/dist/dev.d.ts +1 -1
- package/dist/hooks/build.d.ts +12 -12
- package/dist/hooks/misc.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/types/config/index.d.ts +5 -5
- package/dist/types/config/style.d.ts +2 -2
- package/dist/types/esbuild.d.ts +5 -5
- package/dist/types/hooks.d.ts +3 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/legacyConfig/output.d.ts +1 -1
- package/dist/utils/dts.d.ts +1 -1
- package/dist/utils/dts.js +3 -3
- package/dist/utils/input.d.ts +1 -1
- package/dist/utils/map.js +1 -1
- package/dist/utils/print.d.ts +1 -1
- package/dist/utils/print.js +1 -1
- package/dist/utils/style.d.ts +1 -1
- package/package.json +12 -12
- package/shims/cjs.js +1 -4
- package/shims/esm.js +1 -1
- package/vitest.config.ts +3 -3
package/dist/build.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BuildCommandOptions, ModuleContext, ModuleTools } from './types';
|
|
3
3
|
export declare const build: (api: PluginAPI<ModuleTools>, options: BuildCommandOptions, context: ModuleContext) => Promise<void>;
|
package/dist/builder/build.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BaseBuildConfig, BuildCommandOptions, DTSOptions, ModuleContext, ModuleTools, PluginAPI } from '../types';
|
|
2
2
|
export declare const runBuildTask: (options: {
|
|
3
3
|
buildConfig: BaseBuildConfig;
|
|
4
4
|
buildCmdOptions: BuildCommandOptions;
|
package/dist/builder/build.js
CHANGED
|
@@ -34,9 +34,9 @@ __export(build_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(build_exports);
|
|
36
36
|
var import_utils = require("@modern-js/utils");
|
|
37
|
-
var import_utils2 = require("../utils");
|
|
38
37
|
var import_p_map = __toESM(require("../../compiled/p-map"));
|
|
39
38
|
var import_debug = require("../debug");
|
|
39
|
+
var import_utils2 = require("../utils");
|
|
40
40
|
var import_copy = require("./copy");
|
|
41
41
|
var import_esbuild = require("./esbuild");
|
|
42
42
|
const runBuildTask = async (options, api) => {
|
package/dist/builder/clear.js
CHANGED
|
@@ -23,9 +23,9 @@ __export(clear_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(clear_exports);
|
|
24
24
|
var import_path = require("path");
|
|
25
25
|
var import_utils = require("@modern-js/utils");
|
|
26
|
+
var import_debug = require("../debug");
|
|
26
27
|
var import_locale = require("../locale");
|
|
27
28
|
var import_utils2 = require("../utils");
|
|
28
|
-
var import_debug = require("../debug");
|
|
29
29
|
const clearBuildConfigPaths = async (configs, projectAbsRootPath) => {
|
|
30
30
|
for (const config of configs) {
|
|
31
31
|
if (projectAbsRootPath === config.outDir) {
|
package/dist/builder/copy.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { watch } from '@modern-js/utils';
|
|
2
|
-
import type { CopyOptions, CopyPattern } from '../types/config/copy';
|
|
3
2
|
import type { BaseBuildConfig } from '../types/config';
|
|
3
|
+
import type { CopyOptions, CopyPattern } from '../types/config/copy';
|
|
4
4
|
export declare const runPatterns: (pattern: CopyPattern, options: {
|
|
5
5
|
appDirectory: string;
|
|
6
6
|
enableCopySync?: boolean;
|
package/dist/builder/copy.js
CHANGED
|
@@ -92,7 +92,6 @@ const runPatterns = async (pattern, options) => {
|
|
|
92
92
|
globOptions.dot = true;
|
|
93
93
|
}
|
|
94
94
|
break;
|
|
95
|
-
case "glob":
|
|
96
95
|
default: {
|
|
97
96
|
var _targetPattern_context;
|
|
98
97
|
glob = import_path.default.isAbsolute(from) ? from : import_path.default.posix.join(import_utils.fastGlob.escapePath(normalizePath(import_path.default.resolve((_targetPattern_context = targetPattern.context) !== null && _targetPattern_context !== void 0 ? _targetPattern_context : appDirectory))), from);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { RollupWatcher } from '../../../compiled/rollup';
|
|
2
|
-
import type { GeneratorDtsConfig,
|
|
2
|
+
import type { GeneratorDtsConfig, ModuleTools, PluginAPI } from '../../types';
|
|
3
3
|
export type { RollupWatcher };
|
|
4
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
|
-
import type { GeneratorDtsConfig,
|
|
1
|
+
import type { GeneratorDtsConfig, ModuleTools, PluginAPI } from '../../types';
|
|
2
2
|
export declare const removeTscLogTime: (log: string) => string;
|
|
3
3
|
export declare const runTsc: (api: PluginAPI<ModuleTools>, config: GeneratorDtsConfig) => Promise<void>;
|
package/dist/builder/dts/tsc.js
CHANGED
|
@@ -34,8 +34,8 @@ __export(tsc_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(tsc_exports);
|
|
35
35
|
var import_path = __toESM(require("path"));
|
|
36
36
|
var import_utils = require("@modern-js/utils");
|
|
37
|
-
var import_utils2 = require("../../utils");
|
|
38
37
|
var import_dts = require("../../constants/dts");
|
|
38
|
+
var import_utils2 = require("../../utils");
|
|
39
39
|
const removeTscLogTime = (log) => log.replace(/\[.*\]\s/, "");
|
|
40
40
|
const resolveLog = async (childProgress, options) => {
|
|
41
41
|
var _childProgress_stdout, _childProgress_stdout1, _childProgress_stderr;
|
|
@@ -31,13 +31,13 @@ __export(adapter_exports, {
|
|
|
31
31
|
adapterPlugin: () => adapterPlugin
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(adapter_exports);
|
|
34
|
-
var import_path = require("path");
|
|
35
34
|
var import_module = __toESM(require("module"));
|
|
35
|
+
var import_path = require("path");
|
|
36
36
|
var import_utils = require("@modern-js/utils");
|
|
37
37
|
var import_pluginutils = require("@rollup/pluginutils");
|
|
38
|
-
var import_utils2 = require("../../utils");
|
|
39
38
|
var import_loader = require("../../constants/loader");
|
|
40
39
|
var import_debug = require("../../debug");
|
|
40
|
+
var import_utils2 = require("../../utils");
|
|
41
41
|
var import_write_file = require("./write-file");
|
|
42
42
|
const globalNamespace = "globals";
|
|
43
43
|
const HTTP_PATTERNS = /^(https?:)?\/\//;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as tapable from 'tapable';
|
|
2
|
-
import {
|
|
2
|
+
import type { Chunk, ICompiler, Source } from '../../types';
|
|
3
3
|
export declare function createTransformHook(compiler: ICompiler): tapable.AsyncSeriesWaterfallHook<Source, tapable.UnsetAdditionalOptions>;
|
|
4
4
|
export declare function createRenderChunkHook(compiler: ICompiler): tapable.AsyncSeriesWaterfallHook<Chunk, tapable.UnsetAdditionalOptions>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { BaseBuildConfig, BuilderHooks, Chunk,
|
|
4
|
-
import { TransformContext } from './transform';
|
|
1
|
+
import { type FSWatcher } from '@modern-js/utils';
|
|
2
|
+
import { type BuildContext, type BuildOptions, type BuildResult, type ImportKind } from 'esbuild';
|
|
3
|
+
import type { BaseBuildConfig, BuilderHooks, Chunk, Context, HookList, ICompiler, ModuleTools, PluginAPI } from '../../types';
|
|
5
4
|
import { SourcemapContext } from './sourcemap';
|
|
5
|
+
import { TransformContext } from './transform';
|
|
6
6
|
export declare class EsbuildCompiler implements ICompiler {
|
|
7
7
|
instance?: BuildContext;
|
|
8
8
|
result?: BuildResult;
|
|
@@ -33,17 +33,17 @@ __export(esbuild_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(esbuild_exports);
|
|
35
35
|
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_utils = require("@modern-js/utils");
|
|
36
37
|
var import_esbuild = require("esbuild");
|
|
37
38
|
var tapable = __toESM(require("tapable"));
|
|
38
|
-
var
|
|
39
|
+
var import_build = require("../../constants/build");
|
|
39
40
|
var import_utils2 = require("../../utils");
|
|
40
41
|
var import_feature = require("../feature");
|
|
41
|
-
var import_build = require("../../constants/build");
|
|
42
42
|
var import_adapter = require("./adapter");
|
|
43
|
-
var import_transform = require("./transform");
|
|
44
|
-
var import_sourcemap = require("./sourcemap");
|
|
45
43
|
var import_hook = require("./hook");
|
|
46
44
|
var import_resolve = require("./resolve");
|
|
45
|
+
var import_sourcemap = require("./sourcemap");
|
|
46
|
+
var import_transform = require("./transform");
|
|
47
47
|
var import_watch = require("./watch");
|
|
48
48
|
class EsbuildCompiler {
|
|
49
49
|
async init() {
|
|
@@ -55,7 +55,7 @@ class SourcemapContext {
|
|
|
55
55
|
return this.cachedSourceMap;
|
|
56
56
|
}
|
|
57
57
|
getSourceMapChain() {
|
|
58
|
-
return this.sourceMapChain.filter((m) => Boolean(m
|
|
58
|
+
return this.sourceMapChain.filter((m) => Boolean(m === null || m === void 0 ? void 0 : m.mappings));
|
|
59
59
|
}
|
|
60
60
|
genPluginId(name) {
|
|
61
61
|
if (this.pluginIdMap.has(name)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CacheValue, ITransformContext } from '../../types';
|
|
2
2
|
import { SourcemapContext } from './sourcemap';
|
|
3
3
|
export declare class TransformContext extends SourcemapContext implements ITransformContext {
|
|
4
4
|
private cachedTransformResult;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICompiler } from '../../types';
|
|
1
|
+
import type { ICompiler } from '../../types';
|
|
2
2
|
export declare const initWatcher: (compiler: ICompiler) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICompiler } from '../../types';
|
|
1
|
+
import type { ICompiler } from '../../types';
|
|
2
2
|
export declare const writeFile: (compiler: ICompiler) => Promise<void>;
|
|
@@ -32,13 +32,13 @@ __export(asset_exports, {
|
|
|
32
32
|
getAssetContents: () => getAssetContents
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(asset_exports);
|
|
35
|
-
var import_path = require("path");
|
|
36
35
|
var import_fs = __toESM(require("fs"));
|
|
36
|
+
var import_path = require("path");
|
|
37
37
|
var import_lodash = __toESM(require("@modern-js/utils/lodash"));
|
|
38
38
|
var import_pluginutils = require("@rollup/pluginutils");
|
|
39
39
|
var import_core = require("../../../compiled/@svgr/core");
|
|
40
|
-
var import_plugin_svgo = __toESM(require("../../../compiled/@svgr/plugin-svgo"));
|
|
41
40
|
var import_plugin_jsx = __toESM(require("../../../compiled/@svgr/plugin-jsx"));
|
|
41
|
+
var import_plugin_svgo = __toESM(require("../../../compiled/@svgr/plugin-svgo"));
|
|
42
42
|
var import_file = require("../../constants/file");
|
|
43
43
|
var import_utils = require("../../utils");
|
|
44
44
|
const name = "asset";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Context, HookList } from '../../types';
|
|
2
2
|
export declare function getInternalList(context: Context): Promise<HookList>;
|
|
@@ -32,10 +32,10 @@ __export(feature_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(feature_exports);
|
|
34
34
|
var import_dts = require("../../utils/dts");
|
|
35
|
+
var import_asset = require("./asset");
|
|
35
36
|
var import_format_cjs = require("./format-cjs");
|
|
36
37
|
var import_style = require("./style");
|
|
37
38
|
var import_terser = require("./terser");
|
|
38
|
-
var import_asset = require("./asset");
|
|
39
39
|
async function getInternalList(context) {
|
|
40
40
|
var _userTsconfig_compilerOptions;
|
|
41
41
|
const internal = [];
|
|
@@ -33,9 +33,9 @@ __export(redirect_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(redirect_exports);
|
|
34
34
|
var import_path = require("path");
|
|
35
35
|
var import_napi = require("@ast-grep/napi");
|
|
36
|
-
var import_magic_string = __toESM(require("magic-string"));
|
|
37
|
-
var import_tsconfig_paths = require("@modern-js/utils/tsconfig-paths");
|
|
38
36
|
var import_utils = require("@modern-js/utils");
|
|
37
|
+
var import_tsconfig_paths = require("@modern-js/utils/tsconfig-paths");
|
|
38
|
+
var import_magic_string = __toESM(require("magic-string"));
|
|
39
39
|
var import_file = require("../../constants/file");
|
|
40
40
|
var import_utils2 = require("../../utils");
|
|
41
41
|
var import_asset = require("./asset");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PreprocessRender } from './transformStyle';
|
|
1
|
+
import type { PreprocessRender } from './transformStyle';
|
|
2
2
|
export declare const lessRender: PreprocessRender;
|
|
@@ -31,8 +31,8 @@ __export(lessRender_exports, {
|
|
|
31
31
|
lessRender: () => lessRender
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(lessRender_exports);
|
|
34
|
-
var import_utils = require("./utils");
|
|
35
34
|
var import_lessAliasPlugin = __toESM(require("./lessAliasPlugin"));
|
|
35
|
+
var import_utils = require("./utils");
|
|
36
36
|
const lessRender = async function(content, originPath, stdinDir, options, _, implementation) {
|
|
37
37
|
const less = await (0, import_utils.loadProcessor)("less", this.context.root, implementation);
|
|
38
38
|
const result = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICompiler } from '../../../types';
|
|
1
|
+
import type { 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
4
|
code: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Plugin } from 'postcss';
|
|
2
|
-
import { ICompiler } from '../../../types';
|
|
1
|
+
import type { Plugin } from 'postcss';
|
|
2
|
+
import type { ICompiler } from '../../../types';
|
|
3
3
|
export declare const postcssUrlPlugin: (options: {
|
|
4
4
|
entryPath: string;
|
|
5
5
|
compilation: ICompiler;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PreprocessRender } from './transformStyle';
|
|
1
|
+
import type { PreprocessRender } from './transformStyle';
|
|
2
2
|
export declare const sassRender: PreprocessRender;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { PartialMessage } from 'esbuild';
|
|
3
|
-
import { ICompiler, Source } from '../../../types';
|
|
2
|
+
import type { PartialMessage } from 'esbuild';
|
|
3
|
+
import type { 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
5
|
css: Buffer | string;
|
|
6
6
|
errors?: PartialMessage[];
|
|
@@ -32,8 +32,8 @@ __export(transformStyle_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(transformStyle_exports);
|
|
34
34
|
var import_path = __toESM(require("path"));
|
|
35
|
-
var import_postcssTransformer = require("./postcssTransformer");
|
|
36
35
|
var import_lessRender = require("./lessRender");
|
|
36
|
+
var import_postcssTransformer = require("./postcssTransformer");
|
|
37
37
|
var import_sassRender = require("./sassRender");
|
|
38
38
|
const cssLangs = `\\.(css|less|sass|scss)($|\\?)`;
|
|
39
39
|
const cssLangRE = new RegExp(cssLangs);
|
package/dist/builder/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
+
import type { BaseBuildConfig, BuildCommandOptions, ModuleTools } from '../types';
|
|
2
3
|
import type { ModuleContext } from '../types/context';
|
|
3
|
-
import type { BuildCommandOptions, BaseBuildConfig, ModuleTools } from '../types';
|
|
4
4
|
export declare const run: (options: {
|
|
5
5
|
cmdOptions: BuildCommandOptions;
|
|
6
6
|
normalizedBuildConfig: BaseBuildConfig[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginAPI } from '@modern-js/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
+
import type { BuildCommandOptions, ModuleTools } from '../types';
|
|
3
|
+
import type { ModuleContext } from '../types/context';
|
|
4
4
|
export declare const buildPlatform: (options: BuildCommandOptions, api: PluginAPI<ModuleTools>, context: ModuleContext) => Promise<void>;
|
package/dist/cli.js
CHANGED
|
@@ -32,9 +32,9 @@ __export(cli_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(cli_exports);
|
|
34
34
|
var import_utils = require("@modern-js/utils");
|
|
35
|
+
var import_command = require("./command");
|
|
35
36
|
var import_hooks = require("./hooks");
|
|
36
37
|
var import_plugins = require("./plugins");
|
|
37
|
-
var import_command = require("./command");
|
|
38
38
|
var import_onExit = require("./utils/onExit");
|
|
39
39
|
const moduleTools = () => ({
|
|
40
40
|
name: "@modern-js/module-tools",
|
package/dist/command.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Command } from '@modern-js/utils';
|
|
2
1
|
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
+
import type { Command } from '@modern-js/utils';
|
|
3
3
|
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>;
|
package/dist/config/merge.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModuleContext } from '../types';
|
|
2
|
-
import type { BaseBuildConfig,
|
|
1
|
+
import type { ModuleContext } from '../types';
|
|
2
|
+
import type { BaseBuildConfig, BuildCommandOptions, ModuleLegacyUserConfig, PartialBaseBuildConfig } from '../types';
|
|
3
3
|
export declare const mergeDefaultBaseConfig: (pConfig: PartialBaseBuildConfig, options: {
|
|
4
4
|
context: ModuleContext;
|
|
5
5
|
buildCmdOptions: BuildCommandOptions;
|
package/dist/config/merge.js
CHANGED
|
@@ -33,8 +33,8 @@ __export(merge_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(merge_exports);
|
|
35
35
|
var import_utils = require("@modern-js/utils");
|
|
36
|
-
var import_utils2 = require("../utils");
|
|
37
36
|
var import_build = require("../constants/build");
|
|
37
|
+
var import_utils2 = require("../utils");
|
|
38
38
|
const mergeDefaultBaseConfig = async (pConfig, options) => {
|
|
39
39
|
var _pConfig_resolve, _pConfig_resolve1, _pConfig_resolve2, _pConfig_style, _pConfig_style1, _pConfig_style2, _pConfig_style3;
|
|
40
40
|
const defaultConfig = (0, import_build.getDefaultBuildConfig)();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BaseBuildConfig, BuildCommandOptions, BuildPreset, ModuleContext, ModuleUserConfig, PartialBaseBuildConfig, PartialBuildConfig } from '../types';
|
|
2
2
|
export declare const presetToConfig: (preset?: BuildPreset) => Promise<PartialBaseBuildConfig[] | undefined>;
|
|
3
3
|
export declare const mergeConfig: (low?: PartialBaseBuildConfig[], high?: PartialBuildConfig) => PartialBaseBuildConfig[];
|
|
4
4
|
export declare const normalizeBuildConfig: (resolvedConfig: ModuleUserConfig, context: ModuleContext, buildCmdOptions: BuildCommandOptions) => Promise<BaseBuildConfig[]>;
|
package/dist/config/normalize.js
CHANGED
|
@@ -35,8 +35,8 @@ __export(normalize_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(normalize_exports);
|
|
37
37
|
var import_path = __toESM(require("path"));
|
|
38
|
-
var import_lodash = __toESM(require("@modern-js/utils/lodash"));
|
|
39
38
|
var import_utils = require("@modern-js/utils");
|
|
39
|
+
var import_lodash = __toESM(require("@modern-js/utils/lodash"));
|
|
40
40
|
var import_preset = require("../constants/preset");
|
|
41
41
|
var import_merge = require("./merge");
|
|
42
42
|
var import_valid = require("./valid");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModuleToolsLegacyUserConfig, ModuleUserConfig, PartialBaseBuildConfig } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* transform `tools` to buildConfig
|
|
4
4
|
* include tools.less/sass/postcss/tailwindcss
|
package/dist/config/valid.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PartialBaseBuildConfig, PartialBuildConfig } from '../types';
|
|
2
2
|
export declare const validPartialBuildConfig: (config: PartialBuildConfig, appDirectory: string) => void;
|
|
3
3
|
export declare const validBuildConfig: (config: PartialBaseBuildConfig, appDirectory: string) => void;
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
+
import type { DevToolData, ModuleTools } from './types';
|
|
2
3
|
import type { DevCommandOptions } from './types/command';
|
|
3
4
|
import type { ModuleContext } from './types/context';
|
|
4
|
-
import type { DevToolData, ModuleTools } from './types';
|
|
5
5
|
export declare const showMenu: (metas: DevToolData[], devCmdOptions: DevCommandOptions, api: PluginAPI<ModuleTools>, context: ModuleContext) => Promise<void>;
|
|
6
6
|
export declare const dev: (options: DevCommandOptions, metas: DevToolData[], api: PluginAPI<ModuleTools>, context: ModuleContext) => Promise<void>;
|
package/dist/hooks/build.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { RegisterBuildPlatformResult } from '@modern-js/core';
|
|
2
|
-
import { BuildCommandOptions } from '../types';
|
|
3
|
-
import type {
|
|
2
|
+
import type { BuildCommandOptions } from '../types';
|
|
3
|
+
import type { BaseBuildConfig, BuildPlatformResult, BuildResult, BuildTaskResult, WatchDtsHookContext, WatchJsHookContext } from '../types';
|
|
4
4
|
export declare const buildHooks: {
|
|
5
|
-
beforeBuild: import("@modern-js/
|
|
5
|
+
beforeBuild: import("@modern-js/core").ParallelWorkflow<{
|
|
6
6
|
config: BaseBuildConfig[];
|
|
7
7
|
cliOptions: BuildCommandOptions;
|
|
8
8
|
}, void>;
|
|
9
|
-
beforeBuildTask: import("@modern-js/
|
|
10
|
-
afterBuildTask: import("@modern-js/
|
|
11
|
-
afterBuild: import("@modern-js/
|
|
12
|
-
registerBuildPlatform: import("@modern-js/
|
|
13
|
-
beforeBuildPlatform: import("@modern-js/
|
|
14
|
-
buildPlatform: import("@modern-js/
|
|
9
|
+
beforeBuildTask: import("@modern-js/core").AsyncWaterfall<BaseBuildConfig>;
|
|
10
|
+
afterBuildTask: import("@modern-js/core").ParallelWorkflow<BuildTaskResult, void>;
|
|
11
|
+
afterBuild: import("@modern-js/core").ParallelWorkflow<BuildResult, void>;
|
|
12
|
+
registerBuildPlatform: import("@modern-js/core").ParallelWorkflow<void, RegisterBuildPlatformResult>;
|
|
13
|
+
beforeBuildPlatform: import("@modern-js/core").ParallelWorkflow<RegisterBuildPlatformResult[], void>;
|
|
14
|
+
buildPlatform: import("@modern-js/core").ParallelWorkflow<{
|
|
15
15
|
platform: string;
|
|
16
16
|
}, void>;
|
|
17
|
-
afterBuildPlatform: import("@modern-js/
|
|
17
|
+
afterBuildPlatform: import("@modern-js/core").ParallelWorkflow<BuildPlatformResult, void>;
|
|
18
18
|
};
|
|
19
19
|
export declare const buildWatchHooks: {
|
|
20
|
-
buildWatchJs: import("@modern-js/
|
|
21
|
-
buildWatchDts: import("@modern-js/
|
|
20
|
+
buildWatchJs: import("@modern-js/core").ParallelWorkflow<WatchJsHookContext, void>;
|
|
21
|
+
buildWatchDts: import("@modern-js/core").ParallelWorkflow<WatchDtsHookContext, void>;
|
|
22
22
|
};
|
package/dist/hooks/misc.d.ts
CHANGED
package/dist/locale/index.js
CHANGED
|
@@ -23,8 +23,8 @@ __export(locale_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(locale_exports);
|
|
25
25
|
var import_plugin_i18n = require("@modern-js/plugin-i18n");
|
|
26
|
-
var import_zh = require("./zh");
|
|
27
26
|
var import_en = require("./en");
|
|
27
|
+
var import_zh = require("./zh");
|
|
28
28
|
const i18n = new import_plugin_i18n.I18n();
|
|
29
29
|
const localeKeys = i18n.init("en", {
|
|
30
30
|
zh: import_zh.ZH_LOCALE,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TestConfig } from '@modern-js/types';
|
|
2
2
|
import type { CreateFilter } from '@rollup/pluginutils';
|
|
3
|
+
import type { BuildOptions } from 'esbuild';
|
|
3
4
|
import type { MinifyOptions as TerserMinifyOptions } from 'terser';
|
|
4
|
-
import type { TestConfig } from '@modern-js/types';
|
|
5
5
|
import type { Config } from '../../../compiled/@svgr/core';
|
|
6
|
-
import { internalPreset, presetList } from '../../constants/preset';
|
|
7
|
-
import { ICompiler } from '../esbuild';
|
|
8
|
-
import type { ImportItem } from './transform-import';
|
|
6
|
+
import type { internalPreset, presetList } from '../../constants/preset';
|
|
7
|
+
import type { ICompiler } from '../esbuild';
|
|
9
8
|
import type { CopyConfig } from './copy';
|
|
10
9
|
import type { Dev } from './dev';
|
|
11
10
|
import type { Style, StyleConfig } from './style';
|
|
11
|
+
import type { ImportItem } from './transform-import';
|
|
12
12
|
export * from './style';
|
|
13
13
|
export * from './dev';
|
|
14
14
|
export * from './copy';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AcceptedPlugin as PostCSSPlugin, ProcessOptions
|
|
1
|
+
import type { Plugin, AcceptedPlugin as PostCSSPlugin, ProcessOptions } from 'postcss';
|
|
2
|
+
import type Less from '../../../compiled/less';
|
|
2
3
|
import type { Options as sassOptions } from '../../../compiled/sass';
|
|
3
|
-
import Less from '../../../compiled/less';
|
|
4
4
|
type LocalsConventionFunction = (originalClassName: string, generatedClassName: string, inputFile: string) => string;
|
|
5
5
|
type GenerateScopedNameFunction = (name: string, filename: string, css: string) => string;
|
|
6
6
|
declare class Loader {
|
package/dist/types/esbuild.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { FSWatcher } from '@modern-js/utils';
|
|
3
|
+
import type { BuildContext, BuildOptions, BuildResult, ImportKind, OnLoadArgs, OnLoadResult } from 'esbuild';
|
|
3
4
|
import type { AsyncSeriesBailHook, AsyncSeriesWaterfallHook } from 'tapable';
|
|
4
|
-
import {
|
|
5
|
-
import { BaseBuildConfig } from './config';
|
|
6
|
-
import { ModuleTools, PluginAPI } from '.';
|
|
5
|
+
import type { ModuleTools, PluginAPI } from '.';
|
|
6
|
+
import type { BaseBuildConfig } from './config';
|
|
7
7
|
export interface SourceMap {
|
|
8
8
|
mappings: string;
|
|
9
9
|
names: string[];
|
|
@@ -101,7 +101,7 @@ export type JsChunk = {
|
|
|
101
101
|
originalFileName?: string;
|
|
102
102
|
};
|
|
103
103
|
export type Chunk = AssetChunk | JsChunk;
|
|
104
|
-
export declare
|
|
104
|
+
export declare enum ChunkType {
|
|
105
105
|
chunk = "chunk",
|
|
106
106
|
asset = "asset"
|
|
107
107
|
}
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DevToolData as BaseDevToolData } from '@modern-js/core';
|
|
2
|
-
import { registerHook } from '../hooks';
|
|
1
|
+
import type { DevToolData as BaseDevToolData } from '@modern-js/core';
|
|
2
|
+
import type { registerHook } from '../hooks';
|
|
3
|
+
import type { BuildCommandOptions, DevCommandOptions } from './command';
|
|
3
4
|
import type { BaseBuildConfig, BuildConfig, BuildType } from './config';
|
|
4
|
-
import type { DevCommandOptions, BuildCommandOptions } from './command';
|
|
5
5
|
export interface BuildTaskResult {
|
|
6
6
|
status: 'success' | 'fail';
|
|
7
7
|
message?: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NormalizedConfig, UserConfig } from '@modern-js/core';
|
|
2
|
-
import type { ModuleToolsHooks } from './hooks';
|
|
3
2
|
import type { ModuleExtraConfig } from './config';
|
|
4
|
-
import type {
|
|
3
|
+
import type { ModuleToolsHooks } from './hooks';
|
|
4
|
+
import type { ModuleToolsLegacyNormalizedConfig, ModuleToolsLegacyUserConfig } from './legacyConfig';
|
|
5
5
|
export * from './hooks';
|
|
6
6
|
export * from './command';
|
|
7
7
|
export * from './config';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Externals, Minify, Platform } from '../config';
|
|
1
|
+
import type { Externals, Minify, Platform } from '../config';
|
|
2
2
|
export type LegacyBuildPreset = 'npm-library' | 'npm-library-with-umd' | 'npm-component' | 'npm-component-with-umd';
|
|
3
3
|
export type LegacyFormat = 'esm' | 'cjs' | 'umd';
|
|
4
4
|
export type LegacyTarget = 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'esnext';
|
package/dist/utils/dts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BuildType, GeneratorDtsConfig, ITsconfig, TsTarget } from '../types';
|
|
2
2
|
export declare const getProjectTsconfig: (tsconfigPath: string, resolutionContext?: Record<string, boolean>) => Promise<ITsconfig>;
|
|
3
3
|
export declare function detectTSVersion(appDirectory?: string): Promise<number | undefined>;
|
|
4
4
|
export declare const getTscBinPath: (appDirectory: string) => Promise<string>;
|
package/dist/utils/dts.js
CHANGED
|
@@ -37,11 +37,11 @@ __export(dts_exports, {
|
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(dts_exports);
|
|
39
39
|
var import_path = require("path");
|
|
40
|
+
var import_napi = require("@ast-grep/napi");
|
|
40
41
|
var import_utils = require("@modern-js/utils");
|
|
41
42
|
var import_lodash = require("@modern-js/utils/lodash");
|
|
42
|
-
var import_magic_string = __toESM(require("magic-string"));
|
|
43
43
|
var import_tsconfig_paths = require("@modern-js/utils/tsconfig-paths");
|
|
44
|
-
var
|
|
44
|
+
var import_magic_string = __toESM(require("magic-string"));
|
|
45
45
|
var import_builder = require("./builder");
|
|
46
46
|
const getProjectTsconfig = async (tsconfigPath, resolutionContext = {}) => {
|
|
47
47
|
if (!import_utils.fs.existsSync(tsconfigPath)) {
|
|
@@ -56,7 +56,7 @@ const getProjectTsconfig = async (tsconfigPath, resolutionContext = {}) => {
|
|
|
56
56
|
if (!tsConfig.extends) {
|
|
57
57
|
return tsConfig;
|
|
58
58
|
}
|
|
59
|
-
const extendsResolutionTarget = tsConfig.extends
|
|
59
|
+
const extendsResolutionTarget = Array.isArray(tsConfig.extends) ? tsConfig.extends : [
|
|
60
60
|
tsConfig.extends
|
|
61
61
|
];
|
|
62
62
|
const resolveParentTsConfigPromises = extendsResolutionTarget.map(async (target) => {
|
package/dist/utils/input.d.ts
CHANGED
package/dist/utils/map.js
CHANGED
|
@@ -32,8 +32,8 @@ __export(map_exports, {
|
|
|
32
32
|
normalizeSourceMap: () => normalizeSourceMap
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(map_exports);
|
|
35
|
-
var import_convert_source_map = __toESM(require("convert-source-map"));
|
|
36
35
|
var import_remapping = __toESM(require("@ampproject/remapping"));
|
|
36
|
+
var import_convert_source_map = __toESM(require("convert-source-map"));
|
|
37
37
|
function normalizeSourceMap(map, opts) {
|
|
38
38
|
if ((opts === null || opts === void 0 ? void 0 : opts.needSourceMap) === false || !map) {
|
|
39
39
|
return void 0;
|
package/dist/utils/print.d.ts
CHANGED
package/dist/utils/print.js
CHANGED
|
@@ -91,7 +91,7 @@ const prettyBytes = (bytes) => {
|
|
|
91
91
|
"YB"
|
|
92
92
|
];
|
|
93
93
|
const exp = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
94
|
-
return `${(bytes /
|
|
94
|
+
return `${(bytes / 1024 ** exp).toFixed(1)} ${unit[exp]}`;
|
|
95
95
|
};
|
|
96
96
|
const printBundleFiles = () => {
|
|
97
97
|
if (bundleFiles.length === 0) {
|
package/dist/utils/style.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PartialBaseBuildConfig, PostcssOptions,
|
|
1
|
+
import type { LessOptions, PartialBaseBuildConfig, PostcssOptions, SassOptions } from '../types';
|
|
2
2
|
export declare const getLessConfig: (config: PartialBaseBuildConfig) => Promise<LessOptions>;
|
|
3
3
|
export declare const getSassConfig: (config: PartialBaseBuildConfig) => Promise<SassOptions>;
|
|
4
4
|
export declare const getPostcssConfig: (config: PartialBaseBuildConfig) => Promise<PostcssOptions & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/module-tools",
|
|
3
|
-
"version": "2.58.
|
|
3
|
+
"version": "2.58.3",
|
|
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/
|
|
74
|
-
"@modern-js/
|
|
75
|
-
"@modern-js/plugin-changeset": "2.58.
|
|
76
|
-
"@modern-js/plugin-i18n": "2.58.
|
|
77
|
-
"@modern-js/
|
|
78
|
-
"@modern-js/
|
|
79
|
-
"@modern-js/utils": "2.58.
|
|
73
|
+
"@modern-js/plugin": "2.58.3",
|
|
74
|
+
"@modern-js/core": "2.58.3",
|
|
75
|
+
"@modern-js/plugin-changeset": "2.58.3",
|
|
76
|
+
"@modern-js/plugin-i18n": "2.58.3",
|
|
77
|
+
"@modern-js/types": "2.58.3",
|
|
78
|
+
"@modern-js/plugin-lint": "2.58.3",
|
|
79
|
+
"@modern-js/utils": "2.58.3"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@rsbuild/core": "1.0.1-beta.
|
|
82
|
+
"@rsbuild/core": "1.0.1-beta.14",
|
|
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.58.
|
|
87
|
-
"@scripts/
|
|
88
|
-
"@scripts/
|
|
86
|
+
"@modern-js/self": "npm:@modern-js/module-tools@2.58.3",
|
|
87
|
+
"@scripts/vitest-config": "2.58.3",
|
|
88
|
+
"@scripts/build": "2.58.3"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"typescript": "^4 || ^5"
|
package/shims/cjs.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable node/prefer-global/url */
|
|
2
|
-
/* eslint-disable no-undef */
|
|
3
1
|
// taking from https://github.com/egoist/tsup/blob/dev/assets/cjs_shims.js
|
|
4
2
|
|
|
5
3
|
// Shim globals in cjs bundle
|
|
@@ -10,8 +8,7 @@
|
|
|
10
8
|
const getImportMetaUrl = () =>
|
|
11
9
|
typeof document === 'undefined'
|
|
12
10
|
? new URL(`file:${__filename}`).href
|
|
13
|
-
:
|
|
14
|
-
new URL('main.js', document.baseURI).href;
|
|
11
|
+
: document.currentScript?.src || new URL('main.js', document.baseURI).href;
|
|
15
12
|
|
|
16
13
|
// define importMetaUrl
|
|
17
14
|
export const importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
package/shims/esm.js
CHANGED
package/vitest.config.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
2
|
-
import { withTestPreset } from '@scripts/vitest-config';
|
|
3
1
|
import path from 'path';
|
|
2
|
+
import { withTestPreset } from '@scripts/vitest-config';
|
|
3
|
+
import { defineConfig } from 'vitest/config';
|
|
4
4
|
|
|
5
5
|
const config = defineConfig({
|
|
6
6
|
resolve: {
|
|
7
7
|
alias: {
|
|
8
8
|
'~': path.resolve(__dirname),
|
|
9
9
|
'@': path.resolve(__dirname, 'src'),
|
|
10
|
-
}
|
|
10
|
+
},
|
|
11
11
|
},
|
|
12
12
|
test: {
|
|
13
13
|
root: __dirname,
|