@modern-js/server-generator 3.1.28 → 3.1.30

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 +36 -24
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -35125,6 +35125,8 @@ var require_chainId = __commonJS({
35125
35125
  YAML: "yaml",
35126
35126
  /** Rule for wasm */
35127
35127
  WASM: "wasm",
35128
+ /** Rule for node */
35129
+ NODE: "node",
35128
35130
  /** Rule for bff */
35129
35131
  JS_BFF_API: "js-bff-api"
35130
35132
  },
@@ -35163,6 +35165,8 @@ var require_chainId = __commonJS({
35163
35165
  TOML: "toml",
35164
35166
  /** html-loader */
35165
35167
  HTML: "html",
35168
+ /** node-loader */
35169
+ NODE: "html",
35166
35170
  /** babel-loader */
35167
35171
  BABEL: "babel",
35168
35172
  /** esbuild-loader */
@@ -35423,7 +35427,6 @@ var require_constants = __commonJS({
35423
35427
  };
35424
35428
  var INTERNAL_MODULE_TOOLS_PLUGINS = {
35425
35429
  "@modern-js/module-tools": "@modern-js/module-tools",
35426
- "@modern-js/doc-tools": "@modern-js/doc-tools",
35427
35430
  "@modern-js/runtime": "@modern-js/runtime/cli",
35428
35431
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
35429
35432
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
@@ -35701,11 +35704,12 @@ var require_config = __commonJS({
35701
35704
  });
35702
35705
  var _type = require_type();
35703
35706
  var isSSR = (config) => {
35707
+ var _server, _server1;
35704
35708
  const { server } = config;
35705
- if (server === null || server === void 0 ? void 0 : server.ssr) {
35709
+ if ((_server = server) === null || _server === void 0 ? void 0 : _server.ssr) {
35706
35710
  return true;
35707
35711
  }
35708
- if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && !(0, _type.isEmpty)(server.ssrByEntries)) {
35712
+ if (((_server1 = server) === null || _server1 === void 0 ? void 0 : _server1.ssrByEntries) && !(0, _type.isEmpty)(server.ssrByEntries)) {
35709
35713
  for (const name of Object.keys(server.ssrByEntries)) {
35710
35714
  if (server.ssrByEntries[name]) {
35711
35715
  return true;
@@ -35715,27 +35719,29 @@ var require_config = __commonJS({
35715
35719
  return false;
35716
35720
  };
35717
35721
  var isUseSSRBundle = (config) => {
35722
+ var _output;
35718
35723
  const { output: output2 } = config;
35719
- if (output2 === null || output2 === void 0 ? void 0 : output2.ssg) {
35724
+ if ((_output = output2) === null || _output === void 0 ? void 0 : _output.ssg) {
35720
35725
  return true;
35721
35726
  }
35722
35727
  return isSSR(config);
35723
35728
  };
35724
35729
  var isServiceWorker = (config) => {
35725
- var _deploy_worker;
35730
+ var _deploy_worker, _deploy, _output;
35726
35731
  const { output: output2, deploy } = config;
35727
- 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))) {
35732
+ 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))) {
35728
35733
  return true;
35729
35734
  }
35730
35735
  return false;
35731
35736
  };
35732
35737
  var isRouterV5 = (config) => {
35733
- var _config_runtime, _config_runtime1, _config_runtime_router;
35734
- 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";
35738
+ var _config_runtime, _config_runtime_router, _config_runtime1, _config;
35739
+ 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";
35735
35740
  };
35736
35741
  var isSSGEntry = (config, entryName, entrypoints) => {
35742
+ var _ssgConfig, _ssgConfig1;
35737
35743
  const ssgConfig = config.output.ssg;
35738
- 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]);
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]);
35739
35745
  return useSSG;
35740
35746
  };
35741
35747
  var isSingleEntry = (entrypoints) => entrypoints.length === 1 && entrypoints[0].entryName === "main";
@@ -36482,7 +36488,7 @@ var require_alias = __commonJS({
36482
36488
  };
36483
36489
  var mergeAlias = (alias) => (0, _applyOptionsChain.applyOptionsChain)({}, alias);
36484
36490
  var getAliasConfig = (aliasOption, option) => {
36485
- var _tsconfig_compilerOptions, _tsconfig_compilerOptions1;
36491
+ var _tsconfig_compilerOptions, _tsconfig, _tsconfig_compilerOptions1, _tsconfig1;
36486
36492
  const isTsProject2 = _fs.default.existsSync(option.tsconfigPath);
36487
36493
  const alias = mergeAlias(aliasOption);
36488
36494
  if (!isTsProject2) {
@@ -36494,10 +36500,10 @@ var require_alias = __commonJS({
36494
36500
  };
36495
36501
  }
36496
36502
  const tsconfig = (0, _get.readTsConfigByFile)(option.tsconfigPath);
36497
- const baseUrl = tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
36503
+ const baseUrl = (_tsconfig = tsconfig) === null || _tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = _tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
36498
36504
  return {
36499
36505
  absoluteBaseUrl: baseUrl ? _path.default.join(option.appDirectory, baseUrl) : option.appDirectory,
36500
- 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),
36506
+ 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),
36501
36507
  isTsPath: true,
36502
36508
  isTsProject: isTsProject2
36503
36509
  };
@@ -37036,7 +37042,8 @@ var require_prettyInstructions = __commonJS({
37036
37042
  const LOCAL_LABEL = "Local: ";
37037
37043
  const NETWORK_LABEL = "Network: ";
37038
37044
  const isLocalhost = (url) => {
37039
- return url === null || url === void 0 ? void 0 : url.includes("localhost");
37045
+ var _url;
37046
+ return (_url = url) === null || _url === void 0 ? void 0 : _url.includes("localhost");
37040
37047
  };
37041
37048
  if (host && host !== _constants.DEFAULT_DEV_HOST) {
37042
37049
  return [
@@ -37065,7 +37072,7 @@ var require_prettyInstructions = __commonJS({
37065
37072
  var prettyInstructions = (appContext, config) => {
37066
37073
  var _appContext_builder_context_devServer, _appContext_builder, _config_dev;
37067
37074
  const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
37068
- 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);
37075
+ 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);
37069
37076
  const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
37070
37077
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
37071
37078
  let message = "App running at:\n\n";
@@ -37130,8 +37137,9 @@ var require_require = __commonJS({
37130
37137
  });
37131
37138
  var _fs = require_fs();
37132
37139
  var compatRequire = (filePath, interop = true) => {
37140
+ var _mod;
37133
37141
  const mod = require(filePath);
37134
- const rtnESMDefault = interop && (mod === null || mod === void 0 ? void 0 : mod.__esModule);
37142
+ const rtnESMDefault = interop && ((_mod = mod) === null || _mod === void 0 ? void 0 : _mod.__esModule);
37135
37143
  return rtnESMDefault ? mod.default : mod;
37136
37144
  };
37137
37145
  var dynamicImport = new Function("modulePath", "return import(modulePath)");
@@ -117947,16 +117955,20 @@ var import_utils2 = __toESM(require_cjs());
117947
117955
  function isPackageExist(packageName, registry2) {
117948
117956
  return __async(this, null, function* () {
117949
117957
  if (yield (0, import_utils2.canUseNpm)()) {
117950
- const args = [
117951
- "view",
117952
- packageName,
117953
- "version"
117954
- ];
117955
- if (registry2) {
117956
- args.push(`--registry=${registry2}`);
117958
+ try {
117959
+ const args = [
117960
+ "view",
117961
+ packageName,
117962
+ "version"
117963
+ ];
117964
+ if (registry2) {
117965
+ args.push(`--registry=${registry2}`);
117966
+ }
117967
+ const result = yield (0, import_utils2.execa)("npm", args);
117968
+ return (0, import_utils2.stripAnsi)(result.stdout);
117969
+ } catch (e) {
117970
+ return false;
117957
117971
  }
117958
- const result = yield (0, import_utils2.execa)("npm", args);
117959
- return (0, import_utils2.stripAnsi)(result.stdout);
117960
117972
  }
117961
117973
  throw new Error("not found npm, please install npm before");
117962
117974
  });
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.1.28",
18
+ "version": "3.1.30",
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.1.28",
35
- "@modern-js/dependence-generator": "3.1.28",
36
- "@scripts/jest-config": "2.26.0",
37
- "@modern-js/generator-utils": "3.1.28",
38
- "@scripts/build": "2.26.0"
34
+ "@modern-js/generator-common": "3.1.30",
35
+ "@modern-js/dependence-generator": "3.1.30",
36
+ "@modern-js/generator-utils": "3.1.30",
37
+ "@scripts/build": "2.28.0",
38
+ "@scripts/jest-config": "2.28.0"
39
39
  },
40
40
  "sideEffects": false,
41
41
  "publishConfig": {