@modern-js/app-tools 2.34.0 → 2.34.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/modern.js +1 -1
- package/dist/cjs/analyze/constants.js +1 -0
- package/dist/cjs/analyze/nestedRoutes.js +9 -0
- package/dist/esm/analyze/constants.js +1 -0
- package/dist/esm/analyze/nestedRoutes.js +10 -1
- package/dist/esm-node/analyze/constants.js +1 -0
- package/dist/esm-node/analyze/nestedRoutes.js +9 -0
- package/dist/types/analyze/constants.d.ts +1 -0
- package/dist/types/analyze/generateCode.d.ts +3 -2
- package/package.json +10 -10
package/bin/modern.js
CHANGED
@@ -11,5 +11,5 @@ require('@modern-js/core/runBin').run({
|
|
11
11
|
server: INTERNAL_SERVER_PLUGINS,
|
12
12
|
autoLoad: INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
|
13
13
|
},
|
14
|
-
initialLog:
|
14
|
+
initialLog: `Modern.js Framework v${require('../package.json').version}`,
|
15
15
|
});
|
@@ -116,6 +116,7 @@ const NESTED_ROUTE = {
|
|
116
116
|
PAGE_DATA_FILE: "page.data",
|
117
117
|
PAGE_CLIENT_LOADER: "page.data.client",
|
118
118
|
SPLATE_FILE: "$",
|
119
|
+
SPLATE_CONFIG_FILE: "$.config",
|
119
120
|
SPLATE_LOADER_FILE: "$.loader",
|
120
121
|
SPLATE_DATA_FILE: "$.data",
|
121
122
|
SPLATE_CLIENT_DATA: "$.data.client",
|
@@ -124,6 +124,7 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
124
124
|
let splatData = "";
|
125
125
|
let splatRoute = null;
|
126
126
|
let pageConfigFile = "";
|
127
|
+
let splatConfigFile = "";
|
127
128
|
const items = await _utils.fs.readdir(dirname);
|
128
129
|
for (const item of items) {
|
129
130
|
const itemPath = _path.join(dirname, item);
|
@@ -190,6 +191,11 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
190
191
|
if (itemWithoutExt === _constants.NESTED_ROUTE.SPLATE_CLIENT_DATA) {
|
191
192
|
splatClientData = itemPath;
|
192
193
|
}
|
194
|
+
if (itemWithoutExt === _constants.NESTED_ROUTE.SPLATE_CONFIG_FILE) {
|
195
|
+
if (!route.config) {
|
196
|
+
splatConfigFile = itemPath;
|
197
|
+
}
|
198
|
+
}
|
193
199
|
if (itemWithoutExt === _constants.NESTED_ROUTE.SPLATE_DATA_FILE) {
|
194
200
|
splatData = itemPath;
|
195
201
|
}
|
@@ -208,6 +214,9 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
208
214
|
if (splatData) {
|
209
215
|
splatRoute.data = splatData;
|
210
216
|
}
|
217
|
+
if (splatConfigFile) {
|
218
|
+
splatRoute.config = splatConfigFile;
|
219
|
+
}
|
211
220
|
(_route_children2 = route.children) === null || _route_children2 === void 0 ? void 0 : _route_children2.push(splatRoute);
|
212
221
|
}
|
213
222
|
if (itemWithoutExt === _constants.NESTED_ROUTE.LOADING_FILE) {
|
@@ -37,6 +37,7 @@ export var NESTED_ROUTE = {
|
|
37
37
|
PAGE_DATA_FILE: "page.data",
|
38
38
|
PAGE_CLIENT_LOADER: "page.data.client",
|
39
39
|
SPLATE_FILE: "$",
|
40
|
+
SPLATE_CONFIG_FILE: "$.config",
|
40
41
|
SPLATE_LOADER_FILE: "$.loader",
|
41
42
|
SPLATE_DATA_FILE: "$.data",
|
42
43
|
SPLATE_CLIENT_DATA: "$.data.client",
|
@@ -73,7 +73,7 @@ export var optimizeRoute = function(routeTree) {
|
|
73
73
|
};
|
74
74
|
export var walk = function() {
|
75
75
|
var _ref = _async_to_generator(function(dirname, rootDir, alias, entryName, isMainEntry, oldVersion) {
|
76
|
-
var _routePath, _finalRoute_children, isDirectory, relativeDir, pathSegments, lastSegment, isRoot, isPathlessLayout, isWithoutLayoutPath, routePath, route, pageLoaderFile, pageRoute, splatLoaderFile, splatClientData, splatData, splatRoute, pageConfigFile, items, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, itemPath, extname, itemWithoutExt, isDirectory1, childRoute, _route_children, _route_children1, _route_children2, err, finalRoute, childRoutes, childRoute1, _$path, optimizedRoutes;
|
76
|
+
var _routePath, _finalRoute_children, isDirectory, relativeDir, pathSegments, lastSegment, isRoot, isPathlessLayout, isWithoutLayoutPath, routePath, route, pageLoaderFile, pageRoute, splatLoaderFile, splatClientData, splatData, splatRoute, pageConfigFile, splatConfigFile, items, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, itemPath, extname, itemWithoutExt, isDirectory1, childRoute, _route_children, _route_children1, _route_children2, err, finalRoute, childRoutes, childRoute1, _$path, optimizedRoutes;
|
77
77
|
return _ts_generator(this, function(_state) {
|
78
78
|
switch (_state.label) {
|
79
79
|
case 0:
|
@@ -123,6 +123,7 @@ export var walk = function() {
|
|
123
123
|
splatData = "";
|
124
124
|
splatRoute = null;
|
125
125
|
pageConfigFile = "";
|
126
|
+
splatConfigFile = "";
|
126
127
|
return [
|
127
128
|
4,
|
128
129
|
fs.readdir(dirname)
|
@@ -229,6 +230,11 @@ export var walk = function() {
|
|
229
230
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_CLIENT_DATA) {
|
230
231
|
splatClientData = itemPath;
|
231
232
|
}
|
233
|
+
if (itemWithoutExt === NESTED_ROUTE.SPLATE_CONFIG_FILE) {
|
234
|
+
if (!route.config) {
|
235
|
+
splatConfigFile = itemPath;
|
236
|
+
}
|
237
|
+
}
|
232
238
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_DATA_FILE) {
|
233
239
|
splatData = itemPath;
|
234
240
|
}
|
@@ -247,6 +253,9 @@ export var walk = function() {
|
|
247
253
|
if (splatData) {
|
248
254
|
splatRoute.data = splatData;
|
249
255
|
}
|
256
|
+
if (splatConfigFile) {
|
257
|
+
splatRoute.config = splatConfigFile;
|
258
|
+
}
|
250
259
|
(_route_children2 = route.children) === null || _route_children2 === void 0 ? void 0 : _route_children2.push(splatRoute);
|
251
260
|
}
|
252
261
|
if (itemWithoutExt === NESTED_ROUTE.LOADING_FILE) {
|
@@ -37,6 +37,7 @@ export const NESTED_ROUTE = {
|
|
37
37
|
PAGE_DATA_FILE: "page.data",
|
38
38
|
PAGE_CLIENT_LOADER: "page.data.client",
|
39
39
|
SPLATE_FILE: "$",
|
40
|
+
SPLATE_CONFIG_FILE: "$.config",
|
40
41
|
SPLATE_LOADER_FILE: "$.loader",
|
41
42
|
SPLATE_DATA_FILE: "$.data",
|
42
43
|
SPLATE_CLIENT_DATA: "$.data.client",
|
@@ -101,6 +101,7 @@ export const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldV
|
|
101
101
|
let splatData = "";
|
102
102
|
let splatRoute = null;
|
103
103
|
let pageConfigFile = "";
|
104
|
+
let splatConfigFile = "";
|
104
105
|
const items = await fs.readdir(dirname);
|
105
106
|
for (const item of items) {
|
106
107
|
const itemPath = path.join(dirname, item);
|
@@ -167,6 +168,11 @@ export const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldV
|
|
167
168
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_CLIENT_DATA) {
|
168
169
|
splatClientData = itemPath;
|
169
170
|
}
|
171
|
+
if (itemWithoutExt === NESTED_ROUTE.SPLATE_CONFIG_FILE) {
|
172
|
+
if (!route.config) {
|
173
|
+
splatConfigFile = itemPath;
|
174
|
+
}
|
175
|
+
}
|
170
176
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_DATA_FILE) {
|
171
177
|
splatData = itemPath;
|
172
178
|
}
|
@@ -185,6 +191,9 @@ export const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldV
|
|
185
191
|
if (splatData) {
|
186
192
|
splatRoute.data = splatData;
|
187
193
|
}
|
194
|
+
if (splatConfigFile) {
|
195
|
+
splatRoute.config = splatConfigFile;
|
196
|
+
}
|
188
197
|
(_route_children2 = route.children) === null || _route_children2 === void 0 ? void 0 : _route_children2.push(splatRoute);
|
189
198
|
}
|
190
199
|
if (itemWithoutExt === NESTED_ROUTE.LOADING_FILE) {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { IAppContext, PluginAPI } from '@modern-js/core';
|
2
2
|
import type { Entrypoint } from '@modern-js/types';
|
3
|
-
import {
|
3
|
+
import { BundlerConfig } from '@modern-js/builder-shared';
|
4
|
+
import { AppNormalizedConfig, AppTools, ImportStatement } from '../types';
|
4
5
|
export declare const createImportStatements: (statements: ImportStatement[]) => string;
|
5
6
|
export declare const generateCode: (appContext: IAppContext, config: AppNormalizedConfig<'shared'>, entrypoints: Entrypoint[], api: PluginAPI<AppTools<'shared'>>) => Promise<{
|
6
7
|
importsStatemets: Map<string, ImportStatement[]>;
|
@@ -18,5 +19,5 @@ export declare const generateIndexCode: ({
|
|
18
19
|
entrypoints: Entrypoint[];
|
19
20
|
config: AppNormalizedConfig<'shared'>;
|
20
21
|
importsStatemets: Map<string, ImportStatement[]>;
|
21
|
-
bundlerConfigs?:
|
22
|
+
bundlerConfigs?: BundlerConfig[] | undefined;
|
22
23
|
}) => Promise<void>;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.34.
|
18
|
+
"version": "2.34.1-alpha.1",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -73,24 +73,24 @@
|
|
73
73
|
"esbuild": "0.17.19",
|
74
74
|
"rspack-plugin-virtual-module": "0.1.7",
|
75
75
|
"@swc/helpers": "0.5.1",
|
76
|
-
"@modern-js/builder": "2.34.0",
|
77
|
-
"@modern-js/builder-plugin-esbuild": "2.34.0",
|
78
|
-
"@modern-js/builder-plugin-node-polyfill": "2.34.0",
|
79
|
-
"@modern-js/builder-shared": "2.34.0",
|
80
76
|
"@modern-js/builder-webpack-provider": "2.34.0",
|
77
|
+
"@modern-js/builder-plugin-node-polyfill": "2.34.0",
|
81
78
|
"@modern-js/core": "2.34.0",
|
79
|
+
"@modern-js/builder": "2.34.0",
|
80
|
+
"@modern-js/builder-shared": "2.34.0",
|
82
81
|
"@modern-js/new-action": "2.34.0",
|
83
82
|
"@modern-js/node-bundle-require": "2.34.0",
|
84
83
|
"@modern-js/plugin": "2.34.0",
|
85
84
|
"@modern-js/plugin-data-loader": "2.34.0",
|
86
85
|
"@modern-js/plugin-i18n": "2.34.0",
|
87
|
-
"@modern-js/plugin-
|
86
|
+
"@modern-js/builder-plugin-esbuild": "2.34.0",
|
88
87
|
"@modern-js/prod-server": "2.34.0",
|
89
|
-
"@modern-js/
|
88
|
+
"@modern-js/plugin-lint": "2.34.0",
|
90
89
|
"@modern-js/types": "2.34.0",
|
91
90
|
"@modern-js/upgrade": "2.34.0",
|
92
|
-
"@modern-js/
|
93
|
-
"@modern-js/server-core": "2.34.0"
|
91
|
+
"@modern-js/server": "2.34.0",
|
92
|
+
"@modern-js/server-core": "2.34.0",
|
93
|
+
"@modern-js/utils": "2.34.0"
|
94
94
|
},
|
95
95
|
"devDependencies": {
|
96
96
|
"@types/babel__traverse": "^7.14.2",
|
@@ -100,8 +100,8 @@
|
|
100
100
|
"typescript": "^5",
|
101
101
|
"webpack": "^5.88.1",
|
102
102
|
"@modern-js/builder-plugin-swc": "2.34.0",
|
103
|
-
"@modern-js/builder-rspack-provider": "2.34.0",
|
104
103
|
"@scripts/build": "2.34.0",
|
104
|
+
"@modern-js/builder-rspack-provider": "2.34.0",
|
105
105
|
"@scripts/jest-config": "2.34.0"
|
106
106
|
},
|
107
107
|
"peerDependencies": {
|