@lomray/vite-ssr-boost 7.1.0 → 8.0.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/README.md +18 -1
- package/adapters/body.d.ts +5 -0
- package/adapters/body.js +2 -0
- package/adapters/body.js.map +1 -0
- package/adapters/compression.d.ts +11 -0
- package/adapters/compression.js +2 -0
- package/adapters/compression.js.map +1 -0
- package/adapters/edge.d.ts +11 -0
- package/adapters/edge.js +2 -0
- package/adapters/edge.js.map +1 -0
- package/adapters/express/create-request.d.ts +11 -0
- package/adapters/express/create-request.js +2 -0
- package/adapters/express/create-request.js.map +1 -0
- package/adapters/express/entry.d.ts +55 -0
- package/adapters/express/entry.js.map +1 -0
- package/{services → adapters/express}/prepare-server.d.ts +15 -40
- package/adapters/express/prepare-server.js +2 -0
- package/adapters/express/prepare-server.js.map +1 -0
- package/adapters/express/render.d.ts +63 -0
- package/adapters/express/render.js +2 -0
- package/adapters/express/render.js.map +1 -0
- package/adapters/express/server.d.ts +15 -0
- package/adapters/express/server.js +2 -0
- package/adapters/express/server.js.map +1 -0
- package/adapters/express.d.ts +11 -0
- package/adapters/express.js +2 -0
- package/adapters/express.js.map +1 -0
- package/adapters/fastify.d.ts +23 -0
- package/adapters/fastify.js +2 -0
- package/adapters/fastify.js.map +1 -0
- package/adapters/hono.d.ts +13 -0
- package/adapters/hono.js +2 -0
- package/adapters/hono.js.map +1 -0
- package/adapters/node.d.ts +19 -0
- package/adapters/node.js +2 -0
- package/adapters/node.js.map +1 -0
- package/browser/entry.d.ts +9 -9
- package/browser/entry.js +1 -1
- package/browser/entry.js.map +1 -1
- package/cli/build.d.ts +2 -2
- package/cli/build.js.map +1 -1
- package/cli/helpers/keyboard-input.d.ts +1 -1
- package/cli/helpers/keyboard-input.js +1 -1
- package/cli/helpers/keyboard-input.js.map +1 -1
- package/cli/helpers/vite-reset-cache.d.ts +1 -1
- package/cli/helpers/vite-reset-cache.js.map +1 -1
- package/cli/interfaces/actions.d.ts +8 -9
- package/cli/run-amplify-build.d.ts +1 -1
- package/cli/run-amplify-build.js.map +1 -1
- package/cli/run-dev.d.ts +3 -4
- package/cli/run-dev.js +1 -1
- package/cli/run-dev.js.map +1 -1
- package/cli/run-docker-build.d.ts +2 -2
- package/cli/run-docker-build.js.map +1 -1
- package/cli/run-prod.d.ts +5 -6
- package/cli/run-prod.js +1 -1
- package/cli/run-prod.js.map +1 -1
- package/cli/run-serverless.d.ts +3 -3
- package/cli/run-serverless.js +1 -1
- package/cli/run-serverless.js.map +1 -1
- package/cli/run-vercel-build.d.ts +1 -1
- package/cli/run-vercel-build.js.map +1 -1
- package/cli.js +1 -1
- package/cli.js.map +1 -1
- package/components/navigate.d.ts +3 -3
- package/components/navigate.js.map +1 -1
- package/components/only-client.d.ts +2 -2
- package/components/only-client.js +1 -1
- package/components/only-client.js.map +1 -1
- package/components/render-client.d.ts +4 -4
- package/components/render-client.js +1 -1
- package/components/render-client.js.map +1 -1
- package/components/response-status.d.ts +2 -2
- package/components/response-status.js +1 -1
- package/components/response-status.js.map +1 -1
- package/components/scroll-to-top.d.ts +2 -2
- package/components/scroll-to-top.js +1 -1
- package/components/scroll-to-top.js.map +1 -1
- package/components/with-suspense.d.ts +3 -3
- package/components/with-suspense.js.map +1 -1
- package/constants/cli-actions.d.ts +1 -1
- package/constants/cli-actions.js.map +1 -1
- package/constants/cli-context.d.ts +4 -5
- package/constants/cli-context.js.map +1 -1
- package/constants/cli-name.d.ts +1 -1
- package/constants/cli-name.js.map +1 -1
- package/constants/cli-shortcuts.d.ts +2 -2
- package/constants/cli-shortcuts.js +1 -1
- package/constants/cli-shortcuts.js.map +1 -1
- package/constants/common.js.map +1 -1
- package/constants/plugin-name.d.ts +1 -1
- package/constants/plugin-name.js.map +1 -1
- package/constants/stream-error.d.ts +1 -1
- package/constants/stream-error.js.map +1 -1
- package/context/server.d.ts +3 -4
- package/context/server.js.map +1 -1
- package/core/compose-html.d.ts +5 -0
- package/core/compose-html.js +2 -0
- package/core/compose-html.js.map +1 -0
- package/core/early-hints.d.ts +6 -0
- package/core/early-hints.js +2 -0
- package/core/early-hints.js.map +1 -0
- package/core/handler.d.ts +30 -0
- package/core/handler.js +2 -0
- package/core/handler.js.map +1 -0
- package/core/head-response.d.ts +5 -0
- package/core/head-response.js +2 -0
- package/core/head-response.js.map +1 -0
- package/core/headers.d.ts +12 -0
- package/core/headers.js +2 -0
- package/core/headers.js.map +1 -0
- package/core/render.d.ts +101 -0
- package/core/render.js +2 -0
- package/core/render.js.map +1 -0
- package/core/transform-html.d.ts +7 -0
- package/core/transform-html.js +2 -0
- package/core/transform-html.js.map +1 -0
- package/core/types.d.ts +7 -0
- package/core/types.js +2 -0
- package/core/types.js.map +1 -0
- package/edge/render-to-stream.d.ts +6 -0
- package/edge/render-to-stream.js +2 -0
- package/edge/render-to-stream.js.map +1 -0
- package/helpers/build-custom-state.d.ts +2 -3
- package/helpers/build-custom-state.js +1 -1
- package/helpers/build-custom-state.js.map +1 -1
- package/helpers/build-router-state.d.ts +2 -2
- package/helpers/build-router-state.js.map +1 -1
- package/helpers/create-focus-only.d.ts +3 -3
- package/helpers/create-focus-only.js.map +1 -1
- package/helpers/dev-marker.d.ts +1 -1
- package/helpers/dev-marker.js.map +1 -1
- package/helpers/get-server-state.d.ts +1 -1
- package/helpers/get-server-state.js.map +1 -1
- package/helpers/html-escape.d.ts +1 -1
- package/helpers/html-escape.js +1 -1
- package/helpers/html-escape.js.map +1 -1
- package/helpers/import-route.d.ts +7 -7
- package/helpers/import-route.js +1 -1
- package/helpers/import-route.js.map +1 -1
- package/helpers/is-route-file.d.ts +1 -1
- package/helpers/is-route-file.js.map +1 -1
- package/helpers/obtain-stream-error.d.ts +3 -3
- package/helpers/obtain-stream-error.js +1 -1
- package/helpers/obtain-stream-error.js.map +1 -1
- package/helpers/plugin-config.d.ts +5 -5
- package/helpers/plugin-config.js +1 -1
- package/helpers/plugin-config.js.map +1 -1
- package/helpers/print-server-info.d.ts +3 -4
- package/helpers/print-server-info.js +1 -1
- package/helpers/print-server-info.js.map +1 -1
- package/helpers/print-server-urls.d.ts +2 -2
- package/helpers/print-server-urls.js +1 -1
- package/helpers/print-server-urls.js.map +1 -1
- package/helpers/process-stop.d.ts +1 -1
- package/helpers/process-stop.js.map +1 -1
- package/helpers/resolve-server-urls.d.ts +3 -4
- package/helpers/resolve-server-urls.js +1 -1
- package/helpers/resolve-server-urls.js.map +1 -1
- package/helpers/serialize-errors.d.ts +2 -2
- package/helpers/serialize-errors.js.map +1 -1
- package/helpers/vite-aliases.d.ts +2 -2
- package/helpers/vite-aliases.js +1 -1
- package/helpers/vite-aliases.js.map +1 -1
- package/interfaces/fc-route.d.ts +4 -4
- package/interfaces/fc-route.js.map +1 -1
- package/interfaces/fc.d.ts +3 -4
- package/interfaces/route-object.d.ts +6 -6
- package/node/compress-response.d.ts +6 -0
- package/node/compress-response.js +2 -0
- package/node/compress-response.js.map +1 -0
- package/node/create-headers.d.ts +6 -0
- package/node/create-headers.js +2 -0
- package/node/create-headers.js.map +1 -0
- package/node/create-request.d.ts +13 -0
- package/node/create-request.js +2 -0
- package/node/create-request.js.map +1 -0
- package/node/http.d.ts +4 -0
- package/node/http.js +2 -0
- package/node/http.js.map +1 -0
- package/node/render-to-stream.d.ts +6 -0
- package/node/render-to-stream.js +2 -0
- package/node/render-to-stream.js.map +1 -0
- package/node/request-signal.d.ts +10 -0
- package/node/request-signal.js +2 -0
- package/node/request-signal.js.map +1 -0
- package/node/split-link-header.d.ts +5 -0
- package/node/split-link-header.js +2 -0
- package/node/split-link-header.js.map +1 -0
- package/node/write-early-hints.d.ts +6 -0
- package/node/write-early-hints.js +2 -0
- package/node/write-early-hints.js.map +1 -0
- package/node/write-fetch-response.d.ts +11 -0
- package/node/write-fetch-response.js +2 -0
- package/node/write-fetch-response.js.map +1 -0
- package/package.json +89 -27
- package/plugin.d.ts +7 -7
- package/plugin.js.map +1 -1
- package/plugins/create-spa-index.d.ts +3 -3
- package/plugins/create-spa-index.js.map +1 -1
- package/plugins/handle-custom-entrypoint.d.ts +4 -4
- package/plugins/handle-custom-entrypoint.js +1 -1
- package/plugins/handle-custom-entrypoint.js.map +1 -1
- package/plugins/make-aliases.d.ts +3 -3
- package/plugins/make-aliases.js +1 -1
- package/plugins/make-aliases.js.map +1 -1
- package/plugins/normalize-route.d.ts +3 -3
- package/plugins/normalize-route.js.map +1 -1
- package/services/build.d.ts +5 -51
- package/services/build.js +1 -1
- package/services/build.js.map +1 -1
- package/services/logger.d.ts +2 -30
- package/services/logger.js.map +1 -1
- package/services/parse-routes.d.ts +5 -42
- package/services/parse-routes.js +1 -1
- package/services/parse-routes.js.map +1 -1
- package/services/path-normalize.d.ts +3 -18
- package/services/path-normalize.js +1 -1
- package/services/path-normalize.js.map +1 -1
- package/services/server-api.d.ts +1 -7
- package/services/server-api.js.map +1 -1
- package/services/server-config.d.ts +7 -52
- package/services/server-config.js +1 -1
- package/services/server-config.js.map +1 -1
- package/services/ssr-manifest.d.ts +20 -60
- package/services/ssr-manifest.js +1 -1
- package/services/ssr-manifest.js.map +1 -1
- package/workflow/Dockerfile +1 -1
- package/helpers/handle-response.d.ts +0 -7
- package/helpers/handle-response.js +0 -2
- package/helpers/handle-response.js.map +0 -1
- package/node/create-fetch-request.d.ts +0 -7
- package/node/create-fetch-request.js +0 -2
- package/node/create-fetch-request.js.map +0 -1
- package/node/entry.d.ts +0 -63
- package/node/entry.js.map +0 -1
- package/node/render.d.ts +0 -64
- package/node/render.js +0 -2
- package/node/render.js.map +0 -1
- package/node/server.d.ts +0 -16
- package/node/server.js +0 -2
- package/node/server.js.map +0 -1
- package/node/write-response.d.ts +0 -14
- package/node/write-response.js +0 -2
- package/node/write-response.js.map +0 -1
- package/services/prepare-server.js +0 -2
- package/services/prepare-server.js.map +0 -1
- /package/{node → adapters/express}/entry.js +0 -0
package/services/logger.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { LogErrorOptions, LogOptions } from 'vite';
|
|
2
|
-
import { Logger as ViteLogger } from "vite";
|
|
1
|
+
import type { LogErrorOptions, Logger as ViteLogger, LogOptions } from 'vite';
|
|
3
2
|
declare const LogLevels: {
|
|
4
3
|
error: number;
|
|
5
4
|
warn: number;
|
|
@@ -31,68 +30,41 @@ declare class Logger implements ViteLogger {
|
|
|
31
30
|
* Return 'true' to skip output
|
|
32
31
|
*/
|
|
33
32
|
logFilter: ILoggerOptions['logFilter'] | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* @constructor
|
|
36
|
-
*/
|
|
37
33
|
/**
|
|
38
34
|
* @constructor
|
|
39
35
|
*/
|
|
40
36
|
constructor({ logFilter, logLevel }?: ILoggerOptions);
|
|
41
|
-
/**
|
|
42
|
-
* @inheritDoc
|
|
43
|
-
*/
|
|
44
37
|
/**
|
|
45
38
|
* @inheritDoc
|
|
46
39
|
*/
|
|
47
40
|
clearScreen(): void;
|
|
48
|
-
/**
|
|
49
|
-
* Should we skip current log depends on current log level
|
|
50
|
-
*/
|
|
51
41
|
/**
|
|
52
42
|
* Should we skip current log depends on current log level
|
|
53
43
|
*/
|
|
54
44
|
protected shouldSkipLog(level: number): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Common log
|
|
57
|
-
*/
|
|
58
45
|
/**
|
|
59
46
|
* Common log
|
|
60
47
|
*/
|
|
61
48
|
protected log(params: ILogParams): void;
|
|
62
|
-
/**
|
|
63
|
-
* @inheritDoc
|
|
64
|
-
*/
|
|
65
49
|
/**
|
|
66
50
|
* @inheritDoc
|
|
67
51
|
*/
|
|
68
52
|
error(msg: string, options?: LogErrorOptions): void;
|
|
69
|
-
/**
|
|
70
|
-
* @inheritDoc
|
|
71
|
-
*/
|
|
72
53
|
/**
|
|
73
54
|
* @inheritDoc
|
|
74
55
|
*/
|
|
75
56
|
hasErrorLogged(): boolean;
|
|
76
|
-
/**
|
|
77
|
-
* @inheritDoc
|
|
78
|
-
*/
|
|
79
57
|
/**
|
|
80
58
|
* @inheritDoc
|
|
81
59
|
*/
|
|
82
60
|
info(msg: string, options: LogOptions): void;
|
|
83
|
-
/**
|
|
84
|
-
* @inheritDoc
|
|
85
|
-
*/
|
|
86
61
|
/**
|
|
87
62
|
* @inheritDoc
|
|
88
63
|
*/
|
|
89
64
|
warn(msg: string, options: LogOptions): void;
|
|
90
|
-
/**
|
|
91
|
-
* @inheritDoc
|
|
92
|
-
*/
|
|
93
65
|
/**
|
|
94
66
|
* @inheritDoc
|
|
95
67
|
*/
|
|
96
68
|
warnOnce(msg: string, options: LogOptions): void;
|
|
97
69
|
}
|
|
98
|
-
export
|
|
70
|
+
export default Logger;
|
package/services/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sources":["../../src/services/logger.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"logger.js","sources":["../../src/services/logger.ts"],"sourcesContent":[null],"names":["LogLevels","error","warn","info","Logger","hasWarned","loglevel","logFilter","constructor","logLevel","this","clearScreen","shouldSkipLog","level","log","params","msg","options","args","filter","Boolean","console","hasErrorLogged","warnOnce"],"mappings":"AAEA,MAAMA,EAAY,CAChBC,MAAO,EACPC,KAAM,EACNC,KAAM,GAiBR,MAAMC,EAIGC,UAKAC,SAMAC,UAKP,WAAAC,EAAmBD,UAAEA,EAASE,SAAEA,EAAW,GAAsB,CAAA,GAC/DC,KAAKJ,SAAWG,EAChBC,KAAKH,UAAYA,CACnB,CAKO,WAAAI,GAEP,CAKU,aAAAC,CAAcC,GACtB,OAAOA,EAAQH,KAAKJ,QACtB,CAKU,GAAAQ,CAAIC,GACZ,MAAMF,MAAEA,EAAKG,IAAEA,EAAGC,QAAEA,GAAYF,EAEhC,GAAIL,KAAKE,cAAcZ,EAAUa,KAAWH,KAAKH,YAAYQ,GAC3D,OAGF,MAAMG,EAAO,CAACF,EAAKC,GAAShB,OAAOkB,OAAOC,SAE1CC,QAAQR,MAAUK,EACpB,CAKO,KAAAjB,CAAMe,EAAaC,GACxBP,KAAKI,IAAI,CAAEE,MAAKC,UAASJ,MAAO,SAClC,CAKO,cAAAS,GACL,OAAO,CACT,CAKO,IAAAnB,CAAKa,EAAaC,GACvBP,KAAKI,IAAI,CAAEE,MAAKC,UAASJ,MAAO,QAClC,CAKO,IAAAX,CAAKc,EAAaC,GACvBP,KAAKI,IAAI,CAAEE,MAAKC,UAASJ,MAAO,QAClC,CAKO,QAAAU,CAASP,EAAaC,GAC3BP,KAAKR,KAAKc,EAAKC,EACjB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Alias } from 'vite';
|
|
2
|
-
import PathNormalize from
|
|
3
|
-
import ServerConfig from
|
|
4
|
-
type TRoutesTree = {
|
|
1
|
+
import type { Alias } from 'vite';
|
|
2
|
+
import PathNormalize from './path-normalize.js';
|
|
3
|
+
import type ServerConfig from './server-config.js';
|
|
4
|
+
export type TRoutesTree = {
|
|
5
5
|
index: number;
|
|
6
6
|
import: string;
|
|
7
7
|
children: TRoutesTree[];
|
|
@@ -18,91 +18,54 @@ declare class ParseRoutes {
|
|
|
18
18
|
* Server config
|
|
19
19
|
*/
|
|
20
20
|
protected readonly config: ServerConfig;
|
|
21
|
-
/**
|
|
22
|
-
* @constructor
|
|
23
|
-
*/
|
|
24
21
|
/**
|
|
25
22
|
* @constructor
|
|
26
23
|
*/
|
|
27
24
|
constructor(config: ServerConfig, viteAliases?: Alias[]);
|
|
28
|
-
/**
|
|
29
|
-
* Parse routes
|
|
30
|
-
*/
|
|
31
25
|
/**
|
|
32
26
|
* Parse routes
|
|
33
27
|
*/
|
|
34
28
|
parse(): TRoutesTree[];
|
|
35
|
-
/**
|
|
36
|
-
* Parse file and return ast
|
|
37
|
-
*/
|
|
38
29
|
/**
|
|
39
30
|
* Parse file and return ast
|
|
40
31
|
*/
|
|
41
32
|
private parseFile;
|
|
42
|
-
/**
|
|
43
|
-
* Find route import filepath
|
|
44
|
-
*/
|
|
45
33
|
/**
|
|
46
34
|
* Find route import filepath
|
|
47
35
|
*/
|
|
48
36
|
private getImportPath;
|
|
49
|
-
/**
|
|
50
|
-
* Find routes array inside code
|
|
51
|
-
*/
|
|
52
37
|
/**
|
|
53
38
|
* Find routes array inside code
|
|
54
39
|
*/
|
|
55
40
|
private findRoutesDefinition;
|
|
56
|
-
/**
|
|
57
|
-
* Entrypoint routes file
|
|
58
|
-
*/
|
|
59
41
|
/**
|
|
60
42
|
* Entrypoint routes file
|
|
61
43
|
*/
|
|
62
44
|
private findRoutesEntrypoint;
|
|
63
|
-
/**
|
|
64
|
-
* Resolve route filename import
|
|
65
|
-
*/
|
|
66
45
|
/**
|
|
67
46
|
* Resolve route filename import
|
|
68
47
|
*/
|
|
69
48
|
private resolveFilename;
|
|
70
|
-
/**
|
|
71
|
-
* Parse ast array routes objects
|
|
72
|
-
*/
|
|
73
49
|
/**
|
|
74
50
|
* Parse ast array routes objects
|
|
75
51
|
*/
|
|
76
52
|
private parseRoutesArray;
|
|
77
|
-
/**
|
|
78
|
-
* Parse imports map from ast
|
|
79
|
-
*/
|
|
80
53
|
/**
|
|
81
54
|
* Parse imports map from ast
|
|
82
55
|
*/
|
|
83
56
|
private static parseImportsMap;
|
|
84
|
-
/**
|
|
85
|
-
* Recursive build routes tree with dynamic imports
|
|
86
|
-
*/
|
|
87
57
|
/**
|
|
88
58
|
* Recursive build routes tree with dynamic imports
|
|
89
59
|
*/
|
|
90
60
|
private recursiveBuildRoutesTree;
|
|
91
|
-
/**
|
|
92
|
-
* Add pathId to static routes
|
|
93
|
-
*/
|
|
94
61
|
/**
|
|
95
62
|
* Add pathId to static routes
|
|
96
63
|
*/
|
|
97
64
|
private static processRouteFileCode;
|
|
98
|
-
/**
|
|
99
|
-
* Inject pathId to sync/async routes
|
|
100
|
-
* Add async wrapper (see import-routes)
|
|
101
|
-
*/
|
|
102
65
|
/**
|
|
103
66
|
* Inject pathId to sync/async routes
|
|
104
67
|
* Add async wrapper (see import-routes)
|
|
105
68
|
*/
|
|
106
69
|
static handleRoutes(code: string, shouldAddPathId: boolean): string;
|
|
107
70
|
}
|
|
108
|
-
export
|
|
71
|
+
export default ParseRoutes;
|
package/services/parse-routes.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"fs";import{resolve as t}from"node:path";import r from"path";import n from"@babel/generator";import*as
|
|
1
|
+
import e from"fs";import{resolve as t}from"node:path";import r from"path";import n from"@babel/generator";import*as o from"@babel/parser";import a from"@babel/traverse";import{isObjectProperty as i,isIdentifier as s,isBooleanLiteral as l,isJSXElement as p,isFunction as u,isArrayExpression as c,objectProperty as m,identifier as f,stringLiteral as d,isJSXIdentifier as h,isObjectExpression as y}from"@babel/types";import v from"../constants/plugin-name.js";import E from"./path-normalize.js";const g=n.default??n,x=a.default??a;class I{pathNormalize;config;constructor(e,t){this.config=e,this.pathNormalize=new E(e,t)}parse(){const{clientFile:e,root:r}=this.config.getParams(),n=t(r,e),o=this.findRoutesEntrypoint(n);if(!o?.routesPath)throw new Error(`Unable to find routes file import in ${e}`);const{routesPath:a,exportName:i}=o,s=this.resolveFilename(a,n);return this.recursiveBuildRoutesTree(s,i)}parseFile(t){try{const r=e.readFileSync(t,"utf-8");return o.parse(r,{sourceType:"module",createImportExpressions:!0,plugins:["typescript","jsx"]})}catch{return null}}getImportPath(e,t){let r=null,n=null;return x(e,{ImportDeclaration(e){const o=e.node;o.specifiers.forEach(e=>{e.local.name===t&&(n="ImportDefaultSpecifier"===e.type?null:t,r=o.source.value)})}}),{routesPath:r,exportName:n}}findRoutesDefinition(e,t){let r=t;if(x(e,{ExportNamedDeclaration({node:e}){!e.declaration&&e.specifiers.length>0&&e.specifiers.forEach(e=>{const n=e.exported.name;null===t&&"ExportSpecifier"===e.type?"default"===e.local.name&&(r=n):n===t&&(r=e.local.name)})},ExportDefaultDeclaration({node:e}){null===t&&("Identifier"===e.declaration.type?r=e.declaration.name:"VariableDeclaration"===e.declaration.type&&(r=e.declaration.declarations[0].id.name))}}),r){let t=null;return x(e,{VariableDeclaration({node:e}){e.declarations.forEach(n=>{n.id.name===r&&(t=e)})}}),t}return null}findRoutesEntrypoint(e){const t=this.parseFile(e);let r=null;return t?(x(t,{CallExpression({node:e}){"entryClient"===e.callee.name&&e.arguments.length>=2&&"Identifier"===e.arguments[1].type&&(r=e.arguments[1].name)}}),this.getImportPath(t,r)):r}resolveFilename(e,t){let n=e;(e.startsWith("./")||e.startsWith("../"))&&t&&(n=r.resolve(r.dirname(t),e));const o=this.pathNormalize.getAppPath(n,!0);return this.pathNormalize.findAppFile(o)}parseRoutesArray(e,t,r){const n=[];return e.forEach((e,o)=>{if("ObjectExpression"===e.type){const a={index:o,import:"",children:[]};e.properties.forEach(e=>{const n=e;if("children"===n.key.name&&"ArrayExpression"===n.value.type&&(a.children=this.parseRoutesArray(n.value.elements,t,r)),"lazy"===n.key.name&&"ArrowFunctionExpression"===n.value.type){const e=n.value.body;if("ImportExpression"===e.type){const t=e.source;"StringLiteral"===t.type&&(a.import=t.value)}}if("Component"===n.key.name&&"Identifier"===n.value.type){const e=n.value.name,{path:r}=t[e]??{};r&&(a.import=r)}if("element"===n.key.name&&"JSXElement"===n.value.type){const e=n.value?.openingElement?.name?.name,{path:r}=t[e]??{};r&&(a.import=r)}if("children"===n.key.name&&"Identifier"===n.value.type){const e=n.value.name,{path:o,isDefault:i}=t[e]??{};if(o){const t=this.resolveFilename(o,r);t&&(a.children=this.recursiveBuildRoutesTree(t,i?null:e))}}}),(a.import||a.children.length>0)&&n.push(a)}}),n}static parseImportsMap(e){const t={};return x(e,{ImportDeclaration(e){const r=e.node;r.specifiers.forEach(e=>{t[e.local.name]={path:r.source.value,isDefault:"ImportDefaultSpecifier"===e.type}})}}),t}recursiveBuildRoutesTree(e,t=null){if(!e)return[];const r=this.parseFile(e);if(!r)return[];const n=this.findRoutesDefinition(r,t),o=[];if(!n)return o;const a=I.parseImportsMap(r),i=n.declarations[0].init?.elements;return o.push(...this.parseRoutesArray(i,a,e)),o}static processRouteFileCode(e,t,r,n){e.node.properties.forEach(o=>{if(i(o)&&s(o.key)){if("lazy"===o.key.name&&"ArrowFunctionExpression"===o.value.type){const t=o.value.body,a=e.node.properties.find(e=>i(e)&&s(e.key)&&"onlyClient"===e.key.name);if(o.value={type:"CallExpression",callee:{type:"Identifier",name:"n"},arguments:i(a)&&(l(a.value)||p(a.value)||u(a.value)||s(a.value))?[o.value,a.value]:[o.value]},a&&(e.node.properties=e.node.properties.filter(e=>e!==a)),n(),"ImportExpression"===t.type){const n=t.source,a=e.findParent?.(e=>c(e.node));if(a&&"StringLiteral"===n.type&&n.value&&r){const t=m(f("pathId"),d(n.value));e.node.properties.splice(e.node.properties.indexOf(o)+1,0,t)}}}if("element"===o.key.name||"Component"===o.key.name){let n="";p(o.value)&&h(o.value.openingElement.name)?n=o.value.openingElement.name.name:s(o.value)&&(n=o.value.name);const a=e.findParent?.(e=>c(e.node)),i=t[n]?.path;if(a&&i&&r){const t=m(f("pathId"),d(i));e.node.properties.splice(e.node.properties.indexOf(o)+1,0,t)}}"children"===o.key.name&&c(o.value)&&o.value.elements.forEach(e=>{y(e)&&I.processRouteFileCode({node:e},t,r,n)})}})}static handleRoutes(e,t){if(!e)return e;const r=o.parse(e,{sourceType:"module",createImportExpressions:!0,plugins:["typescript","jsx"]});if(!r)return e;const n=I.parseImportsMap(r);let a=!1;return x(r,{ObjectExpression(e){I.processRouteFileCode(e,n,t,()=>{a=!0})}}),a&&r.program.body.unshift({type:"ImportDeclaration",specifiers:[{type:"ImportDefaultSpecifier",local:{type:"Identifier",name:"n"}}],source:{type:"StringLiteral",value:`${v}/helpers/import-route`}}),g(r,{retainLines:!0}).code}}export{I as default};
|
|
2
2
|
//# sourceMappingURL=parse-routes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-routes.js","sources":["../../src/services/parse-routes.ts"],"sourcesContent":["import fs from 'fs';\nimport { resolve } from 'node:path';\nimport path from 'path';\nimport babelGenerate from '@babel/generator';\nimport type * as GenerateTypes from '@babel/generator';\nimport * as parser from '@babel/parser';\nimport type { ParseResult } from '@babel/parser';\nimport babelTraverse from '@babel/traverse';\nimport type * as TraverseTypes from '@babel/traverse';\nimport type {\n CallExpression,\n File as BabelFile,\n VariableDeclaration,\n ObjectExpression,\n} from '@babel/types';\nimport {\n isObjectProperty,\n isIdentifier,\n identifier,\n isBooleanLiteral,\n stringLiteral,\n isFunction,\n objectProperty,\n isArrayExpression,\n isJSXElement,\n isJSXIdentifier,\n isObjectExpression,\n} from '@babel/types';\nimport type { Alias } from 'vite';\nimport PLUGIN_NAME from '@constants/plugin-name';\nimport PathNormalize from '@services/path-normalize';\nimport type ServerConfig from '@services/server-config';\n//\n// @ts-expect-error known import problem\nconst generate = (babelGenerate.default ?? babelGenerate) as (typeof GenerateTypes)['default'];\n// @ts-expect-error known import problem\nconst traverse = (babelTraverse.default ?? babelTraverse) as (typeof TraverseTypes)['default'];\n\ninterface IPathImport {\n routesPath: string | null;\n exportName: string | null;\n}\n\ninterface IMapImports {\n [name: string]: {\n path: string;\n isDefault: boolean; // is default import?\n };\n}\n\nexport type TRoutesTree = {\n index: number;\n import: string;\n children: TRoutesTree[];\n};\n\n/**\n * Parse react router routes array\n */\nclass ParseRoutes {\n /**\n * Path normalize service\n */\n protected readonly pathNormalize: PathNormalize;\n\n /**\n * Server config\n */\n protected readonly config: ServerConfig;\n\n /**\n * @constructor\n */\n constructor(config: ServerConfig, viteAliases?: Alias[]) {\n this.config = config;\n this.pathNormalize = new PathNormalize(config, viteAliases);\n }\n\n /**\n * Parse routes\n */\n public parse(): TRoutesTree[] {\n const { clientFile, root } = this.config.getParams();\n\n const clientEntrypoint = resolve(root, clientFile);\n const routesEntrypoint = this.findRoutesEntrypoint(clientEntrypoint);\n\n if (!routesEntrypoint?.routesPath) {\n throw new Error(`Unable to find routes file import in ${clientFile}`);\n }\n\n const { routesPath, exportName } = routesEntrypoint;\n const routeFilepath = this.resolveFilename(routesPath, clientEntrypoint);\n\n return this.recursiveBuildRoutesTree(routeFilepath, exportName);\n }\n\n /**\n * Parse file and return ast\n */\n private parseFile(filename: string): ParseResult<BabelFile> | null {\n try {\n const code = fs.readFileSync(filename, 'utf-8');\n\n return parser.parse(code, {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n });\n } catch {\n return null;\n }\n }\n\n /**\n * Find route import filepath\n */\n private getImportPath(\n ast: ParseResult<BabelFile>,\n importName: string | null,\n ): IPathImport | null {\n let routesPath: string | null = null;\n let exportName: string | null = null;\n\n traverse(ast, {\n ImportDeclaration(nodePath) {\n const importNode = nodePath.node;\n\n importNode.specifiers.forEach((specifier) => {\n if (specifier.local.name === importName) {\n exportName = specifier.type === 'ImportDefaultSpecifier' ? null : importName;\n routesPath = importNode.source.value;\n }\n });\n },\n });\n\n return {\n routesPath,\n exportName,\n };\n }\n\n /**\n * Find routes array inside code\n */\n private findRoutesDefinition(\n ast: ParseResult<BabelFile>,\n exportName: string | null,\n ): null | VariableDeclaration {\n let exportNameResolved = exportName;\n\n // noinspection JSUnusedGlobalSymbols\n traverse(ast, {\n ExportNamedDeclaration({ node }) {\n if (!node.declaration && node.specifiers.length > 0) {\n node.specifiers.forEach((specifier) => {\n // @ts-expect-error missing in types\n const exportedName = specifier.exported.name as string;\n\n if (exportName === null && specifier.type === 'ExportSpecifier') {\n if (specifier.local.name === 'default') {\n exportNameResolved = exportedName;\n }\n } else if (exportedName === exportName) {\n // @ts-expect-error missing in types\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n exportNameResolved = specifier.local.name as string;\n }\n });\n }\n },\n ExportDefaultDeclaration({ node }) {\n if (exportName === null) {\n if (node.declaration.type === 'Identifier') {\n exportNameResolved = node.declaration.name;\n // @ts-expect-error missing in types\n } else if (node.declaration.type === 'VariableDeclaration') {\n // @ts-expect-error missing in types\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n exportNameResolved = node.declaration.declarations[0].id.name as string;\n }\n }\n },\n });\n\n if (exportNameResolved) {\n let variableNode: VariableDeclaration | null = null;\n\n traverse(ast, {\n VariableDeclaration({ node }) {\n node.declarations.forEach((declaration) => {\n // @ts-expect-error missing in types\n if (declaration.id.name === exportNameResolved) {\n variableNode = node;\n }\n });\n },\n });\n\n return variableNode;\n }\n\n return null;\n }\n\n /**\n * Entrypoint routes file\n */\n private findRoutesEntrypoint(clientEntrypoint: string): IPathImport | null {\n const ast = this.parseFile(clientEntrypoint);\n\n let routesVariable: string | null = null;\n\n if (!ast) {\n return routesVariable;\n }\n\n traverse(ast, {\n CallExpression({ node }) {\n if (\n // @ts-expect-error missing in types\n node.callee.name === 'entryClient' &&\n node.arguments.length >= 2 &&\n node.arguments[1].type === 'Identifier'\n ) {\n routesVariable = node.arguments[1].name;\n }\n },\n });\n\n return this.getImportPath(ast, routesVariable);\n }\n\n /**\n * Resolve route filename import\n */\n private resolveFilename(filename: string, relativeFile?: string): string | null {\n let resolvedFilename = filename;\n\n if ((filename.startsWith('./') || filename.startsWith('../')) && relativeFile) {\n resolvedFilename = path.resolve(path.dirname(relativeFile), filename);\n }\n\n const filepath = this.pathNormalize.getAppPath(resolvedFilename, true);\n\n return this.pathNormalize.findAppFile(filepath!);\n }\n\n /**\n * Parse ast array routes objects\n */\n private parseRoutesArray(\n elements: TraverseTypes.Node[],\n importsMap: IMapImports,\n relativeFile: string,\n ): TRoutesTree[] {\n const results: TRoutesTree[] = [];\n\n elements.forEach((node, index) => {\n if (node.type === 'ObjectExpression') {\n const routeInfo: TRoutesTree = { index, import: '', children: [] };\n\n node.properties.forEach((prop) => {\n const objectProp = prop as {\n key: { name: string };\n value: { type: string; elements: TraverseTypes.Node[] };\n };\n\n if (objectProp.key.name === 'children' && objectProp.value.type === 'ArrayExpression') {\n routeInfo.children = this.parseRoutesArray(\n objectProp.value.elements,\n importsMap,\n relativeFile,\n );\n }\n\n // async routes\n if (\n objectProp.key.name === 'lazy' &&\n objectProp.value.type === 'ArrowFunctionExpression'\n ) {\n // @ts-expect-error incorrect types\n const importCall = objectProp.value.body as CallExpression;\n\n if (importCall.type === 'CallExpression' && importCall.callee.type === 'Import') {\n const [importArg] = importCall.arguments;\n\n if (importArg.type === 'StringLiteral') {\n routeInfo.import = importArg.value;\n }\n }\n }\n\n // static routes: Component\n if (objectProp.key.name === 'Component' && objectProp.value.type === 'Identifier') {\n // @ts-expect-error incorrect types\n const importName = objectProp.value.name as string;\n const { path: importPath } = importsMap[importName] ?? {};\n\n if (importPath) {\n routeInfo.import = importPath;\n }\n }\n\n // static routes: element\n if (objectProp.key.name === 'element' && objectProp.value.type === 'JSXElement') {\n // @ts-expect-error incorrect types\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const importName = objectProp.value?.openingElement?.name?.name as string;\n const { path: importPath } = importsMap[importName] ?? {};\n\n if (importPath) {\n routeInfo.import = importPath;\n }\n }\n\n if (objectProp.key.name === 'children' && objectProp.value.type === 'Identifier') {\n // @ts-expect-error incorrect types\n const importName = objectProp.value.name as string;\n const { path: importPath, isDefault } = importsMap[importName] ?? {};\n\n if (importPath) {\n const childrenFilePath = this.resolveFilename(importPath, relativeFile);\n\n if (childrenFilePath) {\n routeInfo.children = this.recursiveBuildRoutesTree(\n childrenFilePath,\n isDefault ? null : importName,\n );\n }\n }\n }\n });\n\n if (routeInfo.import || routeInfo.children.length > 0) {\n results.push(routeInfo);\n }\n }\n });\n\n return results;\n }\n\n /**\n * Parse imports map from ast\n */\n private static parseImportsMap(ast: ParseResult<BabelFile>): IMapImports {\n const importsMap: IMapImports = {};\n\n traverse(ast, {\n ImportDeclaration(nodePath) {\n const importNode = nodePath.node;\n\n importNode.specifiers.forEach((specifier) => {\n importsMap[specifier.local.name] = {\n path: importNode.source.value,\n isDefault: specifier.type === 'ImportDefaultSpecifier',\n };\n });\n },\n });\n\n return importsMap;\n }\n\n /**\n * Recursive build routes tree with dynamic imports\n */\n private recursiveBuildRoutesTree(\n filename: string | null,\n exportName: string | null = null,\n ): TRoutesTree[] {\n if (!filename) {\n return [];\n }\n\n const ast = this.parseFile(filename);\n\n if (!ast) {\n return [];\n }\n\n const routesNode = this.findRoutesDefinition(ast, exportName);\n const results: TRoutesTree[] = [];\n\n if (!routesNode) {\n return results;\n }\n\n const importsMap = ParseRoutes.parseImportsMap(ast);\n\n // @ts-expect-error missing types\n const elements = routesNode.declarations[0].init?.elements as TraverseTypes.Node[];\n\n results.push(...this.parseRoutesArray(elements, importsMap, filename));\n\n return results;\n }\n\n /**\n * Add pathId to static routes\n */\n private static processRouteFileCode(\n nodePath: TraverseTypes.NodePath<ObjectExpression>,\n importsMap: IMapImports,\n shouldAddPathId: boolean,\n addImportRouteWrapper: () => void,\n ): void {\n nodePath.node.properties.forEach((property) => {\n if (isObjectProperty(property) && isIdentifier(property.key)) {\n // async routes\n if (property.key.name === 'lazy' && property.value.type === 'ArrowFunctionExpression') {\n const importCall = property.value.body as CallExpression;\n const onlyClientProp = nodePath.node.properties.find(\n (p) => isObjectProperty(p) && isIdentifier(p.key) && p.key.name === 'onlyClient',\n );\n\n /**\n * Wrap lazy import with:\n * @see importRoute\n */\n property.value = {\n type: 'CallExpression',\n callee: {\n type: 'Identifier',\n name: 'n',\n },\n arguments:\n isObjectProperty(onlyClientProp) &&\n (isBooleanLiteral(onlyClientProp.value) ||\n isJSXElement(onlyClientProp.value) ||\n isFunction(onlyClientProp.value) ||\n isIdentifier(onlyClientProp.value))\n ? [property.value, onlyClientProp.value]\n : [property.value],\n };\n\n if (onlyClientProp) {\n nodePath.node.properties = nodePath.node.properties.filter((p) => p !== onlyClientProp);\n }\n\n addImportRouteWrapper();\n\n if (importCall.type === 'CallExpression' && importCall.callee.type === 'Import') {\n const [importArg] = importCall.arguments;\n // current object has part of array (inside array)\n const parent = nodePath.findParent?.((p) => isArrayExpression(p.node));\n\n if (\n parent &&\n importArg.type === 'StringLiteral' &&\n importArg.value &&\n shouldAddPathId\n ) {\n const pathIdProperty = objectProperty(\n identifier('pathId'),\n stringLiteral(importArg.value),\n );\n\n // Insert the pathId property right after the element property\n nodePath.node.properties.splice(\n nodePath.node.properties.indexOf(property) + 1,\n 0,\n pathIdProperty,\n );\n }\n }\n }\n\n if (property.key.name === 'element' || property.key.name === 'Component') {\n let componentName = '';\n\n if (isJSXElement(property.value) && isJSXIdentifier(property.value.openingElement.name)) {\n componentName = property.value.openingElement.name.name;\n } else if (isIdentifier(property.value)) {\n componentName = property.value.name;\n }\n\n // current object has part of array (inside array)\n const parent = nodePath.findParent?.((p) => isArrayExpression(p.node));\n const importName = importsMap[componentName]?.path;\n\n if (parent && importName && shouldAddPathId) {\n const pathIdProperty = objectProperty(identifier('pathId'), stringLiteral(importName));\n\n // Insert the pathId property right after the element property\n nodePath.node.properties.splice(\n nodePath.node.properties.indexOf(property) + 1,\n 0,\n pathIdProperty,\n );\n }\n }\n\n if (property.key.name === 'children' && isArrayExpression(property.value)) {\n // Process each object in the children array recursively\n property.value.elements.forEach((element) => {\n if (isObjectExpression(element)) {\n ParseRoutes.processRouteFileCode(\n { node: element } as TraverseTypes.NodePath<ObjectExpression>,\n importsMap,\n shouldAddPathId,\n addImportRouteWrapper,\n );\n }\n });\n }\n }\n });\n }\n\n /**\n * Inject pathId to sync/async routes\n * Add async wrapper (see import-routes)\n */\n public static handleRoutes(code: string, shouldAddPathId: boolean): string {\n if (!code) {\n return code;\n }\n\n const ast = parser.parse(code, {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n });\n\n if (!ast) {\n return code;\n }\n\n const importsMap = ParseRoutes.parseImportsMap(ast);\n let shouldAddRoutesImport = false;\n\n traverse(ast, {\n ObjectExpression(nodePath): void {\n ParseRoutes.processRouteFileCode(nodePath, importsMap, shouldAddPathId, () => {\n shouldAddRoutesImport = true;\n });\n },\n });\n\n if (shouldAddRoutesImport) {\n ast.program.body.unshift({\n type: 'ImportDeclaration',\n specifiers: [\n {\n type: 'ImportDefaultSpecifier',\n local: {\n type: 'Identifier',\n name: 'n',\n },\n },\n ],\n source: {\n type: 'StringLiteral',\n value: `${PLUGIN_NAME}/helpers/import-route`,\n },\n });\n }\n\n return generate(ast, {\n retainLines: true,\n }).code;\n }\n}\n\nexport default ParseRoutes;\n"],"names":["generate","babelGenerate","default","traverse","babelTraverse","ParseRoutes","pathNormalize","config","constructor","viteAliases","this","PathNormalize","parse","clientFile","root","getParams","clientEntrypoint","resolve","routesEntrypoint","findRoutesEntrypoint","routesPath","Error","exportName","routeFilepath","resolveFilename","recursiveBuildRoutesTree","parseFile","filename","code","fs","readFileSync","parser","sourceType","plugins","getImportPath","ast","importName","ImportDeclaration","nodePath","importNode","node","specifiers","forEach","specifier","local","name","type","source","value","findRoutesDefinition","exportNameResolved","ExportNamedDeclaration","declaration","length","exportedName","exported","ExportDefaultDeclaration","declarations","id","variableNode","VariableDeclaration","routesVariable","CallExpression","callee","arguments","relativeFile","resolvedFilename","startsWith","path","dirname","filepath","getAppPath","findAppFile","parseRoutesArray","elements","importsMap","results","index","routeInfo","import","children","properties","prop","objectProp","key","importCall","body","importArg","importPath","openingElement","isDefault","childrenFilePath","push","static","routesNode","parseImportsMap","init","shouldAddPathId","addImportRouteWrapper","property","isObjectProperty","isIdentifier","onlyClientProp","find","p","isBooleanLiteral","isJSXElement","isFunction","filter","parent","findParent","isArrayExpression","pathIdProperty","objectProperty","identifier","stringLiteral","splice","indexOf","componentName","isJSXIdentifier","element","isObjectExpression","processRouteFileCode","shouldAddRoutesImport","ObjectExpression","program","unshift","PLUGIN_NAME","retainLines"],"mappings":"4eAkCA,MAAMA,EAAYC,EAAcC,SAAWD,EAErCE,EAAYC,EAAcF,SAAWE,EAuB3C,MAAMC,EAIeC,cAKAC,OAKnBC,YAAYD,EAAsBE,GAChCC,KAAKH,OAASA,EACdG,KAAKJ,cAAgB,IAAIK,EAAcJ,EAAQE,EACjD,CAKOG,QACL,MAAMC,WAAEA,EAAUC,KAAEA,GAASJ,KAAKH,OAAOQ,YAEnCC,EAAmBC,EAAQH,EAAMD,GACjCK,EAAmBR,KAAKS,qBAAqBH,GAEnD,IAAKE,GAAkBE,WACrB,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GAC/C,IAAIwF,GAAwB,EA6B5B,OA3BAxH,EAASgC,EAAK,CACZyF,iBAAiBtF,GACfjC,EAAYqH,qBAAqBpF,EAAUqC,EAAYsB,GAAiB,KACtE0B,GAAwB,CAAI,GAEhC,IAGEA,GACFxF,EAAI0F,QAAQvC,KAAKwC,QAAQ,CACvBhF,KAAM,oBACNL,WAAY,CACV,CACEK,KAAM,yBACNF,MAAO,CACLE,KAAM,aACND,KAAM,OAIZE,OAAQ,CACND,KAAM,gBACNE,MAAO,GAAG+E,4BAKT/H,EAASmC,EAAK,CACnB6F,aAAa,IACZpG,IACL"}
|
|
1
|
+
{"version":3,"file":"parse-routes.js","sources":["../../src/services/parse-routes.ts"],"sourcesContent":[null],"names":["generate","babelGenerate","default","traverse","babelTraverse","ParseRoutes","pathNormalize","config","constructor","viteAliases","this","PathNormalize","parse","clientFile","root","getParams","clientEntrypoint","resolve","routesEntrypoint","findRoutesEntrypoint","routesPath","Error","exportName","routeFilepath","resolveFilename","recursiveBuildRoutesTree","parseFile","filename","code","fs","readFileSync","parser","sourceType","createImportExpressions","plugins","getImportPath","ast","importName","ImportDeclaration","nodePath","importNode","node","specifiers","forEach","specifier","local","name","type","source","value","findRoutesDefinition","exportNameResolved","ExportNamedDeclaration","declaration","length","exportedName","exported","ExportDefaultDeclaration","declarations","id","variableNode","VariableDeclaration","routesVariable","CallExpression","callee","arguments","relativeFile","resolvedFilename","startsWith","path","dirname","filepath","getAppPath","findAppFile","parseRoutesArray","elements","importsMap","results","index","routeInfo","import","children","properties","prop","objectProp","key","importCall","body","importArg","importPath","openingElement","isDefault","childrenFilePath","push","parseImportsMap","routesNode","init","processRouteFileCode","shouldAddPathId","addImportRouteWrapper","property","isObjectProperty","isIdentifier","onlyClientProp","find","p","isBooleanLiteral","isJSXElement","isFunction","filter","parent","findParent","isArrayExpression","pathIdProperty","objectProperty","identifier","stringLiteral","splice","indexOf","componentName","isJSXIdentifier","element","isObjectExpression","handleRoutes","shouldAddRoutesImport","Ob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QlB,GAAY,EAC7C,EACAa,EAEJ,CACF,CAE0B,aAAtBb,EAASf,IAAIvC,MAAuBkE,EAAkBZ,EAASnD,QAEjEmD,EAASnD,MAAM0B,SAAShC,QAAS8E,IAC3BC,EAAmBD,IACrBpH,EAAY4F,qBACV,CAAExD,KAAMgF,GACR7C,EACAsB,EACAC,IAKV,GAEJ,CAMO,mBAAOwB,CAAa/F,EAAcsE,GACvC,IAAKtE,EACH,OAAOA,EAGT,MAAMQ,EAAML,EAAOnB,MAAMgB,EAAM,CAC7BI,WAAY,SACZC,yBAAyB,EACzBC,QAAS,CAAC,aAAc,SAG1B,IAAKE,EACH,OAAOR,EAGT,MAAMgD,EAAavE,EAAYyF,gBAAgB1D,GAC/C,IAAIwF,GAAwB,EA6B5B,OA3BAzH,EAASiC,EAAK,CACZ,gBAAAyF,CAAiBtF,GACflC,EAAY4F,qBAAqB1D,EAAUqC,EAAYsB,EAAiB,KACtE0B,GAAwB,GAE5B,IAGEA,GACFxF,EAAI0F,QAAQvC,KAAKwC,QAAQ,CACvBhF,KAAM,oBACNL,WAAY,CACV,CACEK,KAAM,yBACNF,MAAO,CACLE,KAAM,aACND,KAAM,OAIZE,OAAQ,CACND,KAAM,gBACNE,MAAO,GAAG+E,4BAKThI,EAASoC,EAAK,CACnB6F,aAAa,IACZrG,IACL"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Alias } from 'vite';
|
|
2
|
-
import ServerConfig from
|
|
1
|
+
import type { Alias } from 'vite';
|
|
2
|
+
import type ServerConfig from './server-config.js';
|
|
3
3
|
/**
|
|
4
4
|
* Service for work with path and aliases
|
|
5
5
|
*/
|
|
@@ -12,40 +12,25 @@ declare class PathNormalize {
|
|
|
12
12
|
* Server config
|
|
13
13
|
*/
|
|
14
14
|
protected readonly config: ServerConfig;
|
|
15
|
-
/**
|
|
16
|
-
* @constructor
|
|
17
|
-
*/
|
|
18
15
|
/**
|
|
19
16
|
* @constructor
|
|
20
17
|
*/
|
|
21
18
|
constructor(config: ServerConfig, viteAliases?: Alias[]);
|
|
22
|
-
/**
|
|
23
|
-
* Get vite aliases
|
|
24
|
-
*/
|
|
25
19
|
/**
|
|
26
20
|
* Get vite aliases
|
|
27
21
|
*/
|
|
28
22
|
getAliases(): Record<string, string>;
|
|
29
|
-
/**
|
|
30
|
-
* Return filename postfix
|
|
31
|
-
*/
|
|
32
23
|
/**
|
|
33
24
|
* Return filename postfix
|
|
34
25
|
*/
|
|
35
26
|
getImportPostfix(): string[];
|
|
36
|
-
/**
|
|
37
|
-
* Resolve app path
|
|
38
|
-
*/
|
|
39
27
|
/**
|
|
40
28
|
* Resolve app path
|
|
41
29
|
*/
|
|
42
30
|
getAppPath(appPath?: string, withRoot?: boolean): string | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Find app filepath
|
|
45
|
-
*/
|
|
46
31
|
/**
|
|
47
32
|
* Find app filepath
|
|
48
33
|
*/
|
|
49
34
|
findAppFile(basePath: string): string | null;
|
|
50
35
|
}
|
|
51
|
-
export
|
|
36
|
+
export default PathNormalize;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"node:fs";import s from"path";class e{viteAliases;config;constructor(t,s){this.config=t,this.viteAliases=s??t.getVite()?.config?.resolve.alias}getAliases(){const t={};return this.viteAliases?.forEach((
|
|
1
|
+
import t from"node:fs";import s from"path";class e{viteAliases;config;constructor(t,s){this.config=t,this.viteAliases=s??t.getVite()?.config?.resolve.alias}getAliases(){const t={};return this.viteAliases?.forEach(({find:s,replacement:e})=>{"string"==typeof s&&(t[s]=e)}),t}getImportPostfix(){return["","/index"].map(t=>["",".js",".ts",".tsx"].map(s=>`${t}${s}`)).flat()}getAppPath(t,e=!1){if(!t)return;const{root:i}=this.config.getParams();let r=t;if(t.startsWith("./")||t.startsWith("../"))r=s.resolve(i,t);else{const s=this.getAliases(),[e]=t.split("/");s[e]&&(r=t.replace(e,s[e]))}return r=r.split(s.win32.sep).join(s.posix.sep),e?r:r.replace(i,"").replace(/^(\/)|(\/)$/g,"")}findAppFile(s){const e=this.getImportPostfix();for(const i of e){const e=`${s}${i}`;if(t.existsSync(e)&&t.statSync(e).isFile())return e}return null}}export{e as default};
|
|
2
2
|
//# sourceMappingURL=path-normalize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-normalize.js","sources":["../../src/services/path-normalize.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"path-normalize.js","sources":["../../src/services/path-normalize.ts"],"sourcesContent":[null],"names":["PathNormalize","viteAliases","config","constructor","this","getVite","resolve","alias","getAliases","aliases","forEach","find","replacement","getImportPostfix","map","prefix","ext","flat","getAppPath","appPath","withRoot","root","getParams","fullPath","startsWith","path","routeAlias","split","replace","win32","sep","join","posix","findAppFile","basePath","postfixes","postfix","filepath","fs","existsSync","statSync","isFile"],"mappings":"2CAQA,MAAMA,EAIeC,YAKAC,OAKnB,WAAAC,CAAYD,EAAsBD,GAChCG,KAAKF,OAASA,EACdE,KAAKH,YAAcA,GAAeC,EAAOG,WAAWH,QAAQI,QAAQC,KACtE,CAKO,UAAAC,GACL,MAAMC,EAAkC,CAAA,EAUxC,OARAL,KAAKH,aAAaS,QAAQ,EAAGC,OAAMC,kBACb,iBAATD,IAIXF,EAAQE,GAAQC,KAGXH,CACT,CAKO,gBAAAI,GACL,MAAO,CAAC,GAAI,UACTC,IAAKC,GAAW,CAAC,GAAI,MAAO,MAAO,QAAQD,IAAKE,GAAQ,GAAGD,IAASC,MACpEC,MACL,CAKO,UAAAC,CAAWC,EAAkBC,GAAW,GAC7C,IAAKD,EACH,OAGF,MAAME,KAAEA,GAASjB,KAAKF,OAAOoB,YAC7B,IAAIC,EAAWJ,EAGf,GAAIA,EAAQK,WAAW,OAASL,EAAQK,WAAW,OACjDD,EAAWE,EAAKnB,QAAQe,EAAMF,OACzB,CAEL,MAAMV,EAAUL,KAAKI,cAEdkB,GAAcP,EAAQQ,MAAM,KAE/BlB,EAAQiB,KACVH,EAAWJ,EAAQS,QAAQF,EAAYjB,EAAQiB,IAEnD,CAKA,OAFAH,EAAWA,EAASI,MAAMF,EAAKI,MAAMC,KAAKC,KAAKN,EAAKO,MAAMF,KAEtDV,EACKG,EAGFA,EAASK,QAAQP,EAAM,IAAIO,QAAQ,eAAgB,GAC5D,CAKO,WAAAK,CAAYC,GACjB,MAAMC,EAAY/B,KAAKS,mBAEvB,IAAK,MAAMuB,KAAWD,EAAW,CAC/B,MAAME,EAAW,GAAGH,IAAWE,IAE/B,GAAIE,EAAGC,WAAWF,IAAaC,EAAGE,SAASH,GAAUI,SACnD,OAAOJ,CAEX,CAEA,OAAO,IACT"}
|
package/services/server-api.d.ts
CHANGED
|
@@ -6,19 +6,13 @@ declare class ServerApi {
|
|
|
6
6
|
* Block access to index.html
|
|
7
7
|
*/
|
|
8
8
|
protected isAllowIndexHtml: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Server can return index.html
|
|
11
|
-
*/
|
|
12
9
|
/**
|
|
13
10
|
* Server can return index.html
|
|
14
11
|
*/
|
|
15
12
|
hasAccessIndexHtml(): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Allow/disallow return index.html on request
|
|
18
|
-
*/
|
|
19
13
|
/**
|
|
20
14
|
* Allow/disallow return index.html on request
|
|
21
15
|
*/
|
|
22
16
|
changeAccessIndexHtml(isAllowed: boolean): void;
|
|
23
17
|
}
|
|
24
|
-
export
|
|
18
|
+
export default ServerApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-api.js","sources":["../../src/services/server-api.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"server-api.js","sources":["../../src/services/server-api.ts"],"sourcesContent":[null],"names":["ServerApi","isAllowIndexHtml","hasAccessIndexHtml","this","changeAccessIndexHtml","isAllowed"],"mappings":"AAGA,MAAMA,EAIMC,kBAAmB,EAKtB,kBAAAC,GACL,OAAOC,KAAKF,gBACd,CAKO,qBAAAG,CAAsBC,GAC3BF,KAAKF,iBAAmBI,CAC1B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { IBuildEntrypoint } from "./build.js";
|
|
1
|
+
import type { Logger, ViteDevServer } from 'vite';
|
|
2
|
+
import type { IPluginConfig } from '../helpers/plugin-config.js';
|
|
3
|
+
import type { IBuildEntrypoint } from './build.js';
|
|
5
4
|
interface IConfigOptions {
|
|
6
5
|
isProd?: boolean;
|
|
7
6
|
isHost?: boolean;
|
|
@@ -53,7 +52,7 @@ declare class ServerConfig {
|
|
|
53
52
|
/**
|
|
54
53
|
* Express application
|
|
55
54
|
*/
|
|
56
|
-
protected app?:
|
|
55
|
+
protected app?: unknown;
|
|
57
56
|
/**
|
|
58
57
|
* Config params
|
|
59
58
|
*/
|
|
@@ -70,37 +69,22 @@ declare class ServerConfig {
|
|
|
70
69
|
* Default root dir
|
|
71
70
|
*/
|
|
72
71
|
protected defaultBuildRoots: string[];
|
|
73
|
-
/**
|
|
74
|
-
* @constructor
|
|
75
|
-
*/
|
|
76
72
|
/**
|
|
77
73
|
* @constructor
|
|
78
74
|
*/
|
|
79
75
|
protected constructor({ entrypointName, isProd, isHost, isOnlyClient, isModulePreload, mode, }: IConfigOptions, prodParams: Partial<IConfigParams>);
|
|
80
|
-
/**
|
|
81
|
-
* Initialize service
|
|
82
|
-
*/
|
|
83
76
|
/**
|
|
84
77
|
* Initialize service
|
|
85
78
|
*/
|
|
86
79
|
static init(options?: IConfigOptions, prodOptions?: Partial<IConfigParams>): ServerConfig;
|
|
87
|
-
/**
|
|
88
|
-
* Lookup build folder
|
|
89
|
-
*/
|
|
90
80
|
/**
|
|
91
81
|
* Lookup build folder
|
|
92
82
|
*/
|
|
93
83
|
protected getBuildDir(root?: string): string;
|
|
94
|
-
/**
|
|
95
|
-
* Make config params
|
|
96
|
-
*/
|
|
97
84
|
/**
|
|
98
85
|
* Make config params
|
|
99
86
|
*/
|
|
100
87
|
protected makeParams(): void;
|
|
101
|
-
/**
|
|
102
|
-
* Set vite server
|
|
103
|
-
*/
|
|
104
88
|
/**
|
|
105
89
|
* Set vite server
|
|
106
90
|
*/
|
|
@@ -108,14 +92,7 @@ declare class ServerConfig {
|
|
|
108
92
|
/**
|
|
109
93
|
* Set express server
|
|
110
94
|
*/
|
|
111
|
-
|
|
112
|
-
* Set express server
|
|
113
|
-
*/
|
|
114
|
-
setApp(express: Express): void;
|
|
115
|
-
/**
|
|
116
|
-
* Return vite dev server
|
|
117
|
-
* NOTE: only on development mode
|
|
118
|
-
*/
|
|
95
|
+
setApp<T>(app: T): void;
|
|
119
96
|
/**
|
|
120
97
|
* Return vite dev server
|
|
121
98
|
* NOTE: only on development mode
|
|
@@ -124,53 +101,31 @@ declare class ServerConfig {
|
|
|
124
101
|
/**
|
|
125
102
|
* Return express server
|
|
126
103
|
*/
|
|
127
|
-
|
|
128
|
-
* Return express server
|
|
129
|
-
*/
|
|
130
|
-
getApp(): Express | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Return plugin config
|
|
133
|
-
* NOTE: only on development mode
|
|
134
|
-
*/
|
|
104
|
+
getApp<T = unknown>(): T | undefined;
|
|
135
105
|
/**
|
|
136
106
|
* Return plugin config
|
|
137
107
|
* NOTE: only on development mode
|
|
138
108
|
*/
|
|
139
109
|
getPluginConfig(): IPluginConfig | undefined;
|
|
140
|
-
/**
|
|
141
|
-
* Return config params
|
|
142
|
-
*/
|
|
143
110
|
/**
|
|
144
111
|
* Return config params
|
|
145
112
|
*/
|
|
146
113
|
getParams(): IConfigParams;
|
|
147
|
-
/**
|
|
148
|
-
* Get server logger
|
|
149
|
-
*/
|
|
150
114
|
/**
|
|
151
115
|
* Get server logger
|
|
152
116
|
*/
|
|
153
117
|
getLogger(): Logger;
|
|
154
|
-
/**
|
|
155
|
-
* Set custom logger
|
|
156
|
-
*/
|
|
157
118
|
/**
|
|
158
119
|
* Set custom logger
|
|
159
120
|
*/
|
|
160
121
|
setLogger(logger: Logger): void;
|
|
161
|
-
/**
|
|
162
|
-
* Apply config to specified entrypoint
|
|
163
|
-
*/
|
|
164
122
|
/**
|
|
165
123
|
* Apply config to specified entrypoint
|
|
166
124
|
*/
|
|
167
125
|
protected applyEntrypointConfig(): void;
|
|
168
|
-
/**
|
|
169
|
-
* Get current entrypoint
|
|
170
|
-
*/
|
|
171
126
|
/**
|
|
172
127
|
* Get current entrypoint
|
|
173
128
|
*/
|
|
174
129
|
protected getEntrypoint(): IBuildEntrypoint | undefined;
|
|
175
130
|
}
|
|
176
|
-
export
|
|
131
|
+
export default ServerConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"node:fs";import i from"node:path";import e from"../helpers/plugin-config.js";import r from"./logger.js";class s{isProd;isHost;isModulePreload;mode;entrypointName;vite;app;params;defaultParams;logger;defaultBuildRoots=["./build","./dist"];constructor({entrypointName:t,isProd:i=!1,isHost:e=!1,isOnlyClient:r=!1,isModulePreload:s=!1,mode:o="production"},n){this.isProd=i,this.isHost=e,this.isModulePreload=s,this.mode=o,this.entrypointName=t,this.defaultParams={publicDir:"/client",indexFile:"/client/index.html",serverFile:"/server/server.js",host:"127.0.0.1",isSPA:r,...n},this.makeParams()}static init(t={},i={}){return new s(t,i)}getBuildDir(i){for(const e of[i,...this.defaultBuildRoots])if(e&&t.existsSync(e))return e;return i??this.defaultBuildRoots[0]}makeParams(){this.applyEntrypointConfig();const t=this.getPluginConfig()??{},{config:e}=this.vite??{},{root:s,publicDir:o,indexFile:n,clientFile:l,serverFile:a,host:p,isSPA:h}=this.defaultParams,g=new URL(import.meta.url),d=t.pluginPath??i.resolve(i.dirname(g.pathname),"../"),u=this.getEntrypoint(),m="boolean"==typeof e?.server.host||this.isHost?"0.0.0.0":e?.server.host??p,f=Number(e?.env.VITE_PORT??e?.server.port??this.defaultParams.port);this.params={root:e?.root??this.getBuildDir(s),publicDir:e?.publicDir??o,indexFile:t.indexFile??n,clientFile:t.clientFile??l,serverFile:t.serverFile??a,pluginPath:d,host:m,port:f,isSPA:u?"spa"===u.type:h,isProd:this.isProd},this.logger=this.vite?.config.logger??new r}setVite(t){this.vite=t,this.makeParams()}setApp(t){this.app=t}getVite(){return this.vite}getApp(){return this.app}getPluginConfig(){return this.vite?e(this.vite.config):void 0}getParams(){return this.params}getLogger(){return this.logger}setLogger(t){this.logger=t}applyEntrypointConfig(){const t=this.getPluginConfig();if(!this.vite||!t||!this.entrypointName)return;const i=this.getEntrypoint();i&&["indexFile","clientFile","serverFile"].forEach(
|
|
1
|
+
import t from"node:fs";import i from"node:path";import e from"../helpers/plugin-config.js";import r from"./logger.js";class s{isProd;isHost;isModulePreload;mode;entrypointName;vite;app;params;defaultParams;logger;defaultBuildRoots=["./build","./dist"];constructor({entrypointName:t,isProd:i=!1,isHost:e=!1,isOnlyClient:r=!1,isModulePreload:s=!1,mode:o="production"},n){this.isProd=i,this.isHost=e,this.isModulePreload=s,this.mode=o,this.entrypointName=t,this.defaultParams={publicDir:"/client",indexFile:"/client/index.html",serverFile:"/server/server.js",host:"127.0.0.1",isSPA:r,...n},this.makeParams()}static init(t={},i={}){return new s(t,i)}getBuildDir(i){for(const e of[i,...this.defaultBuildRoots])if(e&&t.existsSync(e))return e;return i??this.defaultBuildRoots[0]}makeParams(){this.applyEntrypointConfig();const t=this.getPluginConfig()??{},{config:e}=this.vite??{},{root:s,publicDir:o,indexFile:n,clientFile:l,serverFile:a,host:p,isSPA:h}=this.defaultParams,g=new URL(import.meta.url),d=t.pluginPath??i.resolve(i.dirname(g.pathname),"../"),u=this.getEntrypoint(),m="boolean"==typeof e?.server.host||this.isHost?"0.0.0.0":e?.server.host??p,f=Number(e?.env.VITE_PORT??e?.server.port??this.defaultParams.port);this.params={root:e?.root??this.getBuildDir(s),publicDir:e?.publicDir??o,indexFile:t.indexFile??n,clientFile:t.clientFile??l,serverFile:t.serverFile??a,pluginPath:d,host:m,port:f,isSPA:u?"spa"===u.type:h,isProd:this.isProd},this.logger=this.vite?.config.logger??new r}setVite(t){this.vite=t,this.makeParams()}setApp(t){this.app=t}getVite(){return this.vite}getApp(){return this.app}getPluginConfig(){return this.vite?e(this.vite.config):void 0}getParams(){return this.params}getLogger(){return this.logger}setLogger(t){this.logger=t}applyEntrypointConfig(){const t=this.getPluginConfig();if(!this.vite||!t||!this.entrypointName)return;const i=this.getEntrypoint();i&&["indexFile","clientFile","serverFile"].forEach(e=>{i[e]&&(t[e]=i[e])})}getEntrypoint(){const t=this.vite?e(this.vite.config):void 0;return t?.entrypoint?.find(({name:t})=>t===this.entrypointName)}}export{s as default};
|
|
2
2
|
//# sourceMappingURL=server-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.js","sources":["../../src/services/server-config.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"server-config.js","sources":["../../src/services/server-config.ts"],"sourcesContent":[null],"names":["ServerConfig","isProd","isHost","isModulePreload","mode","entrypointName","vite","app","params","defaultParams","logger","defaultBuildRoots","constructor","isOnlyClient","prodParams","this","publicDir","indexFile","serverFile","host","isSPA","makeParams","init","options","prodOptions","getBuildDir","root","dir","fs","existsSync","applyEntrypointConfig","pluginConfig","getPluginConfig","config","clientFile","defaultHost","dirInfo","URL","url","pluginPath","path","resolve","dirname","pathname","entrypoint","getEntrypoint","server","port","Number","env","VITE_PORT","type","DefaultLogger","setVite","setApp","getVite","getApp","undefined","getParams","getLogger","setLogger","entrypointConfig","forEach","optName","find","name"],"mappings":"sHAiCA,MAAMA,EAIYC,OAKAC,OAKAC,gBAKAC,KAKGC,eAKTC,KAKAC,IAKAC,OAKAC,cAKAC,OAKAC,kBAAoB,CAAC,UAAW,UAK1C,WAAAC,EACEP,eACEA,EAAcJ,OACdA,GAAS,EAAKC,OACdA,GAAS,EAAKW,aACdA,GAAe,EAAKV,gBACpBA,GAAkB,EAAKC,KACvBA,EAAO,cAETU,GAEAC,KAAKd,OAASA,EACdc,KAAKb,OAASA,EACda,KAAKZ,gBAAkBA,EACvBY,KAAKX,KAA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