@modern-js/plugin-docsite 0.0.0-canary-20220410162404 → 0.0.0-canary-20220413101957
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/dist/js/modern/features/build.js +1 -2
- package/dist/js/modern/features/dev.js +1 -2
- package/dist/js/modern/features/index.js +1 -2
- package/dist/js/modern/features/utils/chokidar.js +1 -3
- package/dist/js/modern/features/utils/generate-files.js +0 -1
- package/dist/js/modern/features/utils/valid.js +1 -2
- package/dist/js/node/features/build.js +1 -2
- package/dist/js/node/features/dev.js +0 -1
- package/dist/js/node/features/index.js +1 -3
- package/dist/js/node/features/utils/chokidar.js +2 -6
- package/dist/js/node/features/utils/generate-files.js +0 -1
- package/dist/js/node/features/utils/valid.js +1 -7
- package/package.json +4 -6
@@ -1,7 +1,6 @@
|
|
1
1
|
import { logger, Import, chalk } from '@modern-js/utils';
|
2
2
|
const wp = Import.lazy('./utils/webpack', require);
|
3
|
-
const gen = Import.lazy('./utils/generate-files', require);
|
4
|
-
|
3
|
+
const gen = Import.lazy('./utils/generate-files', require);
|
5
4
|
export async function build(appDirectory, tmpDir, files, webpackConfig, isDev) {
|
6
5
|
const meta = await gen.generateFiles(appDirectory, tmpDir, files, isDev);
|
7
6
|
|
@@ -3,8 +3,7 @@ import { logger } from '@modern-js/utils';
|
|
3
3
|
import webpack from 'webpack';
|
4
4
|
import WebpackDevServer from 'webpack-dev-server';
|
5
5
|
import { chokidarFile } from "./utils/chokidar";
|
6
|
-
import { generateFiles } from "./utils/generate-files";
|
7
|
-
|
6
|
+
import { generateFiles } from "./utils/generate-files";
|
8
7
|
export async function dev(appDirectory, tmpDir, files, webpackConfig, isDev, port) {
|
9
8
|
await generateFiles(appDirectory, tmpDir, files, isDev);
|
10
9
|
const compiler = webpack(webpackConfig);
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import path from 'path';
|
2
|
-
import { fs, Import, logger } from '@modern-js/utils';
|
2
|
+
import { fs, glob, Import, logger } from '@modern-js/utils';
|
3
3
|
import { valid } from "./utils/valid";
|
4
4
|
const buildFeat = Import.lazy('./build', require);
|
5
5
|
const devFeat = Import.lazy('./dev', require);
|
6
6
|
const wp = Import.lazy('./utils/webpack', require);
|
7
|
-
const glob = Import.lazy('glob', require);
|
8
7
|
const DEFAULT_PORT = 5000;
|
9
8
|
export async function buildDocs({
|
10
9
|
appDirectory,
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import path from 'path';
|
2
|
-
import { logger } from '@modern-js/utils';
|
3
|
-
import chokidar from 'chokidar';
|
4
|
-
import glob from 'glob';
|
2
|
+
import { glob, logger, chokidar } from '@modern-js/utils';
|
5
3
|
import { generateFiles } from "./generate-files";
|
6
4
|
export function chokidarFile(appDirectory, tmpDir, isDev) {
|
7
5
|
let dirty = false;
|
@@ -36,7 +36,6 @@ const loadTemplate = async (file, customPath = false) => {
|
|
36
36
|
});
|
37
37
|
};
|
38
38
|
|
39
|
-
// eslint-disable-next-line max-statements
|
40
39
|
async function handleFile(appDirectory, tmpDir, file, images) {
|
41
40
|
const moduleName = file.replace(/\.(md|mdx)$/, '');
|
42
41
|
const content = await fs.readFile(path.resolve(appDirectory, 'docs', file));
|
@@ -9,8 +9,7 @@ var _utils = require("@modern-js/utils");
|
|
9
9
|
|
10
10
|
const wp = _utils.Import.lazy('./utils/webpack', require);
|
11
11
|
|
12
|
-
const gen = _utils.Import.lazy('./utils/generate-files', require);
|
13
|
-
|
12
|
+
const gen = _utils.Import.lazy('./utils/generate-files', require);
|
14
13
|
|
15
14
|
async function build(appDirectory, tmpDir, files, webpackConfig, isDev) {
|
16
15
|
const meta = await gen.generateFiles(appDirectory, tmpDir, files, isDev);
|
@@ -19,7 +19,6 @@ var _generateFiles = require("./utils/generate-files");
|
|
19
19
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
21
|
|
22
|
-
// eslint-disable-next-line max-params
|
23
22
|
async function dev(appDirectory, tmpDir, files, webpackConfig, isDev, port) {
|
24
23
|
await (0, _generateFiles.generateFiles)(appDirectory, tmpDir, files, isDev);
|
25
24
|
const compiler = (0, _webpack.default)(webpackConfig);
|
@@ -19,8 +19,6 @@ const devFeat = _utils.Import.lazy('./dev', require);
|
|
19
19
|
|
20
20
|
const wp = _utils.Import.lazy('./utils/webpack', require);
|
21
21
|
|
22
|
-
const glob = _utils.Import.lazy('glob', require);
|
23
|
-
|
24
22
|
const DEFAULT_PORT = 5000;
|
25
23
|
|
26
24
|
async function buildDocs({
|
@@ -42,7 +40,7 @@ async function buildDocs({
|
|
42
40
|
return;
|
43
41
|
}
|
44
42
|
|
45
|
-
const files = glob.sync('**/*.{md,mdx}', {
|
43
|
+
const files = _utils.glob.sync('**/*.{md,mdx}', {
|
46
44
|
cwd: docsDir,
|
47
45
|
ignore: '**/_*'
|
48
46
|
});
|
@@ -9,10 +9,6 @@ var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
|
10
10
|
var _utils = require("@modern-js/utils");
|
11
11
|
|
12
|
-
var _chokidar = _interopRequireDefault(require("chokidar"));
|
13
|
-
|
14
|
-
var _glob = _interopRequireDefault(require("glob"));
|
15
|
-
|
16
12
|
var _generateFiles = require("./generate-files");
|
17
13
|
|
18
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -21,7 +17,7 @@ function chokidarFile(appDirectory, tmpDir, isDev) {
|
|
21
17
|
let dirty = false;
|
22
18
|
let building = false;
|
23
19
|
|
24
|
-
|
20
|
+
_utils.chokidar.watch('docs/**/*.{md,mdx}', {
|
25
21
|
cwd: appDirectory,
|
26
22
|
ignoreInitial: true
|
27
23
|
}).on('all', async () => {
|
@@ -33,7 +29,7 @@ function chokidarFile(appDirectory, tmpDir, isDev) {
|
|
33
29
|
|
34
30
|
_utils.logger.info('changed, collect and rebuild docs');
|
35
31
|
|
36
|
-
const files =
|
32
|
+
const files = _utils.glob.sync('**/*.{md,mdx}', {
|
37
33
|
cwd: _path.default.resolve(appDirectory, 'docs'),
|
38
34
|
ignore: '**/_*'
|
39
35
|
});
|
@@ -59,7 +59,6 @@ const loadTemplate = async (file, customPath = false) => {
|
|
59
59
|
});
|
60
60
|
};
|
61
61
|
|
62
|
-
// eslint-disable-next-line max-statements
|
63
62
|
async function handleFile(appDirectory, tmpDir, file, images) {
|
64
63
|
const moduleName = file.replace(/\.(md|mdx)$/, '');
|
65
64
|
const content = await _utils.fs.readFile(_path.default.resolve(appDirectory, 'docs', file));
|
@@ -7,14 +7,8 @@ exports.valid = void 0;
|
|
7
7
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
9
9
|
|
10
|
-
var glob = _interopRequireWildcard(require("glob"));
|
11
|
-
|
12
10
|
var _utils = require("@modern-js/utils");
|
13
11
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
15
|
-
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
17
|
-
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
13
|
|
20
14
|
const valid = ({
|
@@ -23,7 +17,7 @@ const valid = ({
|
|
23
17
|
}) => {
|
24
18
|
const docsAbsPath = _path.default.join(appDirectory, docsDir);
|
25
19
|
|
26
|
-
const files = glob.sync(`${docsAbsPath}/**/*.{md,mdx}`);
|
20
|
+
const files = _utils.glob.sync(`${docsAbsPath}/**/*.{md,mdx}`);
|
27
21
|
|
28
22
|
if (!_utils.fs.existsSync(docsAbsPath) || files.length <= 0) {
|
29
23
|
console.info(_utils.chalk.yellow('No docs found, create directory "./docs" and add md(x) files'));
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "0.0.0-canary-
|
14
|
+
"version": "0.0.0-canary-20220413101957",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -37,13 +37,11 @@
|
|
37
37
|
"@babel/runtime": "^7",
|
38
38
|
"@mdx-js/mdx": "^1.6.22",
|
39
39
|
"@mdx-js/react": "^1.6.22",
|
40
|
-
"@modern-js/utils": "^0.0.0-canary-
|
41
|
-
"@modern-js/webpack": "^0.0.0-canary-
|
40
|
+
"@modern-js/utils": "^0.0.0-canary-20220413101957",
|
41
|
+
"@modern-js/webpack": "^0.0.0-canary-20220413101957",
|
42
42
|
"antd": "^4.16.13",
|
43
|
-
"chokidar": "^3.5.2",
|
44
43
|
"core-js": "^3.17.2",
|
45
44
|
"github-slugger": "^1.4.0",
|
46
|
-
"glob": "^7.1.6",
|
47
45
|
"gray-matter": "^4.0.3",
|
48
46
|
"html-webpack-plugin": "^5.3.2",
|
49
47
|
"lodash": "^4.17.21",
|
@@ -61,7 +59,7 @@
|
|
61
59
|
"webpack-dev-server": "^4.1.1"
|
62
60
|
},
|
63
61
|
"devDependencies": {
|
64
|
-
"@modern-js/core": "0.0.0-canary-
|
62
|
+
"@modern-js/core": "0.0.0-canary-20220413101957",
|
65
63
|
"@scripts/build": "0.0.0",
|
66
64
|
"@scripts/jest-config": "0.0.0",
|
67
65
|
"@types/core-js": "^2.5.5",
|