@modern-js/utils 2.67.0 → 2.67.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.
@@ -86,10 +86,10 @@ const getAddressUrls = (protocol = "http", port, host) => {
86
86
  }, []);
87
87
  };
88
88
  const prettyInstructions = (appContext, config) => {
89
- var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source, _config_dev1;
89
+ var _config_dev, _config_tools_devServer, _config_tools, _config_dev1, _config_source, _config_dev2;
90
90
  const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
91
- const isHttps = (0, import_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);
92
- const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
91
+ const isHttps = (0, import_is.isDev)() && ((config === null || config === void 0 ? void 0 : (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.https) || (config === null || config === void 0 ? void 0 : (_config_tools = config.tools) === null || _config_tools === void 0 ? void 0 : (_config_tools_devServer = _config_tools.devServer) === null || _config_tools_devServer === void 0 ? void 0 : _config_tools_devServer.https));
92
+ const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev1 = config.dev) === null || _config_dev1 === void 0 ? void 0 : _config_dev1.host);
93
93
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
94
94
  let message = "\n";
95
95
  if ((0, import_is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
@@ -112,7 +112,7 @@ const prettyInstructions = (appContext, config) => {
112
112
  message += import_compiled.chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
113
113
  message += import_compiled.chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
114
114
  }
115
- if ((_config_dev1 = config.dev) === null || _config_dev1 === void 0 ? void 0 : _config_dev1.cliShortcuts) {
115
+ if ((_config_dev2 = config.dev) === null || _config_dev2 === void 0 ? void 0 : _config_dev2.cliShortcuts) {
116
116
  message += ` ${import_compiled.chalk.dim("> press")} ${import_compiled.chalk.bold("h + enter")} ${import_compiled.chalk.dim("to show shortcuts")}
117
117
  `;
118
118
  }
@@ -20,6 +20,7 @@ var version_exports = {};
20
20
  __export(version_exports, {
21
21
  isVersionAtLeast18: () => isVersionAtLeast18,
22
22
  isVersionAtLeast1819: () => isVersionAtLeast1819,
23
+ isVersionAtLeast20: () => isVersionAtLeast20,
23
24
  isVersionAtLeast22: () => isVersionAtLeast22
24
25
  });
25
26
  module.exports = __toCommonJS(version_exports);
@@ -38,9 +39,15 @@ function isVersionAtLeast22() {
38
39
  const versionArr = nodeVersion.split(".").map(Number);
39
40
  return versionArr[0] >= 22;
40
41
  }
42
+ function isVersionAtLeast20() {
43
+ const nodeVersion = process.versions.node;
44
+ const versionArr = nodeVersion.split(".").map(Number);
45
+ return versionArr[0] >= 20;
46
+ }
41
47
  // Annotate the CommonJS export names for ESM import in node:
42
48
  0 && (module.exports = {
43
49
  isVersionAtLeast18,
44
50
  isVersionAtLeast1819,
51
+ isVersionAtLeast20,
45
52
  isVersionAtLeast22
46
53
  });
@@ -1 +1 @@
1
- (()=>{var e={113:e=>{"use strict";e.exports=require("crypto")},495:(e,r,t)=>{let l=t(113);let{urlAlphabet:a}=t(240);const n=128;let _,u;let fillPool=e=>{if(!_||_.length<e){_=Buffer.allocUnsafe(e*n);l.randomFillSync(_);u=0}else if(u+e>_.length){l.randomFillSync(_);u=0}u+=e};let random=e=>{fillPool(e-=0);return _.subarray(u-e,u)};let customRandom=(e,r,t)=>{let l=(2<<31-Math.clz32(e.length-1|1))-1;let a=Math.ceil(1.6*l*r/e.length);return(n=r)=>{let _="";while(true){let r=t(a);let u=a;while(u--){_+=e[r[u]&l]||"";if(_.length===n)return _}}}};let customAlphabet=(e,r=21)=>customRandom(e,r,random);let nanoid=(e=21)=>{fillPool(e-=0);let r="";for(let t=u-e;t<u;t++){r+=a[_[t]&63]}return r};e.exports={nanoid:nanoid,customAlphabet:customAlphabet,customRandom:customRandom,urlAlphabet:a,random:random}},240:e=>{let r="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";e.exports={urlAlphabet:r}}};var r={};function __nccwpck_require__(t){var l=r[t];if(l!==undefined){return l.exports}var a=r[t]={exports:{}};var n=true;try{e[t](a,a.exports,__nccwpck_require__);n=false}finally{if(n)delete r[t]}return a.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(495);module.exports=t})();
1
+ (()=>{var e={982:e=>{"use strict";e.exports=require("crypto")},985:(e,r,t)=>{let l=t(982);let{urlAlphabet:a}=t(803);const n=128;let _,u;let fillPool=e=>{if(!_||_.length<e){_=Buffer.allocUnsafe(e*n);l.randomFillSync(_);u=0}else if(u+e>_.length){l.randomFillSync(_);u=0}u+=e};let random=e=>{fillPool(e|=0);return _.subarray(u-e,u)};let customRandom=(e,r,t)=>{let l=(2<<31-Math.clz32(e.length-1|1))-1;let a=Math.ceil(1.6*l*r/e.length);return(n=r)=>{let _="";while(true){let r=t(a);let u=a;while(u--){_+=e[r[u]&l]||"";if(_.length===n)return _}}}};let customAlphabet=(e,r=21)=>customRandom(e,r,random);let nanoid=(e=21)=>{fillPool(e|=0);let r="";for(let t=u-e;t<u;t++){r+=a[_[t]&63]}return r};e.exports={nanoid:nanoid,customAlphabet:customAlphabet,customRandom:customRandom,urlAlphabet:a,random:random}},803:e=>{let r="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";e.exports={urlAlphabet:r}}};var r={};function __nccwpck_require__(t){var l=r[t];if(l!==undefined){return l.exports}var a=r[t]={exports:{}};var n=true;try{e[t](a,a.exports,__nccwpck_require__);n=false}finally{if(n)delete r[t]}return a.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(985);module.exports=t})();
@@ -1 +1 @@
1
- {"name":"nanoid","author":"Andrey Sitnik <andrey@sitnik.ru>","version":"3.3.4","license":"MIT","types":"./index.d.ts"}
1
+ {"name":"nanoid","author":"Andrey Sitnik <andrey@sitnik.ru>","version":"3.3.11","funding":[{"type":"github","url":"https://github.com/sponsors/ai"}],"license":"MIT","types":"./index.d.ts"}
@@ -58,10 +58,10 @@ var getAddressUrls = function() {
58
58
  }, []);
59
59
  };
60
60
  var prettyInstructions = function(appContext, config) {
61
- var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source, _config_dev1;
61
+ var _config_dev, _config_tools_devServer, _config_tools, _config_dev1, _config_source, _config_dev2;
62
62
  var entrypoints = appContext.entrypoints, serverRoutes = appContext.serverRoutes, port = appContext.port, apiOnly = appContext.apiOnly, checkedEntries = appContext.checkedEntries;
63
- var isHttps = 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);
64
- var urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
63
+ var isHttps = isDev() && ((config === null || config === void 0 ? void 0 : (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.https) || (config === null || config === void 0 ? void 0 : (_config_tools = config.tools) === null || _config_tools === void 0 ? void 0 : (_config_tools_devServer = _config_tools.devServer) === null || _config_tools_devServer === void 0 ? void 0 : _config_tools_devServer.https));
64
+ var urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev1 = config.dev) === null || _config_dev1 === void 0 ? void 0 : _config_dev1.host);
65
65
  var routes = !apiOnly ? serverRoutes.filter(function(route) {
66
66
  return route.entryName;
67
67
  }) : serverRoutes;
@@ -91,7 +91,7 @@ var prettyInstructions = function(appContext, config) {
91
91
  message += chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
92
92
  message += chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
93
93
  }
94
- if ((_config_dev1 = config.dev) === null || _config_dev1 === void 0 ? void 0 : _config_dev1.cliShortcuts) {
94
+ if ((_config_dev2 = config.dev) === null || _config_dev2 === void 0 ? void 0 : _config_dev2.cliShortcuts) {
95
95
  message += " ".concat(chalk.dim("> press"), " ").concat(chalk.bold("h + enter"), " ").concat(chalk.dim("to show shortcuts"), "\n");
96
96
  }
97
97
  return message;
@@ -13,8 +13,14 @@ function isVersionAtLeast22() {
13
13
  var versionArr = nodeVersion.split(".").map(Number);
14
14
  return versionArr[0] >= 22;
15
15
  }
16
+ function isVersionAtLeast20() {
17
+ var nodeVersion = process.versions.node;
18
+ var versionArr = nodeVersion.split(".").map(Number);
19
+ return versionArr[0] >= 20;
20
+ }
16
21
  export {
17
22
  isVersionAtLeast18,
18
23
  isVersionAtLeast1819,
24
+ isVersionAtLeast20,
19
25
  isVersionAtLeast22
20
26
  };
@@ -52,10 +52,10 @@ const getAddressUrls = (protocol = "http", port, host) => {
52
52
  }, []);
53
53
  };
54
54
  const prettyInstructions = (appContext, config) => {
55
- var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source, _config_dev1;
55
+ var _config_dev, _config_tools_devServer, _config_tools, _config_dev1, _config_source, _config_dev2;
56
56
  const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
57
- const isHttps = 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);
58
- const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
57
+ const isHttps = isDev() && ((config === null || config === void 0 ? void 0 : (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.https) || (config === null || config === void 0 ? void 0 : (_config_tools = config.tools) === null || _config_tools === void 0 ? void 0 : (_config_tools_devServer = _config_tools.devServer) === null || _config_tools_devServer === void 0 ? void 0 : _config_tools_devServer.https));
58
+ const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev1 = config.dev) === null || _config_dev1 === void 0 ? void 0 : _config_dev1.host);
59
59
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
60
60
  let message = "\n";
61
61
  if (isSingleEntry(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
@@ -78,7 +78,7 @@ const prettyInstructions = (appContext, config) => {
78
78
  message += chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
79
79
  message += chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
80
80
  }
81
- if ((_config_dev1 = config.dev) === null || _config_dev1 === void 0 ? void 0 : _config_dev1.cliShortcuts) {
81
+ if ((_config_dev2 = config.dev) === null || _config_dev2 === void 0 ? void 0 : _config_dev2.cliShortcuts) {
82
82
  message += ` ${chalk.dim("> press")} ${chalk.bold("h + enter")} ${chalk.dim("to show shortcuts")}
83
83
  `;
84
84
  }
@@ -13,8 +13,14 @@ function isVersionAtLeast22() {
13
13
  const versionArr = nodeVersion.split(".").map(Number);
14
14
  return versionArr[0] >= 22;
15
15
  }
16
+ function isVersionAtLeast20() {
17
+ const nodeVersion = process.versions.node;
18
+ const versionArr = nodeVersion.split(".").map(Number);
19
+ return versionArr[0] >= 20;
20
+ }
16
21
  export {
17
22
  isVersionAtLeast18,
18
23
  isVersionAtLeast1819,
24
+ isVersionAtLeast20,
19
25
  isVersionAtLeast22
20
26
  };
@@ -1,3 +1,4 @@
1
1
  export declare function isVersionAtLeast1819(): boolean;
2
2
  export declare function isVersionAtLeast18(): boolean;
3
3
  export declare function isVersionAtLeast22(): boolean;
4
+ export declare function isVersionAtLeast20(): boolean;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.67.0",
18
+ "version": "2.67.2",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -190,7 +190,7 @@
190
190
  "jest": "^29",
191
191
  "typescript": "^5",
192
192
  "webpack": "^5.98.0",
193
- "@modern-js/types": "2.67.0",
193
+ "@modern-js/types": "2.67.2",
194
194
  "@scripts/build": "2.66.0",
195
195
  "@scripts/jest-config": "2.66.0"
196
196
  },