@modern-js/module-tools 1.0.0-rc.8 → 1.0.0-rc.9

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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # @modern-js/module-tools
2
2
 
3
+ ## 1.0.0-rc.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 224f7fe: fix server route match
8
+ - 204c626: feat: initial
9
+ - Updated dependencies [224f7fe]
10
+ - Updated dependencies [204c626]
11
+ - @modern-js/babel-preset-module@1.0.0-rc.9
12
+ - @modern-js/core@1.0.0-rc.9
13
+ - @modern-js/css-config@1.0.0-rc.9
14
+ - @modern-js/i18n-cli-language-detector@1.0.0-rc.9
15
+ - @modern-js/plugin-analyze@1.0.0-rc.9
16
+ - @modern-js/plugin-changeset@1.0.0-rc.9
17
+ - @modern-js/plugin-fast-refresh@1.0.0-rc.9
18
+ - @modern-js/plugin-i18n@1.0.0-rc.9
19
+ - @modern-js/new-action@1.0.0-rc.9
20
+ - @modern-js/babel-compiler@1.0.0-rc.9
21
+ - @modern-js/style-compiler@1.0.0-rc.9
22
+ - @modern-js/module-tools-hooks@1.0.0-rc.9
23
+ - @modern-js/plugin@1.0.0-rc.9
24
+ - @modern-js/utils@1.0.0-rc.9
25
+
3
26
  ## 1.0.0-rc.8
4
27
 
5
28
  ### Patch Changes
@@ -13,11 +13,9 @@ export const build = async ({
13
13
  platform
14
14
  }) => {
15
15
  const {
16
- value: {
17
- appDirectory
18
- }
16
+ appDirectory
19
17
  } = core.useAppContext();
20
- const modernConfig = core.useResolvedConfigContext().value;
18
+ const modernConfig = core.useResolvedConfigContext();
21
19
  const {
22
20
  output: {
23
21
  path: outputPath = 'dist'
@@ -9,8 +9,8 @@ export const dev = async option => {
9
9
  const {
10
10
  tsconfig: tsconfigName
11
11
  } = option;
12
- const appContext = core.useAppContext().value;
13
- const modernConfig = core.useResolvedConfigContext().value;
12
+ const appContext = core.useAppContext();
13
+ const modernConfig = core.useResolvedConfigContext();
14
14
  const {
15
15
  appDirectory
16
16
  } = appContext;
@@ -10,7 +10,7 @@ const constants = Import.lazy('./constants', require);
10
10
  export const buildInWatchMode = async (config, _) => {
11
11
  const {
12
12
  appDirectory
13
- } = core.useAppContext().value;
13
+ } = core.useAppContext();
14
14
  const {
15
15
  sourceDir,
16
16
  enableTscCompiler
@@ -15,7 +15,7 @@ export const buildSourceCode = async (config, _) => {
15
15
  } = config;
16
16
  const {
17
17
  appDirectory
18
- } = core.useAppContext().value;
18
+ } = core.useAppContext();
19
19
  const concurrency = os.cpus().length;
20
20
  const srcRootDir = path.join(appDirectory, sourceDir);
21
21
  const lm = new lg.LoggerManager();
@@ -35,14 +35,14 @@ export const getCodeInitMapper = _ => {
35
35
  packageFields,
36
36
  packageMode
37
37
  }
38
- } = core.useResolvedConfigContext().value;
38
+ } = core.useResolvedConfigContext();
39
39
  let initMapper = []; // 如果不存在packageFields配置或者packageFields为空对象,则使用 packageMode
40
40
 
41
41
  if (!packageFields || typeof packageFields === 'object' && Object.keys(packageFields).length === 0) {
42
42
  initMapper = constants.PACKAGE_MODES[packageMode || constants.DEFAULT_PACKAGE_MODE];
43
43
  } else if (packageFields && Object.keys(packageFields).length > 0) {
44
- if (packageFields['modern']) {
45
- initMapper = updateMapper(packageFields['modern'], 'modern', initMapper);
44
+ if (packageFields.modern) {
45
+ initMapper = updateMapper(packageFields.modern, 'modern', initMapper);
46
46
  }
47
47
 
48
48
  if (packageFields.main) {
@@ -54,7 +54,7 @@ export const getCodeInitMapper = _ => {
54
54
  } // TODO: 如果存在其他配置,需要提示
55
55
 
56
56
 
57
- if (!packageFields['modern'] && !packageFields.main && !packageFields.module) {
57
+ if (!packageFields.modern && !packageFields.main && !packageFields.module) {
58
58
  console.error(chalk.red(`Unrecognized ${JSON.stringify(packageFields)} configuration, please use keys: 'modern, main, jupiter:modern' and use values: 'CJS+ES6, ESM+ES5, ESM+ES6'`)); // eslint-disable-next-line no-process-exit
59
59
 
60
60
  process.exit(1);
@@ -73,11 +73,9 @@ export const getCodeMapper = ({
73
73
  willCompilerDirOrFile
74
74
  }) => {
75
75
  const {
76
- value: {
77
- appDirectory
78
- }
76
+ appDirectory
79
77
  } = core.useAppContext();
80
- const modernConfig = core.useResolvedConfigContext().value;
78
+ const modernConfig = core.useResolvedConfigContext();
81
79
  const {
82
80
  output: {
83
81
  enableSourceMap,
@@ -104,11 +102,9 @@ export const getCodeMapper = ({
104
102
 
105
103
  export const getDtsMapper = (config, logger) => {
106
104
  const {
107
- value: {
108
- appDirectory
109
- }
105
+ appDirectory
110
106
  } = core.useAppContext();
111
- const modernConfig = core.useResolvedConfigContext().value;
107
+ const modernConfig = core.useResolvedConfigContext();
112
108
  const {
113
109
  output: {
114
110
  disableTsChecker,
@@ -31,11 +31,9 @@ const build = async ({
31
31
  platform
32
32
  }) => {
33
33
  const {
34
- value: {
35
- appDirectory
36
- }
34
+ appDirectory
37
35
  } = core.useAppContext();
38
- const modernConfig = core.useResolvedConfigContext().value;
36
+ const modernConfig = core.useResolvedConfigContext();
39
37
  const {
40
38
  output: {
41
39
  path: outputPath = 'dist'
@@ -27,8 +27,8 @@ const dev = async option => {
27
27
  const {
28
28
  tsconfig: tsconfigName
29
29
  } = option;
30
- const appContext = core.useAppContext().value;
31
- const modernConfig = core.useResolvedConfigContext().value;
30
+ const appContext = core.useAppContext();
31
+ const modernConfig = core.useResolvedConfigContext();
32
32
  const {
33
33
  appDirectory
34
34
  } = appContext;
@@ -30,7 +30,7 @@ const constants = _utils.Import.lazy('./constants', require);
30
30
  const buildInWatchMode = async (config, _) => {
31
31
  const {
32
32
  appDirectory
33
- } = core.useAppContext().value;
33
+ } = core.useAppContext();
34
34
  const {
35
35
  sourceDir,
36
36
  enableTscCompiler
@@ -35,7 +35,7 @@ const buildSourceCode = async (config, _) => {
35
35
  } = config;
36
36
  const {
37
37
  appDirectory
38
- } = core.useAppContext().value;
38
+ } = core.useAppContext();
39
39
  const concurrency = os.cpus().length;
40
40
  const srcRootDir = path.join(appDirectory, sourceDir);
41
41
  const lm = new lg.LoggerManager();
@@ -51,14 +51,14 @@ const getCodeInitMapper = _ => {
51
51
  packageFields,
52
52
  packageMode
53
53
  }
54
- } = core.useResolvedConfigContext().value;
54
+ } = core.useResolvedConfigContext();
55
55
  let initMapper = []; // 如果不存在packageFields配置或者packageFields为空对象,则使用 packageMode
56
56
 
57
57
  if (!packageFields || typeof packageFields === 'object' && Object.keys(packageFields).length === 0) {
58
58
  initMapper = constants.PACKAGE_MODES[packageMode || constants.DEFAULT_PACKAGE_MODE];
59
59
  } else if (packageFields && Object.keys(packageFields).length > 0) {
60
- if (packageFields['modern']) {
61
- initMapper = updateMapper(packageFields['modern'], 'modern', initMapper);
60
+ if (packageFields.modern) {
61
+ initMapper = updateMapper(packageFields.modern, 'modern', initMapper);
62
62
  }
63
63
 
64
64
  if (packageFields.main) {
@@ -70,7 +70,7 @@ const getCodeInitMapper = _ => {
70
70
  } // TODO: 如果存在其他配置,需要提示
71
71
 
72
72
 
73
- if (!packageFields['modern'] && !packageFields.main && !packageFields.module) {
73
+ if (!packageFields.modern && !packageFields.main && !packageFields.module) {
74
74
  console.error(_utils.chalk.red(`Unrecognized ${JSON.stringify(packageFields)} configuration, please use keys: 'modern, main, jupiter:modern' and use values: 'CJS+ES6, ESM+ES5, ESM+ES6'`)); // eslint-disable-next-line no-process-exit
75
75
 
76
76
  process.exit(1);
@@ -92,11 +92,9 @@ const getCodeMapper = ({
92
92
  willCompilerDirOrFile
93
93
  }) => {
94
94
  const {
95
- value: {
96
- appDirectory
97
- }
95
+ appDirectory
98
96
  } = core.useAppContext();
99
- const modernConfig = core.useResolvedConfigContext().value;
97
+ const modernConfig = core.useResolvedConfigContext();
100
98
  const {
101
99
  output: {
102
100
  enableSourceMap,
@@ -126,11 +124,9 @@ exports.getCodeMapper = getCodeMapper;
126
124
 
127
125
  const getDtsMapper = (config, logger) => {
128
126
  const {
129
- value: {
130
- appDirectory
131
- }
127
+ appDirectory
132
128
  } = core.useAppContext();
133
- const modernConfig = core.useResolvedConfigContext().value;
129
+ const modernConfig = core.useResolvedConfigContext();
134
130
  const {
135
131
  output: {
136
132
  disableTsChecker,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/module-tools",
3
- "version": "1.0.0-rc.8",
3
+ "version": "1.0.0-rc.9",
4
4
  "bin": {
5
5
  "modern": "./bin/modern.js"
6
6
  },
@@ -33,20 +33,20 @@
33
33
  "@babel/runtime": "^7",
34
34
  "@babel/traverse": "^7.15.0",
35
35
  "@babel/types": "^7.15.0",
36
- "@modern-js/babel-compiler": "^1.0.0-rc.8",
37
- "@modern-js/babel-preset-module": "^1.0.0-rc.8",
38
- "@modern-js/core": "^1.0.0-rc.8",
39
- "@modern-js/css-config": "^1.0.0-rc.8",
40
- "@modern-js/i18n-cli-language-detector": "^1.0.0-rc.8",
41
- "@modern-js/module-tools-hooks": "^1.0.0-rc.8",
42
- "@modern-js/new-action": "^1.0.0-rc.8",
43
- "@modern-js/plugin": "^1.0.0-rc.8",
44
- "@modern-js/plugin-analyze": "^1.0.0-rc.8",
45
- "@modern-js/plugin-changeset": "^1.0.0-rc.8",
46
- "@modern-js/plugin-fast-refresh": "^1.0.0-rc.8",
47
- "@modern-js/plugin-i18n": "^1.0.0-rc.8",
48
- "@modern-js/style-compiler": "^1.0.0-rc.8",
49
- "@modern-js/utils": "^1.0.0-rc.8",
36
+ "@modern-js/babel-compiler": "^1.0.0-rc.9",
37
+ "@modern-js/babel-preset-module": "^1.0.0-rc.9",
38
+ "@modern-js/core": "^1.0.0-rc.9",
39
+ "@modern-js/css-config": "^1.0.0-rc.9",
40
+ "@modern-js/i18n-cli-language-detector": "^1.0.0-rc.9",
41
+ "@modern-js/module-tools-hooks": "^1.0.0-rc.9",
42
+ "@modern-js/new-action": "^1.0.0-rc.9",
43
+ "@modern-js/plugin": "^1.0.0-rc.9",
44
+ "@modern-js/plugin-analyze": "^1.0.0-rc.9",
45
+ "@modern-js/plugin-changeset": "^1.0.0-rc.9",
46
+ "@modern-js/plugin-fast-refresh": "^1.0.0-rc.9",
47
+ "@modern-js/plugin-i18n": "^1.0.0-rc.9",
48
+ "@modern-js/style-compiler": "^1.0.0-rc.9",
49
+ "@modern-js/utils": "^1.0.0-rc.9",
50
50
  "chalk": "^4.1.2",
51
51
  "chokidar": "^3.5.2",
52
52
  "dotenv": "^10.0.0",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "devDependencies": {
67
67
  "@babel/preset-typescript": "^7.15.0",
68
- "@modern-js/babel-chain": "^1.0.0-rc.8",
68
+ "@modern-js/babel-chain": "^1.0.0-rc.9",
69
69
  "@types/babel__core": "^7.1.15",
70
70
  "@types/babel__generator": "^7.6.3",
71
71
  "@types/babel__traverse": "^7.14.2",
@@ -78,8 +78,8 @@
78
78
  "@types/signale": "^1.4.2",
79
79
  "commander": "^8.1.0",
80
80
  "typescript": "^4",
81
- "@modern-js/plugin-testing": "^1.0.0-rc.8",
82
- "@modern-js/module-tools": "^1.0.0-rc.8"
81
+ "@modern-js/plugin-testing": "^1.0.0-rc.9",
82
+ "@modern-js/module-tools": "^1.0.0-rc.9"
83
83
  },
84
84
  "sideEffects": false,
85
85
  "modernConfig": {
@@ -37,10 +37,8 @@ export const build = async ({
37
37
  clear = true,
38
38
  platform,
39
39
  }: IBuildOption) => {
40
- const {
41
- value: { appDirectory },
42
- } = core.useAppContext();
43
- const modernConfig = core.useResolvedConfigContext().value;
40
+ const { appDirectory } = core.useAppContext();
41
+ const modernConfig = core.useResolvedConfigContext();
44
42
  const {
45
43
  output: { path: outputPath = 'dist' },
46
44
  } = modernConfig;
@@ -25,8 +25,8 @@ export interface IDevOption {
25
25
 
26
26
  export const dev = async (option: IDevOption) => {
27
27
  const { tsconfig: tsconfigName } = option;
28
- const appContext = core.useAppContext().value;
29
- const modernConfig = core.useResolvedConfigContext().value;
28
+ const appContext = core.useAppContext();
29
+ const modernConfig = core.useResolvedConfigContext();
30
30
  const { appDirectory } = appContext;
31
31
  const tsconfigPath = path.join(appDirectory, tsconfigName);
32
32
 
@@ -22,7 +22,7 @@ export const buildInWatchMode = async (
22
22
  config: IBuildConfig,
23
23
  _: NormalizedConfig,
24
24
  ) => {
25
- const { appDirectory } = core.useAppContext().value;
25
+ const { appDirectory } = core.useAppContext();
26
26
  const { sourceDir, enableTscCompiler } = config;
27
27
  const srcRootDir = path.join(appDirectory, sourceDir);
28
28
  const concurrency = os.cpus().length;
@@ -23,7 +23,7 @@ export const buildSourceCode = async (
23
23
  _: NormalizedConfig,
24
24
  ) => {
25
25
  const { sourceDir, enableTscCompiler } = config;
26
- const { appDirectory } = core.useAppContext().value;
26
+ const { appDirectory } = core.useAppContext();
27
27
  const concurrency = os.cpus().length;
28
28
  const srcRootDir = path.join(appDirectory, sourceDir);
29
29
  const lm = new lg.LoggerManager();
@@ -40,7 +40,7 @@ const updateMapper = (
40
40
  export const getCodeInitMapper = (_: IBuildConfig) => {
41
41
  const {
42
42
  output: { packageFields, packageMode },
43
- } = core.useResolvedConfigContext().value as ModuleToolsConfig;
43
+ } = core.useResolvedConfigContext() as ModuleToolsConfig;
44
44
  let initMapper: IPackageModeValue[] = [];
45
45
 
46
46
  // 如果不存在packageFields配置或者packageFields为空对象,则使用 packageMode
@@ -52,12 +52,8 @@ export const getCodeInitMapper = (_: IBuildConfig) => {
52
52
  initMapper =
53
53
  constants.PACKAGE_MODES[packageMode || constants.DEFAULT_PACKAGE_MODE];
54
54
  } else if (packageFields && Object.keys(packageFields).length > 0) {
55
- if (packageFields['modern']) {
56
- initMapper = updateMapper(
57
- packageFields['modern'],
58
- 'modern',
59
- initMapper,
60
- );
55
+ if (packageFields.modern) {
56
+ initMapper = updateMapper(packageFields.modern, 'modern', initMapper);
61
57
  }
62
58
 
63
59
  if (packageFields.main) {
@@ -73,11 +69,7 @@ export const getCodeInitMapper = (_: IBuildConfig) => {
73
69
  }
74
70
 
75
71
  // TODO: 如果存在其他配置,需要提示
76
- if (
77
- !packageFields['modern'] &&
78
- !packageFields.main &&
79
- !packageFields.module
80
- ) {
72
+ if (!packageFields.modern && !packageFields.main && !packageFields.module) {
81
73
  console.error(
82
74
  chalk.red(
83
75
  `Unrecognized ${JSON.stringify(
@@ -108,10 +100,8 @@ export const getCodeMapper = ({
108
100
  srcRootDir: string;
109
101
  willCompilerDirOrFile: string;
110
102
  }) => {
111
- const {
112
- value: { appDirectory },
113
- } = core.useAppContext();
114
- const modernConfig = core.useResolvedConfigContext().value;
103
+ const { appDirectory } = core.useAppContext();
104
+ const modernConfig = core.useResolvedConfigContext();
115
105
  const {
116
106
  output: { enableSourceMap, jsPath = 'js', path: distDir = 'dist' },
117
107
  } = modernConfig as ModuleToolsConfig;
@@ -147,10 +137,8 @@ export const getCodeMapper = ({
147
137
 
148
138
  // 获取执行生成 d.ts 的参数
149
139
  export const getDtsMapper = (config: IBuildConfig, logger: LoggerText) => {
150
- const {
151
- value: { appDirectory },
152
- } = core.useAppContext();
153
- const modernConfig = core.useResolvedConfigContext().value;
140
+ const { appDirectory } = core.useAppContext();
141
+ const modernConfig = core.useResolvedConfigContext();
154
142
  const {
155
143
  output: { disableTsChecker, path: outputPath = 'dist' },
156
144
  } = modernConfig as ModuleToolsConfig;