@modern-js/server-generator 3.1.30 → 3.1.31
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/dist/index.js +23 -109
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -35185,6 +35185,8 @@ var require_chainId = __commonJS({
|
|
|
35185
35185
|
CSS_MODULES_TS: "css-modules-typescript",
|
|
35186
35186
|
/** mini-css-extract-plugin.loader */
|
|
35187
35187
|
MINI_CSS_EXTRACT: "mini-css-extract",
|
|
35188
|
+
/** resolve-url-loader */
|
|
35189
|
+
RESOLVE_URL_LOADER_FOR_SASS: "resolve-url-loader",
|
|
35188
35190
|
/** builder-plugin-image-compress.loader */
|
|
35189
35191
|
IMAGE_COMPRESS: "image-compress",
|
|
35190
35192
|
/** builder-plugin-image-compress svgo-loader */
|
|
@@ -35232,6 +35234,10 @@ var require_chainId = __commonJS({
|
|
|
35232
35234
|
HTML_NONCE: "html-nonce",
|
|
35233
35235
|
/** HtmlCrossOriginPlugin */
|
|
35234
35236
|
HTML_CROSS_ORIGIN: "html-cross-origin",
|
|
35237
|
+
/** htmlPreconnectPlugin */
|
|
35238
|
+
HTML_PRECONNECT: "html-preconnect-plugin",
|
|
35239
|
+
/** htmlDnsPrefetchPlugin */
|
|
35240
|
+
HTML_DNS_PREFETCH: "html-dns-prefetch-plugin",
|
|
35235
35241
|
/** MiniCssExtractPlugin */
|
|
35236
35242
|
MINI_CSS_EXTRACT: "mini-css-extract",
|
|
35237
35243
|
/** VueLoaderPlugin */
|
|
@@ -35395,7 +35401,7 @@ var require_constants = __commonJS({
|
|
|
35395
35401
|
var API_DIR = "api";
|
|
35396
35402
|
var SERVER_DIR = "server";
|
|
35397
35403
|
var SHARED_DIR = "shared";
|
|
35398
|
-
var CONFIG_CACHE_DIR = "./node_modules/.cache/
|
|
35404
|
+
var CONFIG_CACHE_DIR = "./node_modules/.cache/bundle-require";
|
|
35399
35405
|
var CONFIG_FILE_EXTENSIONS = [
|
|
35400
35406
|
".js",
|
|
35401
35407
|
".ts",
|
|
@@ -35702,6 +35708,7 @@ var require_config = __commonJS({
|
|
|
35702
35708
|
return isSingleEntry;
|
|
35703
35709
|
}
|
|
35704
35710
|
});
|
|
35711
|
+
var _constants = require_constants();
|
|
35705
35712
|
var _type = require_type();
|
|
35706
35713
|
var isSSR = (config) => {
|
|
35707
35714
|
var _server, _server1;
|
|
@@ -35739,12 +35746,12 @@ var require_config = __commonJS({
|
|
|
35739
35746
|
return typeof ((_config_runtime = config.runtime) === null || _config_runtime === void 0 ? void 0 : _config_runtime.router) !== "boolean" && ((_config = config) === null || _config === void 0 ? void 0 : (_config_runtime1 = _config.runtime) === null || _config_runtime1 === void 0 ? void 0 : (_config_runtime_router = _config_runtime1.router) === null || _config_runtime_router === void 0 ? void 0 : _config_runtime_router.mode) === "react-router-5";
|
|
35740
35747
|
};
|
|
35741
35748
|
var isSSGEntry = (config, entryName, entrypoints) => {
|
|
35742
|
-
var _ssgConfig, _ssgConfig1;
|
|
35749
|
+
var _config_source, _ssgConfig, _ssgConfig1;
|
|
35743
35750
|
const ssgConfig = config.output.ssg;
|
|
35744
|
-
const useSSG = isSingleEntry(entrypoints) ? Boolean(ssgConfig) : ssgConfig === true || typeof ((_ssgConfig = ssgConfig) === null || _ssgConfig === void 0 ? void 0 : _ssgConfig[0]) === "function" || Boolean((_ssgConfig1 = ssgConfig) === null || _ssgConfig1 === void 0 ? void 0 : _ssgConfig1[entryName]);
|
|
35751
|
+
const useSSG = isSingleEntry(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) ? Boolean(ssgConfig) : ssgConfig === true || typeof ((_ssgConfig = ssgConfig) === null || _ssgConfig === void 0 ? void 0 : _ssgConfig[0]) === "function" || Boolean((_ssgConfig1 = ssgConfig) === null || _ssgConfig1 === void 0 ? void 0 : _ssgConfig1[entryName]);
|
|
35745
35752
|
return useSSG;
|
|
35746
35753
|
};
|
|
35747
|
-
var isSingleEntry = (entrypoints) => entrypoints.length === 1 && entrypoints[0].entryName ===
|
|
35754
|
+
var isSingleEntry = (entrypoints, mainEntryName = _constants.MAIN_ENTRY_NAME) => entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
|
|
35748
35755
|
}
|
|
35749
35756
|
});
|
|
35750
35757
|
|
|
@@ -36291,6 +36298,9 @@ var require_logger = __commonJS({
|
|
|
36291
36298
|
});
|
|
36292
36299
|
}
|
|
36293
36300
|
_export(exports, {
|
|
36301
|
+
isErrorStackMessage: function() {
|
|
36302
|
+
return isErrorStackMessage;
|
|
36303
|
+
},
|
|
36294
36304
|
Logger: function() {
|
|
36295
36305
|
return Logger;
|
|
36296
36306
|
},
|
|
@@ -36341,6 +36351,9 @@ var require_logger = __commonJS({
|
|
|
36341
36351
|
displayLabel: true,
|
|
36342
36352
|
uppercaseLabel: false
|
|
36343
36353
|
};
|
|
36354
|
+
var errorStackRegExp = /^\s*at\s.*:\d+:\d+[\s)]*$/;
|
|
36355
|
+
var anonymousErrorStackRegExp = /^\s*at\s.*\(<anonymous>\)$/;
|
|
36356
|
+
var isErrorStackMessage = (message) => errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
36344
36357
|
var Logger = class {
|
|
36345
36358
|
_log(type, message, ...args) {
|
|
36346
36359
|
if (message === void 0 || message === null) {
|
|
@@ -36366,6 +36379,9 @@ ${_chalk.default.grey(rest.join("\n"))}`;
|
|
|
36366
36379
|
} else {
|
|
36367
36380
|
text = message.message;
|
|
36368
36381
|
}
|
|
36382
|
+
} else if (logType.level === "error" && typeof message === "string") {
|
|
36383
|
+
const lines = message.split("\n");
|
|
36384
|
+
text = lines.map((line) => isErrorStackMessage(line) ? _chalk.default.gray(line) : line).join("\n");
|
|
36369
36385
|
} else {
|
|
36370
36386
|
text = `${message}`;
|
|
36371
36387
|
}
|
|
@@ -36547,15 +36563,6 @@ var require_path = __commonJS({
|
|
|
36547
36563
|
getTemplatePath: function() {
|
|
36548
36564
|
return getTemplatePath;
|
|
36549
36565
|
},
|
|
36550
|
-
compilePathMatcherRegExp: function() {
|
|
36551
|
-
return compilePathMatcherRegExp;
|
|
36552
|
-
},
|
|
36553
|
-
_joinPathParts: function() {
|
|
36554
|
-
return _joinPathParts;
|
|
36555
|
-
},
|
|
36556
|
-
upwardPaths: function() {
|
|
36557
|
-
return upwardPaths;
|
|
36558
|
-
},
|
|
36559
36566
|
getRealTemporaryDirectory: function() {
|
|
36560
36567
|
return getRealTemporaryDirectory;
|
|
36561
36568
|
},
|
|
@@ -36593,20 +36600,6 @@ var require_path = __commonJS({
|
|
|
36593
36600
|
parts.push((0, _compiled.nanoid)());
|
|
36594
36601
|
return _path.default.resolve(...parts);
|
|
36595
36602
|
};
|
|
36596
|
-
function compilePathMatcherRegExp(match) {
|
|
36597
|
-
if (typeof match !== "string") {
|
|
36598
|
-
return match;
|
|
36599
|
-
}
|
|
36600
|
-
const escaped = _compiled.lodash.escapeRegExp(match);
|
|
36601
|
-
return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`);
|
|
36602
|
-
}
|
|
36603
|
-
var _joinPathParts = (_part, i, parts) => (0, _compiled.lodash)(parts).filter((part) => ![
|
|
36604
|
-
"/",
|
|
36605
|
-
"\\"
|
|
36606
|
-
].includes(part)).tap((parts2) => parts2.unshift("")).slice(0, i + 2).join("/");
|
|
36607
|
-
function upwardPaths(start) {
|
|
36608
|
-
return (0, _compiled.lodash)(start).split(/[/\\]/).filter(Boolean).map(_joinPathParts).reverse().push("/").value();
|
|
36609
|
-
}
|
|
36610
36603
|
function getRealTemporaryDirectory() {
|
|
36611
36604
|
let ret = null;
|
|
36612
36605
|
try {
|
|
@@ -36858,84 +36851,6 @@ var require_monorepo = __commonJS({
|
|
|
36858
36851
|
}
|
|
36859
36852
|
});
|
|
36860
36853
|
|
|
36861
|
-
// ../../../toolkit/utils/dist/cjs/cli/pathSerializer.js
|
|
36862
|
-
var require_pathSerializer = __commonJS({
|
|
36863
|
-
"../../../toolkit/utils/dist/cjs/cli/pathSerializer.js"(exports) {
|
|
36864
|
-
"use strict";
|
|
36865
|
-
Object.defineProperty(exports, "__esModule", {
|
|
36866
|
-
value: true
|
|
36867
|
-
});
|
|
36868
|
-
function _export(target, all) {
|
|
36869
|
-
for (var name in all)
|
|
36870
|
-
Object.defineProperty(target, name, {
|
|
36871
|
-
enumerable: true,
|
|
36872
|
-
get: all[name]
|
|
36873
|
-
});
|
|
36874
|
-
}
|
|
36875
|
-
_export(exports, {
|
|
36876
|
-
matchUpwardPathsAsUnknown: function() {
|
|
36877
|
-
return matchUpwardPathsAsUnknown;
|
|
36878
|
-
},
|
|
36879
|
-
applyPathMatcher: function() {
|
|
36880
|
-
return applyPathMatcher;
|
|
36881
|
-
},
|
|
36882
|
-
applyMatcherReplacement: function() {
|
|
36883
|
-
return applyMatcherReplacement;
|
|
36884
|
-
},
|
|
36885
|
-
createDefaultPathMatchers: function() {
|
|
36886
|
-
return createDefaultPathMatchers;
|
|
36887
|
-
}
|
|
36888
|
-
});
|
|
36889
|
-
var _interop_require_default = require_interop_require_default();
|
|
36890
|
-
var _os = /* @__PURE__ */ _interop_require_default._(require("os"));
|
|
36891
|
-
var _lodash = /* @__PURE__ */ _interop_require_default._(require_lodash2());
|
|
36892
|
-
var _path = require_path();
|
|
36893
|
-
var matchUpwardPathsAsUnknown = (p) => (0, _lodash.default)((0, _path.upwardPaths)((0, _path.normalizeToPosixPath)(p))).map((match) => ({
|
|
36894
|
-
match,
|
|
36895
|
-
mark: "unknown"
|
|
36896
|
-
})).slice(1, -1).value();
|
|
36897
|
-
function applyPathMatcher(matcher, str, options = {}) {
|
|
36898
|
-
const regex2 = (0, _path.compilePathMatcherRegExp)(matcher.match);
|
|
36899
|
-
const replacer = (substring, ...args) => {
|
|
36900
|
-
if (options.minPartials && (0, _path.splitPathString)(substring).length < options.minPartials) {
|
|
36901
|
-
return substring;
|
|
36902
|
-
}
|
|
36903
|
-
const ret = typeof matcher.mark === "string" ? matcher.mark : matcher.mark(substring, ...args);
|
|
36904
|
-
return `<${_lodash.default.snakeCase(ret).toUpperCase()}>`;
|
|
36905
|
-
};
|
|
36906
|
-
return str.replace(regex2, replacer);
|
|
36907
|
-
}
|
|
36908
|
-
function applyMatcherReplacement(matchers, str, options = {}) {
|
|
36909
|
-
return matchers.reduce((ret, matcher) => {
|
|
36910
|
-
return applyPathMatcher(matcher, ret, options);
|
|
36911
|
-
}, str);
|
|
36912
|
-
}
|
|
36913
|
-
var createDefaultPathMatchers = (root) => {
|
|
36914
|
-
const ret = [
|
|
36915
|
-
{
|
|
36916
|
-
match: RegExp("(?<=\\/)(\\.pnpm\\/.+?\\/node_modules)(?=\\/)"),
|
|
36917
|
-
mark: "pnpmInner"
|
|
36918
|
-
}
|
|
36919
|
-
];
|
|
36920
|
-
const tmpdir = (0, _path.getRealTemporaryDirectory)();
|
|
36921
|
-
tmpdir && ret.push({
|
|
36922
|
-
match: tmpdir,
|
|
36923
|
-
mark: "temp"
|
|
36924
|
-
});
|
|
36925
|
-
ret.push({
|
|
36926
|
-
match: _os.default.tmpdir(),
|
|
36927
|
-
mark: "temp"
|
|
36928
|
-
});
|
|
36929
|
-
ret.push({
|
|
36930
|
-
match: _os.default.homedir(),
|
|
36931
|
-
mark: "home"
|
|
36932
|
-
});
|
|
36933
|
-
ret.push(...matchUpwardPathsAsUnknown(root));
|
|
36934
|
-
return ret;
|
|
36935
|
-
};
|
|
36936
|
-
}
|
|
36937
|
-
});
|
|
36938
|
-
|
|
36939
36854
|
// ../../../toolkit/utils/dist/cjs/cli/port.js
|
|
36940
36855
|
var require_port = __commonJS({
|
|
36941
36856
|
"../../../toolkit/utils/dist/cjs/cli/port.js"(exports) {
|
|
@@ -37070,19 +36985,19 @@ var require_prettyInstructions = __commonJS({
|
|
|
37070
36985
|
}, []);
|
|
37071
36986
|
};
|
|
37072
36987
|
var prettyInstructions = (appContext, config) => {
|
|
37073
|
-
var _appContext_builder_context_devServer, _appContext_builder, _config_dev;
|
|
36988
|
+
var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source;
|
|
37074
36989
|
const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
|
|
37075
36990
|
const isHttps = (0, _is.isDev)() && ((_appContext_builder = appContext.builder) === null || _appContext_builder === void 0 ? void 0 : (_appContext_builder_context_devServer = _appContext_builder.context.devServer) === null || _appContext_builder_context_devServer === void 0 ? void 0 : _appContext_builder_context_devServer.https);
|
|
37076
36991
|
const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
|
|
37077
36992
|
const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
|
|
37078
36993
|
let message = "App running at:\n\n";
|
|
37079
|
-
if ((0, _is.isSingleEntry)(entrypoints) || apiOnly) {
|
|
36994
|
+
if ((0, _is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
|
|
37080
36995
|
message += urls.map(({ label, url }) => ` ${_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
|
|
37081
36996
|
`).join("");
|
|
37082
36997
|
} else {
|
|
37083
36998
|
const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
|
|
37084
36999
|
urls.forEach(({ label, url }) => {
|
|
37085
|
-
message += ` ${_compiled.chalk.bold(`> ${label}`)}
|
|
37000
|
+
message += ` ${_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? _compiled.chalk.cyanBright(url) : ""}
|
|
37086
37001
|
`;
|
|
37087
37002
|
routes.forEach(({ entryName, urlPath, isSSR }) => {
|
|
37088
37003
|
if (!checkedEntries.includes(entryName)) {
|
|
@@ -37331,7 +37246,6 @@ var require_cli = __commonJS({
|
|
|
37331
37246
|
_export_star._(require_monorepo(), exports);
|
|
37332
37247
|
_export_star._(require_package2(), exports);
|
|
37333
37248
|
_export_star._(require_path(), exports);
|
|
37334
|
-
_export_star._(require_pathSerializer(), exports);
|
|
37335
37249
|
_export_star._(require_port(), exports);
|
|
37336
37250
|
_export_star._(require_prettyInstructions(), exports);
|
|
37337
37251
|
_export_star._(require_require(), exports);
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.1.
|
|
18
|
+
"version": "3.1.31",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./src/index.ts",
|
|
21
21
|
"main": "./dist/index.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"@types/node": "^14",
|
|
32
32
|
"jest": "^29",
|
|
33
33
|
"typescript": "^5",
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@modern-js/generator-
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
34
|
+
"@scripts/build": "2.29.0",
|
|
35
|
+
"@scripts/jest-config": "2.29.0",
|
|
36
|
+
"@modern-js/generator-common": "3.1.31",
|
|
37
|
+
"@modern-js/dependence-generator": "3.1.31",
|
|
38
|
+
"@modern-js/generator-utils": "3.1.31"
|
|
39
39
|
},
|
|
40
40
|
"sideEffects": false,
|
|
41
41
|
"publishConfig": {
|