@modern-js/module-tools 0.0.0-nightly-20231218170633 → 0.0.0-nightly-20231219170633

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.
Files changed (91) hide show
  1. package/dist/builder/clear.js +21 -14
  2. package/dist/builder/esbuild/adapter.js +1 -1
  3. package/dist/utils/dts.js +9 -2
  4. package/package.json +14 -14
  5. package/dist/build.d.ts +0 -3
  6. package/dist/builder/build.d.ts +0 -13
  7. package/dist/builder/clear.d.ts +0 -2
  8. package/dist/builder/copy.d.ts +0 -17
  9. package/dist/builder/dts/index.d.ts +0 -2
  10. package/dist/builder/dts/rollup.d.ts +0 -4
  11. package/dist/builder/dts/tsc.d.ts +0 -3
  12. package/dist/builder/esbuild/adapter.d.ts +0 -3
  13. package/dist/builder/esbuild/hook.d.ts +0 -4
  14. package/dist/builder/esbuild/index.d.ts +0 -35
  15. package/dist/builder/esbuild/resolve.d.ts +0 -18
  16. package/dist/builder/esbuild/sourcemap.d.ts +0 -16
  17. package/dist/builder/esbuild/transform.d.ts +0 -7
  18. package/dist/builder/esbuild/watch.d.ts +0 -2
  19. package/dist/builder/esbuild/write-file.d.ts +0 -2
  20. package/dist/builder/feature/asset.d.ts +0 -19
  21. package/dist/builder/feature/format-cjs.d.ts +0 -5
  22. package/dist/builder/feature/index.d.ts +0 -2
  23. package/dist/builder/feature/json.d.ts +0 -5
  24. package/dist/builder/feature/redirect.d.ts +0 -5
  25. package/dist/builder/feature/style/index.d.ts +0 -5
  26. package/dist/builder/feature/style/lessAliasPlugin.d.ts +0 -12
  27. package/dist/builder/feature/style/lessRender.d.ts +0 -2
  28. package/dist/builder/feature/style/postcssTransformer.d.ts +0 -6
  29. package/dist/builder/feature/style/postcssUrlPlugin.d.ts +0 -6
  30. package/dist/builder/feature/style/sassRender.d.ts +0 -2
  31. package/dist/builder/feature/style/transformStyle.d.ts +0 -13
  32. package/dist/builder/feature/style/utils.d.ts +0 -18
  33. package/dist/builder/feature/swc.d.ts +0 -9
  34. package/dist/builder/feature/terser.d.ts +0 -5
  35. package/dist/builder/index.d.ts +0 -8
  36. package/dist/builder/platform.d.ts +0 -4
  37. package/dist/cli.d.ts +0 -3
  38. package/dist/command.d.ts +0 -7
  39. package/dist/config/defineConfig.d.ts +0 -8
  40. package/dist/config/merge.d.ts +0 -9
  41. package/dist/config/normalize.d.ts +0 -8
  42. package/dist/config/transformLegacyConfig.d.ts +0 -25
  43. package/dist/config/valid.d.ts +0 -3
  44. package/dist/constants/build.d.ts +0 -6
  45. package/dist/constants/color.d.ts +0 -4
  46. package/dist/constants/dts.d.ts +0 -2
  47. package/dist/constants/file.d.ts +0 -3
  48. package/dist/constants/legacy-preset.d.ts +0 -18
  49. package/dist/constants/loader.d.ts +0 -2
  50. package/dist/constants/log.d.ts +0 -3
  51. package/dist/constants/preset.d.ts +0 -26
  52. package/dist/debug.d.ts +0 -4
  53. package/dist/dev.d.ts +0 -6
  54. package/dist/error.d.ts +0 -33
  55. package/dist/hooks/build.d.ts +0 -22
  56. package/dist/hooks/dev.d.ts +0 -13
  57. package/dist/hooks/index.d.ts +0 -30
  58. package/dist/hooks/misc.d.ts +0 -13
  59. package/dist/index.d.ts +0 -7
  60. package/dist/locale/en.d.ts +0 -45
  61. package/dist/locale/index.d.ts +0 -92
  62. package/dist/locale/zh.d.ts +0 -45
  63. package/dist/plugins.d.ts +0 -2
  64. package/dist/types/color.d.ts +0 -1
  65. package/dist/types/command.d.ts +0 -12
  66. package/dist/types/config/copy.d.ts +0 -15
  67. package/dist/types/config/dev.d.ts +0 -8
  68. package/dist/types/config/index.d.ts +0 -166
  69. package/dist/types/config/style.d.ts +0 -64
  70. package/dist/types/context.d.ts +0 -5
  71. package/dist/types/dts.d.ts +0 -46
  72. package/dist/types/esbuild.d.ts +0 -107
  73. package/dist/types/hooks.d.ts +0 -31
  74. package/dist/types/index.d.ts +0 -27
  75. package/dist/types/legacyConfig/index.d.ts +0 -20
  76. package/dist/types/legacyConfig/output.d.ts +0 -61
  77. package/dist/types/legacyConfig/source.d.ts +0 -12
  78. package/dist/types/legacyConfig/tools.d.ts +0 -53
  79. package/dist/utils/assert.d.ts +0 -5
  80. package/dist/utils/builder.d.ts +0 -19
  81. package/dist/utils/common.d.ts +0 -5
  82. package/dist/utils/dts.d.ts +0 -10
  83. package/dist/utils/hash.d.ts +0 -2
  84. package/dist/utils/index.d.ts +0 -11
  85. package/dist/utils/input.d.ts +0 -8
  86. package/dist/utils/log.d.ts +0 -1
  87. package/dist/utils/map.d.ts +0 -13
  88. package/dist/utils/onExit.d.ts +0 -1
  89. package/dist/utils/outExtension.d.ts +0 -9
  90. package/dist/utils/print.d.ts +0 -14
  91. package/dist/utils/style.d.ts +0 -13
@@ -21,9 +21,11 @@ __export(clear_exports, {
21
21
  clearBuildConfigPaths: () => clearBuildConfigPaths
22
22
  });
23
23
  module.exports = __toCommonJS(clear_exports);
24
+ var import_path = require("path");
24
25
  var import_utils = require("@modern-js/utils");
25
26
  var import_locale = require("../locale");
26
27
  var import_utils2 = require("../utils");
28
+ var import_debug = require("../debug");
27
29
  const clearBuildConfigPaths = async (configs, projectAbsRootPath) => {
28
30
  for (const config of configs) {
29
31
  if (projectAbsRootPath === config.outDir) {
@@ -31,20 +33,25 @@ const clearBuildConfigPaths = async (configs, projectAbsRootPath) => {
31
33
  } else {
32
34
  await import_utils.fs.remove(config.outDir);
33
35
  }
34
- if (config.buildType === "bundleless" && config.dts && // keep it same as https://github.com/web-infra-dev/modern.js/blob/main/packages/solutions/module-tools/src/builder/build.ts#L37
35
- await import_utils.fs.pathExists(config.tsconfig)) {
36
- const tscBinFile = await (0, import_utils2.getTscBinPath)(projectAbsRootPath);
37
- const childProgress = (0, import_utils.execa)(tscBinFile, [
38
- "--build",
39
- "--clean"
40
- ], {
41
- stdio: "pipe",
42
- cwd: projectAbsRootPath
43
- });
44
- try {
45
- await childProgress;
46
- } catch (e) {
47
- import_utils.logger.error(e);
36
+ if (config.buildType === "bundleless" && config.dts) {
37
+ const { compilerOptions } = await (0, import_utils2.getProjectTsconfig)(config.tsconfig);
38
+ const { composite, incremental, rootDir, tsBuildInfoFile = ".tsbuildinfo" } = compilerOptions || {};
39
+ if (!composite && !incremental) {
40
+ return;
41
+ }
42
+ const outDir = config.dts.distPath;
43
+ const tsconfigDir = (0, import_path.dirname)(config.tsconfig);
44
+ let tsbuildInfoFilePath = `${(0, import_path.basename)(config.tsconfig, ".json")}${tsBuildInfoFile}`;
45
+ if (rootDir) {
46
+ tsbuildInfoFilePath = (0, import_path.resolve)(outDir, (0, import_path.relative)((0, import_path.resolve)(tsconfigDir, rootDir), tsconfigDir), tsbuildInfoFilePath);
47
+ } else {
48
+ tsbuildInfoFilePath = (0, import_path.resolve)(outDir, tsbuildInfoFilePath);
49
+ }
50
+ (0, import_debug.debug)("clear tsbuildinfo");
51
+ if (await import_utils.fs.pathExists(tsbuildInfoFilePath)) {
52
+ await import_utils.fs.remove(tsbuildInfoFilePath);
53
+ } else {
54
+ (0, import_debug.debug)(`${tsbuildInfoFilePath} doesn't exist`);
48
55
  }
49
56
  }
50
57
  }
@@ -242,7 +242,7 @@ const adapterPlugin = (compiler) => {
242
242
  if (!item) {
243
243
  continue;
244
244
  }
245
- if (absPath.endsWith(".js")) {
245
+ if ((0, import_utils2.isJsExt)(absPath)) {
246
246
  compiler.emitAsset(absPath, {
247
247
  type: "chunk",
248
248
  contents: item.text,
package/dist/utils/dts.js CHANGED
@@ -144,12 +144,19 @@ ${footer}
144
144
  // users need to set esbuild out-extensions like { '.js': '.mjs' }
145
145
  filePath.replace(/\.d\.ts/, dtsExtension)
146
146
  );
147
- return import_utils.fs.writeFile(
147
+ const writeTask = import_utils.fs.writeFile(
148
148
  // only replace .d.ts, if tsc generate .d.m(c)ts, keep.
149
149
  finalPath,
150
150
  content
151
151
  );
152
- }));
152
+ const removeTask = import_utils.fs.remove(filePath);
153
+ return dtsExtension === ".d.ts" ? [
154
+ writeTask
155
+ ] : [
156
+ writeTask,
157
+ removeTask
158
+ ];
159
+ }).flat());
153
160
  };
154
161
  const printOrThrowDtsErrors = async (error, options) => {
155
162
  const { InternalDTSError } = await Promise.resolve().then(() => __toESM(require("../error")));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/module-tools",
3
- "version": "0.0.0-nightly-20231218170633",
3
+ "version": "0.0.0-nightly-20231219170633",
4
4
  "description": "Simple, powerful, high-performance modern npm package development solution.",
5
5
  "keywords": [
6
6
  "modern",
@@ -67,24 +67,24 @@
67
67
  "tapable": "2.2.1",
68
68
  "terser": "5.19.2",
69
69
  "tsconfig-paths-webpack-plugin": "4.1.0",
70
- "@modern-js/new-action": "0.0.0-nightly-20231218170633",
71
- "@modern-js/core": "0.0.0-nightly-20231218170633",
72
- "@modern-js/plugin": "0.0.0-nightly-20231218170633",
73
- "@modern-js/plugin-changeset": "0.0.0-nightly-20231218170633",
74
- "@modern-js/plugin-i18n": "0.0.0-nightly-20231218170633",
75
- "@modern-js/upgrade": "0.0.0-nightly-20231218170633",
76
- "@modern-js/types": "0.0.0-nightly-20231218170633",
77
- "@modern-js/plugin-lint": "0.0.0-nightly-20231218170633",
78
- "@modern-js/utils": "0.0.0-nightly-20231218170633"
70
+ "@modern-js/core": "0.0.0-nightly-20231219170633",
71
+ "@modern-js/plugin-changeset": "0.0.0-nightly-20231219170633",
72
+ "@modern-js/plugin-i18n": "0.0.0-nightly-20231219170633",
73
+ "@modern-js/plugin": "0.0.0-nightly-20231219170633",
74
+ "@modern-js/plugin-lint": "0.0.0-nightly-20231219170633",
75
+ "@modern-js/types": "0.0.0-nightly-20231219170633",
76
+ "@modern-js/upgrade": "0.0.0-nightly-20231219170633",
77
+ "@modern-js/utils": "0.0.0-nightly-20231219170633",
78
+ "@modern-js/new-action": "0.0.0-nightly-20231219170633"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@types/convert-source-map": "1.5.2",
82
82
  "@types/node": "^14",
83
83
  "typescript": "^5",
84
- "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231218170633",
85
- "@scripts/build": "0.0.0-nightly-20231218170633",
86
- "@scripts/vitest-config": "0.0.0-nightly-20231218170633",
87
- "@modern-js/self": "npm:@modern-js/module-tools@0.0.0-nightly-20231218170633"
84
+ "@modern-js/self": "npm:@modern-js/module-tools@0.0.0-nightly-20231219170633",
85
+ "@scripts/build": "0.0.0-nightly-20231219170633",
86
+ "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231219170633",
87
+ "@scripts/vitest-config": "0.0.0-nightly-20231219170633"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "typescript": "^4 || ^5"
package/dist/build.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { PluginAPI } from '@modern-js/core';
2
- import type { ModuleTools, ModuleContext, BuildCommandOptions } from './types';
3
- export declare const build: (api: PluginAPI<ModuleTools>, options: BuildCommandOptions, context: ModuleContext) => Promise<void>;
@@ -1,13 +0,0 @@
1
- import type { BuildCommandOptions, BaseBuildConfig, ModuleTools, PluginAPI, DTSOptions, ModuleContext } from '../types';
2
- export declare const runBuildTask: (options: {
3
- buildConfig: BaseBuildConfig;
4
- buildCmdOptions: BuildCommandOptions;
5
- context: ModuleContext;
6
- }, api: PluginAPI<ModuleTools>) => Promise<void>;
7
- export declare const generatorDts: (config: BaseBuildConfig, api: PluginAPI<ModuleTools>, options: {
8
- watch: boolean;
9
- dts: DTSOptions;
10
- }) => Promise<void>;
11
- export declare const buildLib: (config: BaseBuildConfig, api: PluginAPI<ModuleTools>, options: {
12
- watch: boolean;
13
- }) => Promise<void>;
@@ -1,2 +0,0 @@
1
- import type { BaseBuildConfig } from '../types';
2
- export declare const clearBuildConfigPaths: (configs: BaseBuildConfig[], projectAbsRootPath: string) => Promise<void>;
@@ -1,17 +0,0 @@
1
- import { watch } from '@modern-js/utils';
2
- import type { CopyOptions, CopyPattern } from '../types/config/copy';
3
- import type { BaseBuildConfig } from '../types/config';
4
- export declare const runPatterns: (pattern: CopyPattern, options: {
5
- appDirectory: string;
6
- enableCopySync?: boolean;
7
- outDir: string;
8
- defaultContext: string;
9
- watch?: boolean;
10
- }) => Promise<void>;
11
- export declare const watchCopyFiles: (options: {
12
- appDirectory: string;
13
- }, copyConfig: CopyOptions) => Promise<void>;
14
- export declare const copyTask: (buildConfig: BaseBuildConfig, options: {
15
- appDirectory: string;
16
- watch?: boolean;
17
- }) => Promise<void>;
@@ -1,2 +0,0 @@
1
- export { runRollup } from './rollup';
2
- export { runTsc } from './tsc';
@@ -1,4 +0,0 @@
1
- import type { RollupWatcher } from '../../../compiled/rollup';
2
- import type { GeneratorDtsConfig, PluginAPI, ModuleTools } from '../../types';
3
- export type { RollupWatcher };
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 +0,0 @@
1
- import type { GeneratorDtsConfig, PluginAPI, ModuleTools } from '../../types';
2
- export declare const removeTscLogTime: (log: string) => string;
3
- export declare const runTsc: (api: PluginAPI<ModuleTools>, config: GeneratorDtsConfig) => Promise<void>;
@@ -1,3 +0,0 @@
1
- import { Plugin } from 'esbuild';
2
- import type { ICompiler } from '../../types';
3
- export declare const adapterPlugin: (compiler: ICompiler) => Plugin;
@@ -1,4 +0,0 @@
1
- import * as tapable from 'tapable';
2
- import { Source, Chunk, ICompiler } from '../../types';
3
- export declare function createTransformHook(compiler: ICompiler): tapable.AsyncSeriesWaterfallHook<Source, tapable.UnsetAdditionalOptions>;
4
- export declare function createRenderChunkHook(compiler: ICompiler): tapable.AsyncSeriesWaterfallHook<Chunk, tapable.UnsetAdditionalOptions>;
@@ -1,35 +0,0 @@
1
- import { BuildResult, BuildOptions, BuildContext, ImportKind } from 'esbuild';
2
- import { FSWatcher } from '@modern-js/utils';
3
- import { BaseBuildConfig, BuilderHooks, Chunk, ICompiler, ModuleTools, PluginAPI, Context, HookList } from '../../types';
4
- import { TransformContext } from './transform';
5
- import { SourcemapContext } from './sourcemap';
6
- export declare class EsbuildCompiler implements ICompiler {
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
- }
35
- export declare const createCompiler: (context: Context) => Promise<EsbuildCompiler>;
@@ -1,18 +0,0 @@
1
- import { ImportKind, Platform } from 'esbuild';
2
- /**
3
- * supports require js plugin in less file
4
- */
5
- export declare const cssExtensions: string[];
6
- export declare const createJsResolver: (options: ResolverOptions) => (id: string, dir: string, kind?: ImportKind) => string | false;
7
- export declare const createCssResolver: (options: ResolverOptions) => (id: string, dir: string, kind?: ImportKind) => string;
8
- interface ResolverOptions {
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
- }
18
- export {};
@@ -1,16 +0,0 @@
1
- import { SourceMap, ISourcemapContext } from '../../types';
2
- export declare class SourcemapContext implements ISourcemapContext {
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 +0,0 @@
1
- import { ITransformContext, CacheValue } from '../../types';
2
- import { SourcemapContext } from './sourcemap';
3
- export declare class TransformContext extends SourcemapContext implements ITransformContext {
4
- private cachedTransformResult;
5
- addTransformResult(pluginId: number, result: CacheValue): void;
6
- getValidCache(pluginId: number, code: string): CacheValue | undefined;
7
- }
@@ -1,2 +0,0 @@
1
- import { ICompiler } from '../../types';
2
- export declare const initWatcher: (compiler: ICompiler) => void;
@@ -1,2 +0,0 @@
1
- import { ICompiler } from '../../types';
2
- export declare const writeFile: (compiler: ICompiler) => Promise<void>;
@@ -1,19 +0,0 @@
1
- /// <reference types="node" />
2
- import { ICompiler, LoadResult, SvgrOptions } from '../../types';
3
- export declare const asset: {
4
- name: string;
5
- apply(compiler: ICompiler): void;
6
- };
7
- /**
8
- *
9
- * @param this Compiler
10
- * @param assetPath Absolute path of the asset
11
- * @param rebaseFrom Absolute path of the file which use asset
12
- * @param calledOnLoad called in load hooks
13
- * @returns dataurl or path
14
- */
15
- export declare function getAssetContents(this: ICompiler, assetPath: string, rebaseFrom: string, calledOnLoad?: boolean): Promise<{
16
- contents: string | Buffer;
17
- loader: "copy" | "text";
18
- }>;
19
- export declare function loadSvgr(path: string, options: boolean | SvgrOptions): Promise<LoadResult | undefined>;
@@ -1,5 +0,0 @@
1
- import { ICompiler } from '../../types';
2
- export declare const formatCjs: {
3
- name: string;
4
- apply: (compiler: ICompiler) => void;
5
- };
@@ -1,2 +0,0 @@
1
- import { HookList, Context } from '../../types';
2
- export declare function getInternalList(context: Context): Promise<HookList>;
@@ -1,5 +0,0 @@
1
- import { ICompiler } from '../../types';
2
- export declare const json: {
3
- name: string;
4
- apply(compiler: ICompiler): void;
5
- };
@@ -1,5 +0,0 @@
1
- import { ICompiler } from '../../types';
2
- export declare const redirect: {
3
- name: string;
4
- apply(compiler: ICompiler): void;
5
- };
@@ -1,5 +0,0 @@
1
- import { ICompiler } from '../../../types';
2
- export declare const css: {
3
- name: string;
4
- apply(compiler: ICompiler): void;
5
- };
@@ -1,12 +0,0 @@
1
- import { ICompiler } from '../../../types';
2
- interface Options {
3
- compiler: ICompiler;
4
- stdinDir: string;
5
- }
6
- export default class LessAliasesPlugin {
7
- compiler: ICompiler;
8
- stdinDir: string;
9
- constructor(options: Options);
10
- install(less: any, pluginManager: any): void;
11
- }
12
- export {};
@@ -1,2 +0,0 @@
1
- import { PreprocessRender } from './transformStyle';
2
- export declare const lessRender: PreprocessRender;
@@ -1,6 +0,0 @@
1
- import { ICompiler } from '../../../types';
2
- export declare const isCssModule: (filePath: string, autoModules: boolean | RegExp) => boolean;
3
- export declare const postcssTransformer: (css: string, entryPath: string, compilation: ICompiler) => Promise<{
4
- code: string;
5
- loader: 'js' | 'css';
6
- }>;
@@ -1,6 +0,0 @@
1
- import { Plugin } from 'postcss';
2
- import { ICompiler } from '../../../types';
3
- export declare const postcssUrlPlugin: (options: {
4
- entryPath: string;
5
- compilation: ICompiler;
6
- }) => Plugin;
@@ -1,2 +0,0 @@
1
- import { PreprocessRender } from './transformStyle';
2
- export declare const sassRender: PreprocessRender;
@@ -1,13 +0,0 @@
1
- /// <reference types="node" />
2
- import { PartialMessage } from 'esbuild';
3
- import { ICompiler, Source } from '../../../types';
4
- export type PreprocessRender = (content: string, stdinPath: string, stdinDir: string, preprocessOptions: any, resolvePathMap: Map<string, string>, implementation?: object | string) => Promise<{
5
- css: Buffer | string;
6
- errors?: PartialMessage[];
7
- warnings?: PartialMessage[];
8
- map?: Buffer | string;
9
- }>;
10
- export declare function transformStyle(this: ICompiler, source: Source): Promise<{
11
- code: string;
12
- loader: "js" | "css";
13
- }>;
@@ -1,18 +0,0 @@
1
- /**
2
- * make sure load processor in user project root other than root
3
- * @param lang
4
- * @param root
5
- * @returns
6
- */
7
- export declare function loadProcessor(lang: string, root: string, implementation?: object | string): any;
8
- type CssUrlReplacer = (url: string, importer?: string) => string | Promise<string>;
9
- /**
10
- * relative url() inside \@imported sass and less files must be rebased to use
11
- * root file as base.
12
- */
13
- export declare function rebaseUrls(filepath: string, rootDir: string, resolver: (id: string, dir: string) => string): Promise<{
14
- file: string;
15
- contents?: string;
16
- }>;
17
- export declare function rewriteCssUrls(css: string, type: false | string, replacer: CssUrlReplacer): Promise<string>;
18
- export {};
@@ -1,9 +0,0 @@
1
- import type { ICompiler, ITsconfig } from '../../types';
2
- export declare const swcTransform: (userTsconfig: ITsconfig) => {
3
- name: string;
4
- apply(compiler: ICompiler): void;
5
- };
6
- export declare const swcRenderChunk: {
7
- name: string;
8
- apply(compiler: ICompiler): void;
9
- };
@@ -1,5 +0,0 @@
1
- import { ICompiler } from '../../types';
2
- export declare const minify: {
3
- name: string;
4
- apply: (compiler: ICompiler) => void;
5
- };
@@ -1,8 +0,0 @@
1
- import type { PluginAPI } from '@modern-js/core';
2
- import type { ModuleContext } from '../types/context';
3
- import type { BuildCommandOptions, BaseBuildConfig, ModuleTools } from '../types';
4
- export declare const run: (options: {
5
- cmdOptions: BuildCommandOptions;
6
- normalizedBuildConfig: BaseBuildConfig[];
7
- context: ModuleContext;
8
- }, api: PluginAPI<ModuleTools>) => Promise<void>;
@@ -1,4 +0,0 @@
1
- import { PluginAPI } from '@modern-js/core';
2
- import { ModuleContext } from '../types/context';
3
- import { BuildCommandOptions, ModuleTools } from '../types';
4
- export declare const buildPlatform: (options: BuildCommandOptions, api: PluginAPI<ModuleTools>, context: ModuleContext) => Promise<void>;
package/dist/cli.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { CliPlugin } from '@modern-js/core';
2
- import type { ModuleTools } from './types';
3
- export declare const moduleTools: () => CliPlugin<ModuleTools>;
package/dist/command.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { Command } from '@modern-js/utils';
2
- import type { PluginAPI } from '@modern-js/core';
3
- import type { ModuleTools } from './types';
4
- export declare const buildCommand: (program: Command, api: PluginAPI<ModuleTools>) => Promise<void>;
5
- export declare const devCommand: (program: Command, api: PluginAPI<ModuleTools>) => Promise<void>;
6
- export declare const newCommand: (program: Command) => Promise<void>;
7
- export declare const upgradeCommand: (program: Command) => Promise<void>;
@@ -1,8 +0,0 @@
1
- import type { UserConfigExport } from '@modern-js/core';
2
- import type { ModuleConfigParams, ModuleLegacyUserConfig } from '../types';
3
- export declare const defineConfig: (config: UserConfigExport<ModuleConfigParams>) => UserConfigExport<ModuleConfigParams>;
4
- /**
5
- * @deprecated
6
- * Using defineConfig first.
7
- */
8
- export declare const defineLegacyConfig: (config: ModuleLegacyUserConfig) => ModuleLegacyUserConfig;
@@ -1,9 +0,0 @@
1
- import { ModuleContext } from '../types';
2
- import type { BaseBuildConfig, PartialBaseBuildConfig, ModuleLegacyUserConfig, BuildCommandOptions } from '../types';
3
- export declare const mergeDefaultBaseConfig: (pConfig: PartialBaseBuildConfig, options: {
4
- context: ModuleContext;
5
- buildCmdOptions: BuildCommandOptions;
6
- }) => Promise<BaseBuildConfig>;
7
- export declare const isLegacyUserConfig: (config: {
8
- legacy?: boolean;
9
- }) => config is ModuleLegacyUserConfig;
@@ -1,8 +0,0 @@
1
- import type { ModuleUserConfig, BaseBuildConfig, BuildPreset, PartialBuildConfig, PartialBaseBuildConfig, ModuleContext, BuildCommandOptions } from '../types';
2
- export declare const presetToConfig: (preset?: BuildPreset) => Promise<PartialBaseBuildConfig[] | undefined>;
3
- export declare const mergeConfig: (low?: PartialBaseBuildConfig[], high?: PartialBuildConfig) => PartialBaseBuildConfig[];
4
- export declare const normalizeBuildConfig: (resolvedConfig: ModuleUserConfig, context: ModuleContext, buildCmdOptions: BuildCommandOptions) => Promise<BaseBuildConfig[]>;
5
- export declare const transformToAbsPath: (baseConfig: BaseBuildConfig, options: {
6
- context: ModuleContext;
7
- buildCmdOptions: BuildCommandOptions;
8
- }) => Promise<BaseBuildConfig>;
@@ -1,25 +0,0 @@
1
- import type { ModuleUserConfig, ModuleToolsLegacyUserConfig, PartialBaseBuildConfig } from '../types';
2
- /**
3
- * transform `tools` to buildConfig
4
- * include tools.less/sass/postcss/tailwindcss
5
- * @param buildConfig PartialBaseBuildConfig
6
- * @param legacyUserConfig Readonly<ModuleToolsLegacyUserConfig>
7
- */
8
- export declare const transformToolsToBuildConfig: (buildConfig: PartialBaseBuildConfig, legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>) => void;
9
- /**
10
- * transform `source` to buildConfig
11
- *
12
- * @param buildConfig PartialBaseBuildConfig
13
- * @param legacyUserConfig Readonly<ModuleToolsLegacyUserConfig>
14
- *
15
- * NB: ignore source.designSystem in this function
16
- */
17
- export declare const transformSourceToBuildConfig: (buildConfig: PartialBaseBuildConfig, legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>) => void;
18
- export declare const transformOutputToBuildConfig: (buildConfig: PartialBaseBuildConfig, legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>) => void;
19
- export declare const commonTransformAndLog: (legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>) => Promise<ModuleUserConfig>;
20
- export declare const createConfigByBuildConfig: (legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>) => Promise<ModuleUserConfig>;
21
- export declare const createConfigByBuildPreset: (legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>) => Promise<ModuleUserConfig>;
22
- export declare const createConfigByPackageFields: (legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>) => Promise<ModuleUserConfig>;
23
- export declare const createConfigByPackageMode: (legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>) => Promise<ModuleUserConfig>;
24
- export declare const createConfigByDefault: (legacyUserConfig: Readonly<ModuleToolsLegacyUserConfig>) => Promise<ModuleUserConfig>;
25
- export declare const createUserConfigFromLegacy: (config: Readonly<ModuleToolsLegacyUserConfig>) => Promise<ModuleUserConfig>;
@@ -1,3 +0,0 @@
1
- import type { PartialBuildConfig, PartialBaseBuildConfig } from '../types';
2
- export declare const validPartialBuildConfig: (config: PartialBuildConfig, appDirectory: string) => void;
3
- export declare const validBuildConfig: (config: PartialBaseBuildConfig, appDirectory: string) => void;
@@ -1,6 +0,0 @@
1
- import type { BaseBuildConfig } from '../types';
2
- export declare const getDefaultBuildConfig: () => Readonly<BaseBuildConfig>;
3
- /**
4
- * supports require js plugin in less file
5
- */
6
- export declare const cssExtensions: string[];
@@ -1,4 +0,0 @@
1
- import type { RGB } from '../types/color';
2
- export declare const green: RGB;
3
- export declare const blue: RGB;
4
- export declare const gray: RGB;
@@ -1,2 +0,0 @@
1
- export declare const defaultTransformedFunctions: string[];
2
- export declare const watchDoneText = "Watching for file changes";
@@ -1,3 +0,0 @@
1
- export declare const styleExts: string[];
2
- export declare const dtsAliasExts: string[];
3
- export declare const assetExt: string[];
@@ -1,18 +0,0 @@
1
- import type { PartialBuildConfig } from '../types';
2
- export declare const universalJsPreset: PartialBuildConfig;
3
- export declare const universalJsLitePreset: PartialBuildConfig;
4
- export declare const browserJsPreset: PartialBuildConfig;
5
- export declare const browserJsLitePreset: PartialBuildConfig;
6
- export declare const nodeJsPreset: PartialBuildConfig;
7
- export declare const legacyPresets: {
8
- 'universal-js': import("../types").PartialBaseBuildConfig[];
9
- UNIVERSAL_JS: import("../types").PartialBaseBuildConfig[];
10
- 'universal-js-lite': import("../types").PartialBaseBuildConfig[];
11
- UNIVERSAL_JS_LITE: import("../types").PartialBaseBuildConfig[];
12
- 'browser-js': import("../types").PartialBaseBuildConfig[];
13
- BROWSER_JS: import("../types").PartialBaseBuildConfig[];
14
- 'browser-js-lite': import("../types").PartialBaseBuildConfig[];
15
- BROWSER_JS_LITE: import("../types").PartialBaseBuildConfig[];
16
- 'node-js': import("../types").PartialBaseBuildConfig[];
17
- NODE_JS: import("../types").PartialBaseBuildConfig[];
18
- };
@@ -1,2 +0,0 @@
1
- import type { Loader } from 'esbuild';
2
- export declare const loaderMap: Record<string, Loader>;
@@ -1,3 +0,0 @@
1
- export declare const buildSuccessText = "Build succeed";
2
- export declare const reportFile1LineText = "Bundle Files";
3
- export declare const reportFile2LineText = "Size";
@@ -1,26 +0,0 @@
1
- import type { PartialBaseBuildConfig, Target } from '../types';
2
- export declare const targets: Target[];
3
- export declare const npmLibraryPresetConfig: PartialBaseBuildConfig[];
4
- export declare const npmLibraryWithUmdPresetConfig: PartialBaseBuildConfig[];
5
- export declare const npmComponentPresetConfig: PartialBaseBuildConfig[];
6
- export declare const npmComponentWithUmdPresetConfig: PartialBaseBuildConfig[];
7
- export declare const libraryPreset: {
8
- 'npm-library': PartialBaseBuildConfig[];
9
- };
10
- export declare const libraryPresetWithTarget: Record<"npm-library-es6" | "npm-library-esnext" | "npm-library-es5" | "npm-library-es2015" | "npm-library-es2016" | "npm-library-es2017" | "npm-library-es2018" | "npm-library-es2019" | "npm-library-es2020" | "npm-library-es2021" | "npm-library-es2022", PartialBaseBuildConfig[]>;
11
- export declare const libraryUmdPreset: {
12
- 'npm-library-with-umd': PartialBaseBuildConfig[];
13
- };
14
- export declare const libraryUmdPresetWithTarget: Record<"npm-library-with-umd-es6" | "npm-library-with-umd-esnext" | "npm-library-with-umd-es5" | "npm-library-with-umd-es2015" | "npm-library-with-umd-es2016" | "npm-library-with-umd-es2017" | "npm-library-with-umd-es2018" | "npm-library-with-umd-es2019" | "npm-library-with-umd-es2020" | "npm-library-with-umd-es2021" | "npm-library-with-umd-es2022", PartialBaseBuildConfig[]>;
15
- export declare const componentPreset: {
16
- 'npm-component': PartialBaseBuildConfig[];
17
- };
18
- export declare const componentPresetWithTarget: Record<"npm-component-es6" | "npm-component-esnext" | "npm-component-es5" | "npm-component-es2015" | "npm-component-es2016" | "npm-component-es2017" | "npm-component-es2018" | "npm-component-es2019" | "npm-component-es2020" | "npm-component-es2021" | "npm-component-es2022", PartialBaseBuildConfig[]>;
19
- export declare const componentUmdPreset: {
20
- 'npm-component-with-umd': PartialBaseBuildConfig[];
21
- };
22
- export declare const componentUmdPresetWithTarget: Record<"npm-component-with-umd-es6" | "npm-component-with-umd-esnext" | "npm-component-with-umd-es5" | "npm-component-with-umd-es2015" | "npm-component-with-umd-es2016" | "npm-component-with-umd-es2017" | "npm-component-with-umd-es2018" | "npm-component-with-umd-es2019" | "npm-component-with-umd-es2020" | "npm-component-with-umd-es2021" | "npm-component-with-umd-es2022", PartialBaseBuildConfig[]>;
23
- export declare const nodeBuildConfig: PartialBaseBuildConfig[];
24
- export declare const universalBuildConfig: PartialBaseBuildConfig[];
25
- export declare const presetList: Record<string, PartialBaseBuildConfig[]>;
26
- export declare const internalPreset: Record<string, PartialBaseBuildConfig[]>;
package/dist/debug.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { debug as Debugger } from '@modern-js/utils';
2
- export declare const debug: Debugger.Debugger;
3
- export declare const label: (info: string) => string;
4
- export declare const debugResolve: Debugger.Debugger;