@modern-js/utils 3.0.0-alpha.2 → 3.0.1

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 (39) hide show
  1. package/dist/cjs/cli/get/data.js +0 -15
  2. package/dist/esm/cli/get/data.mjs +2 -11
  3. package/dist/esm-node/cli/alias.mjs +0 -1
  4. package/dist/esm-node/cli/applyOptionsChain.mjs +0 -1
  5. package/dist/esm-node/cli/commands.mjs +0 -1
  6. package/dist/esm-node/cli/common.mjs +0 -1
  7. package/dist/esm-node/cli/config.mjs +0 -1
  8. package/dist/esm-node/cli/constants.mjs +0 -1
  9. package/dist/esm-node/cli/ensure.mjs +0 -1
  10. package/dist/esm-node/cli/fs.mjs +0 -1
  11. package/dist/esm-node/cli/get/config.mjs +0 -1
  12. package/dist/esm-node/cli/get/data.mjs +2 -12
  13. package/dist/esm-node/cli/get/index.mjs +0 -1
  14. package/dist/esm-node/cli/index.mjs +0 -1
  15. package/dist/esm-node/cli/is/config.mjs +0 -1
  16. package/dist/esm-node/cli/is/env.mjs +0 -1
  17. package/dist/esm-node/cli/is/index.mjs +0 -1
  18. package/dist/esm-node/cli/is/project.mjs +0 -1
  19. package/dist/esm-node/cli/is/type.mjs +0 -1
  20. package/dist/esm-node/cli/logger.mjs +0 -1
  21. package/dist/esm-node/cli/monorepo.mjs +0 -1
  22. package/dist/esm-node/cli/package.mjs +0 -1
  23. package/dist/esm-node/cli/path.mjs +0 -1
  24. package/dist/esm-node/cli/port.mjs +0 -1
  25. package/dist/esm-node/cli/prettyInstructions.mjs +0 -1
  26. package/dist/esm-node/cli/require.mjs +0 -1
  27. package/dist/esm-node/cli/route.mjs +0 -1
  28. package/dist/esm-node/cli/runtimeExports.mjs +0 -1
  29. package/dist/esm-node/cli/version.mjs +0 -1
  30. package/dist/esm-node/cli/watch.mjs +0 -1
  31. package/dist/esm-node/compiled.mjs +0 -1
  32. package/dist/esm-node/import.mjs +0 -1
  33. package/dist/esm-node/index.mjs +0 -1
  34. package/dist/esm-node/universal/constants.mjs +0 -1
  35. package/dist/esm-node/universal/index.mjs +0 -1
  36. package/dist/esm-node/universal/path.mjs +0 -1
  37. package/dist/esm-node/universal/pluginDagSort.mjs +0 -1
  38. package/dist/types/cli/get/data.d.ts +0 -2
  39. package/package.json +7 -7
@@ -35,9 +35,7 @@ __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
36
  getPackageManager: ()=>getPackageManager,
37
37
  getCoreJsVersion: ()=>getCoreJsVersion,
38
- getBrowserslist: ()=>getBrowserslist,
39
38
  getInternalPlugins: ()=>getInternalPlugins,
40
- defaults: ()=>defaults,
41
39
  readTsConfig: ()=>readTsConfig,
42
40
  readTsConfigByFile: ()=>readTsConfigByFile
43
41
  });
@@ -72,15 +70,6 @@ const getCoreJsVersion = (corejsPkgPath)=>{
72
70
  return '3';
73
71
  }
74
72
  };
75
- const defaults = [
76
- 'chrome >= 87',
77
- 'edge >= 88',
78
- 'firefox >= 78',
79
- 'safari >= 14'
80
- ];
81
- const getBrowserslist = (appDirectory)=>external_compiled_js_namespaceObject.browserslist.loadConfig({
82
- path: appDirectory
83
- }) || defaults;
84
73
  function getInternalPlugins(appDirectory, internalPlugins = {}) {
85
74
  return [
86
75
  ...Object.keys(internalPlugins).filter((name)=>{
@@ -99,16 +88,12 @@ const readTsConfigByFile = (filename)=>{
99
88
  const content = external_compiled_js_namespaceObject.fs.readFileSync(external_path_default().resolve(filename), 'utf-8');
100
89
  return external_compiled_js_namespaceObject.json5.parse(content);
101
90
  };
102
- exports.defaults = __webpack_exports__.defaults;
103
- exports.getBrowserslist = __webpack_exports__.getBrowserslist;
104
91
  exports.getCoreJsVersion = __webpack_exports__.getCoreJsVersion;
105
92
  exports.getInternalPlugins = __webpack_exports__.getInternalPlugins;
106
93
  exports.getPackageManager = __webpack_exports__.getPackageManager;
107
94
  exports.readTsConfig = __webpack_exports__.readTsConfig;
108
95
  exports.readTsConfigByFile = __webpack_exports__.readTsConfigByFile;
109
96
  for(var __rspack_i in __webpack_exports__)if (-1 === [
110
- "defaults",
111
- "getBrowserslist",
112
97
  "getCoreJsVersion",
113
98
  "getInternalPlugins",
114
99
  "getPackageManager",
@@ -1,6 +1,6 @@
1
1
  import os from "os";
2
2
  import path from "path";
3
- import { browserslist, fs, json5 } from "../../compiled.mjs";
3
+ import { fs, json5 } from "../../compiled.mjs";
4
4
  import { isDepExists } from "../is/index.mjs";
5
5
  import { canUsePnpm, canUseYarn } from "../package.mjs";
6
6
  const MAX_TIMES = 5;
@@ -27,15 +27,6 @@ const getCoreJsVersion = (corejsPkgPath)=>{
27
27
  return '3';
28
28
  }
29
29
  };
30
- const defaults = [
31
- 'chrome >= 87',
32
- 'edge >= 88',
33
- 'firefox >= 78',
34
- 'safari >= 14'
35
- ];
36
- const getBrowserslist = (appDirectory)=>browserslist.loadConfig({
37
- path: appDirectory
38
- }) || defaults;
39
30
  function getInternalPlugins(appDirectory, internalPlugins = {}) {
40
31
  return [
41
32
  ...Object.keys(internalPlugins).filter((name)=>{
@@ -54,4 +45,4 @@ const readTsConfigByFile = (filename)=>{
54
45
  const content = fs.readFileSync(path.resolve(filename), 'utf-8');
55
46
  return json5.parse(content);
56
47
  };
57
- export { defaults, getBrowserslist, getCoreJsVersion, getInternalPlugins, getPackageManager, readTsConfig, readTsConfigByFile };
48
+ export { getCoreJsVersion, getInternalPlugins, getPackageManager, readTsConfig, readTsConfigByFile };
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import fs from "fs";
4
3
  import path from "path";
5
4
  import { applyOptionsChain } from "./applyOptionsChain.mjs";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { isFunction, isPlainObject } from "./is/index.mjs";
4
3
  import { logger } from "./logger.mjs";
5
4
  function applyOptionsChain(defaults, options, utils, mergeFn = Object.assign) {
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { logger } from "./logger.mjs";
4
3
  const getFullArgv = ()=>process.env.MODERN_ARGV?.split(' ') || process.argv;
5
4
  const getArgv = ()=>getFullArgv().slice(2);
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import debug from "../../compiled/debug/index.js";
4
3
  const createDebugger = (scope)=>debug(`modern-js:${scope}`);
5
4
  const clearConsole = ()=>{
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  const isOverriddenConfigKey = (key)=>[
4
3
  'removeConsole',
5
4
  'baseUrl'
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { DEFAULT_ENTRY_NAME, MAIN_ENTRY_NAME, NESTED_ROUTE_SPEC_FILE, ROUTE_SPEC_FILE, SERVER_BUNDLE_DIRECTORY, SERVER_PLUGIN_BFF, SERVER_PLUGIN_POLYFILL, SERVER_RENDER_FUNCTION_NAME } from "../universal/constants.mjs";
4
3
  const JS_EXTENSIONS = [
5
4
  '.js',
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import path from "path";
4
3
  const ensureAbsolutePath = (base, filePath)=>path.isAbsolute(filePath) ? filePath : path.resolve(base, filePath);
5
4
  const ensureArray = (params)=>{
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { fs } from "../compiled.mjs";
4
3
  const findExists = (files)=>{
5
4
  for (const file of files)if (fs.existsSync(file) && fs.statSync(file).isFile()) return file;
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { isPlainObject } from "../is/index.mjs";
4
3
  const getEntryOptions = (name, isMainEntry, baseOptions, optionsByEntries, packageName)=>{
5
4
  if (!optionsByEntries) return baseOptions;
@@ -1,8 +1,7 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import os from "os";
4
3
  import path from "path";
5
- import { browserslist, fs, json5 } from "../../compiled.mjs";
4
+ import { fs, json5 } from "../../compiled.mjs";
6
5
  import { isDepExists } from "../is/index.mjs";
7
6
  import { canUsePnpm, canUseYarn } from "../package.mjs";
8
7
  const MAX_TIMES = 5;
@@ -29,15 +28,6 @@ const getCoreJsVersion = (corejsPkgPath)=>{
29
28
  return '3';
30
29
  }
31
30
  };
32
- const defaults = [
33
- 'chrome >= 87',
34
- 'edge >= 88',
35
- 'firefox >= 78',
36
- 'safari >= 14'
37
- ];
38
- const getBrowserslist = (appDirectory)=>browserslist.loadConfig({
39
- path: appDirectory
40
- }) || defaults;
41
31
  function getInternalPlugins(appDirectory, internalPlugins = {}) {
42
32
  return [
43
33
  ...Object.keys(internalPlugins).filter((name)=>{
@@ -56,4 +46,4 @@ const readTsConfigByFile = (filename)=>{
56
46
  const content = fs.readFileSync(path.resolve(filename), 'utf-8');
57
47
  return json5.parse(content);
58
48
  };
59
- export { defaults, getBrowserslist, getCoreJsVersion, getInternalPlugins, getPackageManager, readTsConfig, readTsConfigByFile };
49
+ export { getCoreJsVersion, getInternalPlugins, getPackageManager, readTsConfig, readTsConfigByFile };
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import path from "path";
4
3
  import { CONFIG_FILE_EXTENSIONS } from "../constants.mjs";
5
4
  import { findExists } from "../fs.mjs";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  export * from "./constants.mjs";
4
3
  export * from "./get/index.mjs";
5
4
  export * from "./is/index.mjs";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { MAIN_ENTRY_NAME } from "../constants.mjs";
4
3
  import { isEmpty } from "./type.mjs";
5
4
  const isSSR = (config)=>{
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  const getNodeEnv = ()=>process.env.NODE_ENV || 'development';
4
3
  const isDev = ()=>'development' === getNodeEnv();
5
4
  const isProd = ()=>'production' === getNodeEnv();
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  export * from "./env.mjs";
4
3
  export * from "./type.mjs";
5
4
  export * from "./config.mjs";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import path from "path";
4
3
  import pkg_up from "../../../compiled/pkg-up/index.js";
5
4
  import { fs, minimist, semver } from "../../compiled.mjs";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  function isString(str) {
4
3
  return 'string' == typeof str;
5
4
  }
@@ -1,4 +1,3 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { createLogger, logger } from "rslog";
4
3
  export { createLogger, logger };
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import fs from "fs";
4
3
  import path from "path";
5
4
  import { glob, yaml } from "../compiled.mjs";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { execa } from "../compiled.mjs";
4
3
  async function getPnpmVersion() {
5
4
  const { stdout } = await execa('pnpm', [
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import fs from "fs";
4
3
  import os from "os";
5
4
  import path from "path";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import net from "net";
4
3
  import { chalk } from "../compiled.mjs";
5
4
  import { logger } from "./logger.mjs";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { isIPv6 } from "net";
4
3
  import os from "os";
5
4
  import { chalk } from "../compiled.mjs";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { isAbsolute } from "node:path";
4
3
  import { pathToFileURL } from "node:url";
5
4
  import { moduleResolve } from "import-meta-resolve";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { lodash } from "../compiled.mjs";
4
3
  const { cloneDeep } = lodash;
5
4
  function filterRoutesForServer(routes) {
@@ -1,2 +1 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  function isVersionAtLeast1819() {
4
3
  const nodeVersion = process.versions.node;
5
4
  const versionArr = nodeVersion.split('.').map(Number);
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import path from "path";
4
3
  import { chokidar } from "../compiled.mjs";
5
4
  const WatchChangeType = {
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { createRequire } from "node:module";
4
3
  import { Import } from "./import.mjs";
5
4
  import fs_extra from "../compiled/fs-extra/index.js";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import import_lazy from "../compiled/import-lazy/index.js";
4
3
  const lazy = (moduleName, getRequireFn)=>{
5
4
  const importLazyLocal = import_lazy(getRequireFn());
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  export * from "./compiled.mjs";
4
3
  export * from "./cli/index.mjs";
5
4
  export * from "./import.mjs";
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  const ROUTE_MANIFEST = "_MODERNJS_ROUTE_MANIFEST";
4
3
  const ROUTE_MODULES = "_routeModules";
5
4
  const HTML_CHUNKSMAP_SEPARATOR = '<!--<?- chunksMap.js ?>-->';
@@ -1,4 +1,3 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  import { cutNameByHyphen } from "./path.mjs";
4
3
  export { cutNameByHyphen };
@@ -1,4 +1,3 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  const cutNameByHyphen = (s)=>s.split(/[-_]/)[0];
4
3
  export { cutNameByHyphen };
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- /*#__PURE__*/ import.meta.url;
3
2
  const pluginDagSort = (plugins, key = 'name', preKey = 'pre', postKey = 'post')=>{
4
3
  let allLines = [];
5
4
  function getPluginByAny(q) {
@@ -1,8 +1,6 @@
1
1
  import type { InternalPlugins } from '@modern-js/types';
2
2
  export declare function getPackageManager(cwd?: string): Promise<"pnpm" | "npm" | "yarn">;
3
3
  export declare const getCoreJsVersion: (corejsPkgPath: string) => string;
4
- export declare const defaults: string[];
5
- export declare const getBrowserslist: (appDirectory: string) => string[];
6
4
  export declare function getInternalPlugins(appDirectory: string, internalPlugins?: InternalPlugins): string[];
7
5
  export declare const readTsConfig: (root: string) => any;
8
6
  export declare const readTsConfigByFile: (filename: string) => any;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.0.0-alpha.2",
18
+ "version": "3.0.1",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "main": "./dist/cjs/index.js",
21
21
  "module": "./dist/esm/index.mjs",
@@ -142,17 +142,17 @@
142
142
  "rslog": "^1.3.2"
143
143
  },
144
144
  "devDependencies": {
145
- "@rslib/core": "0.19.3",
145
+ "@rslib/core": "0.19.4",
146
146
  "@types/node": "^20",
147
- "happy-dom": "^20.3.9",
147
+ "happy-dom": "^20.4.0",
148
148
  "typescript": "^5",
149
149
  "@modern-js/rslib": "2.68.10",
150
- "@scripts/rstest-config": "2.66.0",
151
- "@modern-js/types": "3.0.0-alpha.2"
150
+ "@modern-js/types": "3.0.1",
151
+ "@scripts/rstest-config": "2.66.0"
152
152
  },
153
153
  "peerDependencies": {
154
- "react": "^19.2.3",
155
- "react-dom": "^19.2.3"
154
+ "react": "^19.2.4",
155
+ "react-dom": "^19.2.4"
156
156
  },
157
157
  "peerDependenciesMeta": {
158
158
  "react": {