@common-stack/rollup-vite-utils 6.0.6-alpha.3 → 6.0.6-alpha.35
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/config-schema.cjs +111 -0
- package/lib/config-schema.cjs.map +1 -0
- package/lib/config-schema.js +111 -0
- package/lib/config-schema.js.map +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +1 -1
- package/lib/interfaces/types.d.ts +3 -0
- package/lib/preStartup/configLoader/index.cjs +1 -1
- package/lib/preStartup/configLoader/index.cjs.map +1 -1
- package/lib/preStartup/configLoader/index.js +1 -1
- package/lib/preStartup/configLoader/index.js.map +1 -1
- package/lib/preStartup/copyIfVersionChanged.cjs +1 -1
- package/lib/preStartup/copyIfVersionChanged.cjs.map +1 -1
- package/lib/preStartup/copyIfVersionChanged.js +1 -1
- package/lib/preStartup/copyIfVersionChanged.js.map +1 -1
- package/lib/rollup/index.d.ts +1 -0
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.cjs +117 -46
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.cjs.map +1 -1
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.d.ts +8 -0
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.js +117 -46
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.js.map +1 -1
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.test.d.ts +1 -0
- package/lib/rollup/rollupPluginModifyLibFiles.cjs +12 -5
- package/lib/rollup/rollupPluginModifyLibFiles.cjs.map +1 -1
- package/lib/rollup/rollupPluginModifyLibFiles.js +12 -5
- package/lib/rollup/rollupPluginModifyLibFiles.js.map +1 -1
- package/lib/rollup/rollupPluginUpdateFromConfig.cjs +118 -0
- package/lib/rollup/rollupPluginUpdateFromConfig.cjs.map +1 -0
- package/lib/rollup/rollupPluginUpdateFromConfig.d.ts +1 -0
- package/lib/rollup/rollupPluginUpdateFromConfig.js +118 -0
- package/lib/rollup/rollupPluginUpdateFromConfig.js.map +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/verifyConfig.cjs +13 -0
- package/lib/utils/verifyConfig.cjs.map +1 -0
- package/lib/utils/verifyConfig.d.ts +2 -0
- package/lib/utils/verifyConfig.js +13 -0
- package/lib/utils/verifyConfig.js.map +1 -0
- package/lib/vite-wrappers/icon-switch.cjs +20 -6
- package/lib/vite-wrappers/icon-switch.cjs.map +1 -1
- package/lib/vite-wrappers/icon-switch.d.ts +1 -1
- package/lib/vite-wrappers/icon-switch.js +20 -6
- package/lib/vite-wrappers/icon-switch.js.map +1 -1
- package/lib/vite-wrappers/json-wrappers.cjs +100 -10
- package/lib/vite-wrappers/json-wrappers.cjs.map +1 -1
- package/lib/vite-wrappers/json-wrappers.d.ts +24 -0
- package/lib/vite-wrappers/json-wrappers.js +100 -10
- package/lib/vite-wrappers/json-wrappers.js.map +1 -1
- package/lib/vite-wrappers/loaderGenerator.cjs +51 -10
- package/lib/vite-wrappers/loaderGenerator.cjs.map +1 -1
- package/lib/vite-wrappers/loaderGenerator.d.ts +44 -2
- package/lib/vite-wrappers/loaderGenerator.js +51 -10
- package/lib/vite-wrappers/loaderGenerator.js.map +1 -1
- package/lib/vite-wrappers/wrapperComponent.cjs +168 -78
- package/lib/vite-wrappers/wrapperComponent.cjs.map +1 -1
- package/lib/vite-wrappers/wrapperComponent.d.ts +9 -0
- package/lib/vite-wrappers/wrapperComponent.js +168 -78
- package/lib/vite-wrappers/wrapperComponent.js.map +1 -1
- package/package.json +7 -5
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});const schema = {
|
|
2
|
+
type: "object",
|
|
3
|
+
properties: {
|
|
4
|
+
commonPaths: { type: "object" },
|
|
5
|
+
copyOperations: {
|
|
6
|
+
type: "array",
|
|
7
|
+
items: {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
packageName: { type: "string" },
|
|
11
|
+
destPath: { type: "string" },
|
|
12
|
+
generateModule: { type: "boolean" }
|
|
13
|
+
},
|
|
14
|
+
required: ["packageName", "destPath", "generateModule"],
|
|
15
|
+
additionalProperties: false
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
i18n: {
|
|
19
|
+
type: "object",
|
|
20
|
+
properties: {
|
|
21
|
+
enabled: { type: "boolean" },
|
|
22
|
+
fallbackLng: { type: "string" },
|
|
23
|
+
supportedLngs: {
|
|
24
|
+
type: "array",
|
|
25
|
+
items: { type: "string" }
|
|
26
|
+
},
|
|
27
|
+
defaultNS: { type: "string" },
|
|
28
|
+
react: {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
useSuspense: { type: "boolean" }
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
backend: {
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: {
|
|
37
|
+
loadPath: { type: "string" },
|
|
38
|
+
loadServerPath: { type: "string" }
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
packages: {
|
|
42
|
+
type: "array",
|
|
43
|
+
items: { type: "string" }
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
modules: {
|
|
48
|
+
type: "array",
|
|
49
|
+
items: {
|
|
50
|
+
oneOf: [
|
|
51
|
+
{ type: "string" },
|
|
52
|
+
{
|
|
53
|
+
type: "array",
|
|
54
|
+
items: [
|
|
55
|
+
{ type: "string" },
|
|
56
|
+
{
|
|
57
|
+
type: "object",
|
|
58
|
+
properties: {
|
|
59
|
+
version: { type: "string" }
|
|
60
|
+
},
|
|
61
|
+
required: ["version"],
|
|
62
|
+
additionalProperties: false
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"minItems": 2,
|
|
66
|
+
"maxItems": 2,
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
paths: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
lifecycleMiddleware: { type: "string" }
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
buildConfig: {
|
|
78
|
+
type: "object",
|
|
79
|
+
properties: {
|
|
80
|
+
__CLIENT__: { type: "boolean" },
|
|
81
|
+
__SERVER__: { type: "boolean" },
|
|
82
|
+
__DEV__: { type: "boolean" },
|
|
83
|
+
__TEST__: { type: "boolean" },
|
|
84
|
+
__CDN_URL__: { type: "string" },
|
|
85
|
+
__GRAPHQL_URL__: { type: "string" },
|
|
86
|
+
__DEBUGGING__: { type: "boolean" },
|
|
87
|
+
__SSR__: { type: "boolean" },
|
|
88
|
+
__API_URL__: { type: "string" },
|
|
89
|
+
__FRONTEND_BUILD_DIR__: { type: "string" },
|
|
90
|
+
__WEB_DEV_SERVER_PORT__: { type: "integer" },
|
|
91
|
+
__GRAPHQL_ENDPOINT__: { type: "string" },
|
|
92
|
+
__LOCAL_SERVER_HOST__: { type: "string" },
|
|
93
|
+
__BACKEND_URL__: { type: "string" }
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
viteConfig: {
|
|
97
|
+
type: "object",
|
|
98
|
+
properties: {
|
|
99
|
+
ssr: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: {
|
|
102
|
+
noExternal: {
|
|
103
|
+
type: "array",
|
|
104
|
+
items: { type: "string" }
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
};exports.default=schema;//# sourceMappingURL=config-schema.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.cjs","sources":["../src/config-schema.js"],"sourcesContent":["const schema = {\n type: \"object\",\n properties: {\n commonPaths: { type: \"object\" },\n copyOperations: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n packageName: { type: \"string\" },\n destPath: { type: \"string\" },\n generateModule: { type: \"boolean\" }\n },\n required: [\"packageName\", \"destPath\", \"generateModule\"],\n additionalProperties: false\n }\n },\n i18n: {\n type: \"object\",\n properties: {\n enabled: { type: \"boolean\" },\n fallbackLng: { type: \"string\" },\n supportedLngs: {\n type: \"array\",\n items: { type: \"string\" }\n },\n defaultNS: { type: \"string\" },\n react: {\n type: \"object\",\n properties: {\n useSuspense: { type: \"boolean\" }\n },\n },\n backend: {\n type: \"object\",\n properties: {\n loadPath: { type: \"string\" },\n loadServerPath: { type: \"string\" }\n },\n },\n packages: {\n type: \"array\",\n items: { type: \"string\" }\n }\n },\n },\n modules: {\n type: \"array\",\n items: {\n oneOf: [\n { type: \"string\" },\n {\n type: \"array\",\n items: [\n { type: \"string\" },\n {\n type: \"object\",\n properties: {\n version: { type: \"string\" }\n },\n required: [\"version\"],\n additionalProperties: false\n }\n ],\n \"minItems\": 2,\n \"maxItems\": 2,\n }\n ]\n }\n },\n paths: {\n type: \"object\",\n properties: {\n lifecycleMiddleware: { type: \"string\" }\n },\n },\n buildConfig: {\n type: \"object\",\n properties: {\n __CLIENT__: { type: \"boolean\" },\n __SERVER__: { type: \"boolean\" },\n __DEV__: { type: \"boolean\" },\n __TEST__: { type: \"boolean\" },\n __CDN_URL__: { type: \"string\" },\n __GRAPHQL_URL__: { type: \"string\" },\n __DEBUGGING__: { type: \"boolean\" },\n __SSR__: { type: \"boolean\" },\n __API_URL__: { type: \"string\" },\n __FRONTEND_BUILD_DIR__: { type: \"string\" },\n __WEB_DEV_SERVER_PORT__: { type: \"integer\" },\n __GRAPHQL_ENDPOINT__: { type: \"string\" },\n __LOCAL_SERVER_HOST__: { type: \"string\" },\n __BACKEND_URL__: { type: \"string\" }\n },\n },\n viteConfig: {\n type: \"object\",\n properties: {\n ssr: {\n type: \"object\",\n properties: {\n noExternal: {\n type: \"array\",\n items: { type: \"string\" }\n }\n },\n }\n },\n }\n },\n};\n\nexport default schema;\n"],"names":[],"mappings":"sEAAK,MAAC,MAAM,GAAG;AACf,EAAE,IAAI,EAAE,QAAQ;AAChB,EAAE,UA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AAQ,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACvC,QAAQ,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC3C,QAAQ,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;AAC1C,QAAQ,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;AACpC,QAAQ,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACvC,QAAQ,sBAAsB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAClD,QAAQ,uBAAuB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;AACpD,QAAQ,oBAAoB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAChD,QAAQ,qBAAqB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACjD,QAAQ,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC3C,OAAO;AACP,KAAK;AACL,IAAI,UAAU,EAAE;AAChB,MAAM,IAAI,EAAE,QAAQ;AACpB,MAAM,UAAU,EAAE;AAClB,QAAQ,GAAG,EAAE;AACb,UAAU,IAAI,EAAE,QAAQ;AACxB,UAAU,UAAU,EAAE;AACtB,YAAY,UAAU,EAAE;AACxB,cAAc,IAAI,EAAE,OAAO;AAC3B,cAAc,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACvC,aAAa;AACb,WAAW;AACX,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const schema = {
|
|
2
|
+
type: "object",
|
|
3
|
+
properties: {
|
|
4
|
+
commonPaths: { type: "object" },
|
|
5
|
+
copyOperations: {
|
|
6
|
+
type: "array",
|
|
7
|
+
items: {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
packageName: { type: "string" },
|
|
11
|
+
destPath: { type: "string" },
|
|
12
|
+
generateModule: { type: "boolean" }
|
|
13
|
+
},
|
|
14
|
+
required: ["packageName", "destPath", "generateModule"],
|
|
15
|
+
additionalProperties: false
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
i18n: {
|
|
19
|
+
type: "object",
|
|
20
|
+
properties: {
|
|
21
|
+
enabled: { type: "boolean" },
|
|
22
|
+
fallbackLng: { type: "string" },
|
|
23
|
+
supportedLngs: {
|
|
24
|
+
type: "array",
|
|
25
|
+
items: { type: "string" }
|
|
26
|
+
},
|
|
27
|
+
defaultNS: { type: "string" },
|
|
28
|
+
react: {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
useSuspense: { type: "boolean" }
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
backend: {
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: {
|
|
37
|
+
loadPath: { type: "string" },
|
|
38
|
+
loadServerPath: { type: "string" }
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
packages: {
|
|
42
|
+
type: "array",
|
|
43
|
+
items: { type: "string" }
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
modules: {
|
|
48
|
+
type: "array",
|
|
49
|
+
items: {
|
|
50
|
+
oneOf: [
|
|
51
|
+
{ type: "string" },
|
|
52
|
+
{
|
|
53
|
+
type: "array",
|
|
54
|
+
items: [
|
|
55
|
+
{ type: "string" },
|
|
56
|
+
{
|
|
57
|
+
type: "object",
|
|
58
|
+
properties: {
|
|
59
|
+
version: { type: "string" }
|
|
60
|
+
},
|
|
61
|
+
required: ["version"],
|
|
62
|
+
additionalProperties: false
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"minItems": 2,
|
|
66
|
+
"maxItems": 2,
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
paths: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
lifecycleMiddleware: { type: "string" }
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
buildConfig: {
|
|
78
|
+
type: "object",
|
|
79
|
+
properties: {
|
|
80
|
+
__CLIENT__: { type: "boolean" },
|
|
81
|
+
__SERVER__: { type: "boolean" },
|
|
82
|
+
__DEV__: { type: "boolean" },
|
|
83
|
+
__TEST__: { type: "boolean" },
|
|
84
|
+
__CDN_URL__: { type: "string" },
|
|
85
|
+
__GRAPHQL_URL__: { type: "string" },
|
|
86
|
+
__DEBUGGING__: { type: "boolean" },
|
|
87
|
+
__SSR__: { type: "boolean" },
|
|
88
|
+
__API_URL__: { type: "string" },
|
|
89
|
+
__FRONTEND_BUILD_DIR__: { type: "string" },
|
|
90
|
+
__WEB_DEV_SERVER_PORT__: { type: "integer" },
|
|
91
|
+
__GRAPHQL_ENDPOINT__: { type: "string" },
|
|
92
|
+
__LOCAL_SERVER_HOST__: { type: "string" },
|
|
93
|
+
__BACKEND_URL__: { type: "string" }
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
viteConfig: {
|
|
97
|
+
type: "object",
|
|
98
|
+
properties: {
|
|
99
|
+
ssr: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: {
|
|
102
|
+
noExternal: {
|
|
103
|
+
type: "array",
|
|
104
|
+
items: { type: "string" }
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
};export{schema as default};//# sourceMappingURL=config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.js","sources":["../src/config-schema.js"],"sourcesContent":["const schema = {\n type: \"object\",\n properties: {\n commonPaths: { type: \"object\" },\n copyOperations: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n packageName: { type: \"string\" },\n destPath: { type: \"string\" },\n generateModule: { type: \"boolean\" }\n },\n required: [\"packageName\", \"destPath\", \"generateModule\"],\n additionalProperties: false\n }\n },\n i18n: {\n type: \"object\",\n properties: {\n enabled: { type: \"boolean\" },\n fallbackLng: { type: \"string\" },\n supportedLngs: {\n type: \"array\",\n items: { type: \"string\" }\n },\n defaultNS: { type: \"string\" },\n react: {\n type: \"object\",\n properties: {\n useSuspense: { type: \"boolean\" }\n },\n },\n backend: {\n type: \"object\",\n properties: {\n loadPath: { type: \"string\" },\n loadServerPath: { type: \"string\" }\n },\n },\n packages: {\n type: \"array\",\n items: { type: \"string\" }\n }\n },\n },\n modules: {\n type: \"array\",\n items: {\n oneOf: [\n { type: \"string\" },\n {\n type: \"array\",\n items: [\n { type: \"string\" },\n {\n type: \"object\",\n properties: {\n version: { type: \"string\" }\n },\n required: [\"version\"],\n additionalProperties: false\n }\n ],\n \"minItems\": 2,\n \"maxItems\": 2,\n }\n ]\n }\n },\n paths: {\n type: \"object\",\n properties: {\n lifecycleMiddleware: { type: \"string\" }\n },\n },\n buildConfig: {\n type: \"object\",\n properties: {\n __CLIENT__: { type: \"boolean\" },\n __SERVER__: { type: \"boolean\" },\n __DEV__: { type: \"boolean\" },\n __TEST__: { type: \"boolean\" },\n __CDN_URL__: { type: \"string\" },\n __GRAPHQL_URL__: { type: \"string\" },\n __DEBUGGING__: { type: \"boolean\" },\n __SSR__: { type: \"boolean\" },\n __API_URL__: { type: \"string\" },\n __FRONTEND_BUILD_DIR__: { type: \"string\" },\n __WEB_DEV_SERVER_PORT__: { type: \"integer\" },\n __GRAPHQL_ENDPOINT__: { type: \"string\" },\n __LOCAL_SERVER_HOST__: { type: \"string\" },\n __BACKEND_URL__: { type: \"string\" }\n },\n },\n viteConfig: {\n type: \"object\",\n properties: {\n ssr: {\n type: \"object\",\n properties: {\n noExternal: {\n type: \"array\",\n items: { type: \"string\" }\n }\n },\n }\n },\n }\n },\n};\n\nexport default schema;\n"],"names":[],"mappings":"AAAK,MAAC,MAAM,GAAG;AACf,EAAE,IAAI,EAAE,QAAQ;AAChB,EAAE,UAAU,EAAE;AACd,IAAI,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAA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,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC3C,QAAQ,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;AAC1C,QAAQ,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;AACpC,QAAQ,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACvC,QAAQ,sBAAsB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAClD,QAAQ,uBAAuB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;AACpD,QAAQ,oBAAoB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAChD,QAAQ,qBAAqB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACjD,QAAQ,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC3C,OAAO;AACP,KAAK;AACL,IAAI,UAAU,EAAE;AAChB,MAAM,IAAI,EAAE,QAAQ;AACpB,MAAM,UAAU,EAAE;AAClB,QAAQ,GAAG,EAAE;AACb,UAAU,IAAI,EAAE,QAAQ;AACxB,UAAU,UAAU,EAAE;AACtB,YAAY,UAAU,EAAE;AACxB,cAAc,IAAI,EAAE,OAAO;AAC3B,cAAc,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACvC,aAAa;AACb,WAAW;AACX,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH"}
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var wrapperComponent=require('./vite-wrappers/wrapperComponent.cjs'),jsonWrappers=require('./vite-wrappers/json-wrappers.cjs'),rollupPluginGenerateJson=require('./rollup/rollupPluginGenerateJson.cjs'),rollupPluginModifyLibFiles=require('./rollup/rollupPluginModifyLibFiles.cjs'),rollupPluginAddJsExtension=require('./rollup/rollupPluginAddJsExtension.cjs'),pluginIgnore=require('./rollup/pluginIgnore.cjs'),copyIfVersionChanged=require('./preStartup/copyIfVersionChanged.cjs');require('./preStartup/configLoader/index.cjs');var i18nInternationalizationPlugin=require('./vite-plugins/i18n-internationalization-plugin.cjs'),vitePluginVirutalImports=require('./vite-plugins/vite-plugin-virutal-imports.cjs'),utils=require('./utils/utils.cjs'),withErrorHandleUtil=require('./utils/withErrorHandleUtil.cjs'),setupConfig=require('./utils/setupConfig.cjs'),configLoader=require('./preStartup/configLoader/configLoader.cjs'),envLoader=require('./preStartup/configLoader/envLoader.cjs');exports.getRootPath=wrapperComponent.getRootPath;exports.wrapRouteComponent=wrapperComponent.wrapRouteComponent;exports.defineRoutesConfig=jsonWrappers.defineRoutesConfig;exports.loadRoutesConfig=jsonWrappers.loadRoutesConfig;exports.resolvePathsUsingPackages=jsonWrappers.resolvePathsUsingPackages;exports.d=rollupPluginGenerateJson;exports.k=rollupPluginModifyLibFiles;exports.l=rollupPluginAddJsExtension;exports.m=pluginIgnore;exports.copyIfVersionChanged=copyIfVersionChanged.copyIfVersionChanged;exports.i18nInternationalizationPlugin=i18nInternationalizationPlugin.i18nInternationalizationPlugin;exports.virtualImportsPlugin=vitePluginVirutalImports.virtualImportsPlugin;exports.findPackageDir=utils.findPackageDir;exports.generateBackendModulesFile=utils.generateBackendModulesFile;exports.generateModulesFile=utils.generateModulesFile;exports.getMetadata=utils.getMetadata;exports.getPackageVersion=utils.getPackageVersion;exports.updateMetadata=utils.updateMetadata;exports.writeBackendModuleFile=utils.writeBackendModuleFile;exports.writeModuleFile=utils.writeModuleFile;exports.withErrorHandler=withErrorHandleUtil.withErrorHandler;exports.deepMerge=setupConfig.deepMerge;exports.setupConfig=setupConfig.setupConfig;exports.performCopyOperations=configLoader.performCopyOperations;exports.resolveConfigPaths=configLoader.resolveConfigPaths;exports.loadEnvConfig=envLoader.loadEnvConfig;//# sourceMappingURL=index.cjs.map
|
|
1
|
+
'use strict';var wrapperComponent=require('./vite-wrappers/wrapperComponent.cjs'),jsonWrappers=require('./vite-wrappers/json-wrappers.cjs'),rollupPluginGenerateJson=require('./rollup/rollupPluginGenerateJson.cjs'),rollupPluginModifyLibFiles=require('./rollup/rollupPluginModifyLibFiles.cjs'),rollupPluginAddJsExtension=require('./rollup/rollupPluginAddJsExtension.cjs'),pluginIgnore=require('./rollup/pluginIgnore.cjs'),rollupPluginUpdateFromConfig=require('./rollup/rollupPluginUpdateFromConfig.cjs'),copyIfVersionChanged=require('./preStartup/copyIfVersionChanged.cjs');require('./preStartup/configLoader/index.cjs');var i18nInternationalizationPlugin=require('./vite-plugins/i18n-internationalization-plugin.cjs'),vitePluginVirutalImports=require('./vite-plugins/vite-plugin-virutal-imports.cjs'),utils=require('./utils/utils.cjs'),withErrorHandleUtil=require('./utils/withErrorHandleUtil.cjs'),setupConfig=require('./utils/setupConfig.cjs'),verifyConfig=require('./utils/verifyConfig.cjs'),configLoader=require('./preStartup/configLoader/configLoader.cjs'),envLoader=require('./preStartup/configLoader/envLoader.cjs');exports.getRootPath=wrapperComponent.getRootPath;exports.wrapRouteComponent=wrapperComponent.wrapRouteComponent;exports.defineRoutesConfig=jsonWrappers.defineRoutesConfig;exports.loadRoutesConfig=jsonWrappers.loadRoutesConfig;exports.resolvePathsUsingPackages=jsonWrappers.resolvePathsUsingPackages;exports.d=rollupPluginGenerateJson;exports.k=rollupPluginModifyLibFiles;exports.l=rollupPluginAddJsExtension;exports.m=pluginIgnore;exports.updateFromConfig=rollupPluginUpdateFromConfig.updateFromConfig;exports.copyIfVersionChanged=copyIfVersionChanged.copyIfVersionChanged;exports.i18nInternationalizationPlugin=i18nInternationalizationPlugin.i18nInternationalizationPlugin;exports.virtualImportsPlugin=vitePluginVirutalImports.virtualImportsPlugin;exports.findPackageDir=utils.findPackageDir;exports.generateBackendModulesFile=utils.generateBackendModulesFile;exports.generateModulesFile=utils.generateModulesFile;exports.getMetadata=utils.getMetadata;exports.getPackageVersion=utils.getPackageVersion;exports.updateMetadata=utils.updateMetadata;exports.writeBackendModuleFile=utils.writeBackendModuleFile;exports.writeModuleFile=utils.writeModuleFile;exports.withErrorHandler=withErrorHandleUtil.withErrorHandler;exports.deepMerge=setupConfig.deepMerge;exports.setupConfig=setupConfig.setupConfig;exports.verifyConfigSchema=verifyConfig.verifyConfigSchema;exports.performCopyOperations=configLoader.performCopyOperations;exports.resolveConfigPaths=configLoader.resolveConfigPaths;exports.loadEnvConfig=envLoader.loadEnvConfig;//# sourceMappingURL=index.cjs.map
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{getRootPath,wrapRouteComponent}from'./vite-wrappers/wrapperComponent.js';export{defineRoutesConfig,loadRoutesConfig,resolvePathsUsingPackages}from'./vite-wrappers/json-wrappers.js';import*as rollupPluginGenerateJson from'./rollup/rollupPluginGenerateJson.js';export{rollupPluginGenerateJson as d };import*as rollupPluginModifyLibFiles from'./rollup/rollupPluginModifyLibFiles.js';export{rollupPluginModifyLibFiles as k };import*as rollupPluginAddJsExtension from'./rollup/rollupPluginAddJsExtension.js';export{rollupPluginAddJsExtension as l };import*as pluginIgnore from'./rollup/pluginIgnore.js';export{pluginIgnore as m };export{copyIfVersionChanged}from'./preStartup/copyIfVersionChanged.js';import'./preStartup/configLoader/index.js';export{i18nInternationalizationPlugin}from'./vite-plugins/i18n-internationalization-plugin.js';export{virtualImportsPlugin}from'./vite-plugins/vite-plugin-virutal-imports.js';export{findPackageDir,generateBackendModulesFile,generateModulesFile,getMetadata,getPackageVersion,updateMetadata,writeBackendModuleFile,writeModuleFile}from'./utils/utils.js';export{withErrorHandler}from'./utils/withErrorHandleUtil.js';export{deepMerge,setupConfig}from'./utils/setupConfig.js';export{performCopyOperations,resolveConfigPaths}from'./preStartup/configLoader/configLoader.js';export{loadEnvConfig}from'./preStartup/configLoader/envLoader.js';//# sourceMappingURL=index.js.map
|
|
1
|
+
export{getRootPath,wrapRouteComponent}from'./vite-wrappers/wrapperComponent.js';export{defineRoutesConfig,loadRoutesConfig,resolvePathsUsingPackages}from'./vite-wrappers/json-wrappers.js';import*as rollupPluginGenerateJson from'./rollup/rollupPluginGenerateJson.js';export{rollupPluginGenerateJson as d };import*as rollupPluginModifyLibFiles from'./rollup/rollupPluginModifyLibFiles.js';export{rollupPluginModifyLibFiles as k };import*as rollupPluginAddJsExtension from'./rollup/rollupPluginAddJsExtension.js';export{rollupPluginAddJsExtension as l };import*as pluginIgnore from'./rollup/pluginIgnore.js';export{pluginIgnore as m };export{updateFromConfig}from'./rollup/rollupPluginUpdateFromConfig.js';export{copyIfVersionChanged}from'./preStartup/copyIfVersionChanged.js';import'./preStartup/configLoader/index.js';export{i18nInternationalizationPlugin}from'./vite-plugins/i18n-internationalization-plugin.js';export{virtualImportsPlugin}from'./vite-plugins/vite-plugin-virutal-imports.js';export{findPackageDir,generateBackendModulesFile,generateModulesFile,getMetadata,getPackageVersion,updateMetadata,writeBackendModuleFile,writeModuleFile}from'./utils/utils.js';export{withErrorHandler}from'./utils/withErrorHandleUtil.js';export{deepMerge,setupConfig}from'./utils/setupConfig.js';export{verifyConfigSchema}from'./utils/verifyConfig.js';export{performCopyOperations,resolveConfigPaths}from'./preStartup/configLoader/configLoader.js';export{loadEnvConfig}from'./preStartup/configLoader/envLoader.js';//# sourceMappingURL=index.js.map
|
|
@@ -10,6 +10,7 @@ export interface IOptions {
|
|
|
10
10
|
hasClientLoader: boolean;
|
|
11
11
|
hasComponent: boolean;
|
|
12
12
|
hasErrorBoundary: boolean;
|
|
13
|
+
hasServerCode: boolean;
|
|
13
14
|
hasLinks: boolean;
|
|
14
15
|
hasMeta: boolean;
|
|
15
16
|
hasHydrateFallback: boolean;
|
|
@@ -32,6 +33,8 @@ export interface IOptions {
|
|
|
32
33
|
resourceUri: string;
|
|
33
34
|
settings: ISettings;
|
|
34
35
|
paths: IPaths;
|
|
36
|
+
extraIcons?: any[];
|
|
37
|
+
extraLink?: any[];
|
|
35
38
|
}
|
|
36
39
|
export interface ISettings {
|
|
37
40
|
disableLoader?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var node=require('@remix-run/node');require('fs-extra'),require('path'),require('semver'),require('dotenv-esm');node.installGlobals();//# sourceMappingURL=index.cjs.map
|
|
1
|
+
'use strict';var node=require('@remix-run/node');require('fs-extra'),require('path'),require('semver'),require('ajv'),require('dotenv-esm');node.installGlobals();//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/preStartup/configLoader/index.ts"],"sourcesContent":[null],"names":["installGlobals"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/preStartup/configLoader/index.ts"],"sourcesContent":[null],"names":["installGlobals"],"mappings":"4IAKAA,mBAAc,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {installGlobals}from'@remix-run/node';import'fs-extra';import'path';import'semver';import'dotenv-esm';installGlobals();//# sourceMappingURL=index.js.map
|
|
1
|
+
import {installGlobals}from'@remix-run/node';import'fs-extra';import'path';import'semver';import'ajv';import'dotenv-esm';installGlobals();//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/preStartup/configLoader/index.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/preStartup/configLoader/index.ts"],"sourcesContent":[null],"names":[],"mappings":"yHAKA,cAAc,EAAE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var fs=require('fs-extra'),path=require('path'),semver=require('semver'),utils=require('../utils/utils.cjs')
|
|
1
|
+
'use strict';var fs=require('fs-extra'),path=require('path'),semver=require('semver'),utils=require('../utils/utils.cjs');require('ajv');var constants=require('../constants/constants.cjs');/**
|
|
2
2
|
* Copy the contents from srcDir to destDir if the version in srcDir is different from destDir.
|
|
3
3
|
* Also update modules.js based on modules.json if required.
|
|
4
4
|
* @param packageName - The name of the package.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyIfVersionChanged.cjs","sources":["../../src/preStartup/copyIfVersionChanged.ts"],"sourcesContent":[null],"names":["findPackageDir","getPackageVersion","getMetadata","updateMetadata","writeModuleFile","MODULES_JS"],"mappings":"
|
|
1
|
+
{"version":3,"file":"copyIfVersionChanged.cjs","sources":["../../src/preStartup/copyIfVersionChanged.ts"],"sourcesContent":[null],"names":["findPackageDir","getPackageVersion","getMetadata","updateMetadata","writeModuleFile","MODULES_JS"],"mappings":"6LAMA;;;;;;;;AAQG;AACI,eAAe,oBAAoB,CACtC,WAAmB,EACnB,cAAsB,EACtB,eAAuB,EACvB,aAAyB,GAAA,KAAK,EAC9B,UAAsB,GAAA,KAAK,EAC3B,cAA2B,GAAA,EAAE,EAC7B,qBAAA,GAA4B,EAAE,EAAA;AAE9B,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,MAAM,aAAa,GAAGA,oBAAc,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAE9D,IAAI,CAAC,aAAa,EAAE;AAChB,QAAA,OAAO,CAAC,KAAK,CAAC,wCAAwC,WAAW,CAAA,CAAE,CAAC,CAAC;QACrE,OAAO;KACV;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAC/C,IAAA,MAAM,UAAU,GAAG,MAAMC,uBAAiB,CAAC,aAAa,CAAC,CAAC;AAC1D,IAAA,MAAM,QAAQ,GAAG,MAAMC,iBAAW,CAAC,MAAM,CAAC,CAAC;AAC3C,IAAA,MAAM,cAAc,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AAE7C,IAAA,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,I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qBACxC;AACJ,iBAAA,CAAC,CAAC;gBACH,OAAO,CAAC,GAAG,CAAC,CAAA,OAAA,EAAU,WAAW,CAAO,IAAA,EAAA,OAAO,CAAkD,gDAAA,CAAA,CAAC,CAAC;aACtG;YAED,QAAQ,CAAC,WAAW,CAAC,GAAG;gBACpB,aAAa;AACb,gBAAA,OAAO,EAAE,UAAU;AACnB,gBAAA,UAAU,EAAE,OAAO;AACnB,gBAAA,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACtC,CAAC;AAEF,YAAA,MAAMC,oBAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;SAE1C;QAAC,OAAO,GAAG,EAAE;AACV,YAAA,OAAO,CAAC,KAAK,CAAC,CAAS,MAAA,EAAA,UAAU,GAAG,kBAAkB,GAAG,mBAAmB,GAAG,EAAE,GAAG,CAAC,CAAC;SACzF;KACJ;SAAM;AACH,QAAA,OAAO,CAAC,GAAG,CAAC,CAAmB,gBAAA,EAAA,WAAW,sBAAsB,UAAU,GAAG,SAAS,GAAG,SAAS,CAAA,QAAA,CAAU,CAAC,CAAC;KACjH;;IAGD,IAAI,aAAa,EAAE;AACf,QAAA,IAAI;AACA,YAAAC,qBAAe,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AACzC,YAAA,OAAO,CAAC,GAAG,CAAC,CAAA,QAAA,EAAW,IAAI,CAAC,IAAI,CAAC,OAAO,EAAEC,oBAAU,CAAC,CAAA,sBAAA,CAAwB,CAAC,CAAC;SAClF;QAAC,OAAO,GAAG,EAAE;AACV,YAAA,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;SACpD;KACJ;AACL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fs from'fs-extra';import path__default from'path';import semver from'semver';import {findPackageDir,getPackageVersion,getMetadata,updateMetadata,writeModuleFile}from'../utils/utils.js';import {MODULES_JS}from'../constants/constants.js';/**
|
|
1
|
+
import fs from'fs-extra';import path__default from'path';import semver from'semver';import {findPackageDir,getPackageVersion,getMetadata,updateMetadata,writeModuleFile}from'../utils/utils.js';import'ajv';import {MODULES_JS}from'../constants/constants.js';/**
|
|
2
2
|
* Copy the contents from srcDir to destDir if the version in srcDir is different from destDir.
|
|
3
3
|
* Also update modules.js based on modules.json if required.
|
|
4
4
|
* @param packageName - The name of the package.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyIfVersionChanged.js","sources":["../../src/preStartup/copyIfVersionChanged.ts"],"sourcesContent":[null],"names":["path"],"mappings":"
|
|
1
|
+
{"version":3,"file":"copyIfVersionChanged.js","sources":["../../src/preStartup/copyIfVersionChanged.ts"],"sourcesContent":[null],"names":["path"],"mappings":"+PAMA;;;;;;;;AAQG;AACI,eAAe,oBAAoB,CACtC,WAAmB,EACnB,cAAsB,EACtB,eAAuB,EACvB,aAAyB,GAAA,KAAK,EAC9B,UAAsB,GAAA,KAAK,EAC3B,cAA2B,GAAA,EAAE,EAC7B,qBAAA,GAA4B,EAAE,EAAA;AAE9B,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,MAAM,aAAa,GAAG,cAAc,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAE9D,IAAI,CAAC,aAAa,EAAE;AAChB,QAAA,OAAO,CAAC,KAAK,CAAC,wCAAwC,WAAW,CAAA,CAAE,CAAC,CAAC;QACrE,OAAO;KACV;IAED,MAAM,MAAM,GAAGA,aAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACxD,MAAM,OAAO,GAAGA,aAAI,CAAC,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACtD,MAAM,MAAM,GAAGA,aAAI,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAC/C,IAAA,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAC1D,IAAA,MAAM,QAAQ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SACpD;KACJ;AACL"}
|
package/lib/rollup/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
'use strict';var fs=require('fs'),path=require('path'),parser=require('@babel/parser'),traverseSource=require('@babel/traverse'),generateSource=require('@babel/generator'),t=require('@babel/types'),
|
|
2
|
-
//
|
|
3
|
-
// https://github.com/babel/babel/issues/15269#issuecomment-1505804243
|
|
1
|
+
'use strict';var fs=require('fs'),path=require('path'),parser=require('@babel/parser'),traverseSource=require('@babel/traverse'),generateSource=require('@babel/generator'),t=require('@babel/types'),extractGraphQLQueries=require('./extractGraphQLQueries.cjs'),utils=require('./utils.cjs');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var t__namespace=/*#__PURE__*/_interopNamespaceDefault(t);/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
// Support esm default
|
|
4
3
|
const traverse = traverseSource.default ?? traverseSource;
|
|
5
4
|
const generate = generateSource.default ?? generateSource;
|
|
6
|
-
util.promisify(glob);
|
|
7
5
|
const RouteModule = {
|
|
8
6
|
action: 'action',
|
|
9
7
|
hasAction: 'hasAction',
|
|
@@ -17,7 +15,7 @@ const RouteModule = {
|
|
|
17
15
|
hasErrorBoundary: 'hasErrorBoundary',
|
|
18
16
|
handle: 'handle',
|
|
19
17
|
hasHandle: 'hasHandle',
|
|
20
|
-
queryParamsGenerator:
|
|
18
|
+
queryParamsGenerator: 'queryParamsGenerator',
|
|
21
19
|
headers: 'headers',
|
|
22
20
|
hasHeaders: 'hasHeaders',
|
|
23
21
|
HydrateFallback: 'HydrateFallback',
|
|
@@ -31,17 +29,31 @@ const RouteModule = {
|
|
|
31
29
|
shouldRevalidate: 'shouldRevalidate',
|
|
32
30
|
hasShouldRevalidate: 'hasShouldRevalidate',
|
|
33
31
|
};
|
|
34
|
-
function parseFileToAST(filePath, plugins) {
|
|
32
|
+
function parseFileToAST(filePath, plugins = ['typescript', 'jsx']) {
|
|
33
|
+
if (!fs.existsSync(filePath))
|
|
34
|
+
return null;
|
|
35
35
|
const fileContent = fs.readFileSync(filePath, 'utf8');
|
|
36
36
|
return parser.parse(fileContent, {
|
|
37
37
|
sourceType: 'module',
|
|
38
38
|
plugins,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Writes the modified AST back to the file.
|
|
43
|
+
*
|
|
44
|
+
* @param filePath - The full path of the file to write the AST.
|
|
45
|
+
* @param ast - The modified AST.
|
|
46
|
+
*/
|
|
47
|
+
function writeModifiedASTToFile(filePath, ast) {
|
|
48
|
+
const output = generate(ast, {}, '');
|
|
43
49
|
fs.writeFileSync(filePath, output.code);
|
|
44
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves the name of a function from the AST node.
|
|
53
|
+
*
|
|
54
|
+
* @param path - The NodePath of a function declaration or expression.
|
|
55
|
+
* @returns Name of the function if available, otherwise null.
|
|
56
|
+
*/
|
|
45
57
|
function getFunctionName(path) {
|
|
46
58
|
if (path.isFunctionDeclaration() || path.isFunctionExpression()) {
|
|
47
59
|
return path.node.id ? path.node.id.name : null;
|
|
@@ -51,10 +63,20 @@ function getFunctionName(path) {
|
|
|
51
63
|
}
|
|
52
64
|
return null;
|
|
53
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Simplifies and modifies the return statement of a loader function.
|
|
68
|
+
*
|
|
69
|
+
* @param returnPath - NodePath of the return statement in the AST.
|
|
70
|
+
* @param returnInfo - Object that holds information about the modified return structure.
|
|
71
|
+
* @returns True if the return statement was modified, otherwise false.
|
|
72
|
+
*/
|
|
54
73
|
function simplifyReturnStatement(returnPath, returnInfo) {
|
|
55
74
|
const { argument } = returnPath.node;
|
|
56
|
-
if (argument &&
|
|
57
|
-
argument.type === '
|
|
75
|
+
if (argument &&
|
|
76
|
+
((argument.type === 'CallExpression' &&
|
|
77
|
+
argument.callee.type === 'Identifier' &&
|
|
78
|
+
(argument.callee.name === 'defer' || argument.callee.name === 'json')) ||
|
|
79
|
+
argument.type === 'ObjectExpression')) {
|
|
58
80
|
const args = argument.type === 'CallExpression' ? argument.arguments : [argument];
|
|
59
81
|
if (args.length > 0 && args[0].type === 'ObjectExpression' && args[0].properties.length > 0) {
|
|
60
82
|
const { properties } = args[0];
|
|
@@ -73,26 +95,32 @@ function simplifyReturnStatement(returnPath, returnInfo) {
|
|
|
73
95
|
returnInfo.keys.push(key.name);
|
|
74
96
|
}
|
|
75
97
|
});
|
|
76
|
-
const objectProperties = [
|
|
77
|
-
t__namespace.objectProperty(t__namespace.identifier('data'), t__namespace.arrayExpression(valuesArray)),
|
|
78
|
-
];
|
|
98
|
+
const objectProperties = [t__namespace.objectProperty(t__namespace.identifier('data'), t__namespace.arrayExpression(valuesArray))];
|
|
79
99
|
if (args.length > 1 && args[1].type === 'ObjectExpression') {
|
|
80
100
|
returnInfo.hasOptions = true;
|
|
81
101
|
objectProperties.push(t__namespace.objectProperty(t__namespace.identifier('options'), args[1]));
|
|
82
102
|
}
|
|
83
103
|
returnPath.node.argument = t__namespace.objectExpression(objectProperties);
|
|
84
|
-
returnInfo.returnType =
|
|
85
|
-
? argument.callee.name
|
|
86
|
-
: 'json';
|
|
104
|
+
returnInfo.returnType =
|
|
105
|
+
argument.type === 'CallExpression' && t__namespace.isIdentifier(argument.callee) ? argument.callee.name : 'json';
|
|
87
106
|
return true;
|
|
88
107
|
}
|
|
89
108
|
}
|
|
90
109
|
return false;
|
|
91
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Modifies the return structure of a loader or action function by processing its AST.
|
|
113
|
+
*
|
|
114
|
+
* @param filePath - The full path of the loader function file to modify.
|
|
115
|
+
* @param loaderName - The name of the loader function.
|
|
116
|
+
* @returns Information about the return structure of the loader function.
|
|
117
|
+
*/
|
|
92
118
|
function modifyReturn(filePath, loaderName) {
|
|
93
119
|
const ast = parseFileToAST(filePath, ['typescript', 'jsx']);
|
|
94
120
|
const returnInfo = { returnType: '', keys: [], hasOptions: false };
|
|
95
121
|
let modified = false;
|
|
122
|
+
if (!ast)
|
|
123
|
+
return returnInfo;
|
|
96
124
|
traverse(ast, {
|
|
97
125
|
'FunctionDeclaration|ArrowFunctionExpression|FunctionExpression': function (path) {
|
|
98
126
|
const functionName = getFunctionName(path);
|
|
@@ -108,10 +136,29 @@ function modifyReturn(filePath, loaderName) {
|
|
|
108
136
|
},
|
|
109
137
|
});
|
|
110
138
|
if (modified) {
|
|
111
|
-
writeModifiedASTToFile(filePath, ast
|
|
139
|
+
writeModifiedASTToFile(filePath, ast);
|
|
112
140
|
}
|
|
113
141
|
return returnInfo;
|
|
114
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Extracts the loader information and queries from a given component or loader file.
|
|
145
|
+
*
|
|
146
|
+
* @param fullPath - The full path of the component or loader file.
|
|
147
|
+
* @returns Object containing the loader information, return structure, and GraphQL queries.
|
|
148
|
+
*/
|
|
149
|
+
function extractLoaderInfoFromFile(fullPath) {
|
|
150
|
+
const ast = parseFileToAST(fullPath);
|
|
151
|
+
if (!ast)
|
|
152
|
+
return { loaderInfo: {}, returnInfo: {}, queries: {} };
|
|
153
|
+
return extractLoaderInfo(ast, fullPath);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Extracts the loader, action, and metadata information from an AST.
|
|
157
|
+
*
|
|
158
|
+
* @param importedAst - The AST of the imported file (loader or component).
|
|
159
|
+
* @param fullPath - The full path of the file being processed.
|
|
160
|
+
* @returns Object containing loader information, return information, and queries.
|
|
161
|
+
*/
|
|
115
162
|
function extractLoaderInfo(importedAst, fullPath) {
|
|
116
163
|
const loaderInfo = {
|
|
117
164
|
hasLoader: false,
|
|
@@ -136,9 +183,6 @@ function extractLoaderInfo(importedAst, fullPath) {
|
|
|
136
183
|
const loaderSourcePath = namedPath.node.source.value;
|
|
137
184
|
fullPath = path.resolve(path.dirname(fullPath), loaderSourcePath);
|
|
138
185
|
}
|
|
139
|
-
else {
|
|
140
|
-
fullPath = fullPath;
|
|
141
|
-
}
|
|
142
186
|
namedPath.node.specifiers.forEach((specifier) => {
|
|
143
187
|
if (t__namespace.isExportSpecifier(specifier) && t__namespace.isIdentifier(specifier.exported)) {
|
|
144
188
|
switch (specifier.exported.name) {
|
|
@@ -190,10 +234,49 @@ function extractLoaderInfo(importedAst, fullPath) {
|
|
|
190
234
|
});
|
|
191
235
|
return { loaderInfo, returnInfo, queries };
|
|
192
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Updates the metadata of the parent object in the AST with loader information, return data, and queries.
|
|
239
|
+
*
|
|
240
|
+
* @param parentObject - The AST node representing the parent object (e.g., component metadata).
|
|
241
|
+
* @param loaderInfo - Object containing loader-related information.
|
|
242
|
+
* @param returnInfo - Object containing return-related information.
|
|
243
|
+
* @param queries - Object containing GraphQL queries.
|
|
244
|
+
*/
|
|
245
|
+
function updateParentMetadata(parentObject, loaderInfo, returnInfo, queries) {
|
|
246
|
+
// Add metadata for loaders, actions, and other module-related flags (only if true)
|
|
247
|
+
Object.keys(loaderInfo).forEach((key) => {
|
|
248
|
+
if (loaderInfo[key]) {
|
|
249
|
+
parentObject.properties.push(t__namespace.objectProperty(t__namespace.identifier(RouteModule[key]), t__namespace.booleanLiteral(loaderInfo[key])));
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
// Add return information if available
|
|
253
|
+
if (returnInfo.keys.length > 0) {
|
|
254
|
+
const returnInfoObject = t__namespace.objectExpression([
|
|
255
|
+
t__namespace.objectProperty(t__namespace.identifier('returnType'), t__namespace.stringLiteral(returnInfo.returnType)),
|
|
256
|
+
t__namespace.objectProperty(t__namespace.identifier('hasOptions'), t__namespace.booleanLiteral(returnInfo.hasOptions)),
|
|
257
|
+
t__namespace.objectProperty(t__namespace.identifier('keys'), t__namespace.arrayExpression(returnInfo.keys.map((key) => t__namespace.stringLiteral(key)))),
|
|
258
|
+
]);
|
|
259
|
+
parentObject.properties.push(t__namespace.objectProperty(t__namespace.identifier('loaderReturnInfo'), returnInfoObject));
|
|
260
|
+
}
|
|
261
|
+
// Add GraphQL queries if available
|
|
262
|
+
if (Object.keys(queries).length > 0) {
|
|
263
|
+
parentObject.properties.push(t__namespace.objectProperty(t__namespace.identifier('queries'), t__namespace.objectExpression(Object.entries(queries).map(([key, value]) => t__namespace.objectProperty(t__namespace.identifier(key), t__namespace.stringLiteral(value ?? '{}'))))));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Handles component or dialog files, extracting metadata and updating parent objects.
|
|
268
|
+
*
|
|
269
|
+
* @param astroPath - The NodePath to the AST node representing the component or dialog property.
|
|
270
|
+
* @param filePath - The file path of the component or dialog.
|
|
271
|
+
* @param dist - The distribution folder where the files reside.
|
|
272
|
+
* @returns True if the file was successfully handled, otherwise false.
|
|
273
|
+
*/
|
|
193
274
|
function handleComponentOrDialog(astroPath, filePath, dist) {
|
|
194
275
|
const importDeclaration = astroPath.node.value;
|
|
195
276
|
const propName = astroPath.node.key.name;
|
|
196
|
-
if (t__namespace.isArrowFunctionExpression(importDeclaration) &&
|
|
277
|
+
if (t__namespace.isArrowFunctionExpression(importDeclaration) &&
|
|
278
|
+
t__namespace.isCallExpression(importDeclaration.body) &&
|
|
279
|
+
t__namespace.isImport(importDeclaration.body.callee)) {
|
|
197
280
|
const importArg = importDeclaration.body.arguments[0];
|
|
198
281
|
if (t__namespace.isStringLiteral(importArg)) {
|
|
199
282
|
const importPath = importArg.value;
|
|
@@ -203,32 +286,20 @@ function handleComponentOrDialog(astroPath, filePath, dist) {
|
|
|
203
286
|
if (parentObject && t__namespace.isObjectExpression(parentObject.node)) {
|
|
204
287
|
astroPath.remove();
|
|
205
288
|
parentObject.node.properties.push(fileProperty);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
if (returnInfo.keys.length > 0) {
|
|
220
|
-
const returnInfoObject = t__namespace.objectExpression([
|
|
221
|
-
t__namespace.objectProperty(t__namespace.identifier('returnType'), t__namespace.stringLiteral(returnInfo.returnType)),
|
|
222
|
-
t__namespace.objectProperty(t__namespace.identifier('hasOptions'), t__namespace.booleanLiteral(returnInfo.hasOptions)),
|
|
223
|
-
t__namespace.objectProperty(t__namespace.identifier('keys'), t__namespace.arrayExpression(returnInfo.keys.map((key) => t__namespace.stringLiteral(key)))),
|
|
224
|
-
]);
|
|
225
|
-
parentObject.node.properties.push(t__namespace.objectProperty(t__namespace.identifier('loaderReturnInfo'), returnInfoObject));
|
|
226
|
-
}
|
|
227
|
-
if (queries) {
|
|
228
|
-
parentObject.node.properties.push(t__namespace.objectProperty(t__namespace.identifier('queries'), t__namespace.objectExpression(Object.entries(queries).map(([key, value]) => t__namespace.objectProperty(t__namespace.identifier(key), t__namespace.stringLiteral(value ?? '{}'))))));
|
|
229
|
-
}
|
|
230
|
-
return true;
|
|
289
|
+
// Check for hasServerCode property
|
|
290
|
+
const hasServerCodeProp = parentObject.node.properties.find((prop) => t__namespace.isObjectProperty(prop) && t__namespace.isIdentifier(prop.key, { name: 'hasServerCode' }));
|
|
291
|
+
const hasServerCode = hasServerCodeProp && t__namespace.isBooleanLiteral(hasServerCodeProp.value, { value: true });
|
|
292
|
+
const { loaderInfo, returnInfo, queries } = extractLoaderInfoFromFile(path.resolve(path.dirname(filePath), importPath));
|
|
293
|
+
// Update parent metadata with client-side info
|
|
294
|
+
updateParentMetadata(parentObject.node, loaderInfo, returnInfo, queries);
|
|
295
|
+
// If hasServerCode is true, process .server.js files
|
|
296
|
+
if (hasServerCode) {
|
|
297
|
+
const serverFilePath = path.resolve(path.dirname(filePath), importPath.replace(/\.js$/, '.server.js'));
|
|
298
|
+
const { loaderInfo: serverLoaderInfo, returnInfo: serverReturnInfo } = extractLoaderInfoFromFile(serverFilePath);
|
|
299
|
+
// Update parent metadata with server-side info
|
|
300
|
+
updateParentMetadata(parentObject.node, serverLoaderInfo, serverReturnInfo, {});
|
|
231
301
|
}
|
|
302
|
+
return true;
|
|
232
303
|
}
|
|
233
304
|
}
|
|
234
305
|
}
|