@modern-js/server-generator 3.2.1 → 3.2.2

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 +25 -26
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -34231,8 +34231,6 @@ var require_chainId = __commonJS({
34231
34231
  STYLE: "style-loader",
34232
34232
  /** postcss-loader */
34233
34233
  POSTCSS: "postcss",
34234
- /** markdown-loader */
34235
- MARKDOWN: "markdown",
34236
34234
  /** ignore-css-loader */
34237
34235
  IGNORE_CSS: "ignore-css",
34238
34236
  /** css-modules-typescript-loader */
@@ -34313,7 +34311,9 @@ var require_chainId = __commonJS({
34313
34311
  /** HtmlAsyncChunkPlugin */
34314
34312
  HTML_ASYNC_CHUNK: "html-async-chunk",
34315
34313
  /** SWC_POLYFILL_CHECKER */
34316
- SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin"
34314
+ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
34315
+ /** RouterPlugin */
34316
+ ROUTER_MANIFEST: "route-plugin"
34317
34317
  },
34318
34318
  /** Predefined minimizers */
34319
34319
  MINIMIZER: {
@@ -34769,12 +34769,11 @@ var require_config = __commonJS({
34769
34769
  var _constants = require_constants();
34770
34770
  var _type = require_type();
34771
34771
  var isSSR = (config) => {
34772
- var _server, _server1;
34773
34772
  const { server } = config;
34774
- if ((_server = server) === null || _server === void 0 ? void 0 : _server.ssr) {
34773
+ if (server === null || server === void 0 ? void 0 : server.ssr) {
34775
34774
  return true;
34776
34775
  }
34777
- if (((_server1 = server) === null || _server1 === void 0 ? void 0 : _server1.ssrByEntries) && !(0, _type.isEmpty)(server.ssrByEntries)) {
34776
+ if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && !(0, _type.isEmpty)(server.ssrByEntries)) {
34778
34777
  for (const name of Object.keys(server.ssrByEntries)) {
34779
34778
  if (server.ssrByEntries[name]) {
34780
34779
  return true;
@@ -34784,29 +34783,28 @@ var require_config = __commonJS({
34784
34783
  return false;
34785
34784
  };
34786
34785
  var isUseSSRBundle = (config) => {
34787
- var _output;
34788
34786
  const { output: output2 } = config;
34789
- if ((_output = output2) === null || _output === void 0 ? void 0 : _output.ssg) {
34787
+ if (output2 === null || output2 === void 0 ? void 0 : output2.ssg) {
34790
34788
  return true;
34791
34789
  }
34792
34790
  return isSSR(config);
34793
34791
  };
34794
34792
  var isServiceWorker = (config) => {
34795
- var _deploy_worker, _deploy, _output;
34793
+ var _deploy_worker;
34796
34794
  const { output: output2, deploy } = config;
34797
- 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))) {
34795
+ 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))) {
34798
34796
  return true;
34799
34797
  }
34800
34798
  return false;
34801
34799
  };
34802
34800
  var isRouterV5 = (config) => {
34803
- var _config_runtime, _config_runtime_router, _config_runtime1, _config;
34804
- 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";
34801
+ var _config_runtime, _config_runtime_router, _config_runtime1;
34802
+ 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";
34805
34803
  };
34806
34804
  var isSSGEntry = (config, entryName, entrypoints) => {
34807
- var _config_source, _ssgConfig, _ssgConfig1;
34805
+ var _config_source;
34808
34806
  const ssgConfig = config.output.ssg;
34809
- 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]);
34807
+ const useSSG = isSingleEntry(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) ? 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]);
34810
34808
  return useSSG;
34811
34809
  };
34812
34810
  var isSingleEntry = (entrypoints, mainEntryName = _constants.MAIN_ENTRY_NAME) => entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
@@ -35385,9 +35383,14 @@ var require_logger = __commonJS({
35385
35383
  label: "info",
35386
35384
  level: "info"
35387
35385
  },
35386
+ ready: {
35387
+ color: "green",
35388
+ label: "ready",
35389
+ level: "info"
35390
+ },
35388
35391
  success: {
35389
35392
  color: "green",
35390
- label: "Success",
35393
+ label: "success",
35391
35394
  level: "info"
35392
35395
  },
35393
35396
  warn: {
@@ -35567,7 +35570,7 @@ var require_alias = __commonJS({
35567
35570
  };
35568
35571
  var mergeAlias = (alias) => (0, _applyOptionsChain.applyOptionsChain)({}, alias);
35569
35572
  var getAliasConfig = (aliasOption, option) => {
35570
- var _tsconfig_compilerOptions, _tsconfig, _tsconfig_compilerOptions1, _tsconfig1;
35573
+ var _tsconfig_compilerOptions, _tsconfig_compilerOptions1;
35571
35574
  const isTsProject2 = _fs.default.existsSync(option.tsconfigPath);
35572
35575
  const alias = mergeAlias(aliasOption);
35573
35576
  if (!isTsProject2) {
@@ -35579,12 +35582,12 @@ var require_alias = __commonJS({
35579
35582
  };
35580
35583
  }
35581
35584
  const tsconfig = (0, _get.readTsConfigByFile)(option.tsconfigPath);
35582
- const baseUrl = (_tsconfig = tsconfig) === null || _tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = _tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
35585
+ const baseUrl = tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
35583
35586
  return {
35584
35587
  absoluteBaseUrl: baseUrl ? _path.default.join(option.appDirectory, baseUrl) : option.appDirectory,
35585
35588
  paths: {
35586
35589
  ...alias,
35587
- ...(_tsconfig1 = tsconfig) === null || _tsconfig1 === void 0 ? void 0 : (_tsconfig_compilerOptions1 = _tsconfig1.compilerOptions) === null || _tsconfig_compilerOptions1 === void 0 ? void 0 : _tsconfig_compilerOptions1.paths
35590
+ ...tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions1 = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions1 === void 0 ? void 0 : _tsconfig_compilerOptions1.paths
35588
35591
  },
35589
35592
  isTsPath: true,
35590
35593
  isTsProject: isTsProject2
@@ -35979,7 +35982,7 @@ var require_port = __commonJS({
35979
35982
  if (strictPort) {
35980
35983
  throw new Error(`Port "${original}" is occupied, please choose another one.`);
35981
35984
  } else if (!slient) {
35982
- _logger.logger.info(`Something is already running on port ${original}. ${_compiled.chalk.yellow(`Use port ${port} instead.`)}`);
35985
+ _logger.logger.info(`Port ${original} is in use. ${_compiled.chalk.yellow(`using port ${port}.`)}`);
35983
35986
  }
35984
35987
  }
35985
35988
  return port;
@@ -36031,10 +36034,7 @@ var require_prettyInstructions = __commonJS({
36031
36034
  var getAddressUrls = (protocol = "http", port, host) => {
36032
36035
  const LOCAL_LABEL = "Local: ";
36033
36036
  const NETWORK_LABEL = "Network: ";
36034
- const isLocalhost = (url) => {
36035
- var _url;
36036
- return (_url = url) === null || _url === void 0 ? void 0 : _url.includes("localhost");
36037
- };
36037
+ const isLocalhost = (url) => url === null || url === void 0 ? void 0 : url.includes("localhost");
36038
36038
  if (host && host !== _constants.DEFAULT_DEV_HOST) {
36039
36039
  return [
36040
36040
  {
@@ -36065,7 +36065,7 @@ var require_prettyInstructions = __commonJS({
36065
36065
  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);
36066
36066
  const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
36067
36067
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
36068
- let message = "App running at:\n\n";
36068
+ let message = "\n";
36069
36069
  if ((0, _is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
36070
36070
  message += urls.map(({ label, url }) => ` ${_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
36071
36071
  `).join("");
@@ -36127,9 +36127,8 @@ var require_require = __commonJS({
36127
36127
  });
36128
36128
  var _fs = require_fs();
36129
36129
  var compatRequire = (filePath, interop = true) => {
36130
- var _mod;
36131
36130
  const mod = require(filePath);
36132
- const rtnESMDefault = interop && ((_mod = mod) === null || _mod === void 0 ? void 0 : _mod.__esModule);
36131
+ const rtnESMDefault = interop && (mod === null || mod === void 0 ? void 0 : mod.__esModule);
36133
36132
  return rtnESMDefault ? mod.default : mod;
36134
36133
  };
36135
36134
  var dynamicImport = new Function("modulePath", "return import(modulePath)");
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.2.1",
18
+ "version": "3.2.2",
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
- "@modern-js/generator-common": "3.2.1",
35
- "@modern-js/dependence-generator": "3.2.1",
36
- "@modern-js/generator-utils": "3.2.1",
37
- "@scripts/jest-config": "2.35.0",
38
- "@scripts/build": "2.35.0"
34
+ "@modern-js/generator-common": "3.2.2",
35
+ "@scripts/jest-config": "2.35.1",
36
+ "@modern-js/dependence-generator": "3.2.2",
37
+ "@modern-js/generator-utils": "3.2.2",
38
+ "@scripts/build": "2.35.1"
39
39
  },
40
40
  "sideEffects": false,
41
41
  "publishConfig": {