@modern-js/dependence-generator 3.1.29 → 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.
Files changed (2) hide show
  1. package/dist/index.js +44 -122
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -115356,6 +115356,8 @@ var require_chainId = __commonJS({
115356
115356
  YAML: "yaml",
115357
115357
  /** Rule for wasm */
115358
115358
  WASM: "wasm",
115359
+ /** Rule for node */
115360
+ NODE: "node",
115359
115361
  /** Rule for bff */
115360
115362
  JS_BFF_API: "js-bff-api"
115361
115363
  },
@@ -115394,6 +115396,8 @@ var require_chainId = __commonJS({
115394
115396
  TOML: "toml",
115395
115397
  /** html-loader */
115396
115398
  HTML: "html",
115399
+ /** node-loader */
115400
+ NODE: "html",
115397
115401
  /** babel-loader */
115398
115402
  BABEL: "babel",
115399
115403
  /** esbuild-loader */
@@ -115412,6 +115416,8 @@ var require_chainId = __commonJS({
115412
115416
  CSS_MODULES_TS: "css-modules-typescript",
115413
115417
  /** mini-css-extract-plugin.loader */
115414
115418
  MINI_CSS_EXTRACT: "mini-css-extract",
115419
+ /** resolve-url-loader */
115420
+ RESOLVE_URL_LOADER_FOR_SASS: "resolve-url-loader",
115415
115421
  /** builder-plugin-image-compress.loader */
115416
115422
  IMAGE_COMPRESS: "image-compress",
115417
115423
  /** builder-plugin-image-compress svgo-loader */
@@ -115459,6 +115465,10 @@ var require_chainId = __commonJS({
115459
115465
  HTML_NONCE: "html-nonce",
115460
115466
  /** HtmlCrossOriginPlugin */
115461
115467
  HTML_CROSS_ORIGIN: "html-cross-origin",
115468
+ /** htmlPreconnectPlugin */
115469
+ HTML_PRECONNECT: "html-preconnect-plugin",
115470
+ /** htmlDnsPrefetchPlugin */
115471
+ HTML_DNS_PREFETCH: "html-dns-prefetch-plugin",
115462
115472
  /** MiniCssExtractPlugin */
115463
115473
  MINI_CSS_EXTRACT: "mini-css-extract",
115464
115474
  /** VueLoaderPlugin */
@@ -115622,7 +115632,7 @@ var require_constants = __commonJS({
115622
115632
  var API_DIR = "api";
115623
115633
  var SERVER_DIR = "server";
115624
115634
  var SHARED_DIR = "shared";
115625
- var CONFIG_CACHE_DIR = "./node_modules/.cache/node-bundle-require";
115635
+ var CONFIG_CACHE_DIR = "./node_modules/.cache/bundle-require";
115626
115636
  var CONFIG_FILE_EXTENSIONS = [
115627
115637
  ".js",
115628
115638
  ".ts",
@@ -115654,7 +115664,6 @@ var require_constants = __commonJS({
115654
115664
  };
115655
115665
  var INTERNAL_MODULE_TOOLS_PLUGINS = {
115656
115666
  "@modern-js/module-tools": "@modern-js/module-tools",
115657
- "@modern-js/doc-tools": "@modern-js/doc-tools",
115658
115667
  "@modern-js/runtime": "@modern-js/runtime/cli",
115659
115668
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
115660
115669
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
@@ -115930,13 +115939,15 @@ var require_config2 = __commonJS({
115930
115939
  return isSingleEntry;
115931
115940
  }
115932
115941
  });
115942
+ var _constants = require_constants();
115933
115943
  var _type = require_type();
115934
115944
  var isSSR = (config) => {
115945
+ var _server, _server1;
115935
115946
  const { server } = config;
115936
- if (server === null || server === void 0 ? void 0 : server.ssr) {
115947
+ if ((_server = server) === null || _server === void 0 ? void 0 : _server.ssr) {
115937
115948
  return true;
115938
115949
  }
115939
- if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && !(0, _type.isEmpty)(server.ssrByEntries)) {
115950
+ if (((_server1 = server) === null || _server1 === void 0 ? void 0 : _server1.ssrByEntries) && !(0, _type.isEmpty)(server.ssrByEntries)) {
115940
115951
  for (const name of Object.keys(server.ssrByEntries)) {
115941
115952
  if (server.ssrByEntries[name]) {
115942
115953
  return true;
@@ -115946,30 +115957,32 @@ var require_config2 = __commonJS({
115946
115957
  return false;
115947
115958
  };
115948
115959
  var isUseSSRBundle = (config) => {
115960
+ var _output;
115949
115961
  const { output: output2 } = config;
115950
- if (output2 === null || output2 === void 0 ? void 0 : output2.ssg) {
115962
+ if ((_output = output2) === null || _output === void 0 ? void 0 : _output.ssg) {
115951
115963
  return true;
115952
115964
  }
115953
115965
  return isSSR(config);
115954
115966
  };
115955
115967
  var isServiceWorker = (config) => {
115956
- var _deploy_worker;
115968
+ var _deploy_worker, _deploy, _output;
115957
115969
  const { output: output2, deploy } = config;
115958
- if ((deploy === null || deploy === void 0 ? void 0 : (_deploy_worker = deploy.worker) === null || _deploy_worker === void 0 ? void 0 : _deploy_worker.ssr) && ((output2 === null || output2 === void 0 ? void 0 : output2.ssg) || isSSR(config))) {
115970
+ if (((_deploy = deploy) === null || _deploy === void 0 ? void 0 : (_deploy_worker = _deploy.worker) === null || _deploy_worker === void 0 ? void 0 : _deploy_worker.ssr) && (((_output = output2) === null || _output === void 0 ? void 0 : _output.ssg) || isSSR(config))) {
115959
115971
  return true;
115960
115972
  }
115961
115973
  return false;
115962
115974
  };
115963
115975
  var isRouterV5 = (config) => {
115964
- var _config_runtime, _config_runtime1, _config_runtime_router;
115965
- return typeof ((_config_runtime = config.runtime) === null || _config_runtime === void 0 ? void 0 : _config_runtime.router) !== "boolean" && (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";
115976
+ var _config_runtime, _config_runtime_router, _config_runtime1, _config;
115977
+ 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";
115966
115978
  };
115967
115979
  var isSSGEntry = (config, entryName, entrypoints) => {
115980
+ var _config_source, _ssgConfig, _ssgConfig1;
115968
115981
  const ssgConfig = config.output.ssg;
115969
- const useSSG = isSingleEntry(entrypoints) ? Boolean(ssgConfig) : ssgConfig === true || typeof (ssgConfig === null || ssgConfig === void 0 ? void 0 : ssgConfig[0]) === "function" || Boolean(ssgConfig === null || ssgConfig === void 0 ? void 0 : ssgConfig[entryName]);
115982
+ 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]);
115970
115983
  return useSSG;
115971
115984
  };
115972
- var isSingleEntry = (entrypoints) => entrypoints.length === 1 && entrypoints[0].entryName === "main";
115985
+ var isSingleEntry = (entrypoints, mainEntryName = _constants.MAIN_ENTRY_NAME) => entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
115973
115986
  }
115974
115987
  });
115975
115988
 
@@ -116516,6 +116529,9 @@ var require_logger2 = __commonJS({
116516
116529
  });
116517
116530
  }
116518
116531
  _export(exports, {
116532
+ isErrorStackMessage: function() {
116533
+ return isErrorStackMessage;
116534
+ },
116519
116535
  Logger: function() {
116520
116536
  return Logger;
116521
116537
  },
@@ -116566,6 +116582,9 @@ var require_logger2 = __commonJS({
116566
116582
  displayLabel: true,
116567
116583
  uppercaseLabel: false
116568
116584
  };
116585
+ var errorStackRegExp = /^\s*at\s.*:\d+:\d+[\s)]*$/;
116586
+ var anonymousErrorStackRegExp = /^\s*at\s.*\(<anonymous>\)$/;
116587
+ var isErrorStackMessage = (message) => errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
116569
116588
  var Logger = class {
116570
116589
  _log(type, message, ...args) {
116571
116590
  if (message === void 0 || message === null) {
@@ -116591,6 +116610,9 @@ ${_chalk.default.grey(rest.join("\n"))}`;
116591
116610
  } else {
116592
116611
  text = message.message;
116593
116612
  }
116613
+ } else if (logType.level === "error" && typeof message === "string") {
116614
+ const lines = message.split("\n");
116615
+ text = lines.map((line) => isErrorStackMessage(line) ? _chalk.default.gray(line) : line).join("\n");
116594
116616
  } else {
116595
116617
  text = `${message}`;
116596
116618
  }
@@ -116713,7 +116735,7 @@ var require_alias = __commonJS({
116713
116735
  };
116714
116736
  var mergeAlias = (alias) => (0, _applyOptionsChain.applyOptionsChain)({}, alias);
116715
116737
  var getAliasConfig = (aliasOption, option) => {
116716
- var _tsconfig_compilerOptions, _tsconfig_compilerOptions1;
116738
+ var _tsconfig_compilerOptions, _tsconfig, _tsconfig_compilerOptions1, _tsconfig1;
116717
116739
  const isTsProject2 = _fs.default.existsSync(option.tsconfigPath);
116718
116740
  const alias = mergeAlias(aliasOption);
116719
116741
  if (!isTsProject2) {
@@ -116725,10 +116747,10 @@ var require_alias = __commonJS({
116725
116747
  };
116726
116748
  }
116727
116749
  const tsconfig = (0, _get.readTsConfigByFile)(option.tsconfigPath);
116728
- const baseUrl = tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
116750
+ const baseUrl = (_tsconfig = tsconfig) === null || _tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = _tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
116729
116751
  return {
116730
116752
  absoluteBaseUrl: baseUrl ? _path.default.join(option.appDirectory, baseUrl) : option.appDirectory,
116731
- paths: __spreadValues(__spreadValues({}, alias), tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions1 = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions1 === void 0 ? void 0 : _tsconfig_compilerOptions1.paths),
116753
+ paths: __spreadValues(__spreadValues({}, alias), (_tsconfig1 = tsconfig) === null || _tsconfig1 === void 0 ? void 0 : (_tsconfig_compilerOptions1 = _tsconfig1.compilerOptions) === null || _tsconfig_compilerOptions1 === void 0 ? void 0 : _tsconfig_compilerOptions1.paths),
116732
116754
  isTsPath: true,
116733
116755
  isTsProject: isTsProject2
116734
116756
  };
@@ -116772,15 +116794,6 @@ var require_path = __commonJS({
116772
116794
  getTemplatePath: function() {
116773
116795
  return getTemplatePath;
116774
116796
  },
116775
- compilePathMatcherRegExp: function() {
116776
- return compilePathMatcherRegExp;
116777
- },
116778
- _joinPathParts: function() {
116779
- return _joinPathParts;
116780
- },
116781
- upwardPaths: function() {
116782
- return upwardPaths;
116783
- },
116784
116797
  getRealTemporaryDirectory: function() {
116785
116798
  return getRealTemporaryDirectory;
116786
116799
  },
@@ -116818,20 +116831,6 @@ var require_path = __commonJS({
116818
116831
  parts.push((0, _compiled.nanoid)());
116819
116832
  return _path.default.resolve(...parts);
116820
116833
  };
116821
- function compilePathMatcherRegExp(match) {
116822
- if (typeof match !== "string") {
116823
- return match;
116824
- }
116825
- const escaped = _compiled.lodash.escapeRegExp(match);
116826
- return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`);
116827
- }
116828
- var _joinPathParts = (_part, i, parts) => (0, _compiled.lodash)(parts).filter((part) => ![
116829
- "/",
116830
- "\\"
116831
- ].includes(part)).tap((parts2) => parts2.unshift("")).slice(0, i + 2).join("/");
116832
- function upwardPaths(start) {
116833
- return (0, _compiled.lodash)(start).split(/[/\\]/).filter(Boolean).map(_joinPathParts).reverse().push("/").value();
116834
- }
116835
116834
  function getRealTemporaryDirectory() {
116836
116835
  let ret = null;
116837
116836
  try {
@@ -117083,84 +117082,6 @@ var require_monorepo = __commonJS({
117083
117082
  }
117084
117083
  });
117085
117084
 
117086
- // ../../../toolkit/utils/dist/cjs/cli/pathSerializer.js
117087
- var require_pathSerializer = __commonJS({
117088
- "../../../toolkit/utils/dist/cjs/cli/pathSerializer.js"(exports) {
117089
- "use strict";
117090
- Object.defineProperty(exports, "__esModule", {
117091
- value: true
117092
- });
117093
- function _export(target, all) {
117094
- for (var name in all)
117095
- Object.defineProperty(target, name, {
117096
- enumerable: true,
117097
- get: all[name]
117098
- });
117099
- }
117100
- _export(exports, {
117101
- matchUpwardPathsAsUnknown: function() {
117102
- return matchUpwardPathsAsUnknown;
117103
- },
117104
- applyPathMatcher: function() {
117105
- return applyPathMatcher;
117106
- },
117107
- applyMatcherReplacement: function() {
117108
- return applyMatcherReplacement;
117109
- },
117110
- createDefaultPathMatchers: function() {
117111
- return createDefaultPathMatchers;
117112
- }
117113
- });
117114
- var _interop_require_default = require_interop_require_default();
117115
- var _os = /* @__PURE__ */ _interop_require_default._(require("os"));
117116
- var _lodash = /* @__PURE__ */ _interop_require_default._(require_lodash4());
117117
- var _path = require_path();
117118
- var matchUpwardPathsAsUnknown = (p) => (0, _lodash.default)((0, _path.upwardPaths)((0, _path.normalizeToPosixPath)(p))).map((match) => ({
117119
- match,
117120
- mark: "unknown"
117121
- })).slice(1, -1).value();
117122
- function applyPathMatcher(matcher, str, options = {}) {
117123
- const regex2 = (0, _path.compilePathMatcherRegExp)(matcher.match);
117124
- const replacer = (substring, ...args) => {
117125
- if (options.minPartials && (0, _path.splitPathString)(substring).length < options.minPartials) {
117126
- return substring;
117127
- }
117128
- const ret = typeof matcher.mark === "string" ? matcher.mark : matcher.mark(substring, ...args);
117129
- return `<${_lodash.default.snakeCase(ret).toUpperCase()}>`;
117130
- };
117131
- return str.replace(regex2, replacer);
117132
- }
117133
- function applyMatcherReplacement(matchers, str, options = {}) {
117134
- return matchers.reduce((ret, matcher) => {
117135
- return applyPathMatcher(matcher, ret, options);
117136
- }, str);
117137
- }
117138
- var createDefaultPathMatchers = (root) => {
117139
- const ret = [
117140
- {
117141
- match: RegExp("(?<=\\/)(\\.pnpm\\/.+?\\/node_modules)(?=\\/)"),
117142
- mark: "pnpmInner"
117143
- }
117144
- ];
117145
- const tmpdir = (0, _path.getRealTemporaryDirectory)();
117146
- tmpdir && ret.push({
117147
- match: tmpdir,
117148
- mark: "temp"
117149
- });
117150
- ret.push({
117151
- match: _os.default.tmpdir(),
117152
- mark: "temp"
117153
- });
117154
- ret.push({
117155
- match: _os.default.homedir(),
117156
- mark: "home"
117157
- });
117158
- ret.push(...matchUpwardPathsAsUnknown(root));
117159
- return ret;
117160
- };
117161
- }
117162
- });
117163
-
117164
117085
  // ../../../toolkit/utils/dist/cjs/cli/port.js
117165
117086
  var require_port = __commonJS({
117166
117087
  "../../../toolkit/utils/dist/cjs/cli/port.js"(exports) {
@@ -117267,7 +117188,8 @@ var require_prettyInstructions = __commonJS({
117267
117188
  const LOCAL_LABEL = "Local: ";
117268
117189
  const NETWORK_LABEL = "Network: ";
117269
117190
  const isLocalhost = (url) => {
117270
- return url === null || url === void 0 ? void 0 : url.includes("localhost");
117191
+ var _url;
117192
+ return (_url = url) === null || _url === void 0 ? void 0 : _url.includes("localhost");
117271
117193
  };
117272
117194
  if (host && host !== _constants.DEFAULT_DEV_HOST) {
117273
117195
  return [
@@ -117294,19 +117216,19 @@ var require_prettyInstructions = __commonJS({
117294
117216
  }, []);
117295
117217
  };
117296
117218
  var prettyInstructions = (appContext, config) => {
117297
- var _appContext_builder_context_devServer, _appContext_builder, _config_dev;
117219
+ var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source;
117298
117220
  const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
117299
- const isHttps = (0, _is.isDev)() && ((_appContext_builder_context_devServer = (_appContext_builder = appContext.builder) === null || _appContext_builder === void 0 ? void 0 : _appContext_builder.context.devServer) === null || _appContext_builder_context_devServer === void 0 ? void 0 : _appContext_builder_context_devServer.https);
117221
+ 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);
117300
117222
  const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
117301
117223
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
117302
117224
  let message = "App running at:\n\n";
117303
- if ((0, _is.isSingleEntry)(entrypoints) || apiOnly) {
117225
+ if ((0, _is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
117304
117226
  message += urls.map(({ label, url }) => ` ${_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
117305
117227
  `).join("");
117306
117228
  } else {
117307
117229
  const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
117308
117230
  urls.forEach(({ label, url }) => {
117309
- message += ` ${_compiled.chalk.bold(`> ${label}`)}
117231
+ message += ` ${_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? _compiled.chalk.cyanBright(url) : ""}
117310
117232
  `;
117311
117233
  routes.forEach(({ entryName, urlPath, isSSR }) => {
117312
117234
  if (!checkedEntries.includes(entryName)) {
@@ -117361,8 +117283,9 @@ var require_require = __commonJS({
117361
117283
  });
117362
117284
  var _fs = require_fs();
117363
117285
  var compatRequire = (filePath, interop = true) => {
117286
+ var _mod;
117364
117287
  const mod = require(filePath);
117365
- const rtnESMDefault = interop && (mod === null || mod === void 0 ? void 0 : mod.__esModule);
117288
+ const rtnESMDefault = interop && ((_mod = mod) === null || _mod === void 0 ? void 0 : _mod.__esModule);
117366
117289
  return rtnESMDefault ? mod.default : mod;
117367
117290
  };
117368
117291
  var dynamicImport = new Function("modulePath", "return import(modulePath)");
@@ -117554,7 +117477,6 @@ var require_cli = __commonJS({
117554
117477
  _export_star._(require_monorepo(), exports);
117555
117478
  _export_star._(require_package4(), exports);
117556
117479
  _export_star._(require_path(), exports);
117557
- _export_star._(require_pathSerializer(), exports);
117558
117480
  _export_star._(require_port(), exports);
117559
117481
  _export_star._(require_prettyInstructions(), exports);
117560
117482
  _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.29",
18
+ "version": "3.1.31",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "main": "./dist/index.js",
21
21
  "files": [
@@ -30,11 +30,11 @@
30
30
  "@types/node": "^14",
31
31
  "jest": "^29",
32
32
  "typescript": "^5",
33
- "@scripts/build": "2.27.0",
34
- "@scripts/jest-config": "2.27.0",
35
- "@modern-js/plugin-i18n": "2.27.0",
36
- "@modern-js/generator-utils": "3.1.29",
37
- "@modern-js/generator-common": "3.1.29"
33
+ "@scripts/build": "2.29.0",
34
+ "@scripts/jest-config": "2.29.0",
35
+ "@modern-js/plugin-i18n": "2.29.0",
36
+ "@modern-js/generator-utils": "3.1.31",
37
+ "@modern-js/generator-common": "3.1.31"
38
38
  },
39
39
  "sideEffects": false,
40
40
  "publishConfig": {