swico 1.2.1-beta.2 → 1.3.0-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "1.2.1-beta.2",
3
+ "version": "1.3.0-beta.2",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -61,13 +61,16 @@ var path_1 = __importDefault(require("path"));
61
61
  var _a = process.env, SWICO_PORT = _a.SWICO_PORT, SWICO_RESTART = _a.SWICO_RESTART, SWICO_ROUTER_BASE = _a.SWICO_ROUTER_BASE;
62
62
  var package_json_1 = __importDefault(require("../../package.json"));
63
63
  var chalk_1 = __importDefault(require("chalk"));
64
+ var fs_extra_1 = __importDefault(require("fs-extra"));
64
65
  var currentPort, currentRouterBase = '/';
65
- var handleWatch = function (projectPath, devServer) {
66
+ var handleWatch = function (projectPath, devServer, env) {
67
+ var envPath = env === 'dev' ? '/.dev/' : '/.prod/';
66
68
  var configFilesWatcher = chokidar_1.default
67
69
  .watch([path_1.default.join(projectPath, '/config/*.ts'), path_1.default.join(projectPath, '/.eslintrc')], {
68
70
  interval: 500,
69
71
  binaryInterval: 500,
70
- ignoreInitial: true
72
+ ignoreInitial: true,
73
+ ignored: [path_1.default.join(projectPath, '/config/swico.prod.ts')]
71
74
  })
72
75
  .on('all', function (path, stats) { return __awaiter(void 0, void 0, void 0, function () {
73
76
  return __generator(this, function (_a) {
@@ -87,33 +90,48 @@ var handleWatch = function (projectPath, devServer) {
87
90
  }
88
91
  });
89
92
  }); });
90
- var watchFiles = [
91
- path_1.default.join(projectPath, '/src/loading/index.tsx'),
93
+ var globalStyleFilesPathList = [
92
94
  path_1.default.join(projectPath, '/src/global.css'),
93
95
  path_1.default.join(projectPath, '/src/global.less'),
94
96
  path_1.default.join(projectPath, '/src/global.scss')
95
97
  ];
98
+ var loadingFilePath = path_1.default.join(projectPath, '/src/loading/index.tsx');
96
99
  var tsTypingsWatcher = chokidar_1.default
97
100
  .watch([path_1.default.join(projectPath, '/src/**/*')], {
98
101
  interval: 500,
99
102
  binaryInterval: 500,
100
103
  ignoreInitial: true
101
104
  })
102
- .on('all', function (eventName, path, stats) { return __awaiter(void 0, void 0, void 0, function () {
103
- return __generator(this, function (_a) {
104
- switch (_a.label) {
105
- case 0:
106
- if (!((watchFiles.includes(path) || path.endsWith('.d.ts')) &&
107
- ['add'].includes(eventName))) return [3, 3];
108
- return [4, devServer.stop()];
105
+ .on('all', function (eventName, filePath, stats) { return __awaiter(void 0, void 0, void 0, function () {
106
+ var replaceIndexText, _a;
107
+ return __generator(this, function (_b) {
108
+ switch (_b.label) {
109
+ case 0: return [4, fs_extra_1.default.readFile(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), 'utf8')];
109
110
  case 1:
110
- _a.sent();
111
+ replaceIndexText = _b.sent();
112
+ if (!['add', 'unlink'].includes(eventName)) return [3, 7];
113
+ _a = true;
114
+ switch (_a) {
115
+ case filePath.endsWith('.d.ts'): return [3, 2];
116
+ case globalStyleFilesPathList.includes(filePath): return [3, 5];
117
+ case filePath === loadingFilePath: return [3, 6];
118
+ }
119
+ return [3, 7];
120
+ case 2: return [4, devServer.stop()];
121
+ case 3:
122
+ _b.sent();
111
123
  return [4, tsTypingsWatcher.close()];
112
- case 2:
113
- _a.sent();
124
+ case 4:
125
+ _b.sent();
114
126
  restartServer();
115
- _a.label = 3;
116
- case 3: return [2];
127
+ return [3, 7];
128
+ case 5:
129
+ (0, config_1.handleGlobalStyleFile)(replaceIndexText);
130
+ return [3, 7];
131
+ case 6:
132
+ (0, config_1.handleLoadingFile)(replaceIndexText, envPath);
133
+ _b.label = 7;
134
+ case 7: return [2];
117
135
  }
118
136
  });
119
137
  }); });
@@ -167,7 +185,7 @@ var createCompileListener = function (compiler) {
167
185
  function start() {
168
186
  var _a, _b, _c, _d, _e, _f;
169
187
  return __awaiter(this, void 0, void 0, function () {
170
- var availablePort, _g, projectConfig, projectPath, customConfig, newRouterBase, startConfig, compiler, oriLogger, devServer, e_1, strErr;
188
+ var availablePort, _g, projectConfig, projectPath, customConfig, env, newRouterBase, startConfig, compiler, oriLogger, devServer, e_1, strErr;
171
189
  return __generator(this, function (_h) {
172
190
  switch (_h.label) {
173
191
  case 0:
@@ -191,7 +209,7 @@ function start() {
191
209
  return [4, (0, config_1.getProjectConfig)('dev')];
192
210
  case 5:
193
211
  projectConfig = _h.sent();
194
- projectPath = projectConfig.projectPath, customConfig = projectConfig.customConfig;
212
+ projectPath = projectConfig.projectPath, customConfig = projectConfig.customConfig, env = projectConfig.env;
195
213
  newRouterBase = (_f = (_c = (_b = (_a = customConfig['dev']) === null || _a === void 0 ? void 0 : _a.router) === null || _b === void 0 ? void 0 : _b.base) !== null && _c !== void 0 ? _c : (_e = (_d = customConfig['base']) === null || _d === void 0 ? void 0 : _d.router) === null || _e === void 0 ? void 0 : _e.base) !== null && _f !== void 0 ? _f : '/';
196
214
  return [4, (0, webpack_dev_1.default)(projectConfig)];
197
215
  case 6:
@@ -209,7 +227,7 @@ function start() {
209
227
  process.env.SWICO_PORT = availablePort.toString();
210
228
  createCompileListener(compiler);
211
229
  compiler.getInfrastructureLogger = oriLogger;
212
- handleWatch(projectPath, devServer);
230
+ handleWatch(projectPath, devServer, env);
213
231
  if (SWICO_RESTART !== 'true' ||
214
232
  (SWICO_RESTART === 'true' && newRouterBase !== SWICO_ROUTER_BASE)) {
215
233
  tools_1.toast.info("Project is running at\uFF1A".concat(chalk_1.default.hex('#29abe0')("".concat(startConfig.devServer.server, "://localhost:").concat(availablePort).concat(newRouterBase))));
@@ -5,6 +5,7 @@ export declare const formatAncPath: (ancPath: string) => string;
5
5
  export declare const pathNameList: {
6
6
  path: string;
7
7
  name: string;
8
+ custom?: any;
8
9
  }[];
9
10
  export declare const getHistory: (router: any) => {
10
11
  go: (delta: any) => void;
@@ -72,9 +72,9 @@ exports.formatAncPath = formatAncPath;
72
72
  var getPathNameList = function (routes) {
73
73
  var list = [];
74
74
  var checkRouteItem = function (item, ancPath) {
75
- var path = item.path, name = item.name, children = item.children;
75
+ var path = item.path, name = item.name, children = item.children, custom = item.custom;
76
76
  var newAncPath = "".concat((0, exports.formatAncPath)(ancPath)).concat(path.startsWith('/') ? path : '/' + path);
77
- list.push({ path: newAncPath, name: name });
77
+ list.push({ path: newAncPath, name: name, custom: custom });
78
78
  if (children) {
79
79
  children.some(function (item) { return checkRouteItem(item, newAncPath); });
80
80
  }
@@ -97,7 +97,8 @@ var getLocation = function (historyLocation) {
97
97
  query: search ? qs_1.default.parse(search.startsWith('?') ? search.slice(1) : search) : {},
98
98
  name: matchPathNameItem === null || matchPathNameItem === void 0 ? void 0 : matchPathNameItem.name,
99
99
  params: params,
100
- path: path
100
+ path: path,
101
+ custom: matchPathNameItem === null || matchPathNameItem === void 0 ? void 0 : matchPathNameItem.custom
101
102
  };
102
103
  };
103
104
  var getFormatHistoryOption = function (to, pathList, type) {
@@ -8,5 +8,6 @@ export type RoutesItemType = {
8
8
  path: string;
9
9
  redirect?: string;
10
10
  name?: string;
11
+ custom?: any;
11
12
  };
12
13
  export declare const getChildrenRouteList: (childrenRoutes: RoutesItemType[], ancPathKey: string) => any;
@@ -19,20 +19,21 @@ var react_router_dom_1 = require("react-router-dom");
19
19
  var history_1 = require("./$env/history");
20
20
  var qs_1 = __importDefault(require("qs"));
21
21
  var useLocation = function () {
22
- var _a, _b;
22
+ var _a;
23
23
  var location = (0, react_router_dom_1.useLocation)();
24
24
  var params = (0, react_router_dom_1.useParams)();
25
25
  var search = location.search, hash = location.hash, pathname = location.pathname, state = location.state;
26
- var name = (_a = history_1.pathNameList.find(function (item) {
26
+ var matchItem = history_1.pathNameList.find(function (item) {
27
27
  return (Object.keys(params).length > 0 && (0, history_1.compareURLPatterns)(pathname, item.path)) ||
28
28
  item.path === pathname;
29
- })) === null || _a === void 0 ? void 0 : _a.name;
29
+ });
30
30
  var query = search ? qs_1.default.parse(search.startsWith('?') ? search.slice(1) : search) : {};
31
31
  return {
32
- name: name,
32
+ name: matchItem === null || matchItem === void 0 ? void 0 : matchItem.name,
33
+ custom: matchItem === null || matchItem === void 0 ? void 0 : matchItem.custom,
33
34
  state: state !== null && state !== void 0 ? state : {},
34
35
  path: pathname,
35
- pathname: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.pathname,
36
+ pathname: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.pathname,
36
37
  search: '',
37
38
  query: query,
38
39
  hash: hash,
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
@@ -8,10 +19,17 @@ var vue_router_1 = require("vue-router");
8
19
  var config_1 = require("./config");
9
20
  var routes_1 = __importDefault(require("./routes"));
10
21
  var qs_1 = __importDefault(require("qs"));
22
+ var transformRouteItemCustomToMeta = function (routeItem) {
23
+ var newRouteItem = __assign({}, routeItem);
24
+ var custom = routeItem.custom, children = routeItem.children;
25
+ newRouteItem.meta = custom;
26
+ return __assign(__assign({}, newRouteItem), { children: children === null || children === void 0 ? void 0 : children.map(function (item) { return transformRouteItemCustomToMeta(item); }) });
27
+ };
28
+ var formatRoutes = routes_1.default.map(function (routeItem) { return transformRouteItemCustomToMeta(routeItem); });
11
29
  var getRouter = function () {
12
30
  var router = (0, vue_router_1.createRouter)({
13
31
  history: (config_1.routerType === 'hash' ? vue_router_1.createWebHashHistory : vue_router_1.createWebHistory)(config_1.routerBase),
14
- routes: routes_1.default
32
+ routes: formatRoutes
15
33
  });
16
34
  exports.history = {
17
35
  push: function (options) {
@@ -39,9 +57,10 @@ var getRouter = function () {
39
57
  var _a, _b;
40
58
  var lastIndexBase = config_1.routerBase[config_1.routerBase.length - 1];
41
59
  var formatRouterBase = lastIndexBase === '/' ? config_1.routerBase.slice(0, config_1.routerBase.length - 1) : config_1.routerBase;
42
- var _c = router.currentRoute.value, path = _c.path, params = _c.params, query = _c.query, name = _c.name, hash = _c.hash, fullPath = _c.fullPath;
60
+ var _c = router.currentRoute.value, path = _c.path, params = _c.params, query = _c.query, name = _c.name, hash = _c.hash, fullPath = _c.fullPath, meta = _c.meta;
43
61
  return {
44
62
  path: path,
63
+ custom: meta,
45
64
  pathname: formatRouterBase + path,
46
65
  params: params,
47
66
  query: query,
@@ -38,7 +38,7 @@ var useLocation = function () {
38
38
  });
39
39
  (0, vue_1.watchEffect)(function () {
40
40
  var _a;
41
- var hash = route.hash, path = route.path, params = route.params, fullPath = route.fullPath, query = route.query, name = route.name;
41
+ var hash = route.hash, path = route.path, params = route.params, fullPath = route.fullPath, query = route.query, name = route.name, meta = route.meta;
42
42
  var search = query ? qs_1.default.stringify(query) : '';
43
43
  location.name = name;
44
44
  location.path = path;
@@ -48,6 +48,7 @@ var useLocation = function () {
48
48
  location.hash = hash;
49
49
  location.params = params;
50
50
  location.state = ((_a = window.history.state) === null || _a === void 0 ? void 0 : _a.swicoState) || {};
51
+ location.custom = meta;
51
52
  });
52
53
  return location;
53
54
  };
@@ -7,6 +7,7 @@ export type SwicoLocationType = {
7
7
  pathname: string;
8
8
  search: string;
9
9
  state?: Record<string, any>;
10
+ custom?: any;
10
11
  };
11
12
  export type SwicoHistoryOptionType = {
12
13
  query?: Record<string, any>;
@@ -15,6 +16,7 @@ export type SwicoHistoryOptionType = {
15
16
  path?: string;
16
17
  name?: string;
17
18
  state?: Record<string, any>;
19
+ custom?: any;
18
20
  };
19
21
  export type SwicoHistoryType = {
20
22
  push: (to: string | SwicoHistoryOptionType) => void;
@@ -5,6 +5,7 @@ export type ConfigRoutesItemType = {
5
5
  redirect?: string;
6
6
  name?: string;
7
7
  decorator?: string;
8
+ custom?: any;
8
9
  [key: string]: any;
9
10
  };
10
11
  export type ConfigRouterType = {
@@ -43,5 +44,7 @@ export interface GlobalData {
43
44
  };
44
45
  }
45
46
  export declare const getProjectConfig: (env: GlobalData['env']) => Promise<GlobalData>;
47
+ export declare const handleLoadingFile: (replaceIndexText: any, envPath: any) => Promise<void>;
48
+ export declare const handleGlobalStyleFile: (replaceIndexText: any) => any;
46
49
  export declare const getFormatDefineVars: (defineVarsConfigData: any) => Promise<{}>;
47
50
  export declare const initConfig: Omit<GlobalSwicoConfigType, 'template'>;
@@ -73,7 +73,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
73
73
  return (mod && mod.__esModule) ? mod : { "default": mod };
74
74
  };
75
75
  Object.defineProperty(exports, "__esModule", { value: true });
76
- exports.initConfig = exports.getFormatDefineVars = exports.getProjectConfig = void 0;
76
+ exports.initConfig = exports.getFormatDefineVars = exports.handleGlobalStyleFile = exports.handleLoadingFile = exports.getProjectConfig = void 0;
77
77
  var fs_extra_1 = __importDefault(require("fs-extra"));
78
78
  var path_1 = __importDefault(require("path"));
79
79
  var chalk_1 = __importDefault(require("chalk"));
@@ -286,12 +286,49 @@ var getGlobalStyleFilePath = function () {
286
286
  }
287
287
  return { filePath: filePath, fileType: fileType };
288
288
  };
289
+ var handleLoadingFile = function (replaceIndexText, envPath) { return __awaiter(void 0, void 0, void 0, function () {
290
+ var e_1;
291
+ return __generator(this, function (_a) {
292
+ switch (_a.label) {
293
+ case 0:
294
+ _a.trys.push([0, 2, 3, 5]);
295
+ return [4, fs_extra_1.default.access(path_1.default.resolve(projectPath, './src/loading/index.tsx'), fs_extra_1.default.constants.F_OK)];
296
+ case 1:
297
+ _a.sent();
298
+ replaceIndexText = replaceIndexText.replace('"../loading"', '"../../loading"');
299
+ return [3, 5];
300
+ case 2:
301
+ e_1 = _a.sent();
302
+ replaceIndexText = replaceIndexText.replace('"../../loading"', '"../loading"');
303
+ return [3, 5];
304
+ case 3: return [4, fs_extra_1.default.writeFile(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), replaceIndexText)];
305
+ case 4:
306
+ _a.sent();
307
+ return [7];
308
+ case 5: return [2];
309
+ }
310
+ });
311
+ }); };
312
+ exports.handleLoadingFile = handleLoadingFile;
313
+ var handleGlobalStyleFile = function (replaceIndexText) {
314
+ var _a = getGlobalStyleFilePath(), styleFilePath = _a.filePath, styleFileType = _a.fileType;
315
+ var newReplaceIndexText = replaceIndexText;
316
+ if (styleFilePath) {
317
+ newReplaceIndexText = newReplaceIndexText.replaceAll("require(\"../../global.".concat(styleFileType, "\");"), '');
318
+ newReplaceIndexText = "require(\"../../global.".concat(styleFileType, "\");\n").concat(replaceIndexText);
319
+ }
320
+ else {
321
+ newReplaceIndexText = newReplaceIndexText.replaceAll(/require\("\.\.\/\.\.\/global.(less|scss|css)"\);/g, '');
322
+ }
323
+ return newReplaceIndexText;
324
+ };
325
+ exports.handleGlobalStyleFile = handleGlobalStyleFile;
289
326
  var initTemplateConfig = function (routerConfig, templateType, env) {
290
327
  var envPath = env === 'dev' ? '/.dev/' : '/.prod/';
291
328
  return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
292
- var copyTargetPath, replaceIndexText, hooksFilePath, replaceHooksText, _a, styleFilePath, styleFileType, e_1;
293
- return __generator(this, function (_b) {
294
- switch (_b.label) {
329
+ var copyTargetPath, replaceIndexText, hooksFilePath, replaceHooksText;
330
+ return __generator(this, function (_a) {
331
+ switch (_a.label) {
295
332
  case 0:
296
333
  copyTargetPath = path_1.default.resolve(projectPath, "./src/.swico".concat(envPath));
297
334
  return [4, (0, tools_1.copyDirFiles)(path_1.default.resolve(__dirname, "../template/".concat(templateType, "/$env")), copyTargetPath, function (fileName) {
@@ -301,59 +338,39 @@ var initTemplateConfig = function (routerConfig, templateType, env) {
301
338
  : !['react-hooks.js'].includes(fileName));
302
339
  })];
303
340
  case 1:
304
- _b.sent();
341
+ _a.sent();
305
342
  return [4, (0, tools_1.copyDirFiles)(path_1.default.resolve(__dirname, "../template/".concat(templateType)), path_1.default.resolve(projectPath, './src/.swico'), function (fileName) {
306
343
  return ['react-hooks.js', 'vue-hooks.js', 'loading.js', 'Container.vue'].includes(fileName);
307
344
  })];
308
345
  case 2:
309
- _b.sent();
346
+ _a.sent();
310
347
  return [4, formatRouterConfig(routerConfig, templateType, env)];
311
348
  case 3:
312
- _b.sent();
349
+ _a.sent();
313
350
  return [4, fs_extra_1.default.readFile(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), 'utf8')];
314
351
  case 4:
315
- replaceIndexText = _b.sent();
352
+ replaceIndexText = _a.sent();
316
353
  hooksFilePath = path_1.default.resolve(projectPath, "./src/.swico/".concat(templateType, "-hooks.js"));
317
354
  return [4, fs_extra_1.default.readFile(hooksFilePath, 'utf8')];
318
355
  case 5:
319
- replaceHooksText = _b.sent();
356
+ replaceHooksText = _a.sent();
320
357
  replaceHooksText = replaceHooksText.replaceAll('$env', ".".concat(env));
321
358
  return [4, fs_extra_1.default.writeFile(hooksFilePath, replaceHooksText)];
322
359
  case 6:
323
- _b.sent();
324
- _a = getGlobalStyleFilePath(), styleFilePath = _a.filePath, styleFileType = _a.fileType;
325
- if (styleFilePath) {
326
- replaceIndexText = replaceIndexText.replaceAll("require(\"../../global.".concat(styleFileType, "\");"), '');
327
- replaceIndexText = "require(\"../../global.".concat(styleFileType, "\");\n").concat(replaceIndexText);
328
- }
329
- else {
330
- replaceIndexText = replaceIndexText.replaceAll(/require\("\.\.\/\.\.\/global.(less|scss|css)"\);/g, '');
331
- }
360
+ _a.sent();
361
+ replaceIndexText = (0, exports.handleGlobalStyleFile)(replaceIndexText);
332
362
  if (!(templateType === 'vue')) return [3, 8];
333
363
  replaceIndexText = replaceIndexText.replace('"../Container"', '"../Container.vue"');
334
364
  return [4, fs_extra_1.default.writeFile(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), replaceIndexText)];
335
365
  case 7:
336
- _b.sent();
337
- return [3, 14];
366
+ _a.sent();
367
+ return [3, 9];
338
368
  case 8:
339
- if (!(templateType === 'react')) return [3, 14];
340
- _b.label = 9;
369
+ if (templateType === 'react') {
370
+ (0, exports.handleLoadingFile)(replaceIndexText, envPath);
371
+ }
372
+ _a.label = 9;
341
373
  case 9:
342
- _b.trys.push([9, 11, 12, 14]);
343
- return [4, fs_extra_1.default.access(path_1.default.resolve(projectPath, './src/loading/index.tsx'), fs_extra_1.default.constants.F_OK)];
344
- case 10:
345
- _b.sent();
346
- replaceIndexText = replaceIndexText.replace('"../loading"', '"../../loading"');
347
- return [3, 14];
348
- case 11:
349
- e_1 = _b.sent();
350
- replaceIndexText = replaceIndexText.replace('"../../loading"', '"../loading"');
351
- return [3, 14];
352
- case 12: return [4, fs_extra_1.default.writeFile(path_1.default.resolve(projectPath, "./src/.swico".concat(envPath, "index.js")), replaceIndexText)];
353
- case 13:
354
- _b.sent();
355
- return [7];
356
- case 14:
357
374
  resolve(null);
358
375
  return [2];
359
376
  }
@@ -170,7 +170,7 @@ var copyDirFiles = function (src, dest, filter) { return __awaiter(void 0, void
170
170
  exports.copyDirFiles = copyDirFiles;
171
171
  var getFormatRouter = function (projectPath, routes, templateType) {
172
172
  var _main = function (item) {
173
- var path = item.path, component = item.component, name = item.name, children = item.children, redirect = item.redirect, decorator = item.decorator;
173
+ var component = item.component, name = item.name, children = item.children, redirect = item.redirect, decorator = item.decorator;
174
174
  return decorator
175
175
  ? __assign(__assign({}, item), { component: "()=>import('".concat(projectPath, "/src/pages/").concat(decorator).concat(templateType === 'vue' ? '.vue' : '', "')"), children: [
176
176
  {
@@ -182,15 +182,9 @@ var getFormatRouter = function (projectPath, routes, templateType) {
182
182
  redirect: redirect,
183
183
  children: children ? children === null || children === void 0 ? void 0 : children.map(function (item) { return _main(item); }) : undefined
184
184
  }
185
- ] }) : {
186
- path: path,
187
- component: component
185
+ ] }) : __assign(__assign({}, item), { component: component
188
186
  ? "()=>import('".concat(projectPath, "/src/pages/").concat(component).concat(templateType === 'vue' ? '.vue' : '', "')")
189
- : undefined,
190
- name: name,
191
- redirect: redirect,
192
- children: children ? children === null || children === void 0 ? void 0 : children.map(function (item) { return _main(item); }) : undefined
193
- };
187
+ : undefined, name: name, redirect: redirect, children: children ? children === null || children === void 0 ? void 0 : children.map(function (item) { return _main(item); }) : undefined });
194
188
  };
195
189
  return routes.map(function (item) {
196
190
  return _main(item);