@modern-js/plugin-docsite 0.0.0-canary-2021101015357 → 0.0.0-compat-202112071120
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 +29 -2
- package/dist/js/modern/build-task.js +7 -1
- package/dist/js/modern/features/utils/webpack.js +33 -15
- package/dist/js/node/build-task.js +7 -1
- package/dist/js/node/features/utils/webpack.js +33 -15
- package/modern.config.js +5 -1
- package/package.json +10 -9
- package/src/build-task.ts +6 -2
- package/src/features/utils/webpack.ts +39 -29
package/CHANGELOG.md
CHANGED
@@ -1,10 +1,37 @@
|
|
1
1
|
# @modern-js/plugin-docsite
|
2
2
|
|
3
|
-
##
|
3
|
+
## 1.1.2
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
7
|
-
-
|
7
|
+
- fix missing dependencies bug
|
8
|
+
|
9
|
+
## 1.1.1
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- 0fa83663: support more .env files
|
14
|
+
- Updated dependencies [6f7fe574]
|
15
|
+
- Updated dependencies [e4755134]
|
16
|
+
- Updated dependencies [0fa83663]
|
17
|
+
- Updated dependencies [19b4f79e]
|
18
|
+
- Updated dependencies [f594fbc8]
|
19
|
+
- Updated dependencies [d1fde77a]
|
20
|
+
- @modern-js/core@1.1.2
|
21
|
+
- @modern-js/webpack@1.1.2
|
22
|
+
- @modern-js/utils@1.1.2
|
23
|
+
|
24
|
+
## 1.1.0
|
25
|
+
|
26
|
+
### Minor Changes
|
27
|
+
|
28
|
+
- 96119db2: Relese v1.1.0### Patch Changes
|
29
|
+
|
30
|
+
- 6b802b2a: use path method from @modern-js/utils
|
31
|
+
- Updated dependencies [96119db2]
|
32
|
+
- @modern-js/core@1.1.0
|
33
|
+
- @modern-js/webpack@1.1.0
|
34
|
+
- @modern-js/utils@1.1.0
|
8
35
|
|
9
36
|
## 1.0.0
|
10
37
|
|
@@ -14,9 +14,15 @@ const taskMain = async ({
|
|
14
14
|
};
|
15
15
|
|
16
16
|
(async () => {
|
17
|
+
let options;
|
18
|
+
|
19
|
+
if (process.env.CORE_INIT_OPTION_FILE) {
|
20
|
+
options = require(process.env.CORE_INIT_OPTION_FILE);
|
21
|
+
}
|
22
|
+
|
17
23
|
const {
|
18
24
|
appContext
|
19
|
-
} = await core.cli.init();
|
25
|
+
} = await core.cli.init([], options);
|
20
26
|
await core.manager.run(async () => {
|
21
27
|
try {
|
22
28
|
await taskMain({
|
@@ -24,24 +24,42 @@ export function generatorWebpackConfig(appDirectory, tmpDir, isDev) {
|
|
24
24
|
templateContent: fs.readFileSync(path.resolve(UTILS_STATIC, 'index.html.ejs'), 'utf8')
|
25
25
|
})]
|
26
26
|
};
|
27
|
-
|
27
|
+
const docsiteNodeModules = [// for yarn
|
28
|
+
path.dirname(require.resolve('@modern-js/plugin-docsite/package.json')), // for pnpm
|
29
|
+
path.resolve(path.dirname(require.resolve('@modern-js/plugin-docsite/package.json')), '../..')]; // maybe check if outside appDir or monorepoDir
|
30
|
+
|
31
|
+
config.resolve.modules = [...(config.resolve.modules || []), ...docsiteNodeModules];
|
28
32
|
config.resolve.alias['@assets'] = path.resolve(appDirectory, 'assets');
|
29
33
|
config.resolve.alias['@styles'] = path.resolve(appDirectory, 'styles'); // fix this since react-live relies on core-js@2
|
30
34
|
|
31
|
-
config.resolve.alias[`${path.dirname(require.resolve('core-js'))}/fn`] = 'core-js/es';
|
32
|
-
|
33
|
-
|
34
|
-
if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
35
|
-
|
36
|
-
} else {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
35
|
+
config.resolve.alias[`${path.dirname(require.resolve('core-js'))}/fn`] = 'core-js/es'; // const pkgJSON = JSON.parse(
|
36
|
+
// fs.readFileSync(path.join(appDirectory, 'package.json'), 'utf-8'),
|
37
|
+
// );
|
38
|
+
// if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
39
|
+
// (config.resolve!.alias as Alias).react = path.resolve('node_modules/react');
|
40
|
+
// } else {
|
41
|
+
// (config.resolve!.alias as Alias).react = path.resolve(
|
42
|
+
// __dirname,
|
43
|
+
// '../../../../../',
|
44
|
+
// 'node_modules',
|
45
|
+
// 'react',
|
46
|
+
// );
|
47
|
+
// }
|
48
|
+
// if (
|
49
|
+
// pkgJSON.dependencies['react-dom'] ||
|
50
|
+
// pkgJSON.devDependencies['react-dom']
|
51
|
+
// ) {
|
52
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
53
|
+
// 'node_modules/react-dom',
|
54
|
+
// );
|
55
|
+
// } else {
|
56
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
57
|
+
// __dirname,
|
58
|
+
// '../../../../../',
|
59
|
+
// 'node_modules',
|
60
|
+
// 'react-dom',
|
61
|
+
// );
|
62
|
+
// }
|
45
63
|
|
46
64
|
config.resolve.fallback = {
|
47
65
|
path: require.resolve('path-browserify')
|
@@ -18,9 +18,15 @@ const taskMain = async ({
|
|
18
18
|
};
|
19
19
|
|
20
20
|
(async () => {
|
21
|
+
let options;
|
22
|
+
|
23
|
+
if (process.env.CORE_INIT_OPTION_FILE) {
|
24
|
+
options = require(process.env.CORE_INIT_OPTION_FILE);
|
25
|
+
}
|
26
|
+
|
21
27
|
const {
|
22
28
|
appContext
|
23
|
-
} = await core.cli.init();
|
29
|
+
} = await core.cli.init([], options);
|
24
30
|
await core.manager.run(async () => {
|
25
31
|
try {
|
26
32
|
await taskMain({
|
@@ -40,24 +40,42 @@ function generatorWebpackConfig(appDirectory, tmpDir, isDev) {
|
|
40
40
|
templateContent: _utils.fs.readFileSync(_path.default.resolve(_constant.UTILS_STATIC, 'index.html.ejs'), 'utf8')
|
41
41
|
})]
|
42
42
|
};
|
43
|
-
|
43
|
+
const docsiteNodeModules = [// for yarn
|
44
|
+
_path.default.dirname(require.resolve('@modern-js/plugin-docsite/package.json')), // for pnpm
|
45
|
+
_path.default.resolve(_path.default.dirname(require.resolve('@modern-js/plugin-docsite/package.json')), '../..')]; // maybe check if outside appDir or monorepoDir
|
46
|
+
|
47
|
+
config.resolve.modules = [...(config.resolve.modules || []), ...docsiteNodeModules];
|
44
48
|
config.resolve.alias['@assets'] = _path.default.resolve(appDirectory, 'assets');
|
45
49
|
config.resolve.alias['@styles'] = _path.default.resolve(appDirectory, 'styles'); // fix this since react-live relies on core-js@2
|
46
50
|
|
47
|
-
config.resolve.alias[`${_path.default.dirname(require.resolve('core-js'))}/fn`] = 'core-js/es';
|
48
|
-
|
49
|
-
|
50
|
-
if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
51
|
-
|
52
|
-
} else {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
config.resolve.alias[`${_path.default.dirname(require.resolve('core-js'))}/fn`] = 'core-js/es'; // const pkgJSON = JSON.parse(
|
52
|
+
// fs.readFileSync(path.join(appDirectory, 'package.json'), 'utf-8'),
|
53
|
+
// );
|
54
|
+
// if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
55
|
+
// (config.resolve!.alias as Alias).react = path.resolve('node_modules/react');
|
56
|
+
// } else {
|
57
|
+
// (config.resolve!.alias as Alias).react = path.resolve(
|
58
|
+
// __dirname,
|
59
|
+
// '../../../../../',
|
60
|
+
// 'node_modules',
|
61
|
+
// 'react',
|
62
|
+
// );
|
63
|
+
// }
|
64
|
+
// if (
|
65
|
+
// pkgJSON.dependencies['react-dom'] ||
|
66
|
+
// pkgJSON.devDependencies['react-dom']
|
67
|
+
// ) {
|
68
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
69
|
+
// 'node_modules/react-dom',
|
70
|
+
// );
|
71
|
+
// } else {
|
72
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
73
|
+
// __dirname,
|
74
|
+
// '../../../../../',
|
75
|
+
// 'node_modules',
|
76
|
+
// 'react-dom',
|
77
|
+
// );
|
78
|
+
// }
|
61
79
|
|
62
80
|
config.resolve.fallback = {
|
63
81
|
path: require.resolve('path-browserify')
|
package/modern.config.js
CHANGED
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "0.0.0-
|
14
|
+
"version": "0.0.0-compat-202112071120",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -25,15 +25,16 @@
|
|
25
25
|
},
|
26
26
|
"default": "./dist/js/treeshaking/index.js"
|
27
27
|
},
|
28
|
-
"./cli": "./dist/js/node/index.js"
|
28
|
+
"./cli": "./dist/js/node/index.js",
|
29
|
+
"./package.json": "./package.json"
|
29
30
|
},
|
30
31
|
"dependencies": {
|
31
32
|
"@babel/parser": "^7.15.2",
|
32
33
|
"@babel/runtime": "^7",
|
33
34
|
"@mdx-js/mdx": "^1.6.22",
|
34
35
|
"@mdx-js/react": "^1.6.22",
|
35
|
-
"@modern-js/utils": "^1.
|
36
|
-
"@modern-js/webpack": "^1.
|
36
|
+
"@modern-js/utils": "^1.1.2",
|
37
|
+
"@modern-js/webpack": "^1.1.2",
|
37
38
|
"antd": "^4.16.13",
|
38
39
|
"chokidar": "^3.5.2",
|
39
40
|
"core-js": "^3.17.2",
|
@@ -57,7 +58,7 @@
|
|
57
58
|
"webpack-dev-server": "^4.1.1"
|
58
59
|
},
|
59
60
|
"devDependencies": {
|
60
|
-
"@modern-js/module-tools-hooks": "^1.
|
61
|
+
"@modern-js/module-tools-hooks": "^1.1.1",
|
61
62
|
"@types/core-js": "^2.5.5",
|
62
63
|
"@types/github-slugger": "^1.3.0",
|
63
64
|
"@types/glob": "^7.1.4",
|
@@ -68,12 +69,12 @@
|
|
68
69
|
"@types/react-dom": "^17",
|
69
70
|
"@types/webpack-dev-server": "^4.1.0",
|
70
71
|
"typescript": "^4",
|
71
|
-
"@modern-js/core": "^1.
|
72
|
-
"@modern-js/plugin-testing": "^1.
|
73
|
-
"@modern-js/module-tools": "^1.
|
72
|
+
"@modern-js/core": "^1.1.2",
|
73
|
+
"@modern-js/plugin-testing": "^1.1.1",
|
74
|
+
"@modern-js/module-tools": "^1.1.1"
|
74
75
|
},
|
75
76
|
"peerDependencies": {
|
76
|
-
"@modern-js/core": "^1.
|
77
|
+
"@modern-js/core": "^1.1.2"
|
77
78
|
},
|
78
79
|
"sideEffects": false,
|
79
80
|
"modernConfig": {
|
package/src/build-task.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { IAppContext } from '@modern-js/core';
|
1
|
+
import type { IAppContext, CoreOptions } from '@modern-js/core';
|
2
2
|
import { Import } from '@modern-js/utils';
|
3
3
|
|
4
4
|
const core: typeof import('@modern-js/core') = Import.lazy(
|
@@ -20,7 +20,11 @@ const taskMain = async ({ appContext }: IBuildTaskOption) => {
|
|
20
20
|
};
|
21
21
|
|
22
22
|
(async () => {
|
23
|
-
|
23
|
+
let options: CoreOptions | undefined;
|
24
|
+
if (process.env.CORE_INIT_OPTION_FILE) {
|
25
|
+
options = require(process.env.CORE_INIT_OPTION_FILE);
|
26
|
+
}
|
27
|
+
const { appContext } = await core.cli.init([], options);
|
24
28
|
await core.manager.run(async () => {
|
25
29
|
try {
|
26
30
|
await taskMain({ appContext });
|
@@ -35,10 +35,20 @@ export function generatorWebpackConfig(
|
|
35
35
|
}),
|
36
36
|
],
|
37
37
|
};
|
38
|
+
const docsiteNodeModules = [
|
39
|
+
// for yarn
|
40
|
+
path.dirname(require.resolve('@modern-js/plugin-docsite/package.json')),
|
41
|
+
// for pnpm
|
42
|
+
path.resolve(
|
43
|
+
path.dirname(require.resolve('@modern-js/plugin-docsite/package.json')),
|
44
|
+
'../..',
|
45
|
+
),
|
46
|
+
];
|
38
47
|
|
48
|
+
// maybe check if outside appDir or monorepoDir
|
39
49
|
config.resolve!.modules = [
|
40
50
|
...(config.resolve!.modules || []),
|
41
|
-
|
51
|
+
...docsiteNodeModules,
|
42
52
|
];
|
43
53
|
(config.resolve!.alias as Alias)['@assets'] = path.resolve(
|
44
54
|
appDirectory,
|
@@ -53,35 +63,35 @@ export function generatorWebpackConfig(
|
|
53
63
|
`${path.dirname(require.resolve('core-js'))}/fn`
|
54
64
|
] = 'core-js/es';
|
55
65
|
|
56
|
-
const pkgJSON = JSON.parse(
|
57
|
-
|
58
|
-
);
|
66
|
+
// const pkgJSON = JSON.parse(
|
67
|
+
// fs.readFileSync(path.join(appDirectory, 'package.json'), 'utf-8'),
|
68
|
+
// );
|
59
69
|
|
60
|
-
if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
61
|
-
|
62
|
-
} else {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
}
|
70
|
-
if (
|
71
|
-
|
72
|
-
|
73
|
-
) {
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
} else {
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
70
|
+
// if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
71
|
+
// (config.resolve!.alias as Alias).react = path.resolve('node_modules/react');
|
72
|
+
// } else {
|
73
|
+
// (config.resolve!.alias as Alias).react = path.resolve(
|
74
|
+
// __dirname,
|
75
|
+
// '../../../../../',
|
76
|
+
// 'node_modules',
|
77
|
+
// 'react',
|
78
|
+
// );
|
79
|
+
// }
|
80
|
+
// if (
|
81
|
+
// pkgJSON.dependencies['react-dom'] ||
|
82
|
+
// pkgJSON.devDependencies['react-dom']
|
83
|
+
// ) {
|
84
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
85
|
+
// 'node_modules/react-dom',
|
86
|
+
// );
|
87
|
+
// } else {
|
88
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
89
|
+
// __dirname,
|
90
|
+
// '../../../../../',
|
91
|
+
// 'node_modules',
|
92
|
+
// 'react-dom',
|
93
|
+
// );
|
94
|
+
// }
|
85
95
|
|
86
96
|
config.resolve!.fallback = {
|
87
97
|
path: require.resolve('path-browserify'),
|