@modern-js/app-tools 2.42.0 → 2.42.2-alpha.0

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.
@@ -158,40 +158,40 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
158
158
  }
159
159
  if (itemWithoutExt === import_constants.NESTED_ROUTE.LAYOUT_LOADER_FILE) {
160
160
  if (!route.loader) {
161
- route.loader = itemPath;
161
+ route.loader = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
162
162
  }
163
163
  }
164
164
  if (itemWithoutExt === import_constants.NESTED_ROUTE.LAYOUT_CLIENT_LOADER) {
165
- route.clientData = itemPath;
165
+ route.clientData = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
166
166
  }
167
167
  if (itemWithoutExt === import_constants.NESTED_ROUTE.LAYOUT_DATA_FILE) {
168
- route.data = itemPath;
168
+ route.data = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
169
169
  if (await (0, import_utils2.hasAction)(itemPath)) {
170
- route.action = itemPath;
170
+ route.action = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
171
171
  }
172
172
  }
173
173
  if (itemWithoutExt === import_constants.NESTED_ROUTE.LAYOUT_CONFIG_FILE) {
174
174
  if (!route.config) {
175
- route.config = itemPath;
175
+ route.config = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
176
176
  }
177
177
  }
178
178
  if (itemWithoutExt === import_constants.NESTED_ROUTE.LAYOUT_FILE) {
179
179
  route._component = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
180
180
  }
181
181
  if (itemWithoutExt === import_constants.NESTED_ROUTE.PAGE_LOADER_FILE) {
182
- pageLoaderFile = itemPath;
182
+ pageLoaderFile = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
183
183
  }
184
184
  if (itemWithoutExt === import_constants.NESTED_ROUTE.PAGE_CLIENT_LOADER) {
185
- pageClientData = itemPath;
185
+ pageClientData = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
186
186
  }
187
187
  if (itemWithoutExt === import_constants.NESTED_ROUTE.PAGE_DATA_FILE) {
188
- pageData = itemPath;
188
+ pageData = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
189
189
  if (await (0, import_utils2.hasAction)(itemPath)) {
190
- pageAction = itemPath;
190
+ pageAction = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
191
191
  }
192
192
  }
193
193
  if (itemWithoutExt === import_constants.NESTED_ROUTE.PAGE_CONFIG_FILE) {
194
- pageConfigFile = itemPath;
194
+ pageConfigFile = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
195
195
  }
196
196
  if (itemWithoutExt === import_constants.NESTED_ROUTE.PAGE_FILE) {
197
197
  var _route_children1;
@@ -216,20 +216,20 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
216
216
  (_route_children1 = route.children) === null || _route_children1 === void 0 ? void 0 : _route_children1.push(pageRoute);
217
217
  }
218
218
  if (itemWithoutExt === import_constants.NESTED_ROUTE.SPLATE_LOADER_FILE) {
219
- splatLoaderFile = itemPath;
219
+ splatLoaderFile = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
220
220
  }
221
221
  if (itemWithoutExt === import_constants.NESTED_ROUTE.SPLATE_CLIENT_DATA) {
222
- splatClientData = itemPath;
222
+ splatClientData = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
223
223
  }
224
224
  if (itemWithoutExt === import_constants.NESTED_ROUTE.SPLATE_CONFIG_FILE) {
225
225
  if (!route.config) {
226
- splatConfigFile = itemPath;
226
+ splatConfigFile = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
227
227
  }
228
228
  }
229
229
  if (itemWithoutExt === import_constants.NESTED_ROUTE.SPLATE_DATA_FILE) {
230
- splatData = itemPath;
230
+ splatData = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
231
231
  if (await (0, import_utils2.hasAction)(itemPath)) {
232
- splatAction = itemPath;
232
+ splatAction = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
233
233
  }
234
234
  }
235
235
  if (itemWithoutExt === import_constants.NESTED_ROUTE.SPLATE_FILE) {
@@ -47,9 +47,10 @@ function initHtmlConfig(config, appContext) {
47
47
  config.html.favicon = createBuilderFavicon(config, appContext);
48
48
  return config.html;
49
49
  function createBuilderAppIcon(config2, appContext2) {
50
+ const { appIcon } = config2.html;
50
51
  const { configDir } = config2.source;
51
- const appIcon = (0, import_utils.findExists)(ICON_EXTENSIONS.map((ext) => import_path.default.resolve(appContext2.appDirectory, configDir || "./config", `icon.${ext}`)));
52
- return typeof appIcon === "string" ? appIcon : void 0;
52
+ const defaultAppIcon = (0, import_utils.findExists)(ICON_EXTENSIONS.map((ext) => import_path.default.resolve(appContext2.appDirectory, configDir || "./config", `icon.${ext}`)));
53
+ return appIcon || defaultAppIcon || void 0;
53
54
  }
54
55
  function createBuilderFavicon(config2, appContext2) {
55
56
  const { configDir } = config2.source;
@@ -183,60 +183,60 @@ var walk = function() {
183
183
  }
184
184
  if (itemWithoutExt === NESTED_ROUTE.LAYOUT_LOADER_FILE) {
185
185
  if (!route.loader) {
186
- route.loader = itemPath;
186
+ route.loader = replaceWithAlias(alias.basename, itemPath, alias.name);
187
187
  }
188
188
  }
189
189
  if (itemWithoutExt === NESTED_ROUTE.LAYOUT_CLIENT_LOADER) {
190
- route.clientData = itemPath;
190
+ route.clientData = replaceWithAlias(alias.basename, itemPath, alias.name);
191
191
  }
192
192
  if (!(itemWithoutExt === NESTED_ROUTE.LAYOUT_DATA_FILE))
193
193
  return [
194
194
  3,
195
195
  10
196
196
  ];
197
- route.data = itemPath;
197
+ route.data = replaceWithAlias(alias.basename, itemPath, alias.name);
198
198
  return [
199
199
  4,
200
200
  hasAction(itemPath)
201
201
  ];
202
202
  case 9:
203
203
  if (_state.sent()) {
204
- route.action = itemPath;
204
+ route.action = replaceWithAlias(alias.basename, itemPath, alias.name);
205
205
  }
206
206
  _state.label = 10;
207
207
  case 10:
208
208
  if (itemWithoutExt === NESTED_ROUTE.LAYOUT_CONFIG_FILE) {
209
209
  if (!route.config) {
210
- route.config = itemPath;
210
+ route.config = replaceWithAlias(alias.basename, itemPath, alias.name);
211
211
  }
212
212
  }
213
213
  if (itemWithoutExt === NESTED_ROUTE.LAYOUT_FILE) {
214
214
  route._component = replaceWithAlias(alias.basename, itemPath, alias.name);
215
215
  }
216
216
  if (itemWithoutExt === NESTED_ROUTE.PAGE_LOADER_FILE) {
217
- pageLoaderFile = itemPath;
217
+ pageLoaderFile = replaceWithAlias(alias.basename, itemPath, alias.name);
218
218
  }
219
219
  if (itemWithoutExt === NESTED_ROUTE.PAGE_CLIENT_LOADER) {
220
- pageClientData = itemPath;
220
+ pageClientData = replaceWithAlias(alias.basename, itemPath, alias.name);
221
221
  }
222
222
  if (!(itemWithoutExt === NESTED_ROUTE.PAGE_DATA_FILE))
223
223
  return [
224
224
  3,
225
225
  12
226
226
  ];
227
- pageData = itemPath;
227
+ pageData = replaceWithAlias(alias.basename, itemPath, alias.name);
228
228
  return [
229
229
  4,
230
230
  hasAction(itemPath)
231
231
  ];
232
232
  case 11:
233
233
  if (_state.sent()) {
234
- pageAction = itemPath;
234
+ pageAction = replaceWithAlias(alias.basename, itemPath, alias.name);
235
235
  }
236
236
  _state.label = 12;
237
237
  case 12:
238
238
  if (itemWithoutExt === NESTED_ROUTE.PAGE_CONFIG_FILE) {
239
- pageConfigFile = itemPath;
239
+ pageConfigFile = replaceWithAlias(alias.basename, itemPath, alias.name);
240
240
  }
241
241
  if (itemWithoutExt === NESTED_ROUTE.PAGE_FILE) {
242
242
  ;
@@ -261,14 +261,14 @@ var walk = function() {
261
261
  (_route_children1 = route.children) === null || _route_children1 === void 0 ? void 0 : _route_children1.push(pageRoute);
262
262
  }
263
263
  if (itemWithoutExt === NESTED_ROUTE.SPLATE_LOADER_FILE) {
264
- splatLoaderFile = itemPath;
264
+ splatLoaderFile = replaceWithAlias(alias.basename, itemPath, alias.name);
265
265
  }
266
266
  if (itemWithoutExt === NESTED_ROUTE.SPLATE_CLIENT_DATA) {
267
- splatClientData = itemPath;
267
+ splatClientData = replaceWithAlias(alias.basename, itemPath, alias.name);
268
268
  }
269
269
  if (itemWithoutExt === NESTED_ROUTE.SPLATE_CONFIG_FILE) {
270
270
  if (!route.config) {
271
- splatConfigFile = itemPath;
271
+ splatConfigFile = replaceWithAlias(alias.basename, itemPath, alias.name);
272
272
  }
273
273
  }
274
274
  if (!(itemWithoutExt === NESTED_ROUTE.SPLATE_DATA_FILE))
@@ -276,14 +276,14 @@ var walk = function() {
276
276
  3,
277
277
  14
278
278
  ];
279
- splatData = itemPath;
279
+ splatData = replaceWithAlias(alias.basename, itemPath, alias.name);
280
280
  return [
281
281
  4,
282
282
  hasAction(itemPath)
283
283
  ];
284
284
  case 13:
285
285
  if (_state.sent()) {
286
- splatAction = itemPath;
286
+ splatAction = replaceWithAlias(alias.basename, itemPath, alias.name);
287
287
  }
288
288
  _state.label = 14;
289
289
  case 14:
@@ -12,11 +12,12 @@ function initHtmlConfig(config, appContext) {
12
12
  config.html.favicon = createBuilderFavicon(config, appContext);
13
13
  return config.html;
14
14
  function createBuilderAppIcon(config2, appContext2) {
15
+ var appIcon = config2.html.appIcon;
15
16
  var configDir = config2.source.configDir;
16
- var appIcon = findExists(ICON_EXTENSIONS.map(function(ext) {
17
+ var defaultAppIcon = findExists(ICON_EXTENSIONS.map(function(ext) {
17
18
  return path.resolve(appContext2.appDirectory, configDir || "./config", "icon.".concat(ext));
18
19
  }));
19
- return typeof appIcon === "string" ? appIcon : void 0;
20
+ return appIcon || defaultAppIcon || void 0;
20
21
  }
21
22
  function createBuilderFavicon(config2, appContext2) {
22
23
  var configDir = config2.source.configDir;
@@ -123,40 +123,40 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
123
123
  }
124
124
  if (itemWithoutExt === NESTED_ROUTE.LAYOUT_LOADER_FILE) {
125
125
  if (!route.loader) {
126
- route.loader = itemPath;
126
+ route.loader = replaceWithAlias(alias.basename, itemPath, alias.name);
127
127
  }
128
128
  }
129
129
  if (itemWithoutExt === NESTED_ROUTE.LAYOUT_CLIENT_LOADER) {
130
- route.clientData = itemPath;
130
+ route.clientData = replaceWithAlias(alias.basename, itemPath, alias.name);
131
131
  }
132
132
  if (itemWithoutExt === NESTED_ROUTE.LAYOUT_DATA_FILE) {
133
- route.data = itemPath;
133
+ route.data = replaceWithAlias(alias.basename, itemPath, alias.name);
134
134
  if (await hasAction(itemPath)) {
135
- route.action = itemPath;
135
+ route.action = replaceWithAlias(alias.basename, itemPath, alias.name);
136
136
  }
137
137
  }
138
138
  if (itemWithoutExt === NESTED_ROUTE.LAYOUT_CONFIG_FILE) {
139
139
  if (!route.config) {
140
- route.config = itemPath;
140
+ route.config = replaceWithAlias(alias.basename, itemPath, alias.name);
141
141
  }
142
142
  }
143
143
  if (itemWithoutExt === NESTED_ROUTE.LAYOUT_FILE) {
144
144
  route._component = replaceWithAlias(alias.basename, itemPath, alias.name);
145
145
  }
146
146
  if (itemWithoutExt === NESTED_ROUTE.PAGE_LOADER_FILE) {
147
- pageLoaderFile = itemPath;
147
+ pageLoaderFile = replaceWithAlias(alias.basename, itemPath, alias.name);
148
148
  }
149
149
  if (itemWithoutExt === NESTED_ROUTE.PAGE_CLIENT_LOADER) {
150
- pageClientData = itemPath;
150
+ pageClientData = replaceWithAlias(alias.basename, itemPath, alias.name);
151
151
  }
152
152
  if (itemWithoutExt === NESTED_ROUTE.PAGE_DATA_FILE) {
153
- pageData = itemPath;
153
+ pageData = replaceWithAlias(alias.basename, itemPath, alias.name);
154
154
  if (await hasAction(itemPath)) {
155
- pageAction = itemPath;
155
+ pageAction = replaceWithAlias(alias.basename, itemPath, alias.name);
156
156
  }
157
157
  }
158
158
  if (itemWithoutExt === NESTED_ROUTE.PAGE_CONFIG_FILE) {
159
- pageConfigFile = itemPath;
159
+ pageConfigFile = replaceWithAlias(alias.basename, itemPath, alias.name);
160
160
  }
161
161
  if (itemWithoutExt === NESTED_ROUTE.PAGE_FILE) {
162
162
  var _route_children1;
@@ -181,20 +181,20 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
181
181
  (_route_children1 = route.children) === null || _route_children1 === void 0 ? void 0 : _route_children1.push(pageRoute);
182
182
  }
183
183
  if (itemWithoutExt === NESTED_ROUTE.SPLATE_LOADER_FILE) {
184
- splatLoaderFile = itemPath;
184
+ splatLoaderFile = replaceWithAlias(alias.basename, itemPath, alias.name);
185
185
  }
186
186
  if (itemWithoutExt === NESTED_ROUTE.SPLATE_CLIENT_DATA) {
187
- splatClientData = itemPath;
187
+ splatClientData = replaceWithAlias(alias.basename, itemPath, alias.name);
188
188
  }
189
189
  if (itemWithoutExt === NESTED_ROUTE.SPLATE_CONFIG_FILE) {
190
190
  if (!route.config) {
191
- splatConfigFile = itemPath;
191
+ splatConfigFile = replaceWithAlias(alias.basename, itemPath, alias.name);
192
192
  }
193
193
  }
194
194
  if (itemWithoutExt === NESTED_ROUTE.SPLATE_DATA_FILE) {
195
- splatData = itemPath;
195
+ splatData = replaceWithAlias(alias.basename, itemPath, alias.name);
196
196
  if (await hasAction(itemPath)) {
197
- splatAction = itemPath;
197
+ splatAction = replaceWithAlias(alias.basename, itemPath, alias.name);
198
198
  }
199
199
  }
200
200
  if (itemWithoutExt === NESTED_ROUTE.SPLATE_FILE) {
@@ -12,9 +12,10 @@ function initHtmlConfig(config, appContext) {
12
12
  config.html.favicon = createBuilderFavicon(config, appContext);
13
13
  return config.html;
14
14
  function createBuilderAppIcon(config2, appContext2) {
15
+ const { appIcon } = config2.html;
15
16
  const { configDir } = config2.source;
16
- const appIcon = findExists(ICON_EXTENSIONS.map((ext) => path.resolve(appContext2.appDirectory, configDir || "./config", `icon.${ext}`)));
17
- return typeof appIcon === "string" ? appIcon : void 0;
17
+ const defaultAppIcon = findExists(ICON_EXTENSIONS.map((ext) => path.resolve(appContext2.appDirectory, configDir || "./config", `icon.${ext}`)));
18
+ return appIcon || defaultAppIcon || void 0;
18
19
  }
19
20
  function createBuilderFavicon(config2, appContext2) {
20
21
  const { configDir } = config2.source;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.42.0",
18
+ "version": "2.42.2-alpha.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -72,24 +72,24 @@
72
72
  "es-module-lexer": "^1.1.0",
73
73
  "esbuild": "0.17.19",
74
74
  "@swc/helpers": "0.5.3",
75
- "@modern-js/builder-plugin-node-polyfill": "2.42.0",
76
- "@modern-js/builder-plugin-esbuild": "2.42.0",
77
- "@modern-js/builder-webpack-provider": "2.42.0",
78
- "@modern-js/builder-shared": "2.42.0",
79
- "@modern-js/builder": "2.42.0",
80
- "@modern-js/core": "2.42.0",
81
- "@modern-js/plugin": "2.42.0",
82
- "@modern-js/new-action": "2.42.0",
83
- "@modern-js/node-bundle-require": "2.42.0",
84
- "@modern-js/plugin-data-loader": "2.42.0",
85
- "@modern-js/plugin-lint": "2.42.0",
86
- "@modern-js/plugin-i18n": "2.42.0",
87
- "@modern-js/prod-server": "2.42.0",
88
- "@modern-js/server": "2.42.0",
89
- "@modern-js/upgrade": "2.42.0",
90
- "@modern-js/types": "2.42.0",
91
- "@modern-js/server-core": "2.42.0",
92
- "@modern-js/utils": "2.42.0"
75
+ "@modern-js/builder": "2.42.1",
76
+ "@modern-js/builder-plugin-esbuild": "2.42.1",
77
+ "@modern-js/builder-plugin-node-polyfill": "2.42.1",
78
+ "@modern-js/builder-webpack-provider": "2.42.1",
79
+ "@modern-js/core": "2.42.1",
80
+ "@modern-js/node-bundle-require": "2.42.1",
81
+ "@modern-js/plugin": "2.42.1",
82
+ "@modern-js/plugin-i18n": "2.42.1",
83
+ "@modern-js/new-action": "2.42.1",
84
+ "@modern-js/plugin-data-loader": "2.42.1",
85
+ "@modern-js/types": "2.42.1",
86
+ "@modern-js/plugin-lint": "2.42.1",
87
+ "@modern-js/builder-shared": "2.42.1",
88
+ "@modern-js/upgrade": "2.42.1",
89
+ "@modern-js/utils": "2.42.1",
90
+ "@modern-js/server": "2.42.1",
91
+ "@modern-js/prod-server": "2.42.1",
92
+ "@modern-js/server-core": "2.42.1"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@types/babel__traverse": "7.18.5",
@@ -98,13 +98,13 @@
98
98
  "jest": "^29",
99
99
  "typescript": "^5",
100
100
  "webpack": "^5.88.1",
101
- "@modern-js/builder-plugin-swc": "2.42.0",
102
- "@modern-js/builder-rspack-provider": "2.42.0",
103
- "@scripts/build": "2.42.0",
104
- "@scripts/jest-config": "2.42.0"
101
+ "@modern-js/builder-plugin-swc": "2.42.1",
102
+ "@scripts/build": "2.42.1",
103
+ "@modern-js/builder-rspack-provider": "2.42.1",
104
+ "@scripts/jest-config": "2.42.1"
105
105
  },
106
106
  "peerDependencies": {
107
- "@modern-js/builder-rspack-provider": "^2.42.0"
107
+ "@modern-js/builder-rspack-provider": "^2.42.1"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "@modern-js/builder-rspack-provider": {