@modern-js/core 0.0.0-canary-20211129651 → 0.0.0-options-202112031434

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,13 +1,5 @@
1
1
  # @modern-js/core
2
2
 
3
- ## 0.0.0-canary-20211129651
4
-
5
- ### Patch Changes
6
-
7
- - 72610a1: support server runtime
8
- - Updated dependencies [72610a1]
9
- - @modern-js/utils@0.0.0-canary-20211129651
10
-
11
3
  ## 1.1.2
12
4
 
13
5
  ### Patch Changes
@@ -165,9 +165,6 @@ export const server = {
165
165
  },
166
166
  enableMicroFrontendDebug: {
167
167
  type: 'boolean'
168
- },
169
- disableUserExtension: {
170
- type: 'boolean'
171
168
  }
172
169
  }
173
170
  };
@@ -6,7 +6,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import path from 'path';
8
8
  import { compatRequire, pkgUp, ensureAbsolutePath, logger } from '@modern-js/utils';
9
- import { createAsyncManager, createAsyncWorkflow, createParallelWorkflow } from '@modern-js/plugin';
9
+ import { createAsyncManager, createAsyncWorkflow, createParallelWorkflow, createAsyncWaterfall } from '@modern-js/plugin';
10
10
  import { enable } from '@modern-js/plugin/node';
11
11
  import { program } from "./utils/commander";
12
12
  import { resolveConfig, defineConfig, loadUserConfig } from "./config";
@@ -20,6 +20,7 @@ export * from '@modern-js/plugin/node';
20
20
  program.name('modern').usage('<command> [options]').version(process.env.MODERN_JS_VERSION || '0.1.0');
21
21
  const hooksMap = {
22
22
  config: createParallelWorkflow(),
23
+ resolvedConfig: createAsyncWaterfall(),
23
24
  validateSchema: createParallelWorkflow(),
24
25
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
25
26
  prepare: createAsyncWorkflow(),
@@ -60,7 +61,7 @@ const createCli = () => {
60
61
  const appDirectory = await initAppDir();
61
62
  loadEnv(appDirectory);
62
63
  const loaded = await loadUserConfig(appDirectory);
63
- let plugins = loadPlugins(appDirectory, loaded.config.plugins || []);
64
+ let plugins = loadPlugins(appDirectory, loaded.config.plugins || [], options === null || options === void 0 ? void 0 : options.plugins);
64
65
 
65
66
  if (options !== null && options !== void 0 && options.beforeUsePlugins) {
66
67
  plugins = options.beforeUsePlugins(plugins, loaded.config);
@@ -89,7 +90,12 @@ const createCli = () => {
89
90
  });
90
91
  const extraConfigs = await hooksRunner.config();
91
92
  const extraSchemas = await hooksRunner.validateSchema();
92
- const resolved = await resolveConfig(loaded, extraConfigs, extraSchemas, isRestart, argv); // update context value
93
+ const config = await resolveConfig(loaded, extraConfigs, extraSchemas, isRestart, argv);
94
+ const {
95
+ resolved
96
+ } = await hooksRunner.resolvedConfig({
97
+ resolved: config
98
+ }); // update context value
93
99
 
94
100
  manager.run(() => {
95
101
  ConfigContext.set(loaded.config);
@@ -173,9 +173,6 @@ const server = {
173
173
  },
174
174
  enableMicroFrontendDebug: {
175
175
  type: 'boolean'
176
- },
177
- disableUserExtension: {
178
- type: 'boolean'
179
176
  }
180
177
  }
181
178
  };
@@ -121,6 +121,7 @@ _commander.program.name('modern').usage('<command> [options]').version(process.e
121
121
 
122
122
  const hooksMap = {
123
123
  config: (0, _plugin.createParallelWorkflow)(),
124
+ resolvedConfig: (0, _plugin.createAsyncWaterfall)(),
124
125
  validateSchema: (0, _plugin.createParallelWorkflow)(),
125
126
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
126
127
  prepare: (0, _plugin.createAsyncWorkflow)(),
@@ -167,7 +168,7 @@ const createCli = () => {
167
168
  const appDirectory = await initAppDir();
168
169
  (0, _loadEnv.loadEnv)(appDirectory);
169
170
  const loaded = await (0, _config.loadUserConfig)(appDirectory);
170
- let plugins = (0, _loadPlugins.loadPlugins)(appDirectory, loaded.config.plugins || []);
171
+ let plugins = (0, _loadPlugins.loadPlugins)(appDirectory, loaded.config.plugins || [], options === null || options === void 0 ? void 0 : options.plugins);
171
172
 
172
173
  if (options !== null && options !== void 0 && options.beforeUsePlugins) {
173
174
  plugins = options.beforeUsePlugins(plugins, loaded.config);
@@ -197,7 +198,12 @@ const createCli = () => {
197
198
  });
198
199
  const extraConfigs = await hooksRunner.config();
199
200
  const extraSchemas = await hooksRunner.validateSchema();
200
- const resolved = await (0, _config.resolveConfig)(loaded, extraConfigs, extraSchemas, isRestart, argv); // update context value
201
+ const config = await (0, _config.resolveConfig)(loaded, extraConfigs, extraSchemas, isRestart, argv);
202
+ const {
203
+ resolved
204
+ } = await hooksRunner.resolvedConfig({
205
+ resolved: config
206
+ }); // update context value
201
207
 
202
208
  manager.run(() => {
203
209
  _context.ConfigContext.set(loaded.config);
@@ -75,7 +75,6 @@ export interface ServerConfig {
75
75
  logger?: Record<string, string>;
76
76
  measure?: Record<string, string>;
77
77
  enableMicroFrontendDebug?: boolean;
78
- disableUserExtension?: boolean;
79
78
  }
80
79
  export interface DevConfig {
81
80
  assetPrefix?: string | boolean;
@@ -391,9 +391,6 @@ export declare const patchSchema: (pluginSchemas: Array<PluginValidateSchema | P
391
391
  enableMicroFrontendDebug: {
392
392
  type: string;
393
393
  };
394
- disableUserExtension: {
395
- type: string;
396
- };
397
394
  };
398
395
  };
399
396
  deploy: {
@@ -178,8 +178,5 @@ export declare const server: {
178
178
  enableMicroFrontendDebug: {
179
179
  type: string;
180
180
  };
181
- disableUserExtension: {
182
- type: string;
183
- };
184
181
  };
185
182
  };
@@ -1,5 +1,5 @@
1
1
  import { INTERNAL_PLUGINS } from '@modern-js/utils';
2
- import { ParallelWorkflow, AsyncWorkflow, Progresses2Runners } from '@modern-js/plugin';
2
+ import { ParallelWorkflow, AsyncWorkflow, Progresses2Runners, AsyncWaterfall } from '@modern-js/plugin';
3
3
  import type { Hooks } from '@modern-js/types';
4
4
  import { Command } from './utils/commander';
5
5
  import { defineConfig, UserConfig, ToolsConfig } from './config';
@@ -11,6 +11,9 @@ export * from '@modern-js/plugin';
11
11
  export * from '@modern-js/plugin/node';
12
12
  export declare type HooksRunner = Progresses2Runners<{
13
13
  config: ParallelWorkflow<void>;
14
+ resolvedConfig: AsyncWaterfall<{
15
+ resolved: NormalizedConfig;
16
+ }>;
14
17
  validateSchema: ParallelWorkflow<void>;
15
18
  prepare: AsyncWorkflow<void, void>;
16
19
  commands: AsyncWorkflow<{
@@ -24,6 +27,9 @@ export declare type HooksRunner = Progresses2Runners<{
24
27
  }>;
25
28
  export declare const manager: import("@modern-js/plugin").AsyncManager<Hooks, {
26
29
  config: ParallelWorkflow<void, unknown>;
30
+ resolvedConfig: AsyncWaterfall<{
31
+ resolved: NormalizedConfig;
32
+ }>;
27
33
  validateSchema: ParallelWorkflow<void, unknown>;
28
34
  prepare: AsyncWorkflow<void, void>;
29
35
  commands: AsyncWorkflow<{
@@ -37,6 +43,9 @@ export declare const manager: import("@modern-js/plugin").AsyncManager<Hooks, {
37
43
  }>;
38
44
  export declare const createPlugin: (initializer: import("@modern-js/plugin").AsyncInitializer<Partial<import("@modern-js/plugin").Progresses2Threads<{
39
45
  config: ParallelWorkflow<void, unknown>;
46
+ resolvedConfig: AsyncWaterfall<{
47
+ resolved: NormalizedConfig;
48
+ }>;
40
49
  validateSchema: ParallelWorkflow<void, unknown>;
41
50
  prepare: AsyncWorkflow<void, void>;
42
51
  commands: AsyncWorkflow<{
@@ -49,6 +58,9 @@ export declare const createPlugin: (initializer: import("@modern-js/plugin").Asy
49
58
  beforeExit: AsyncWorkflow<void, void>;
50
59
  } & import("@modern-js/plugin").ClearDraftProgress<Hooks>>>>, options?: import("@modern-js/plugin").PluginOptions | undefined) => import("@modern-js/plugin").AsyncPlugin<Partial<import("@modern-js/plugin").Progresses2Threads<{
51
60
  config: ParallelWorkflow<void, unknown>;
61
+ resolvedConfig: AsyncWaterfall<{
62
+ resolved: NormalizedConfig;
63
+ }>;
52
64
  validateSchema: ParallelWorkflow<void, unknown>;
53
65
  prepare: AsyncWorkflow<void, void>;
54
66
  commands: AsyncWorkflow<{
@@ -61,6 +73,9 @@ export declare const createPlugin: (initializer: import("@modern-js/plugin").Asy
61
73
  beforeExit: AsyncWorkflow<void, void>;
62
74
  } & import("@modern-js/plugin").ClearDraftProgress<Hooks>>>>, registerHook: (newShape: Partial<Hooks>) => void, mountHook: () => Progresses2Runners<{
63
75
  config: ParallelWorkflow<void, unknown>;
76
+ resolvedConfig: AsyncWaterfall<{
77
+ resolved: NormalizedConfig;
78
+ }>;
64
79
  validateSchema: ParallelWorkflow<void, unknown>;
65
80
  prepare: AsyncWorkflow<void, void>;
66
81
  commands: AsyncWorkflow<{
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "0.0.0-canary-20211129651",
14
+ "version": "0.0.0-options-202112031434",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -35,12 +35,20 @@
35
35
  }
36
36
  },
37
37
  "bin": "./bin/modern-js.js",
38
+ "scripts": {
39
+ "prepare": "pnpm build",
40
+ "prepublishOnly": "pnpm build -- --platform",
41
+ "new": "modern new",
42
+ "build": "modern build",
43
+ "dev": "modern build --watch",
44
+ "test": "modern test --passWithNoTests"
45
+ },
38
46
  "dependencies": {
39
47
  "@babel/code-frame": "^7.14.5",
40
48
  "@babel/runtime": "^7",
41
- "@modern-js/load-config": "^1.1.1",
42
- "@modern-js/plugin": "^1.1.2",
43
- "@modern-js/utils": "^0.0.0-canary-20211129651",
49
+ "@modern-js/load-config": "workspace:^1.1.1",
50
+ "@modern-js/plugin": "workspace:^1.1.2",
51
+ "@modern-js/utils": "workspace:^1.1.2",
44
52
  "address": "^1.1.2",
45
53
  "ajv": "^8.6.2",
46
54
  "ajv-keywords": "^5.0.0",
@@ -57,7 +65,7 @@
57
65
  },
58
66
  "devDependencies": {
59
67
  "@types/babel__code-frame": "^7.0.3",
60
- "@modern-js/types": "^1.1.2",
68
+ "@modern-js/types": "workspace:^1.1.2",
61
69
  "@types/jest": "^26",
62
70
  "@types/lodash.clonedeep": "^4.5.6",
63
71
  "@types/lodash.mergewith": "^4.6.6",
@@ -78,11 +86,5 @@
78
86
  "publishConfig": {
79
87
  "registry": "https://registry.npmjs.org/",
80
88
  "access": "public"
81
- },
82
- "scripts": {
83
- "new": "modern new",
84
- "build": "modern build",
85
- "dev": "modern build --watch",
86
- "test": "modern test --passWithNoTests"
87
89
  }
88
- }
90
+ }
@@ -109,7 +109,6 @@ export interface ServerConfig {
109
109
  logger?: Record<string, string>;
110
110
  measure?: Record<string, string>;
111
111
  enableMicroFrontendDebug?: boolean;
112
- disableUserExtension?: boolean;
113
112
  }
114
113
 
115
114
  export interface DevConfig {
@@ -102,6 +102,5 @@ export const server = {
102
102
  measure: { type: 'object' },
103
103
  proxy: { type: 'object' },
104
104
  enableMicroFrontendDebug: { type: 'boolean' },
105
- disableUserExtension: { type: 'boolean' },
106
105
  },
107
106
  };
package/src/index.ts CHANGED
@@ -13,6 +13,8 @@ import {
13
13
  ParallelWorkflow,
14
14
  AsyncWorkflow,
15
15
  Progresses2Runners,
16
+ createAsyncWaterfall,
17
+ AsyncWaterfall,
16
18
  } from '@modern-js/plugin';
17
19
  import { enable } from '@modern-js/plugin/node';
18
20
 
@@ -53,6 +55,9 @@ program
53
55
 
54
56
  export type HooksRunner = Progresses2Runners<{
55
57
  config: ParallelWorkflow<void>;
58
+ resolvedConfig: AsyncWaterfall<{
59
+ resolved: NormalizedConfig;
60
+ }>;
56
61
  validateSchema: ParallelWorkflow<void>;
57
62
  prepare: AsyncWorkflow<void, void>;
58
63
  commands: AsyncWorkflow<
@@ -73,6 +78,9 @@ export type HooksRunner = Progresses2Runners<{
73
78
 
74
79
  const hooksMap = {
75
80
  config: createParallelWorkflow(),
81
+ resolvedConfig: createAsyncWaterfall<{
82
+ resolved: NormalizedConfig;
83
+ }>(),
76
84
  validateSchema: createParallelWorkflow(),
77
85
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
78
86
  prepare: createAsyncWorkflow<void, void>(),
@@ -151,7 +159,11 @@ const createCli = () => {
151
159
 
152
160
  const loaded = await loadUserConfig(appDirectory);
153
161
 
154
- let plugins = loadPlugins(appDirectory, loaded.config.plugins || []);
162
+ let plugins = loadPlugins(
163
+ appDirectory,
164
+ loaded.config.plugins || [],
165
+ options?.plugins,
166
+ );
155
167
 
156
168
  if (options?.beforeUsePlugins) {
157
169
  plugins = options.beforeUsePlugins(plugins, loaded.config);
@@ -187,7 +199,7 @@ const createCli = () => {
187
199
 
188
200
  const extraSchemas = await hooksRunner.validateSchema();
189
201
 
190
- const resolved = await resolveConfig(
202
+ const config = await resolveConfig(
191
203
  loaded,
192
204
  extraConfigs as any,
193
205
  extraSchemas as any,
@@ -195,6 +207,10 @@ const createCli = () => {
195
207
  argv,
196
208
  );
197
209
 
210
+ const { resolved } = await hooksRunner.resolvedConfig({
211
+ resolved: config,
212
+ });
213
+
198
214
  // update context value
199
215
  manager.run(() => {
200
216
  ConfigContext.set(loaded.config);