@modern-js/base-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 +5 -5
package/dist/index.js
CHANGED
|
@@ -113803,6 +113803,8 @@ var require_chainId = __commonJS({
|
|
|
113803
113803
|
CSS_MODULES_TS: "css-modules-typescript",
|
|
113804
113804
|
/** mini-css-extract-plugin.loader */
|
|
113805
113805
|
MINI_CSS_EXTRACT: "mini-css-extract",
|
|
113806
|
+
/** resolve-url-loader */
|
|
113807
|
+
RESOLVE_URL_LOADER_FOR_SASS: "resolve-url-loader",
|
|
113806
113808
|
/** builder-plugin-image-compress.loader */
|
|
113807
113809
|
IMAGE_COMPRESS: "image-compress",
|
|
113808
113810
|
/** builder-plugin-image-compress svgo-loader */
|
|
@@ -113850,6 +113852,10 @@ var require_chainId = __commonJS({
|
|
|
113850
113852
|
HTML_NONCE: "html-nonce",
|
|
113851
113853
|
/** HtmlCrossOriginPlugin */
|
|
113852
113854
|
HTML_CROSS_ORIGIN: "html-cross-origin",
|
|
113855
|
+
/** htmlPreconnectPlugin */
|
|
113856
|
+
HTML_PRECONNECT: "html-preconnect-plugin",
|
|
113857
|
+
/** htmlDnsPrefetchPlugin */
|
|
113858
|
+
HTML_DNS_PREFETCH: "html-dns-prefetch-plugin",
|
|
113853
113859
|
/** MiniCssExtractPlugin */
|
|
113854
113860
|
MINI_CSS_EXTRACT: "mini-css-extract",
|
|
113855
113861
|
/** VueLoaderPlugin */
|
|
@@ -114013,7 +114019,7 @@ var require_constants = __commonJS({
|
|
|
114013
114019
|
var API_DIR = "api";
|
|
114014
114020
|
var SERVER_DIR = "server";
|
|
114015
114021
|
var SHARED_DIR = "shared";
|
|
114016
|
-
var CONFIG_CACHE_DIR = "./node_modules/.cache/
|
|
114022
|
+
var CONFIG_CACHE_DIR = "./node_modules/.cache/bundle-require";
|
|
114017
114023
|
var CONFIG_FILE_EXTENSIONS = [
|
|
114018
114024
|
".js",
|
|
114019
114025
|
".ts",
|
|
@@ -114320,6 +114326,7 @@ var require_config2 = __commonJS({
|
|
|
114320
114326
|
return isSingleEntry;
|
|
114321
114327
|
}
|
|
114322
114328
|
});
|
|
114329
|
+
var _constants = require_constants();
|
|
114323
114330
|
var _type = require_type();
|
|
114324
114331
|
var isSSR = (config) => {
|
|
114325
114332
|
var _server, _server1;
|
|
@@ -114357,12 +114364,12 @@ var require_config2 = __commonJS({
|
|
|
114357
114364
|
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";
|
|
114358
114365
|
};
|
|
114359
114366
|
var isSSGEntry = (config, entryName, entrypoints) => {
|
|
114360
|
-
var _ssgConfig, _ssgConfig1;
|
|
114367
|
+
var _config_source, _ssgConfig, _ssgConfig1;
|
|
114361
114368
|
const ssgConfig = config.output.ssg;
|
|
114362
|
-
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]);
|
|
114369
|
+
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]);
|
|
114363
114370
|
return useSSG;
|
|
114364
114371
|
};
|
|
114365
|
-
var isSingleEntry = (entrypoints) => entrypoints.length === 1 && entrypoints[0].entryName ===
|
|
114372
|
+
var isSingleEntry = (entrypoints, mainEntryName = _constants.MAIN_ENTRY_NAME) => entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
|
|
114366
114373
|
}
|
|
114367
114374
|
});
|
|
114368
114375
|
|
|
@@ -114909,6 +114916,9 @@ var require_logger2 = __commonJS({
|
|
|
114909
114916
|
});
|
|
114910
114917
|
}
|
|
114911
114918
|
_export(exports, {
|
|
114919
|
+
isErrorStackMessage: function() {
|
|
114920
|
+
return isErrorStackMessage;
|
|
114921
|
+
},
|
|
114912
114922
|
Logger: function() {
|
|
114913
114923
|
return Logger;
|
|
114914
114924
|
},
|
|
@@ -114959,6 +114969,9 @@ var require_logger2 = __commonJS({
|
|
|
114959
114969
|
displayLabel: true,
|
|
114960
114970
|
uppercaseLabel: false
|
|
114961
114971
|
};
|
|
114972
|
+
var errorStackRegExp = /^\s*at\s.*:\d+:\d+[\s)]*$/;
|
|
114973
|
+
var anonymousErrorStackRegExp = /^\s*at\s.*\(<anonymous>\)$/;
|
|
114974
|
+
var isErrorStackMessage = (message) => errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
114962
114975
|
var Logger = class {
|
|
114963
114976
|
_log(type, message, ...args) {
|
|
114964
114977
|
if (message === void 0 || message === null) {
|
|
@@ -114984,6 +114997,9 @@ ${_chalk.default.grey(rest.join("\n"))}`;
|
|
|
114984
114997
|
} else {
|
|
114985
114998
|
text = message.message;
|
|
114986
114999
|
}
|
|
115000
|
+
} else if (logType.level === "error" && typeof message === "string") {
|
|
115001
|
+
const lines = message.split("\n");
|
|
115002
|
+
text = lines.map((line) => isErrorStackMessage(line) ? _chalk.default.gray(line) : line).join("\n");
|
|
114987
115003
|
} else {
|
|
114988
115004
|
text = `${message}`;
|
|
114989
115005
|
}
|
|
@@ -115165,15 +115181,6 @@ var require_path = __commonJS({
|
|
|
115165
115181
|
getTemplatePath: function() {
|
|
115166
115182
|
return getTemplatePath;
|
|
115167
115183
|
},
|
|
115168
|
-
compilePathMatcherRegExp: function() {
|
|
115169
|
-
return compilePathMatcherRegExp;
|
|
115170
|
-
},
|
|
115171
|
-
_joinPathParts: function() {
|
|
115172
|
-
return _joinPathParts;
|
|
115173
|
-
},
|
|
115174
|
-
upwardPaths: function() {
|
|
115175
|
-
return upwardPaths;
|
|
115176
|
-
},
|
|
115177
115184
|
getRealTemporaryDirectory: function() {
|
|
115178
115185
|
return getRealTemporaryDirectory;
|
|
115179
115186
|
},
|
|
@@ -115211,20 +115218,6 @@ var require_path = __commonJS({
|
|
|
115211
115218
|
parts.push((0, _compiled.nanoid)());
|
|
115212
115219
|
return _path.default.resolve(...parts);
|
|
115213
115220
|
};
|
|
115214
|
-
function compilePathMatcherRegExp(match) {
|
|
115215
|
-
if (typeof match !== "string") {
|
|
115216
|
-
return match;
|
|
115217
|
-
}
|
|
115218
|
-
const escaped = _compiled.lodash.escapeRegExp(match);
|
|
115219
|
-
return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`);
|
|
115220
|
-
}
|
|
115221
|
-
var _joinPathParts = (_part, i, parts) => (0, _compiled.lodash)(parts).filter((part) => ![
|
|
115222
|
-
"/",
|
|
115223
|
-
"\\"
|
|
115224
|
-
].includes(part)).tap((parts2) => parts2.unshift("")).slice(0, i + 2).join("/");
|
|
115225
|
-
function upwardPaths(start) {
|
|
115226
|
-
return (0, _compiled.lodash)(start).split(/[/\\]/).filter(Boolean).map(_joinPathParts).reverse().push("/").value();
|
|
115227
|
-
}
|
|
115228
115221
|
function getRealTemporaryDirectory() {
|
|
115229
115222
|
let ret = null;
|
|
115230
115223
|
try {
|
|
@@ -115476,84 +115469,6 @@ var require_monorepo = __commonJS({
|
|
|
115476
115469
|
}
|
|
115477
115470
|
});
|
|
115478
115471
|
|
|
115479
|
-
// ../../../toolkit/utils/dist/cjs/cli/pathSerializer.js
|
|
115480
|
-
var require_pathSerializer = __commonJS({
|
|
115481
|
-
"../../../toolkit/utils/dist/cjs/cli/pathSerializer.js"(exports) {
|
|
115482
|
-
"use strict";
|
|
115483
|
-
Object.defineProperty(exports, "__esModule", {
|
|
115484
|
-
value: true
|
|
115485
|
-
});
|
|
115486
|
-
function _export(target, all) {
|
|
115487
|
-
for (var name in all)
|
|
115488
|
-
Object.defineProperty(target, name, {
|
|
115489
|
-
enumerable: true,
|
|
115490
|
-
get: all[name]
|
|
115491
|
-
});
|
|
115492
|
-
}
|
|
115493
|
-
_export(exports, {
|
|
115494
|
-
matchUpwardPathsAsUnknown: function() {
|
|
115495
|
-
return matchUpwardPathsAsUnknown;
|
|
115496
|
-
},
|
|
115497
|
-
applyPathMatcher: function() {
|
|
115498
|
-
return applyPathMatcher;
|
|
115499
|
-
},
|
|
115500
|
-
applyMatcherReplacement: function() {
|
|
115501
|
-
return applyMatcherReplacement;
|
|
115502
|
-
},
|
|
115503
|
-
createDefaultPathMatchers: function() {
|
|
115504
|
-
return createDefaultPathMatchers;
|
|
115505
|
-
}
|
|
115506
|
-
});
|
|
115507
|
-
var _interop_require_default = require_interop_require_default();
|
|
115508
|
-
var _os = /* @__PURE__ */ _interop_require_default._(require("os"));
|
|
115509
|
-
var _lodash = /* @__PURE__ */ _interop_require_default._(require_lodash4());
|
|
115510
|
-
var _path = require_path();
|
|
115511
|
-
var matchUpwardPathsAsUnknown = (p) => (0, _lodash.default)((0, _path.upwardPaths)((0, _path.normalizeToPosixPath)(p))).map((match) => ({
|
|
115512
|
-
match,
|
|
115513
|
-
mark: "unknown"
|
|
115514
|
-
})).slice(1, -1).value();
|
|
115515
|
-
function applyPathMatcher(matcher, str, options = {}) {
|
|
115516
|
-
const regex2 = (0, _path.compilePathMatcherRegExp)(matcher.match);
|
|
115517
|
-
const replacer = (substring, ...args) => {
|
|
115518
|
-
if (options.minPartials && (0, _path.splitPathString)(substring).length < options.minPartials) {
|
|
115519
|
-
return substring;
|
|
115520
|
-
}
|
|
115521
|
-
const ret = typeof matcher.mark === "string" ? matcher.mark : matcher.mark(substring, ...args);
|
|
115522
|
-
return `<${_lodash.default.snakeCase(ret).toUpperCase()}>`;
|
|
115523
|
-
};
|
|
115524
|
-
return str.replace(regex2, replacer);
|
|
115525
|
-
}
|
|
115526
|
-
function applyMatcherReplacement(matchers, str, options = {}) {
|
|
115527
|
-
return matchers.reduce((ret, matcher) => {
|
|
115528
|
-
return applyPathMatcher(matcher, ret, options);
|
|
115529
|
-
}, str);
|
|
115530
|
-
}
|
|
115531
|
-
var createDefaultPathMatchers = (root) => {
|
|
115532
|
-
const ret = [
|
|
115533
|
-
{
|
|
115534
|
-
match: RegExp("(?<=\\/)(\\.pnpm\\/.+?\\/node_modules)(?=\\/)"),
|
|
115535
|
-
mark: "pnpmInner"
|
|
115536
|
-
}
|
|
115537
|
-
];
|
|
115538
|
-
const tmpdir = (0, _path.getRealTemporaryDirectory)();
|
|
115539
|
-
tmpdir && ret.push({
|
|
115540
|
-
match: tmpdir,
|
|
115541
|
-
mark: "temp"
|
|
115542
|
-
});
|
|
115543
|
-
ret.push({
|
|
115544
|
-
match: _os.default.tmpdir(),
|
|
115545
|
-
mark: "temp"
|
|
115546
|
-
});
|
|
115547
|
-
ret.push({
|
|
115548
|
-
match: _os.default.homedir(),
|
|
115549
|
-
mark: "home"
|
|
115550
|
-
});
|
|
115551
|
-
ret.push(...matchUpwardPathsAsUnknown(root));
|
|
115552
|
-
return ret;
|
|
115553
|
-
};
|
|
115554
|
-
}
|
|
115555
|
-
});
|
|
115556
|
-
|
|
115557
115472
|
// ../../../toolkit/utils/dist/cjs/cli/port.js
|
|
115558
115473
|
var require_port = __commonJS({
|
|
115559
115474
|
"../../../toolkit/utils/dist/cjs/cli/port.js"(exports) {
|
|
@@ -115688,19 +115603,19 @@ var require_prettyInstructions = __commonJS({
|
|
|
115688
115603
|
}, []);
|
|
115689
115604
|
};
|
|
115690
115605
|
var prettyInstructions = (appContext, config) => {
|
|
115691
|
-
var _appContext_builder_context_devServer, _appContext_builder, _config_dev;
|
|
115606
|
+
var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source;
|
|
115692
115607
|
const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
|
|
115693
115608
|
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);
|
|
115694
115609
|
const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
|
|
115695
115610
|
const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
|
|
115696
115611
|
let message = "App running at:\n\n";
|
|
115697
|
-
if ((0, _is.isSingleEntry)(entrypoints) || apiOnly) {
|
|
115612
|
+
if ((0, _is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
|
|
115698
115613
|
message += urls.map(({ label, url }) => ` ${_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
|
|
115699
115614
|
`).join("");
|
|
115700
115615
|
} else {
|
|
115701
115616
|
const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
|
|
115702
115617
|
urls.forEach(({ label, url }) => {
|
|
115703
|
-
message += ` ${_compiled.chalk.bold(`> ${label}`)}
|
|
115618
|
+
message += ` ${_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? _compiled.chalk.cyanBright(url) : ""}
|
|
115704
115619
|
`;
|
|
115705
115620
|
routes.forEach(({ entryName, urlPath, isSSR }) => {
|
|
115706
115621
|
if (!checkedEntries.includes(entryName)) {
|
|
@@ -115949,7 +115864,6 @@ var require_cli = __commonJS({
|
|
|
115949
115864
|
_export_star._(require_monorepo(), exports);
|
|
115950
115865
|
_export_star._(require_package4(), exports);
|
|
115951
115866
|
_export_star._(require_path(), exports);
|
|
115952
|
-
_export_star._(require_pathSerializer(), exports);
|
|
115953
115867
|
_export_star._(require_port(), exports);
|
|
115954
115868
|
_export_star._(require_prettyInstructions(), exports);
|
|
115955
115869
|
_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",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"@types/node": "^14",
|
|
31
31
|
"jest": "^29",
|
|
32
32
|
"typescript": "^5",
|
|
33
|
-
"@modern-js/generator-utils": "3.1.
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@scripts/
|
|
33
|
+
"@modern-js/generator-utils": "3.1.31",
|
|
34
|
+
"@scripts/build": "2.29.0",
|
|
35
|
+
"@modern-js/generator-common": "3.1.31",
|
|
36
|
+
"@scripts/jest-config": "2.29.0"
|
|
37
37
|
},
|
|
38
38
|
"sideEffects": false,
|
|
39
39
|
"publishConfig": {
|