@modern-js/plugin-docsite 0.0.0-canary-20220413101957 → 0.0.0-canary-20220414073202
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,20 @@
|
|
1
1
|
# @modern-js/plugin-docsite
|
2
2
|
|
3
|
+
## 0.0.0-canary-20220414073202
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 17d0cc46: feat: prebundle lodash to @modern-js/utils/lodash
|
8
|
+
- Updated dependencies [ec1b7367]
|
9
|
+
- Updated dependencies [77ff9754]
|
10
|
+
- Updated dependencies [d2d1d6b2]
|
11
|
+
- Updated dependencies [07a4887e]
|
12
|
+
- Updated dependencies [ea2ae711]
|
13
|
+
- Updated dependencies [17d0cc46]
|
14
|
+
- Updated dependencies [d2d1d6b2]
|
15
|
+
- @modern-js/webpack@0.0.0-canary-20220414073202
|
16
|
+
- @modern-js/utils@0.0.0-canary-20220414073202
|
17
|
+
|
3
18
|
## 1.2.5
|
4
19
|
|
5
20
|
### Patch Changes
|
@@ -1,9 +1,3 @@
|
|
1
|
-
import _difference from "lodash/difference";
|
2
|
-
import _template from "lodash/template";
|
3
|
-
import _union from "lodash/union";
|
4
|
-
import _camelCase from "lodash/camelCase";
|
5
|
-
import _startCase from "lodash/startCase";
|
6
|
-
|
7
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
8
2
|
|
9
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
@@ -13,6 +7,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
13
7
|
import path from 'path';
|
14
8
|
import { logger, fs } from '@modern-js/utils';
|
15
9
|
import matter from 'gray-matter';
|
10
|
+
import { startCase, camelCase, union, template, difference } from '@modern-js/utils/lodash';
|
16
11
|
import GithubSlugger from 'github-slugger';
|
17
12
|
import sortPaths from 'sort-paths';
|
18
13
|
import visit from 'unist-util-visit';
|
@@ -31,7 +26,7 @@ const loadTemplate = async (file, customPath = false) => {
|
|
31
26
|
result = await fs.readFile(path.join(UTILS_STATIC, file), 'utf-8');
|
32
27
|
}
|
33
28
|
|
34
|
-
return
|
29
|
+
return template(result, {
|
35
30
|
interpolate: /<%=([\s\S]+?)%>/g
|
36
31
|
});
|
37
32
|
};
|
@@ -42,7 +37,7 @@ async function handleFile(appDirectory, tmpDir, file, images) {
|
|
42
37
|
const parsed = matter(content);
|
43
38
|
|
44
39
|
if (!parsed.data.title) {
|
45
|
-
parsed.data.title =
|
40
|
+
parsed.data.title = startCase(camelCase(path.basename(moduleName)));
|
46
41
|
}
|
47
42
|
|
48
43
|
const slugger = new GithubSlugger();
|
@@ -84,12 +79,10 @@ async function handleFile(appDirectory, tmpDir, file, images) {
|
|
84
79
|
}
|
85
80
|
});
|
86
81
|
});
|
87
|
-
|
88
|
-
const extraImported = _difference(imported.map(n => n.id), exported.map(n => n.id)); // we have to put the export statement with the import,
|
82
|
+
const extraImported = difference(imported.map(n => n.id), exported.map(n => n.id)); // we have to put the export statement with the import,
|
89
83
|
// otherwise the mdx's babel transformer cannot found
|
90
84
|
// the corresponding imports
|
91
85
|
|
92
|
-
|
93
86
|
extraImported.forEach(id => {
|
94
87
|
const {
|
95
88
|
node
|
@@ -140,9 +133,7 @@ async function handleFile(appDirectory, tmpDir, file, images) {
|
|
140
133
|
const transpiled = await mdx(parsed.content, {
|
141
134
|
remarkPlugins: [modifier]
|
142
135
|
});
|
143
|
-
|
144
|
-
const totalExported = _union(imported.map(n => n.id), exported.map(n => n.id));
|
145
|
-
|
136
|
+
const totalExported = union(imported.map(n => n.id), exported.map(n => n.id));
|
146
137
|
const outputFile = path.resolve(tmpDir, `${moduleName}/mdx.jsx`);
|
147
138
|
await fs.outputFile(outputFile, MDX_DEFAULT_RENDERER + transpiled, {
|
148
139
|
encoding: 'utf8'
|
@@ -5,22 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.generateFiles = generateFiles;
|
7
7
|
|
8
|
-
var _difference2 = _interopRequireDefault(require("lodash/difference"));
|
9
|
-
|
10
|
-
var _template2 = _interopRequireDefault(require("lodash/template"));
|
11
|
-
|
12
|
-
var _union2 = _interopRequireDefault(require("lodash/union"));
|
13
|
-
|
14
|
-
var _camelCase2 = _interopRequireDefault(require("lodash/camelCase"));
|
15
|
-
|
16
|
-
var _startCase2 = _interopRequireDefault(require("lodash/startCase"));
|
17
|
-
|
18
8
|
var _path = _interopRequireDefault(require("path"));
|
19
9
|
|
20
10
|
var _utils = require("@modern-js/utils");
|
21
11
|
|
22
12
|
var _grayMatter = _interopRequireDefault(require("gray-matter"));
|
23
13
|
|
14
|
+
var _lodash = require("@modern-js/utils/lodash");
|
15
|
+
|
24
16
|
var _githubSlugger = _interopRequireDefault(require("github-slugger"));
|
25
17
|
|
26
18
|
var _sortPaths = _interopRequireDefault(require("sort-paths"));
|
@@ -54,7 +46,7 @@ const loadTemplate = async (file, customPath = false) => {
|
|
54
46
|
result = await _utils.fs.readFile(_path.default.join(_constant.UTILS_STATIC, file), 'utf-8');
|
55
47
|
}
|
56
48
|
|
57
|
-
return (0,
|
49
|
+
return (0, _lodash.template)(result, {
|
58
50
|
interpolate: /<%=([\s\S]+?)%>/g
|
59
51
|
});
|
60
52
|
};
|
@@ -65,7 +57,7 @@ async function handleFile(appDirectory, tmpDir, file, images) {
|
|
65
57
|
const parsed = (0, _grayMatter.default)(content);
|
66
58
|
|
67
59
|
if (!parsed.data.title) {
|
68
|
-
parsed.data.title = (0,
|
60
|
+
parsed.data.title = (0, _lodash.startCase)((0, _lodash.camelCase)(_path.default.basename(moduleName)));
|
69
61
|
}
|
70
62
|
|
71
63
|
const slugger = new _githubSlugger.default();
|
@@ -109,7 +101,7 @@ async function handleFile(appDirectory, tmpDir, file, images) {
|
|
109
101
|
}
|
110
102
|
});
|
111
103
|
});
|
112
|
-
const extraImported = (0,
|
104
|
+
const extraImported = (0, _lodash.difference)(imported.map(n => n.id), exported.map(n => n.id)); // we have to put the export statement with the import,
|
113
105
|
// otherwise the mdx's babel transformer cannot found
|
114
106
|
// the corresponding imports
|
115
107
|
|
@@ -164,7 +156,7 @@ async function handleFile(appDirectory, tmpDir, file, images) {
|
|
164
156
|
const transpiled = await (0, _mdx.default)(parsed.content, {
|
165
157
|
remarkPlugins: [modifier]
|
166
158
|
});
|
167
|
-
const totalExported = (0,
|
159
|
+
const totalExported = (0, _lodash.union)(imported.map(n => n.id), exported.map(n => n.id));
|
168
160
|
|
169
161
|
const outputFile = _path.default.resolve(tmpDir, `${moduleName}/mdx.jsx`);
|
170
162
|
|
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-20220414073202",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -37,14 +37,13 @@
|
|
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-20220414073202",
|
41
|
+
"@modern-js/webpack": "^0.0.0-canary-20220414073202",
|
42
42
|
"antd": "^4.16.13",
|
43
43
|
"core-js": "^3.17.2",
|
44
44
|
"github-slugger": "^1.4.0",
|
45
45
|
"gray-matter": "^4.0.3",
|
46
46
|
"html-webpack-plugin": "^5.3.2",
|
47
|
-
"lodash": "^4.17.21",
|
48
47
|
"mdast-util-to-string": "^2.0.0",
|
49
48
|
"path-browserify": "^1.0.1",
|
50
49
|
"prism-react-renderer": "^1.2.1",
|
@@ -59,14 +58,13 @@
|
|
59
58
|
"webpack-dev-server": "^4.1.1"
|
60
59
|
},
|
61
60
|
"devDependencies": {
|
62
|
-
"@modern-js/core": "0.0.0-canary-
|
61
|
+
"@modern-js/core": "0.0.0-canary-20220414073202",
|
63
62
|
"@scripts/build": "0.0.0",
|
64
63
|
"@scripts/jest-config": "0.0.0",
|
65
64
|
"@types/core-js": "^2.5.5",
|
66
65
|
"@types/github-slugger": "^1.3.0",
|
67
66
|
"@types/glob": "^7.1.4",
|
68
67
|
"@types/jest": "^26",
|
69
|
-
"@types/lodash": "^4.14.168",
|
70
68
|
"@types/node": "^14",
|
71
69
|
"@types/react": "^17",
|
72
70
|
"@types/react-dom": "^17",
|