@modern-js/app-tools 2.59.0 → 2.60.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +2 -2
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +5 -4
- package/dist/esm/commands/index.js +16 -14
- package/dist/esm/plugins/analyze/getServerRoutes.js +4 -4
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +2 -2
- package/dist/types/types/config/tools.d.ts +1 -1
- package/package.json +20 -20
@@ -126,10 +126,10 @@ function applyRouterPlugin(chain, pluginName, options, HtmlBundlerPlugin) {
|
|
126
126
|
}
|
127
127
|
}
|
128
128
|
function applyFilterEntriesBySSRConfig({ isProd, chain, appNormalizedConfig }) {
|
129
|
-
var
|
129
|
+
var _outputConfig_ssg;
|
130
130
|
const { server: serverConfig, output: outputConfig } = appNormalizedConfig;
|
131
131
|
const entries = chain.entryPoints.entries();
|
132
|
-
if (isProd && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (
|
132
|
+
if (isProd && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (_outputConfig_ssg = outputConfig.ssg) === null || _outputConfig_ssg === void 0 ? void 0 : _outputConfig_ssg[0]) === "function")) {
|
133
133
|
return;
|
134
134
|
}
|
135
135
|
if (typeof entries === "undefined") {
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
|
+
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
2
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
4
|
import * as path from "path";
|
4
5
|
import { SERVICE_WORKER_ENVIRONMENT_NAME, isHtmlDisabled } from "@modern-js/uni-builder";
|
@@ -77,13 +78,13 @@ var builderPluginAdapterSSR = function(options) {
|
|
77
78
|
};
|
78
79
|
var isStreamingSSR = function(userConfig) {
|
79
80
|
var isStreaming = function(ssr) {
|
80
|
-
return ssr && typeof ssr === "object" && ssr.mode === "stream";
|
81
|
+
return ssr && (typeof ssr === "undefined" ? "undefined" : _type_of(ssr)) === "object" && ssr.mode === "stream";
|
81
82
|
};
|
82
83
|
var server = userConfig.server;
|
83
84
|
if (isStreaming(server.ssr)) {
|
84
85
|
return true;
|
85
86
|
}
|
86
|
-
if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) &&
|
87
|
+
if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && _type_of(server.ssrByEntries) === "object") {
|
87
88
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
88
89
|
try {
|
89
90
|
for (var _iterator = Object.keys(server.ssrByEntries)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
@@ -145,10 +146,10 @@ function applyRouterPlugin(chain, pluginName, options, HtmlBundlerPlugin) {
|
|
145
146
|
}
|
146
147
|
function applyFilterEntriesBySSRConfig(param) {
|
147
148
|
var isProd = param.isProd, chain = param.chain, appNormalizedConfig = param.appNormalizedConfig;
|
148
|
-
var
|
149
|
+
var _outputConfig_ssg;
|
149
150
|
var serverConfig = appNormalizedConfig.server, outputConfig = appNormalizedConfig.output;
|
150
151
|
var entries = chain.entryPoints.entries();
|
151
|
-
if (isProd && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (
|
152
|
+
if (isProd && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (_outputConfig_ssg = outputConfig.ssg) === null || _outputConfig_ssg === void 0 ? void 0 : _outputConfig_ssg[0]) === "function")) {
|
152
153
|
return;
|
153
154
|
}
|
154
155
|
if (typeof entries === "undefined") {
|
@@ -7,7 +7,7 @@ import { newAction, upgradeAction } from "@modern-js/utils";
|
|
7
7
|
import { i18n, localeKeys } from "../locale";
|
8
8
|
var devCommand = function() {
|
9
9
|
var _ref = _async_to_generator(function(program, api) {
|
10
|
-
var runner, devToolMetas, devProgram, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step
|
10
|
+
var runner, devToolMetas, devProgram, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step;
|
11
11
|
return _ts_generator(this, function(_state) {
|
12
12
|
switch (_state.label) {
|
13
13
|
case 0:
|
@@ -48,15 +48,15 @@ var devCommand = function() {
|
|
48
48
|
}());
|
49
49
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
50
50
|
try {
|
51
|
-
|
52
|
-
meta = _step.value;
|
51
|
+
_loop = function() {
|
52
|
+
var meta = _step.value;
|
53
53
|
if (!meta.subCommands) {
|
54
|
-
continue;
|
54
|
+
return "continue";
|
55
55
|
}
|
56
|
-
|
56
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
|
57
57
|
try {
|
58
|
-
for (
|
59
|
-
subCmd = _step1.value;
|
58
|
+
for (var _iterator2 = meta.subCommands[Symbol.iterator](), _step1; !(_iteratorNormalCompletion2 = (_step1 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
59
|
+
var subCmd = _step1.value;
|
60
60
|
devProgram.command(subCmd).action(/* @__PURE__ */ _async_to_generator(function() {
|
61
61
|
var options, appDirectory, isTypescript;
|
62
62
|
var _arguments = arguments;
|
@@ -93,20 +93,22 @@ var devCommand = function() {
|
|
93
93
|
}));
|
94
94
|
}
|
95
95
|
} catch (err) {
|
96
|
-
|
97
|
-
|
96
|
+
_didIteratorError2 = true;
|
97
|
+
_iteratorError2 = err;
|
98
98
|
} finally {
|
99
99
|
try {
|
100
|
-
if (!
|
101
|
-
|
100
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
101
|
+
_iterator2.return();
|
102
102
|
}
|
103
103
|
} finally {
|
104
|
-
if (
|
105
|
-
throw
|
104
|
+
if (_didIteratorError2) {
|
105
|
+
throw _iteratorError2;
|
106
106
|
}
|
107
107
|
}
|
108
108
|
}
|
109
|
-
}
|
109
|
+
};
|
110
|
+
for (_iterator = devToolMetas[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)
|
111
|
+
_loop();
|
110
112
|
} catch (err) {
|
111
113
|
_didIteratorError = true;
|
112
114
|
_iteratorError = err;
|
@@ -2,6 +2,7 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
3
3
|
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
4
4
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
5
|
+
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
5
6
|
import fs from "fs";
|
6
7
|
import path from "path";
|
7
8
|
import { SERVER_BUNDLE_DIRECTORY, SERVER_WORKER_BUNDLE_DIRECTORY, getEntryOptions, isPlainObject, removeLeadingSlash, removeTailSlash, urlJoin } from "@modern-js/utils";
|
@@ -31,8 +32,7 @@ var applyRouteOptions = function(original, routeOptions) {
|
|
31
32
|
var routes;
|
32
33
|
if (route) {
|
33
34
|
if (Array.isArray(route)) {
|
34
|
-
|
35
|
-
_route_map = route.map(function(url) {
|
35
|
+
routes = route.map(function(url) {
|
36
36
|
if (isPlainObject(url)) {
|
37
37
|
var urlPath2 = url.path, other2 = _object_without_properties(url, [
|
38
38
|
"path"
|
@@ -45,7 +45,7 @@ var applyRouteOptions = function(original, routeOptions) {
|
|
45
45
|
urlPath: url
|
46
46
|
});
|
47
47
|
}
|
48
|
-
})
|
48
|
+
});
|
49
49
|
} else if (isPlainObject(route)) {
|
50
50
|
var urlPath = route.path, other = _object_without_properties(route, [
|
51
51
|
"path"
|
@@ -80,7 +80,7 @@ var collectHtmlRoutes = function(entrypoints, appContext, config) {
|
|
80
80
|
var entryOptions = getEntryOptions(entryName, isMain, ssr, ssrByEntries, packageName);
|
81
81
|
var isSSR = Boolean(entryOptions);
|
82
82
|
var isWorker = Boolean(workerSSR);
|
83
|
-
var isStream = typeof entryOptions === "object" && entryOptions.mode === "stream";
|
83
|
+
var isStream = (typeof entryOptions === "undefined" ? "undefined" : _type_of(entryOptions)) === "object" && entryOptions.mode === "stream";
|
84
84
|
var resHeaders = ((routes === null || routes === void 0 ? void 0 : routes[entryName]) || {}).resHeaders;
|
85
85
|
var route = {
|
86
86
|
urlPath: "/".concat(isMain ? "" : entryName),
|
@@ -93,10 +93,10 @@ function applyRouterPlugin(chain, pluginName, options, HtmlBundlerPlugin) {
|
|
93
93
|
}
|
94
94
|
}
|
95
95
|
function applyFilterEntriesBySSRConfig({ isProd, chain, appNormalizedConfig }) {
|
96
|
-
var
|
96
|
+
var _outputConfig_ssg;
|
97
97
|
const { server: serverConfig, output: outputConfig } = appNormalizedConfig;
|
98
98
|
const entries = chain.entryPoints.entries();
|
99
|
-
if (isProd && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (
|
99
|
+
if (isProd && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (_outputConfig_ssg = outputConfig.ssg) === null || _outputConfig_ssg === void 0 ? void 0 : _outputConfig_ssg[0]) === "function")) {
|
100
100
|
return;
|
101
101
|
}
|
102
102
|
if (typeof entries === "undefined") {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { PluginEsbuildOptions } from '@modern-js/rsbuild-plugin-esbuild';
|
2
2
|
import type { JestConfig } from '@modern-js/types';
|
3
3
|
import type { UniBuilderConfig } from '@modern-js/uni-builder';
|
4
|
-
import type { PluginSwcOptions } from '@rsbuild/plugin-swc';
|
4
|
+
import type { PluginSwcOptions } from '@rsbuild/plugin-webpack-swc';
|
5
5
|
import type { Bundler, UnwrapBuilderConfig } from '../utils';
|
6
6
|
export type Tailwindcss = Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
|
7
7
|
type BuilderToolsConfig = UnwrapBuilderConfig<UniBuilderConfig, 'tools'>;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.60.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -77,9 +77,9 @@
|
|
77
77
|
"@babel/parser": "^7.22.15",
|
78
78
|
"@babel/traverse": "^7.23.2",
|
79
79
|
"@babel/types": "^7.24.7",
|
80
|
-
"@rsbuild/core": "1.0.
|
80
|
+
"@rsbuild/core": "1.0.2",
|
81
81
|
"@rsbuild/plugin-node-polyfill": "1.0.4",
|
82
|
-
"@swc/helpers": "0.5.
|
82
|
+
"@swc/helpers": "0.5.13",
|
83
83
|
"@vercel/nft": "^0.26.4",
|
84
84
|
"es-module-lexer": "^1.1.0",
|
85
85
|
"esbuild": "0.17.19",
|
@@ -88,23 +88,23 @@
|
|
88
88
|
"mlly": "^1.6.1",
|
89
89
|
"pkg-types": "^1.1.0",
|
90
90
|
"std-env": "^3.7.0",
|
91
|
-
"@modern-js/
|
92
|
-
"@modern-js/
|
93
|
-
"@modern-js/plugin-
|
94
|
-
"@modern-js/plugin-i18n": "2.
|
95
|
-
"@modern-js/plugin-
|
96
|
-
"@modern-js/
|
97
|
-
"@modern-js/
|
98
|
-
"@modern-js/
|
99
|
-
"@modern-js/
|
100
|
-
"@modern-js/server-
|
101
|
-
"@modern-js/
|
102
|
-
"@modern-js/
|
103
|
-
"@modern-js/
|
104
|
-
"@modern-js/utils": "2.
|
91
|
+
"@modern-js/core": "2.60.0",
|
92
|
+
"@modern-js/node-bundle-require": "2.60.0",
|
93
|
+
"@modern-js/plugin-lint": "2.60.0",
|
94
|
+
"@modern-js/plugin-i18n": "2.60.0",
|
95
|
+
"@modern-js/plugin-data-loader": "2.60.0",
|
96
|
+
"@modern-js/prod-server": "2.60.0",
|
97
|
+
"@modern-js/server": "2.60.0",
|
98
|
+
"@modern-js/plugin": "2.60.0",
|
99
|
+
"@modern-js/rsbuild-plugin-esbuild": "2.60.0",
|
100
|
+
"@modern-js/server-core": "2.60.0",
|
101
|
+
"@modern-js/server-utils": "2.60.0",
|
102
|
+
"@modern-js/types": "2.60.0",
|
103
|
+
"@modern-js/uni-builder": "2.60.0",
|
104
|
+
"@modern-js/utils": "2.60.0"
|
105
105
|
},
|
106
106
|
"devDependencies": {
|
107
|
-
"@rsbuild/plugin-swc": "1.0.
|
107
|
+
"@rsbuild/plugin-webpack-swc": "1.0.2",
|
108
108
|
"@types/babel__traverse": "7.18.5",
|
109
109
|
"@types/jest": "^29",
|
110
110
|
"@types/node": "^16",
|
@@ -113,8 +113,8 @@
|
|
113
113
|
"tsconfig-paths": "^4.2.0",
|
114
114
|
"typescript": "^5",
|
115
115
|
"webpack": "^5.94.0",
|
116
|
-
"@scripts/build": "2.
|
117
|
-
"@scripts/jest-config": "2.
|
116
|
+
"@scripts/build": "2.60.0",
|
117
|
+
"@scripts/jest-config": "2.60.0"
|
118
118
|
},
|
119
119
|
"sideEffects": false,
|
120
120
|
"publishConfig": {
|