@tramvai/cli 2.97.2 → 2.98.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/lib/external/pages.d.ts +1 -0
- package/lib/external/pages.js +2 -1
- package/lib/external/pages.js.map +1 -1
- package/lib/library/webpack/loaders/pagesResolve.js +25 -6
- package/lib/library/webpack/loaders/pagesResolve.js.map +1 -1
- package/package.json +2 -2
- package/src/api/start/__integration__/start.test.ts +1 -0
- package/src/external/pages.ts +3 -1
- package/src/library/webpack/loaders/pagesResolve.ts +35 -12
package/lib/external/pages.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ declare const _default: {
|
|
|
4
4
|
pages: Record<string, LazyComponentWrapper<PageComponent>>;
|
|
5
5
|
layouts: Record<string, LazyComponentWrapper<NestedLayoutComponent>>;
|
|
6
6
|
errorBoundaries: Record<string, LazyComponentWrapper<ErrorBoundaryComponent>>;
|
|
7
|
+
wildcards: Record<string, LazyComponentWrapper<PageComponent>>;
|
|
7
8
|
};
|
|
8
9
|
export default _default;
|
package/lib/external/pages.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// eslint-disable-next-line import/no-default-export
|
|
4
3
|
exports.default = {
|
|
5
4
|
routes: {},
|
|
6
5
|
pages: {},
|
|
7
6
|
layouts: {},
|
|
7
|
+
errorBoundaries: {},
|
|
8
|
+
wildcards: {},
|
|
8
9
|
};
|
|
9
10
|
//# sourceMappingURL=pages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../../src/external/pages.ts"],"names":[],"mappings":";;AAOA,
|
|
1
|
+
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../../src/external/pages.ts"],"names":[],"mappings":";;AAOA,kBAAe;IACb,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,EAAE;IACX,eAAe,EAAE,EAAE;IACnB,SAAS,EAAE,EAAE;CAOd,CAAC"}
|
|
@@ -6,17 +6,24 @@ const fs_readdir_recursive_1 = tslib_1.__importDefault(require("fs-readdir-recur
|
|
|
6
6
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
7
|
const LAYOUT_FILENAME = '_layout.tsx';
|
|
8
8
|
const ERROR_BOUNDARY_FILENAME = '_error.tsx';
|
|
9
|
+
const WILDCARD_FILENAME = '*.tsx';
|
|
10
|
+
const removeExtension = (filename) => {
|
|
11
|
+
const parsed = path_1.default.parse(filename);
|
|
12
|
+
return path_1.default.join(parsed.dir, parsed.name);
|
|
13
|
+
};
|
|
9
14
|
// eslint-disable-next-line func-style
|
|
10
15
|
const pagesResolve = function () {
|
|
11
16
|
const { fileSystemPages, rootDir, root, extensions } = this.getOptions();
|
|
12
17
|
const fsLayouts = [];
|
|
13
18
|
const fsErrorBoundaries = [];
|
|
19
|
+
const fsWildcards = [];
|
|
14
20
|
this.cacheable(false);
|
|
21
|
+
// eslint-disable-next-line max-statements
|
|
15
22
|
const filesToPages = ({ pagesRootDirectory, isRoutes = false, }) => {
|
|
16
23
|
const pagesDir = path_1.default.resolve(rootDir, root, pagesRootDirectory);
|
|
17
24
|
this.addContextDependency(pagesDir);
|
|
18
|
-
// skip files whose name starts with dot or underscore symbols
|
|
19
|
-
const pagesFiles = (0, fs_readdir_recursive_1.default)(pagesDir, (name) => name[0] !== '.' && name[0] !== '_');
|
|
25
|
+
// skip files whose name starts with dot, asterisk or underscore symbols
|
|
26
|
+
const pagesFiles = (0, fs_readdir_recursive_1.default)(pagesDir, (name) => name[0] !== '.' && name[0] !== '*' && name[0] !== '_');
|
|
20
27
|
const fsPages = [];
|
|
21
28
|
for (const file of pagesFiles) {
|
|
22
29
|
const extname = path_1.default.extname(file);
|
|
@@ -24,20 +31,29 @@ const pagesResolve = function () {
|
|
|
24
31
|
if (extensions.indexOf(extname) !== -1) {
|
|
25
32
|
const pageComponentName = `@/${pagesRootDirectory}/${name}`;
|
|
26
33
|
const pageComponentPath = path_1.default.resolve(pagesDir, name).replace(/\\/g, '\\\\');
|
|
27
|
-
const
|
|
34
|
+
const chunkname = pageComponentName.replace(/\//g, '_');
|
|
28
35
|
// @example '@/pages/MainPage': lazy(() => import(/* webpackChunkName: "@_pages_MainPage" */ '/tramvai-app/src/pages/MainPage'))
|
|
29
|
-
fsPages.push(`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${
|
|
36
|
+
fsPages.push(`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${chunkname}" */ '${pageComponentPath}'))`);
|
|
30
37
|
if (isRoutes) {
|
|
31
38
|
const pageDirname = path_1.default.dirname(pageComponentPath);
|
|
32
39
|
const layoutPath = path_1.default.join(pageDirname, LAYOUT_FILENAME);
|
|
33
40
|
const errorBoundaryPath = path_1.default.join(pageDirname, ERROR_BOUNDARY_FILENAME);
|
|
41
|
+
const wildcardPath = path_1.default.join(pageDirname, WILDCARD_FILENAME);
|
|
34
42
|
if (fs_1.default.existsSync(layoutPath)) {
|
|
43
|
+
const filename = removeExtension(layoutPath);
|
|
35
44
|
// @example '@/pages/MainPage': lazy(() => import(/* webpackChunkName: "@_pages_MainPage__layout" */ '/tramvai-app/src/pages/MainPage_layout'))
|
|
36
|
-
fsLayouts.push(`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${
|
|
45
|
+
fsLayouts.push(`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${chunkname}__layout" */ '${filename}'))`);
|
|
37
46
|
}
|
|
38
47
|
if (fs_1.default.existsSync(errorBoundaryPath)) {
|
|
48
|
+
const filename = removeExtension(errorBoundaryPath);
|
|
39
49
|
// @example '@/pages/MainPage': lazy(() => import(/* webpackChunkName: "@_pages_MainPage__errorBoundary" */ '/tramvai-app/src/pages/MainPage_errorBoundary'))
|
|
40
|
-
fsErrorBoundaries.push(`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${
|
|
50
|
+
fsErrorBoundaries.push(`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${chunkname}__errorBoundary" */ '${filename}'))`);
|
|
51
|
+
}
|
|
52
|
+
if (fs_1.default.existsSync(wildcardPath)) {
|
|
53
|
+
const componentName = `${pageComponentName}__wildcard`;
|
|
54
|
+
const filename = removeExtension(wildcardPath);
|
|
55
|
+
// @example '@/pages/MainPage': lazy(() => import(/* webpackChunkName: "@_pages_MainPage__wildcard" */ '/tramvai-app/src/pages/MainPage_wildcard'))
|
|
56
|
+
fsWildcards.push(`'${componentName}': lazy(() => import(/* webpackChunkName: "${chunkname}__wildcard" */ '${filename}'))`);
|
|
41
57
|
}
|
|
42
58
|
}
|
|
43
59
|
}
|
|
@@ -70,6 +86,9 @@ const pagesResolve = function () {
|
|
|
70
86
|
errorBoundaries: {
|
|
71
87
|
${fsErrorBoundaries.join(',\n')}
|
|
72
88
|
},
|
|
89
|
+
wildcards: {
|
|
90
|
+
${fsWildcards.join(',\n')}
|
|
91
|
+
},
|
|
73
92
|
}`;
|
|
74
93
|
return code;
|
|
75
94
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagesResolve.js","sourceRoot":"","sources":["../../../../src/library/webpack/loaders/pagesResolve.ts"],"names":[],"mappings":";;;AAAA,wDAAwB;AACxB,wFAA2C;AAC3C,oDAAoB;AAIpB,MAAM,eAAe,GAAG,aAAa,CAAC;AACtC,MAAM,uBAAuB,GAAG,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"pagesResolve.js","sourceRoot":"","sources":["../../../../src/library/webpack/loaders/pagesResolve.ts"],"names":[],"mappings":";;;AAAA,wDAAwB;AACxB,wFAA2C;AAC3C,oDAAoB;AAIpB,MAAM,eAAe,GAAG,aAAa,CAAC;AACtC,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAC7C,MAAM,iBAAiB,GAAG,OAAO,CAAC;AASlC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAU,EAAE;IACnD,MAA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ки и запуска приложений",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@tinkoff/utils": "^2.1.3",
|
|
72
72
|
"@tinkoff/webpack-dedupe-plugin": "1.0.5",
|
|
73
73
|
"@tramvai/build": "3.1.3",
|
|
74
|
-
"@tramvai/react": "2.
|
|
74
|
+
"@tramvai/react": "2.98.2",
|
|
75
75
|
"@tramvai/tools-check-versions": "0.4.14",
|
|
76
76
|
"@tramvai/tools-migrate": "0.6.17",
|
|
77
77
|
"ajv": "^6.12.6",
|
package/src/external/pages.ts
CHANGED
|
@@ -5,14 +5,16 @@ import type {
|
|
|
5
5
|
PageComponent,
|
|
6
6
|
} from '@tramvai/react';
|
|
7
7
|
|
|
8
|
-
// eslint-disable-next-line import/no-default-export
|
|
9
8
|
export default {
|
|
10
9
|
routes: {},
|
|
11
10
|
pages: {},
|
|
12
11
|
layouts: {},
|
|
12
|
+
errorBoundaries: {},
|
|
13
|
+
wildcards: {},
|
|
13
14
|
} as {
|
|
14
15
|
routes: Record<string, LazyComponentWrapper<PageComponent>>;
|
|
15
16
|
pages: Record<string, LazyComponentWrapper<PageComponent>>;
|
|
16
17
|
layouts: Record<string, LazyComponentWrapper<NestedLayoutComponent>>;
|
|
17
18
|
errorBoundaries: Record<string, LazyComponentWrapper<ErrorBoundaryComponent>>;
|
|
19
|
+
wildcards: Record<string, LazyComponentWrapper<PageComponent>>;
|
|
18
20
|
};
|
|
@@ -6,6 +6,7 @@ import type { ApplicationConfigEntry } from '../../../api';
|
|
|
6
6
|
|
|
7
7
|
const LAYOUT_FILENAME = '_layout.tsx';
|
|
8
8
|
const ERROR_BOUNDARY_FILENAME = '_error.tsx';
|
|
9
|
+
const WILDCARD_FILENAME = '*.tsx';
|
|
9
10
|
|
|
10
11
|
interface Options {
|
|
11
12
|
rootDir: string;
|
|
@@ -14,14 +15,22 @@ interface Options {
|
|
|
14
15
|
fileSystemPages: ApplicationConfigEntry['fileSystemPages'];
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
const removeExtension = (filename: string): string => {
|
|
19
|
+
const parsed = path.parse(filename);
|
|
20
|
+
|
|
21
|
+
return path.join(parsed.dir, parsed.name);
|
|
22
|
+
};
|
|
23
|
+
|
|
17
24
|
// eslint-disable-next-line func-style
|
|
18
25
|
const pagesResolve: LoaderDefinitionFunction<Options> = function () {
|
|
19
26
|
const { fileSystemPages, rootDir, root, extensions } = this.getOptions();
|
|
20
27
|
const fsLayouts: string[] = [];
|
|
21
28
|
const fsErrorBoundaries: string[] = [];
|
|
29
|
+
const fsWildcards: string[] = [];
|
|
22
30
|
|
|
23
31
|
this.cacheable(false);
|
|
24
32
|
|
|
33
|
+
// eslint-disable-next-line max-statements
|
|
25
34
|
const filesToPages = ({
|
|
26
35
|
pagesRootDirectory,
|
|
27
36
|
isRoutes = false,
|
|
@@ -33,8 +42,11 @@ const pagesResolve: LoaderDefinitionFunction<Options> = function () {
|
|
|
33
42
|
|
|
34
43
|
this.addContextDependency(pagesDir);
|
|
35
44
|
|
|
36
|
-
// skip files whose name starts with dot or underscore symbols
|
|
37
|
-
const pagesFiles = readDir(
|
|
45
|
+
// skip files whose name starts with dot, asterisk or underscore symbols
|
|
46
|
+
const pagesFiles = readDir(
|
|
47
|
+
pagesDir,
|
|
48
|
+
(name: string) => name[0] !== '.' && name[0] !== '*' && name[0] !== '_'
|
|
49
|
+
);
|
|
38
50
|
const fsPages = [];
|
|
39
51
|
|
|
40
52
|
for (const file of pagesFiles) {
|
|
@@ -44,11 +56,11 @@ const pagesResolve: LoaderDefinitionFunction<Options> = function () {
|
|
|
44
56
|
if (extensions.indexOf(extname) !== -1) {
|
|
45
57
|
const pageComponentName = `@/${pagesRootDirectory}/${name}`;
|
|
46
58
|
const pageComponentPath = path.resolve(pagesDir, name).replace(/\\/g, '\\\\');
|
|
47
|
-
const
|
|
59
|
+
const chunkname = pageComponentName.replace(/\//g, '_');
|
|
48
60
|
|
|
49
61
|
// @example '@/pages/MainPage': lazy(() => import(/* webpackChunkName: "@_pages_MainPage" */ '/tramvai-app/src/pages/MainPage'))
|
|
50
62
|
fsPages.push(
|
|
51
|
-
`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${
|
|
63
|
+
`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${chunkname}" */ '${pageComponentPath}'))`
|
|
52
64
|
);
|
|
53
65
|
|
|
54
66
|
if (isRoutes) {
|
|
@@ -56,24 +68,32 @@ const pagesResolve: LoaderDefinitionFunction<Options> = function () {
|
|
|
56
68
|
|
|
57
69
|
const layoutPath = path.join(pageDirname, LAYOUT_FILENAME);
|
|
58
70
|
const errorBoundaryPath = path.join(pageDirname, ERROR_BOUNDARY_FILENAME);
|
|
71
|
+
const wildcardPath = path.join(pageDirname, WILDCARD_FILENAME);
|
|
59
72
|
|
|
60
73
|
if (fs.existsSync(layoutPath)) {
|
|
74
|
+
const filename = removeExtension(layoutPath);
|
|
61
75
|
// @example '@/pages/MainPage': lazy(() => import(/* webpackChunkName: "@_pages_MainPage__layout" */ '/tramvai-app/src/pages/MainPage_layout'))
|
|
62
76
|
fsLayouts.push(
|
|
63
|
-
`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${
|
|
64
|
-
'.tsx',
|
|
65
|
-
''
|
|
66
|
-
)}'))`
|
|
77
|
+
`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${chunkname}__layout" */ '${filename}'))`
|
|
67
78
|
);
|
|
68
79
|
}
|
|
69
80
|
|
|
70
81
|
if (fs.existsSync(errorBoundaryPath)) {
|
|
82
|
+
const filename = removeExtension(errorBoundaryPath);
|
|
83
|
+
|
|
71
84
|
// @example '@/pages/MainPage': lazy(() => import(/* webpackChunkName: "@_pages_MainPage__errorBoundary" */ '/tramvai-app/src/pages/MainPage_errorBoundary'))
|
|
72
85
|
fsErrorBoundaries.push(
|
|
73
|
-
`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
`'${pageComponentName}': lazy(() => import(/* webpackChunkName: "${chunkname}__errorBoundary" */ '${filename}'))`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (fs.existsSync(wildcardPath)) {
|
|
91
|
+
const componentName = `${pageComponentName}__wildcard`;
|
|
92
|
+
const filename = removeExtension(wildcardPath);
|
|
93
|
+
|
|
94
|
+
// @example '@/pages/MainPage': lazy(() => import(/* webpackChunkName: "@_pages_MainPage__wildcard" */ '/tramvai-app/src/pages/MainPage_wildcard'))
|
|
95
|
+
fsWildcards.push(
|
|
96
|
+
`'${componentName}': lazy(() => import(/* webpackChunkName: "${chunkname}__wildcard" */ '${filename}'))`
|
|
77
97
|
);
|
|
78
98
|
}
|
|
79
99
|
}
|
|
@@ -110,6 +130,9 @@ const pagesResolve: LoaderDefinitionFunction<Options> = function () {
|
|
|
110
130
|
errorBoundaries: {
|
|
111
131
|
${fsErrorBoundaries.join(',\n')}
|
|
112
132
|
},
|
|
133
|
+
wildcards: {
|
|
134
|
+
${fsWildcards.join(',\n')}
|
|
135
|
+
},
|
|
113
136
|
}`;
|
|
114
137
|
|
|
115
138
|
return code;
|