@modern-js/module-tools 2.0.0-beta.0 → 2.0.0-beta.2
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/CHANGELOG.md +102 -0
- package/dist/js/modern/cli/build.js +2 -1
- package/dist/js/modern/cli/dev.js +2 -2
- package/dist/js/modern/cli/new.js +0 -3
- package/dist/js/modern/commands/build.js +2 -6
- package/dist/js/modern/commands/dev.js +2 -5
- package/dist/js/modern/features/build/build-platform.js +11 -14
- package/dist/js/modern/features/build/bundle/runRollup.js +5 -18
- package/dist/js/modern/features/build/bundle/runSpeedy.js +6 -18
- package/dist/js/modern/features/build/bundleless/copy-assets.js +0 -8
- package/dist/js/modern/features/build/bundleless/generator-dts/index.js +7 -17
- package/dist/js/modern/features/build/bundleless/generator-dts/utils.js +6 -16
- package/dist/js/modern/features/build/bundleless/index.js +0 -2
- package/dist/js/modern/features/build/bundleless/runBabel.js +7 -34
- package/dist/js/modern/features/build/bundleless/style.js +1 -30
- package/dist/js/modern/features/build/constants.js +0 -3
- package/dist/js/modern/features/build/error.js +4 -27
- package/dist/js/modern/features/build/index.js +6 -15
- package/dist/js/modern/features/build/legacy-constants.js +8 -4
- package/dist/js/modern/features/build/logger/logText.js +0 -12
- package/dist/js/modern/features/build/logger/loggerManager.js +6 -19
- package/dist/js/modern/features/build/normalize.js +18 -43
- package/dist/js/modern/features/build/utils.js +5 -14
- package/dist/js/modern/features/dev/index.js +4 -9
- package/dist/js/modern/hooks/index.js +0 -3
- package/dist/js/modern/index.js +11 -11
- package/dist/js/modern/schema/build-config.js +2 -1
- package/dist/js/modern/schema/output.js +16 -10
- package/dist/js/modern/utils/babel.js +17 -15
- package/dist/js/modern/utils/copy.js +6 -15
- package/dist/js/modern/utils/init-env.js +0 -1
- package/dist/js/modern/utils/logger.js +1 -16
- package/dist/js/modern/utils/readline.js +2 -4
- package/dist/js/modern/utils/tsconfig.js +0 -1
- package/dist/js/modern/utils/tspaths-transform/constants.js +4 -2
- package/dist/js/modern/utils/tspaths-transform/index.js +2 -19
- package/dist/js/modern/utils/tspaths-transform/utils.js +0 -3
- package/dist/js/modern/utils/valide.js +10 -12
- package/dist/js/node/cli/build.js +2 -6
- package/dist/js/node/cli/dev.js +2 -7
- package/dist/js/node/cli/index.js +0 -6
- package/dist/js/node/cli/new.js +0 -8
- package/dist/js/node/commands/build.js +2 -21
- package/dist/js/node/commands/dev.js +2 -15
- package/dist/js/node/commands/index.js +0 -2
- package/dist/js/node/features/build/build-platform.js +11 -20
- package/dist/js/node/features/build/bundle/index.js +0 -6
- package/dist/js/node/features/build/bundle/runRollup.js +3 -32
- package/dist/js/node/features/build/bundle/runSpeedy.js +6 -32
- package/dist/js/node/features/build/bundleless/copy-assets.js +0 -20
- package/dist/js/node/features/build/bundleless/generator-dts/index.js +7 -27
- package/dist/js/node/features/build/bundleless/generator-dts/utils.js +6 -32
- package/dist/js/node/features/build/bundleless/index.js +0 -11
- package/dist/js/node/features/build/bundleless/runBabel.js +6 -60
- package/dist/js/node/features/build/bundleless/style.js +1 -50
- package/dist/js/node/features/build/constants.js +0 -11
- package/dist/js/node/features/build/error.js +4 -40
- package/dist/js/node/features/build/index.js +6 -38
- package/dist/js/node/features/build/legacy-constants.js +8 -4
- package/dist/js/node/features/build/logger/index.js +0 -4
- package/dist/js/node/features/build/logger/logText.js +0 -18
- package/dist/js/node/features/build/logger/loggerManager.js +5 -26
- package/dist/js/node/features/build/normalize.js +18 -61
- package/dist/js/node/features/build/utils.js +5 -30
- package/dist/js/node/features/dev/index.js +4 -17
- package/dist/js/node/hooks/build.js +0 -5
- package/dist/js/node/hooks/dev.js +0 -5
- package/dist/js/node/hooks/index.js +0 -10
- package/dist/js/node/index.js +12 -36
- package/dist/js/node/locale/index.js +0 -5
- package/dist/js/node/schema/build-config.js +2 -1
- package/dist/js/node/schema/index.js +0 -5
- package/dist/js/node/schema/output.js +16 -12
- package/dist/js/node/utils/babel.js +17 -23
- package/dist/js/node/utils/color.js +0 -3
- package/dist/js/node/utils/copy.js +6 -23
- package/dist/js/node/utils/init-env.js +0 -3
- package/dist/js/node/utils/json.js +0 -2
- package/dist/js/node/utils/language.js +0 -3
- package/dist/js/node/utils/logger.js +1 -26
- package/dist/js/node/utils/readline.js +0 -8
- package/dist/js/node/utils/tsconfig.js +0 -7
- package/dist/js/node/utils/tspaths-transform/constants.js +4 -2
- package/dist/js/node/utils/tspaths-transform/index.js +2 -34
- package/dist/js/node/utils/tspaths-transform/utils.js +0 -7
- package/dist/js/node/utils/valide.js +10 -17
- package/dist/types/commands/build.d.ts +0 -1
- package/dist/types/features/build/logger/loggerManager.d.ts +0 -1
- package/dist/types/features/build/normalize.d.ts +1 -1
- package/dist/types/features/build/utils.d.ts +0 -1
- package/dist/types/hooks/build.d.ts +6 -6
- package/dist/types/hooks/index.d.ts +3 -3
- package/dist/types/index.d.ts +0 -3
- package/dist/types/schema/types.d.ts +1 -3
- package/dist/types/types.d.ts +0 -1
- package/dist/types/utils/babel.d.ts +2 -2
- package/dist/types/utils/valide.d.ts +2 -2
- package/package.json +22 -22
|
@@ -4,38 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.valideBeforeTask = exports.modernConfigValid = void 0;
|
|
7
|
-
|
|
8
7
|
var _utils = require("@modern-js/utils");
|
|
9
|
-
|
|
10
8
|
const valideBeforeTask = ({
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
10
|
modernConfig,
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
12
|
tsconfigPath
|
|
13
13
|
}) => {
|
|
14
|
-
const modernConfigValidResult = modernConfigValid(modernConfig, {
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
14
|
+
// const modernConfigValidResult = modernConfigValid(modernConfig, {
|
|
15
|
+
// tsconfigPath,
|
|
16
|
+
// });
|
|
17
|
+
// if (modernConfigValidResult) {
|
|
18
|
+
// console.error(modernConfigValidResult);
|
|
19
|
+
// // eslint-disable-next-line no-process-exit
|
|
20
|
+
// process.exit(0);
|
|
21
|
+
// }
|
|
23
22
|
};
|
|
24
|
-
|
|
25
23
|
exports.valideBeforeTask = valideBeforeTask;
|
|
26
|
-
|
|
27
24
|
const modernConfigValid = (modernConfig, option) => {
|
|
28
25
|
const valids = [_utils.validAlias];
|
|
29
|
-
|
|
30
26
|
for (const validFn of valids) {
|
|
31
27
|
const result = validFn(modernConfig, option);
|
|
32
|
-
|
|
33
28
|
if (result) {
|
|
34
29
|
return result;
|
|
35
30
|
}
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
return null;
|
|
39
33
|
};
|
|
40
|
-
|
|
41
34
|
exports.modernConfigValid = modernConfigValid;
|
|
@@ -2,7 +2,7 @@ import type { PluginAPI } from '@modern-js/core';
|
|
|
2
2
|
import type { BuildConfig, BaseBuildConfig, SourceMap } from '../../schema/types';
|
|
3
3
|
import type { IBuildFeatOption } from '../../types';
|
|
4
4
|
import type { NormalizedBuildConfig } from './types';
|
|
5
|
-
export declare const getNormalizeModuleConfigByPackageModeAndFileds: (api: PluginAPI, buildFeatOption: IBuildFeatOption) => BuildConfig;
|
|
5
|
+
export declare const getNormalizeModuleConfigByPackageModeAndFileds: (api: PluginAPI, buildFeatOption: IBuildFeatOption) => BuildConfig[];
|
|
6
6
|
export declare const getFinalTsconfig: (config: {
|
|
7
7
|
tsconfig?: string;
|
|
8
8
|
}, buildFeatOption: IBuildFeatOption) => string;
|
|
@@ -10,13 +10,13 @@ export declare const platformBuild: import("@modern-js/plugin").ParallelWorkflow
|
|
|
10
10
|
params: string[];
|
|
11
11
|
}>;
|
|
12
12
|
export declare const moduleLessConfig: import("@modern-js/plugin").AsyncPipeline<{
|
|
13
|
-
modernConfig: NormalizedConfig
|
|
13
|
+
modernConfig: NormalizedConfig<any>;
|
|
14
14
|
}, LessOption | undefined>;
|
|
15
15
|
export declare const moduleSassConfig: import("@modern-js/plugin").AsyncPipeline<{
|
|
16
|
-
modernConfig: NormalizedConfig
|
|
16
|
+
modernConfig: NormalizedConfig<any>;
|
|
17
17
|
}, SassOptions<"sync"> | undefined>;
|
|
18
18
|
export declare const moduleTailwindConfig: import("@modern-js/plugin").AsyncPipeline<{
|
|
19
|
-
modernConfig: NormalizedConfig
|
|
19
|
+
modernConfig: NormalizedConfig<any>;
|
|
20
20
|
}, any>;
|
|
21
21
|
export declare const buildHooks: {
|
|
22
22
|
platformBuild: import("@modern-js/plugin").ParallelWorkflow<PlatformBuildOption, {
|
|
@@ -26,13 +26,13 @@ export declare const buildHooks: {
|
|
|
26
26
|
params: string[];
|
|
27
27
|
}>;
|
|
28
28
|
moduleLessConfig: import("@modern-js/plugin").AsyncPipeline<{
|
|
29
|
-
modernConfig: NormalizedConfig
|
|
29
|
+
modernConfig: NormalizedConfig<any>;
|
|
30
30
|
}, LessOption | undefined>;
|
|
31
31
|
moduleSassConfig: import("@modern-js/plugin").AsyncPipeline<{
|
|
32
|
-
modernConfig: NormalizedConfig
|
|
32
|
+
modernConfig: NormalizedConfig<any>;
|
|
33
33
|
}, SassOptions<"sync"> | undefined>;
|
|
34
34
|
moduleTailwindConfig: import("@modern-js/plugin").AsyncPipeline<{
|
|
35
|
-
modernConfig: NormalizedConfig
|
|
35
|
+
modernConfig: NormalizedConfig<any>;
|
|
36
36
|
}, any>;
|
|
37
37
|
};
|
|
38
38
|
export declare const lifecycle: () => void;
|
|
@@ -18,13 +18,13 @@ export declare const hooks: {
|
|
|
18
18
|
params: string[];
|
|
19
19
|
}>;
|
|
20
20
|
moduleLessConfig: import("@modern-js/plugin").AsyncPipeline<{
|
|
21
|
-
modernConfig: import("@modern-js/core").NormalizedConfig
|
|
21
|
+
modernConfig: import("@modern-js/core").NormalizedConfig<any, {}, {}, {}>;
|
|
22
22
|
}, import("@modern-js/style-compiler").LessOption | undefined>;
|
|
23
23
|
moduleSassConfig: import("@modern-js/plugin").AsyncPipeline<{
|
|
24
|
-
modernConfig: import("@modern-js/core").NormalizedConfig
|
|
24
|
+
modernConfig: import("@modern-js/core").NormalizedConfig<any, {}, {}, {}>;
|
|
25
25
|
}, import("@modern-js/style-compiler").SassOptions<"sync"> | undefined>;
|
|
26
26
|
moduleTailwindConfig: import("@modern-js/plugin").AsyncPipeline<{
|
|
27
|
-
modernConfig: import("@modern-js/core").NormalizedConfig
|
|
27
|
+
modernConfig: import("@modern-js/core").NormalizedConfig<any, {}, {}, {}>;
|
|
28
28
|
}, any>;
|
|
29
29
|
};
|
|
30
30
|
export declare type ModuleHooks = typeof hooks;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,8 +2,5 @@ import type { CliPlugin } from '@modern-js/core';
|
|
|
2
2
|
import { ModuleHooks } from './hooks';
|
|
3
3
|
export * from './types';
|
|
4
4
|
export type { ModuleHooks, CliPlugin };
|
|
5
|
-
export { defineConfig } from '@modern-js/core';
|
|
6
|
-
|
|
7
5
|
declare const _default: () => CliPlugin;
|
|
8
|
-
|
|
9
6
|
export default _default;
|
|
@@ -15,9 +15,7 @@ export declare type BundleOptions = {
|
|
|
15
15
|
export declare type BundlelessOptions = {
|
|
16
16
|
sourceDir?: string;
|
|
17
17
|
style?: {
|
|
18
|
-
compileMode?: 'all' | 'only-compiled-code' |
|
|
19
|
-
/* may be will be deprecated */
|
|
20
|
-
'only-source-code' | false;
|
|
18
|
+
compileMode?: 'all' | 'only-compiled-code' | /* may be will be deprecated */'only-source-code' | false;
|
|
21
19
|
path?: string;
|
|
22
20
|
};
|
|
23
21
|
static?: {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -35,7 +35,6 @@ declare module '@modern-js/core' {
|
|
|
35
35
|
/** @deprecated Use the `buildConfig.bundlelessOptions.static.path` instead . */
|
|
36
36
|
assetsPath?: string;
|
|
37
37
|
/** @deprecated Use the `buildConfig.sourceMap` instead */
|
|
38
|
-
|
|
39
38
|
disableSourceMap?: boolean;
|
|
40
39
|
buildPreset?: BuildPreset;
|
|
41
40
|
buildConfig?: BuildConfig;
|
|
@@ -2,7 +2,7 @@ import type { NormalizedConfig } from '@modern-js/core';
|
|
|
2
2
|
import type { IPackageModeValue } from '../types';
|
|
3
3
|
import type { BundlelessOptions, SourceMap } from '../schema/types';
|
|
4
4
|
export declare const getFinalAlias: any;
|
|
5
|
-
export declare const resolveBabelConfig: (appDirectory: string, modernConfig: NormalizedConfig
|
|
5
|
+
export declare const resolveBabelConfig: (appDirectory: string, modernConfig: NormalizedConfig<any>, sourceMap: SourceMap, bundlelessOptions: Required<BundlelessOptions>, option: Pick<IPackageModeValue, 'syntax' | 'type'> & {
|
|
6
6
|
sourceAbsDir: string;
|
|
7
7
|
tsconfigPath: string;
|
|
8
|
-
}) =>
|
|
8
|
+
}) => any;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { NormalizedConfig } from '@modern-js/core';
|
|
2
2
|
export interface IValideOption {
|
|
3
|
-
modernConfig: NormalizedConfig
|
|
3
|
+
modernConfig: NormalizedConfig<any>;
|
|
4
4
|
tsconfigPath: string;
|
|
5
5
|
}
|
|
6
6
|
export declare const valideBeforeTask: ({
|
|
7
7
|
modernConfig,
|
|
8
8
|
tsconfigPath
|
|
9
9
|
}: IValideOption) => void;
|
|
10
|
-
export declare const modernConfigValid: (modernConfig: NormalizedConfig
|
|
10
|
+
export declare const modernConfigValid: (modernConfig: NormalizedConfig<any>, option: {
|
|
11
11
|
tsconfigPath: string;
|
|
12
12
|
}) => string | null;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.0.0-beta.
|
|
14
|
+
"version": "2.0.0-beta.2",
|
|
15
15
|
"bin": {
|
|
16
16
|
"modern": "./bin/modern.js"
|
|
17
17
|
},
|
|
@@ -54,33 +54,31 @@
|
|
|
54
54
|
"@babel/runtime": "^7.18.0",
|
|
55
55
|
"@babel/traverse": "^7.18.0",
|
|
56
56
|
"@babel/types": "^7.18.0",
|
|
57
|
-
"@modern-js/babel-compiler": "2.0.0-beta.0",
|
|
58
|
-
"@modern-js/babel-preset-module": "2.0.0-beta.0",
|
|
59
|
-
"@modern-js/core": "2.0.0-beta.0",
|
|
60
57
|
"@modern-js/css-config": "1.21.1",
|
|
61
|
-
"@modern-js/new-action": "2.0.0-beta.0",
|
|
62
|
-
"@modern-js/upgrade": "2.0.0-beta.0",
|
|
63
|
-
"@modern-js/plugin": "2.0.0-beta.0",
|
|
64
|
-
"@modern-js/plugin-changeset": "2.0.0-beta.0",
|
|
65
|
-
"@modern-js/plugin-i18n": "2.0.0-beta.0",
|
|
66
|
-
"@modern-js/plugin-jarvis": "2.0.0-beta.0",
|
|
67
|
-
"@modern-js/style-compiler": "2.0.0-beta.0",
|
|
68
|
-
"@modern-js/utils": "2.0.0-beta.0",
|
|
69
58
|
"@rollup/plugin-json": "~4.1.0",
|
|
70
|
-
"@speedy-js/speedy-types": "0.13.2-modern.
|
|
71
|
-
"@speedy-js/speedy-core": "0.13.2-modern.
|
|
72
|
-
"@speedy-js/speedy-plugin-es5": "0.13.2-modern.
|
|
59
|
+
"@speedy-js/speedy-types": "0.13.2-modern.4",
|
|
60
|
+
"@speedy-js/speedy-core": "0.13.2-modern.4",
|
|
61
|
+
"@speedy-js/speedy-plugin-es5": "0.13.2-modern.4",
|
|
73
62
|
"normalize-path": "^3.0.0",
|
|
74
63
|
"p-map": "^4",
|
|
75
64
|
"process.argv": "^0.6.0",
|
|
76
65
|
"rollup": "^2.70.2",
|
|
77
66
|
"rollup-plugin-dts": "^4.2.1",
|
|
78
67
|
"rollup-plugin-hashbang": "^3.0.0",
|
|
79
|
-
"signal-exit": "^3.0.7"
|
|
68
|
+
"signal-exit": "^3.0.7",
|
|
69
|
+
"@modern-js/babel-compiler": "2.0.0-beta.2",
|
|
70
|
+
"@modern-js/babel-preset-module": "2.0.0-beta.2",
|
|
71
|
+
"@modern-js/core": "2.0.0-beta.2",
|
|
72
|
+
"@modern-js/new-action": "2.0.0-beta.2",
|
|
73
|
+
"@modern-js/upgrade": "2.0.0-beta.2",
|
|
74
|
+
"@modern-js/plugin": "2.0.0-beta.2",
|
|
75
|
+
"@modern-js/plugin-changeset": "2.0.0-beta.2",
|
|
76
|
+
"@modern-js/plugin-i18n": "2.0.0-beta.2",
|
|
77
|
+
"@modern-js/plugin-lint": "2.0.0-beta.2",
|
|
78
|
+
"@modern-js/style-compiler": "2.0.0-beta.2",
|
|
79
|
+
"@modern-js/utils": "2.0.0-beta.2"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@scripts/build": "2.0.0-beta.0",
|
|
83
|
-
"@scripts/jest-config": "2.0.0-beta.0",
|
|
84
82
|
"@types/babel__core": "^7.1.15",
|
|
85
83
|
"@types/babel__generator": "^7.6.3",
|
|
86
84
|
"@types/babel__traverse": "^7.14.2",
|
|
@@ -92,7 +90,9 @@
|
|
|
92
90
|
"jest": "^27",
|
|
93
91
|
"typescript": "^4",
|
|
94
92
|
"ajv": "^8",
|
|
95
|
-
"ajv-keywords": "^5"
|
|
93
|
+
"ajv-keywords": "^5",
|
|
94
|
+
"@scripts/build": "2.0.0-beta.2",
|
|
95
|
+
"@scripts/jest-config": "2.0.0-beta.2"
|
|
96
96
|
},
|
|
97
97
|
"sideEffects": false,
|
|
98
98
|
"modernConfig": {
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
"access": "public"
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
|
-
"new": "modern new",
|
|
109
|
-
"build": "modern build",
|
|
108
|
+
"new": "modern-lib new",
|
|
109
|
+
"build": "modern-lib build",
|
|
110
110
|
"test": "jest --passWithNoTests",
|
|
111
|
-
"dev": "modern build --watch"
|
|
111
|
+
"dev": "modern-lib build --watch"
|
|
112
112
|
}
|
|
113
113
|
}
|