@modern-js/packages-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
|
@@ -115854,6 +115854,8 @@ var require_chainId = __commonJS({
|
|
|
115854
115854
|
CSS_MODULES_TS: "css-modules-typescript",
|
|
115855
115855
|
/** mini-css-extract-plugin.loader */
|
|
115856
115856
|
MINI_CSS_EXTRACT: "mini-css-extract",
|
|
115857
|
+
/** resolve-url-loader */
|
|
115858
|
+
RESOLVE_URL_LOADER_FOR_SASS: "resolve-url-loader",
|
|
115857
115859
|
/** builder-plugin-image-compress.loader */
|
|
115858
115860
|
IMAGE_COMPRESS: "image-compress",
|
|
115859
115861
|
/** builder-plugin-image-compress svgo-loader */
|
|
@@ -115901,6 +115903,10 @@ var require_chainId = __commonJS({
|
|
|
115901
115903
|
HTML_NONCE: "html-nonce",
|
|
115902
115904
|
/** HtmlCrossOriginPlugin */
|
|
115903
115905
|
HTML_CROSS_ORIGIN: "html-cross-origin",
|
|
115906
|
+
/** htmlPreconnectPlugin */
|
|
115907
|
+
HTML_PRECONNECT: "html-preconnect-plugin",
|
|
115908
|
+
/** htmlDnsPrefetchPlugin */
|
|
115909
|
+
HTML_DNS_PREFETCH: "html-dns-prefetch-plugin",
|
|
115904
115910
|
/** MiniCssExtractPlugin */
|
|
115905
115911
|
MINI_CSS_EXTRACT: "mini-css-extract",
|
|
115906
115912
|
/** VueLoaderPlugin */
|
|
@@ -116064,7 +116070,7 @@ var require_constants = __commonJS({
|
|
|
116064
116070
|
var API_DIR = "api";
|
|
116065
116071
|
var SERVER_DIR = "server";
|
|
116066
116072
|
var SHARED_DIR = "shared";
|
|
116067
|
-
var CONFIG_CACHE_DIR = "./node_modules/.cache/
|
|
116073
|
+
var CONFIG_CACHE_DIR = "./node_modules/.cache/bundle-require";
|
|
116068
116074
|
var CONFIG_FILE_EXTENSIONS = [
|
|
116069
116075
|
".js",
|
|
116070
116076
|
".ts",
|
|
@@ -116371,6 +116377,7 @@ var require_config2 = __commonJS({
|
|
|
116371
116377
|
return isSingleEntry;
|
|
116372
116378
|
}
|
|
116373
116379
|
});
|
|
116380
|
+
var _constants = require_constants();
|
|
116374
116381
|
var _type = require_type();
|
|
116375
116382
|
var isSSR = (config) => {
|
|
116376
116383
|
var _server, _server1;
|
|
@@ -116408,12 +116415,12 @@ var require_config2 = __commonJS({
|
|
|
116408
116415
|
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";
|
|
116409
116416
|
};
|
|
116410
116417
|
var isSSGEntry = (config, entryName, entrypoints) => {
|
|
116411
|
-
var _ssgConfig, _ssgConfig1;
|
|
116418
|
+
var _config_source, _ssgConfig, _ssgConfig1;
|
|
116412
116419
|
const ssgConfig = config.output.ssg;
|
|
116413
|
-
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]);
|
|
116420
|
+
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]);
|
|
116414
116421
|
return useSSG;
|
|
116415
116422
|
};
|
|
116416
|
-
var isSingleEntry = (entrypoints) => entrypoints.length === 1 && entrypoints[0].entryName ===
|
|
116423
|
+
var isSingleEntry = (entrypoints, mainEntryName = _constants.MAIN_ENTRY_NAME) => entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
|
|
116417
116424
|
}
|
|
116418
116425
|
});
|
|
116419
116426
|
|
|
@@ -116960,6 +116967,9 @@ var require_logger2 = __commonJS({
|
|
|
116960
116967
|
});
|
|
116961
116968
|
}
|
|
116962
116969
|
_export(exports, {
|
|
116970
|
+
isErrorStackMessage: function() {
|
|
116971
|
+
return isErrorStackMessage;
|
|
116972
|
+
},
|
|
116963
116973
|
Logger: function() {
|
|
116964
116974
|
return Logger;
|
|
116965
116975
|
},
|
|
@@ -117010,6 +117020,9 @@ var require_logger2 = __commonJS({
|
|
|
117010
117020
|
displayLabel: true,
|
|
117011
117021
|
uppercaseLabel: false
|
|
117012
117022
|
};
|
|
117023
|
+
var errorStackRegExp = /^\s*at\s.*:\d+:\d+[\s)]*$/;
|
|
117024
|
+
var anonymousErrorStackRegExp = /^\s*at\s.*\(<anonymous>\)$/;
|
|
117025
|
+
var isErrorStackMessage = (message) => errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
117013
117026
|
var Logger = class {
|
|
117014
117027
|
_log(type, message, ...args) {
|
|
117015
117028
|
if (message === void 0 || message === null) {
|
|
@@ -117035,6 +117048,9 @@ ${_chalk.default.grey(rest.join("\n"))}`;
|
|
|
117035
117048
|
} else {
|
|
117036
117049
|
text = message.message;
|
|
117037
117050
|
}
|
|
117051
|
+
} else if (logType.level === "error" && typeof message === "string") {
|
|
117052
|
+
const lines = message.split("\n");
|
|
117053
|
+
text = lines.map((line) => isErrorStackMessage(line) ? _chalk.default.gray(line) : line).join("\n");
|
|
117038
117054
|
} else {
|
|
117039
117055
|
text = `${message}`;
|
|
117040
117056
|
}
|
|
@@ -117216,15 +117232,6 @@ var require_path = __commonJS({
|
|
|
117216
117232
|
getTemplatePath: function() {
|
|
117217
117233
|
return getTemplatePath;
|
|
117218
117234
|
},
|
|
117219
|
-
compilePathMatcherRegExp: function() {
|
|
117220
|
-
return compilePathMatcherRegExp;
|
|
117221
|
-
},
|
|
117222
|
-
_joinPathParts: function() {
|
|
117223
|
-
return _joinPathParts;
|
|
117224
|
-
},
|
|
117225
|
-
upwardPaths: function() {
|
|
117226
|
-
return upwardPaths;
|
|
117227
|
-
},
|
|
117228
117235
|
getRealTemporaryDirectory: function() {
|
|
117229
117236
|
return getRealTemporaryDirectory;
|
|
117230
117237
|
},
|
|
@@ -117262,20 +117269,6 @@ var require_path = __commonJS({
|
|
|
117262
117269
|
parts.push((0, _compiled.nanoid)());
|
|
117263
117270
|
return _path.default.resolve(...parts);
|
|
117264
117271
|
};
|
|
117265
|
-
function compilePathMatcherRegExp(match) {
|
|
117266
|
-
if (typeof match !== "string") {
|
|
117267
|
-
return match;
|
|
117268
|
-
}
|
|
117269
|
-
const escaped = _compiled.lodash.escapeRegExp(match);
|
|
117270
|
-
return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`);
|
|
117271
|
-
}
|
|
117272
|
-
var _joinPathParts = (_part, i, parts) => (0, _compiled.lodash)(parts).filter((part) => ![
|
|
117273
|
-
"/",
|
|
117274
|
-
"\\"
|
|
117275
|
-
].includes(part)).tap((parts2) => parts2.unshift("")).slice(0, i + 2).join("/");
|
|
117276
|
-
function upwardPaths(start) {
|
|
117277
|
-
return (0, _compiled.lodash)(start).split(/[/\\]/).filter(Boolean).map(_joinPathParts).reverse().push("/").value();
|
|
117278
|
-
}
|
|
117279
117272
|
function getRealTemporaryDirectory() {
|
|
117280
117273
|
let ret = null;
|
|
117281
117274
|
try {
|
|
@@ -117527,84 +117520,6 @@ var require_monorepo = __commonJS({
|
|
|
117527
117520
|
}
|
|
117528
117521
|
});
|
|
117529
117522
|
|
|
117530
|
-
// ../../../toolkit/utils/dist/cjs/cli/pathSerializer.js
|
|
117531
|
-
var require_pathSerializer = __commonJS({
|
|
117532
|
-
"../../../toolkit/utils/dist/cjs/cli/pathSerializer.js"(exports) {
|
|
117533
|
-
"use strict";
|
|
117534
|
-
Object.defineProperty(exports, "__esModule", {
|
|
117535
|
-
value: true
|
|
117536
|
-
});
|
|
117537
|
-
function _export(target, all) {
|
|
117538
|
-
for (var name in all)
|
|
117539
|
-
Object.defineProperty(target, name, {
|
|
117540
|
-
enumerable: true,
|
|
117541
|
-
get: all[name]
|
|
117542
|
-
});
|
|
117543
|
-
}
|
|
117544
|
-
_export(exports, {
|
|
117545
|
-
matchUpwardPathsAsUnknown: function() {
|
|
117546
|
-
return matchUpwardPathsAsUnknown;
|
|
117547
|
-
},
|
|
117548
|
-
applyPathMatcher: function() {
|
|
117549
|
-
return applyPathMatcher;
|
|
117550
|
-
},
|
|
117551
|
-
applyMatcherReplacement: function() {
|
|
117552
|
-
return applyMatcherReplacement;
|
|
117553
|
-
},
|
|
117554
|
-
createDefaultPathMatchers: function() {
|
|
117555
|
-
return createDefaultPathMatchers;
|
|
117556
|
-
}
|
|
117557
|
-
});
|
|
117558
|
-
var _interop_require_default = require_interop_require_default();
|
|
117559
|
-
var _os = /* @__PURE__ */ _interop_require_default._(require("os"));
|
|
117560
|
-
var _lodash = /* @__PURE__ */ _interop_require_default._(require_lodash3());
|
|
117561
|
-
var _path = require_path();
|
|
117562
|
-
var matchUpwardPathsAsUnknown = (p) => (0, _lodash.default)((0, _path.upwardPaths)((0, _path.normalizeToPosixPath)(p))).map((match) => ({
|
|
117563
|
-
match,
|
|
117564
|
-
mark: "unknown"
|
|
117565
|
-
})).slice(1, -1).value();
|
|
117566
|
-
function applyPathMatcher(matcher, str, options = {}) {
|
|
117567
|
-
const regex2 = (0, _path.compilePathMatcherRegExp)(matcher.match);
|
|
117568
|
-
const replacer = (substring, ...args) => {
|
|
117569
|
-
if (options.minPartials && (0, _path.splitPathString)(substring).length < options.minPartials) {
|
|
117570
|
-
return substring;
|
|
117571
|
-
}
|
|
117572
|
-
const ret = typeof matcher.mark === "string" ? matcher.mark : matcher.mark(substring, ...args);
|
|
117573
|
-
return `<${_lodash.default.snakeCase(ret).toUpperCase()}>`;
|
|
117574
|
-
};
|
|
117575
|
-
return str.replace(regex2, replacer);
|
|
117576
|
-
}
|
|
117577
|
-
function applyMatcherReplacement(matchers, str, options = {}) {
|
|
117578
|
-
return matchers.reduce((ret, matcher) => {
|
|
117579
|
-
return applyPathMatcher(matcher, ret, options);
|
|
117580
|
-
}, str);
|
|
117581
|
-
}
|
|
117582
|
-
var createDefaultPathMatchers = (root) => {
|
|
117583
|
-
const ret = [
|
|
117584
|
-
{
|
|
117585
|
-
match: RegExp("(?<=\\/)(\\.pnpm\\/.+?\\/node_modules)(?=\\/)"),
|
|
117586
|
-
mark: "pnpmInner"
|
|
117587
|
-
}
|
|
117588
|
-
];
|
|
117589
|
-
const tmpdir = (0, _path.getRealTemporaryDirectory)();
|
|
117590
|
-
tmpdir && ret.push({
|
|
117591
|
-
match: tmpdir,
|
|
117592
|
-
mark: "temp"
|
|
117593
|
-
});
|
|
117594
|
-
ret.push({
|
|
117595
|
-
match: _os.default.tmpdir(),
|
|
117596
|
-
mark: "temp"
|
|
117597
|
-
});
|
|
117598
|
-
ret.push({
|
|
117599
|
-
match: _os.default.homedir(),
|
|
117600
|
-
mark: "home"
|
|
117601
|
-
});
|
|
117602
|
-
ret.push(...matchUpwardPathsAsUnknown(root));
|
|
117603
|
-
return ret;
|
|
117604
|
-
};
|
|
117605
|
-
}
|
|
117606
|
-
});
|
|
117607
|
-
|
|
117608
117523
|
// ../../../toolkit/utils/dist/cjs/cli/port.js
|
|
117609
117524
|
var require_port = __commonJS({
|
|
117610
117525
|
"../../../toolkit/utils/dist/cjs/cli/port.js"(exports) {
|
|
@@ -117739,19 +117654,19 @@ var require_prettyInstructions = __commonJS({
|
|
|
117739
117654
|
}, []);
|
|
117740
117655
|
};
|
|
117741
117656
|
var prettyInstructions = (appContext, config) => {
|
|
117742
|
-
var _appContext_builder_context_devServer, _appContext_builder, _config_dev;
|
|
117657
|
+
var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source;
|
|
117743
117658
|
const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
|
|
117744
117659
|
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);
|
|
117745
117660
|
const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
|
|
117746
117661
|
const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
|
|
117747
117662
|
let message = "App running at:\n\n";
|
|
117748
|
-
if ((0, _is.isSingleEntry)(entrypoints) || apiOnly) {
|
|
117663
|
+
if ((0, _is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
|
|
117749
117664
|
message += urls.map(({ label, url }) => ` ${_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
|
|
117750
117665
|
`).join("");
|
|
117751
117666
|
} else {
|
|
117752
117667
|
const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
|
|
117753
117668
|
urls.forEach(({ label, url }) => {
|
|
117754
|
-
message += ` ${_compiled.chalk.bold(`> ${label}`)}
|
|
117669
|
+
message += ` ${_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? _compiled.chalk.cyanBright(url) : ""}
|
|
117755
117670
|
`;
|
|
117756
117671
|
routes.forEach(({ entryName, urlPath, isSSR }) => {
|
|
117757
117672
|
if (!checkedEntries.includes(entryName)) {
|
|
@@ -118000,7 +117915,6 @@ var require_cli = __commonJS({
|
|
|
118000
117915
|
_export_star._(require_monorepo(), exports);
|
|
118001
117916
|
_export_star._(require_package4(), exports);
|
|
118002
117917
|
_export_star._(require_path(), exports);
|
|
118003
|
-
_export_star._(require_pathSerializer(), exports);
|
|
118004
117918
|
_export_star._(require_port(), exports);
|
|
118005
117919
|
_export_star._(require_prettyInstructions(), exports);
|
|
118006
117920
|
_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
|
"main": "./dist/index.js",
|
|
21
21
|
"files": [
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"@types/node": "^14",
|
|
31
31
|
"jest": "^29",
|
|
32
32
|
"typescript": "^5",
|
|
33
|
-
"@
|
|
34
|
-
"@modern-js/generator-
|
|
35
|
-
"@scripts/
|
|
36
|
-
"@
|
|
33
|
+
"@modern-js/generator-utils": "3.1.31",
|
|
34
|
+
"@modern-js/generator-common": "3.1.31",
|
|
35
|
+
"@scripts/jest-config": "2.29.0",
|
|
36
|
+
"@scripts/build": "2.29.0"
|
|
37
37
|
},
|
|
38
38
|
"sideEffects": false,
|
|
39
39
|
"publishConfig": {
|