@modern-js/plugin-ssg 1.0.0-rc.9 → 1.1.1

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.
Files changed (50) hide show
  1. package/.eslintrc.js +6 -0
  2. package/CHANGELOG.md +249 -0
  3. package/README.md +19 -21
  4. package/dist/js/modern/index.js +96 -58
  5. package/dist/js/modern/libs/{render.js → make.js} +22 -0
  6. package/dist/js/modern/libs/replace.js +3 -2
  7. package/dist/js/modern/libs/util.js +38 -22
  8. package/dist/js/modern/server/index.js +1 -1
  9. package/dist/js/modern/server/process.js +3 -2
  10. package/dist/js/modern/types.js +1 -0
  11. package/dist/js/node/index.js +94 -57
  12. package/dist/js/node/libs/{render.js → make.js} +28 -0
  13. package/dist/js/node/libs/replace.js +3 -2
  14. package/dist/js/node/libs/util.js +38 -29
  15. package/dist/js/node/server/index.js +2 -2
  16. package/dist/js/node/server/process.js +3 -2
  17. package/dist/types/libs/make.d.ts +5 -0
  18. package/dist/types/libs/replace.d.ts +1 -1
  19. package/dist/types/libs/util.d.ts +4 -8
  20. package/dist/types/types.d.ts +13 -17
  21. package/package.json +21 -9
  22. package/src/index.ts +84 -83
  23. package/src/libs/make.ts +45 -0
  24. package/src/libs/replace.ts +7 -4
  25. package/src/libs/util.ts +40 -28
  26. package/src/server/index.ts +2 -2
  27. package/src/server/process.ts +4 -2
  28. package/src/types.ts +26 -20
  29. package/tests/.eslintrc.js +6 -0
  30. package/tests/lib.test.ts +48 -169
  31. package/tests/util.test.ts +71 -32
  32. package/dist/js/modern/libs/createPage.js +0 -46
  33. package/dist/js/modern/libs/invoker.js +0 -55
  34. package/dist/js/modern/loader/index.js +0 -105
  35. package/dist/js/modern/manifest-op.js +0 -101
  36. package/dist/js/node/libs/createPage.js +0 -57
  37. package/dist/js/node/libs/invoker.js +0 -66
  38. package/dist/js/node/loader/index.js +0 -115
  39. package/dist/js/node/manifest-op.js +0 -124
  40. package/dist/types/libs/createPage.d.ts +0 -2
  41. package/dist/types/libs/invoker.d.ts +0 -5
  42. package/dist/types/libs/render.d.ts +0 -3
  43. package/dist/types/loader/index.d.ts +0 -4
  44. package/dist/types/manifest-op.d.ts +0 -18
  45. package/src/libs/createPage.ts +0 -42
  46. package/src/libs/invoker.ts +0 -55
  47. package/src/libs/render.ts +0 -16
  48. package/src/loader/index.ts +0 -99
  49. package/src/manifest-op.ts +0 -111
  50. package/tests/operate.test.ts +0 -39
@@ -7,15 +7,13 @@ exports.default = void 0;
7
7
 
8
8
  var _path = _interopRequireDefault(require("path"));
9
9
 
10
- var _core = require("@modern-js/core");
11
-
12
10
  var _utils = require("@modern-js/utils");
13
11
 
14
- var _manifestOp = require("./manifest-op");
12
+ var _core = require("@modern-js/core");
15
13
 
16
- var _util = require("./libs/util");
14
+ var _reactRouterDom = require("react-router-dom");
17
15
 
18
- var _invoker = require("./libs/invoker");
16
+ var _util = require("./libs/util");
19
17
 
20
18
  var _server = require("./server");
21
19
 
@@ -23,34 +21,19 @@ var _output = require("./libs/output");
23
21
 
24
22
  var _replace = require("./libs/replace");
25
23
 
24
+ var _make = require("./libs/make");
25
+
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
 
28
- const listStaticFiles = (pwd, entriesDir, useSSG) => {
29
- const absEntriesDir = _path.default.join(pwd, entriesDir);
28
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
30
29
 
31
- const staticRenderLevel = (0, _util.getSSGRenderLevel)(useSSG);
32
- const staticFiles = new _manifestOp.LoaderManifest().get(absEntriesDir, staticRenderLevel); // 将绝对路径转换成 alias,因为获取到的约定路由也是使用别名的
30
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
33
31
 
34
- const staticAlias = staticFiles.map(filepath => (0, _util.replaceWithAlias)(_path.default.join(pwd, 'src'), filepath, _utils.INTERNAL_SRC_ALIAS));
35
- return staticAlias;
36
- };
32
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
37
33
 
38
34
  var _default = (0, _core.createPlugin)(() => {
39
35
  const agreedRouteMap = {};
40
36
  return {
41
- config() {
42
- return {
43
- tools: {
44
- babel(config, {
45
- chain
46
- }) {
47
- chain.plugin('./loader').use(require.resolve("./loader"));
48
- }
49
-
50
- }
51
- };
52
- },
53
-
54
37
  validateSchema() {
55
38
  return _utils.PLUGIN_SCHEMAS['@modern-js/plugin-ssg'];
56
39
  },
@@ -76,16 +59,11 @@ var _default = (0, _core.createPlugin)(() => {
76
59
 
77
60
  const appContext = (0, _core.useAppContext)();
78
61
  const {
79
- appDirectory
62
+ appDirectory,
63
+ entrypoints
80
64
  } = appContext;
81
65
  const {
82
- output,
83
- server: {
84
- baseUrl
85
- },
86
- source: {
87
- entriesDir
88
- }
66
+ output
89
67
  } = resolvedConfig;
90
68
  const {
91
69
  ssg,
@@ -97,15 +75,9 @@ var _default = (0, _core.createPlugin)(() => {
97
75
  return;
98
76
  }
99
77
 
100
- const {
101
- useSSG,
102
- userHook
103
- } = (0, _util.parsedSSGConfig)(ssgOptions);
104
-
105
78
  const buildDir = _path.default.join(appDirectory, outputPath);
106
79
 
107
- const routes = (0, _util.readJSONSpec)(buildDir);
108
- const staticAlias = listStaticFiles(appDirectory, entriesDir, useSSG); // filter all routes not web
80
+ const routes = (0, _util.readJSONSpec)(buildDir); // filter all routes not web
109
81
 
110
82
  const pageRoutes = routes.filter(route => !route.isApi);
111
83
  const apiRoutes = routes.filter(route => route.isApi); // if no web page route, skip ssg render
@@ -114,27 +86,91 @@ var _default = (0, _core.createPlugin)(() => {
114
86
  return;
115
87
  }
116
88
 
117
- const ssgRoutes = []; // callback of context.createPage, to format output, collect page route
118
-
119
- const listener = (route, agreed) => {
120
- const urlPrefix = (0, _util.getUrlPrefix)(route, baseUrl);
121
- const ssgOutput = (0, _util.getOutput)(route, urlPrefix, agreed);
122
- route.output = (0, _util.formatOutput)(route.entryPath, ssgOutput);
123
- ssgRoutes.push(route);
124
- }; // check if every allowed agreed route was collected
125
-
89
+ const intermediateOptions = (0, _util.standardOptions)(ssgOptions, entrypoints);
126
90
 
127
- const autoAddAgreed = context => {
128
- // if not exist in allowed list, return false
129
- if (!staticAlias.includes(context.component)) {
130
- return false;
131
- } // if allowed, return collection state
91
+ if (!intermediateOptions) {
92
+ return;
93
+ }
132
94
 
95
+ const ssgRoutes = []; // each route will try to match the configuration
96
+
97
+ pageRoutes.forEach(pageRoute => {
98
+ const {
99
+ entryName,
100
+ entryPath
101
+ } = pageRoute;
102
+ const agreedRoutes = agreedRouteMap[entryName];
103
+ let entryOptions = intermediateOptions[entryName];
104
+
105
+ if (!agreedRoutes) {
106
+ var _entryOptions$routes;
107
+
108
+ // default behavior for non-agreed route
109
+ if (!entryOptions) {
110
+ return;
111
+ } // only add entry route if entryOptions is true
112
+
113
+
114
+ if (entryOptions === true) {
115
+ ssgRoutes.push(_objectSpread(_objectSpread({}, pageRoute), {}, {
116
+ output: entryPath
117
+ }));
118
+ } else if (((_entryOptions$routes = entryOptions.routes) === null || _entryOptions$routes === void 0 ? void 0 : _entryOptions$routes.length) > 0) {
119
+ // if entryOptions is object and has routes options
120
+ // add every route in options
121
+ const {
122
+ routes: enrtyRoutes,
123
+ headers
124
+ } = entryOptions;
125
+ enrtyRoutes.forEach(route => {
126
+ ssgRoutes.push((0, _make.makeRoute)(pageRoute, route, headers));
127
+ });
128
+ }
129
+ } else {
130
+ // Unless entryOptions is set to false
131
+ // the default behavior is to add all file-based routes
132
+ if (entryOptions === false) {
133
+ return;
134
+ }
133
135
 
134
- return !ssgRoutes.some(ssgRoute => ssgRoute.urlPath === context.route.path);
135
- };
136
+ if (!entryOptions || entryOptions === true) {
137
+ entryOptions = {
138
+ preventDefault: [],
139
+ routes: [],
140
+ headers: {}
141
+ };
142
+ }
136
143
 
137
- await (0, _invoker.invoker)(pageRoutes, agreedRouteMap, userHook, autoAddAgreed, listener);
144
+ const {
145
+ preventDefault = [],
146
+ routes: userRoutes = [],
147
+ headers
148
+ } = entryOptions; // if the user sets the routes, then only add them
149
+
150
+ if (userRoutes.length > 0) {
151
+ userRoutes.forEach(route => {
152
+ if (typeof route === 'string') {
153
+ ssgRoutes.push((0, _make.makeRoute)(pageRoute, route, headers));
154
+ } else if (Array.isArray(route.params)) {
155
+ route.params.forEach(param => {
156
+ ssgRoutes.push((0, _make.makeRoute)(pageRoute, _objectSpread(_objectSpread({}, route), {}, {
157
+ url: (0, _reactRouterDom.generatePath)(route.url, param)
158
+ }), headers));
159
+ });
160
+ } else {
161
+ ssgRoutes.push((0, _make.makeRoute)(pageRoute, route, headers));
162
+ }
163
+ });
164
+ } else {
165
+ // otherwith add all except dynamic routes
166
+ agreedRoutes.filter(route => !preventDefault.includes(route.path)).forEach(route => {
167
+ if (!(0, _util.isDynamicUrl)(route.path)) {
168
+ ssgRoutes.push((0, _make.makeRoute)(pageRoute, route.path, headers));
169
+ }
170
+ });
171
+ }
172
+ }
173
+ });
138
174
 
139
175
  if (ssgRoutes.length === 0) {
140
176
  return;
@@ -153,6 +189,7 @@ var _default = (0, _core.createPlugin)(() => {
153
189
  }
154
190
 
155
191
  ssgRoute.isSSR = false;
192
+ ssgRoute.output = (0, _util.formatOutput)(ssgRoute.output);
156
193
  });
157
194
  const htmlAry = await (0, _server.createServer)(ssgRoutes, apiRoutes, resolvedConfig, appDirectory); // write to dist file
158
195
 
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.makeRender = makeRender;
7
+ exports.makeRoute = makeRoute;
8
+
9
+ var _path = _interopRequireDefault(require("path"));
10
+
11
+ var _normalizePath = _interopRequireDefault(require("normalize-path"));
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7
14
 
8
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
9
16
 
@@ -19,4 +26,25 @@ function makeRender(ssgRoutes, render, port) {
19
26
  }, ssgRoute.headers),
20
27
  connection: {}
21
28
  }));
29
+ }
30
+
31
+ function makeRoute(baseRoute, route, headers = {}) {
32
+ const {
33
+ urlPath,
34
+ entryPath
35
+ } = baseRoute;
36
+
37
+ if (typeof route === 'string') {
38
+ return _objectSpread(_objectSpread({}, baseRoute), {}, {
39
+ urlPath: (0, _normalizePath.default)(`${urlPath}${route}`),
40
+ headers,
41
+ output: _path.default.join(entryPath, `..${route}`)
42
+ });
43
+ } else {
44
+ return _objectSpread(_objectSpread({}, baseRoute), {}, {
45
+ urlPath: (0, _normalizePath.default)(`${urlPath}${route.url}`),
46
+ headers: _objectSpread(_objectSpread({}, headers), route.headers),
47
+ output: route.output ? _path.default.normalize(route.output) : _path.default.join(entryPath, `..${route.url}`)
48
+ });
49
+ }
22
50
  }
@@ -8,7 +8,7 @@ exports.replaceRoute = replaceRoute;
8
8
 
9
9
  var _normalizePath = _interopRequireDefault(require("normalize-path"));
10
10
 
11
- const _excluded = ["output"];
11
+ const _excluded = ["output", "headers"];
12
12
 
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
 
@@ -39,7 +39,8 @@ function replaceRoute(ssgRoutes, pageRoutes) {
39
39
  // remove redundant fields and replace rendered entryPath
40
40
  const cleanSsgRoutes = ssgRoutes.map(ssgRoute => {
41
41
  const {
42
- output
42
+ output,
43
+ headers
43
44
  } = ssgRoute,
44
45
  cleanSsgRoute = _objectWithoutProperties(ssgRoute, _excluded);
45
46
 
@@ -6,25 +6,19 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.formatOutput = formatOutput;
7
7
  exports.formatPath = formatPath;
8
8
  exports.getOutput = getOutput;
9
- exports.getSSGRenderLevel = void 0;
10
9
  exports.getUrlPrefix = getUrlPrefix;
11
10
  exports.isDynamicUrl = isDynamicUrl;
12
- exports.writeJSONSpec = exports.replaceWithAlias = exports.readJSONSpec = exports.parsedSSGConfig = void 0;
11
+ exports.writeJSONSpec = exports.standardOptions = exports.replaceWithAlias = exports.readJSONSpec = void 0;
13
12
 
14
13
  var _path = _interopRequireDefault(require("path"));
15
14
 
16
15
  var _utils = require("@modern-js/utils");
17
16
 
18
- var _manifestOp = require("../manifest-op");
19
-
20
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
18
 
22
- function formatOutput(base, filename) {
23
- const file = _path.default.extname(filename) ? filename : `${filename}/index.html`;
24
-
25
- const dirname = _path.default.dirname(base);
26
-
27
- return _path.default.join(dirname, file);
19
+ function formatOutput(filename) {
20
+ const outputPath = _path.default.extname(filename) ? filename : `${filename}/index.html`;
21
+ return outputPath;
28
22
  }
29
23
 
30
24
  function formatPath(str) {
@@ -122,30 +116,45 @@ const writeJSONSpec = (dir, routes) => {
122
116
 
123
117
  exports.writeJSONSpec = writeJSONSpec;
124
118
 
125
- const getSSGRenderLevel = key => {
126
- const level = typeof key === 'boolean' ? _manifestOp.MODE.LOOSE : _manifestOp.MODE[key.toUpperCase()]; // currently only MODE.STRICT and MODE.LOOSE are supported
119
+ const replaceWithAlias = (base, filePath, alias) => _path.default.posix.join(alias, _path.default.posix.relative(base, filePath));
127
120
 
128
- if (!level || level > 2 || level < 1) {
129
- throw new Error(`[SSG Render Fail] SSG 不支持当前 Mode,useSSG: ${key.toString()}, Level: ${level}`);
130
- }
121
+ exports.replaceWithAlias = replaceWithAlias;
131
122
 
132
- return level;
133
- };
123
+ const standardOptions = (ssgOptions, entrypoints) => {
124
+ if (ssgOptions === false) {
125
+ return false;
126
+ }
134
127
 
135
- exports.getSSGRenderLevel = getSSGRenderLevel;
128
+ if (ssgOptions === true) {
129
+ return entrypoints.reduce((opt, entry) => {
130
+ opt[entry.entryName] = ssgOptions;
131
+ return opt;
132
+ }, {});
133
+ } else if (typeof ssgOptions === 'object') {
134
+ const isSingle = (0, _utils.isSingleEntry)(entrypoints);
135
+
136
+ if (isSingle && typeof ssgOptions.main === 'undefined') {
137
+ return {
138
+ main: ssgOptions
139
+ };
140
+ } else {
141
+ return ssgOptions;
142
+ }
143
+ } else if (typeof ssgOptions === 'function') {
144
+ const intermediateOptions = {};
136
145
 
137
- const parsedSSGConfig = ssg => {
138
- const useSSG = typeof ssg === 'string' ? ssg : true; // eslint-disable-next-line @typescript-eslint/no-empty-function
146
+ for (const entrypoint of entrypoints) {
147
+ const {
148
+ entryName
149
+ } = entrypoint; // Todo may be async function
139
150
 
140
- const userHook = typeof ssg === 'function' ? ssg : () => {};
141
- return {
142
- useSSG,
143
- userHook
144
- };
145
- };
151
+ intermediateOptions[entryName] = ssgOptions(entryName);
152
+ }
146
153
 
147
- exports.parsedSSGConfig = parsedSSGConfig;
154
+ return intermediateOptions;
155
+ }
148
156
 
149
- const replaceWithAlias = (base, filePath, alias) => _path.default.join(alias, _path.default.relative(base, filePath));
157
+ return false;
158
+ };
150
159
 
151
- exports.replaceWithAlias = replaceWithAlias;
160
+ exports.standardOptions = standardOptions;
@@ -9,10 +9,10 @@ var _child_process = _interopRequireDefault(require("child_process"));
9
9
 
10
10
  var _path = _interopRequireDefault(require("path"));
11
11
 
12
- var _core = require("@modern-js/core");
13
-
14
12
  var _utils = require("@modern-js/utils");
15
13
 
14
+ var _core = require("@modern-js/core");
15
+
16
16
  var _consts = require("./consts");
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -6,7 +6,7 @@ var _portfinder = _interopRequireDefault(require("portfinder"));
6
6
 
7
7
  var _utils = require("@modern-js/utils");
8
8
 
9
- var _render = require("../libs/render");
9
+ var _make = require("../libs/make");
10
10
 
11
11
  var _prerender = require("./prerender");
12
12
 
@@ -65,7 +65,8 @@ process.on('message', async chunk => {
65
65
 
66
66
 
67
67
  const render = (0, _prerender.compile)(modernServer.getRequestHandler());
68
- const renderPromiseAry = (0, _render.makeRender)(routes.filter(route => !route.isApi), render, port);
68
+ const renderPromiseAry = (0, _make.makeRender)(routes.filter(route => !route.isApi), render, port); // eslint-disable-next-line promise/no-promise-in-callback
69
+
69
70
  const htmlAry = await Promise.all(renderPromiseAry);
70
71
  htmlAry.forEach(html => {
71
72
  process.send(html);
@@ -0,0 +1,5 @@
1
+ import { ModernRoute } from '@modern-js/server';
2
+ import { compile } from '../server/prerender';
3
+ import { RouteOptions, SsgRoute } from '../types';
4
+ export declare function makeRender(ssgRoutes: SsgRoute[], render: ReturnType<typeof compile>, port: number): Promise<string>[];
5
+ export declare function makeRoute(baseRoute: ModernRoute, route: string | RouteOptions, headers?: Record<string, any>): SsgRoute;
@@ -1,4 +1,4 @@
1
1
  import { ModernRoute } from '@modern-js/server';
2
2
  import { SsgRoute } from '../types';
3
- export declare function exist(route: SsgRoute, pageRoutes: ModernRoute[]): number;
3
+ export declare function exist(route: ModernRoute, pageRoutes: ModernRoute[]): number;
4
4
  export declare function replaceRoute(ssgRoutes: SsgRoute[], pageRoutes: ModernRoute[]): ModernRoute[];
@@ -1,15 +1,11 @@
1
1
  import { ModernRoute } from '@modern-js/server';
2
- import { SSGConfig, SsgRoute } from '../types';
3
- export declare function formatOutput(base: string, filename: string): string;
2
+ import { EntryPoint, MultiEntryOptions, SSG, SsgRoute } from '../types';
3
+ export declare function formatOutput(filename: string): string;
4
4
  export declare function formatPath(str: string): string;
5
5
  export declare function isDynamicUrl(url: string): boolean;
6
6
  export declare function getUrlPrefix(route: SsgRoute, baseUrl: string | string[]): string;
7
7
  export declare function getOutput(route: SsgRoute, base: string, agreed?: boolean): string;
8
8
  export declare const readJSONSpec: (dir: string) => ModernRoute[];
9
9
  export declare const writeJSONSpec: (dir: string, routes: ModernRoute[]) => void;
10
- export declare const getSSGRenderLevel: (key: boolean | string) => number;
11
- export declare const parsedSSGConfig: (ssg: SSGConfig) => {
12
- useSSG: string | boolean;
13
- userHook: (context: any) => void;
14
- };
15
- export declare const replaceWithAlias: (base: string, filePath: string, alias: string) => string;
10
+ export declare const replaceWithAlias: (base: string, filePath: string, alias: string) => string;
11
+ export declare const standardOptions: (ssgOptions: SSG, entrypoints: EntryPoint[]) => false | MultiEntryOptions;
@@ -12,27 +12,23 @@ export declare type EntryPoint = {
12
12
  export declare type AgreedRouteMap = {
13
13
  [propNames: string]: AgreedRoute[];
14
14
  };
15
- export declare type FreshPageConfig = {
16
- url?: string;
17
- output?: string;
18
- params?: Record<string, string | number>;
15
+ export declare type SsgRoute = ModernRoute & {
16
+ output: string;
19
17
  headers?: Record<string, string>;
20
18
  };
21
- export declare type UserInterfaceRoute = ModernRoute & {
22
- path: string;
23
- agreed?: boolean;
24
- };
25
- export declare type CreatePageParam = FreshPageConfig | FreshPageConfig[];
26
- export declare type CreatePageListener = (route: SsgRoute, agreed?: boolean) => void;
27
- export declare type SsgRoute = ModernRoute & {
19
+ export declare type RouteOptions = string | {
20
+ url: string;
28
21
  output?: string;
29
- headers?: Record<string, string>;
22
+ params?: Record<string, any>[];
23
+ headers?: Record<string, any>;
30
24
  };
31
- export declare type HookContext = {
32
- createPage: (config?: CreatePageParam) => any;
33
- route: UserInterfaceRoute;
25
+ export declare type SingleEntryOptions = boolean | {
26
+ preventDefault?: string[];
27
+ headers?: Record<string, any>;
28
+ routes: RouteOptions[];
34
29
  };
35
- export declare type SSGConfig = string | ((context: any) => void);
30
+ export declare type MultiEntryOptions = Record<string, SingleEntryOptions>;
31
+ export declare type SSG = boolean | SingleEntryOptions | MultiEntryOptions | ((entryName: string) => SingleEntryOptions);
36
32
  export declare type ExtendOutputConfig = {
37
- ssg: SSGConfig;
33
+ ssg: SSG;
38
34
  };
package/package.json CHANGED
@@ -1,6 +1,17 @@
1
1
  {
2
2
  "name": "@modern-js/plugin-ssg",
3
- "version": "1.0.0-rc.9",
3
+ "description": "The meta-framework suite designed from scratch for frontend-focused modern web development.",
4
+ "homepage": "https://modernjs.dev",
5
+ "bugs": "https://github.com/modern-js-dev/modern.js/issues",
6
+ "repository": "modern-js-dev/modern.js",
7
+ "license": "MIT",
8
+ "keywords": [
9
+ "react",
10
+ "framework",
11
+ "modern",
12
+ "modern.js"
13
+ ],
14
+ "version": "1.1.1",
4
15
  "jsnext:source": "./src/index.ts",
5
16
  "types": "./dist/types/index.d.ts",
6
17
  "main": "./dist/js/node/index.js",
@@ -24,17 +35,14 @@
24
35
  },
25
36
  "dependencies": {
26
37
  "@babel/runtime": "^7",
27
- "@modern-js/babel-chain": "^1.0.0-rc.9",
28
- "@modern-js/core": "^1.0.0-rc.9",
29
- "@modern-js/utils": "^1.0.0-rc.9",
38
+ "@modern-js/utils": "^1.1.2",
30
39
  "node-mocks-http": "^1.10.1",
31
40
  "normalize-path": "^3.0.0",
32
41
  "portfinder": "^1.0.28",
33
- "react-router-dom": "^5.2.1",
34
- "webpack-chain": "^6.5.1"
42
+ "react-router-dom": "^5.2.1"
35
43
  },
36
44
  "devDependencies": {
37
- "@modern-js/server": "^1.0.0-rc.9",
45
+ "@modern-js/server": "^1.1.2",
38
46
  "@types/jest": "^26",
39
47
  "@types/node": "^14",
40
48
  "@types/react": "^17",
@@ -42,8 +50,12 @@
42
50
  "@types/react-router": "^5.1.16",
43
51
  "@types/react-router-dom": "^5.1.8",
44
52
  "typescript": "^4",
45
- "@modern-js/plugin-testing": "^1.0.0-rc.9",
46
- "@modern-js/module-tools": "^1.0.0-rc.9"
53
+ "@modern-js/core": "^1.1.2",
54
+ "@modern-js/plugin-testing": "^1.1.0",
55
+ "@modern-js/module-tools": "^1.1.0"
56
+ },
57
+ "peerDependencies": {
58
+ "@modern-js/core": "^1.1.2"
47
59
  },
48
60
  "sideEffects": false,
49
61
  "modernConfig": {