@modern-js/utils 2.22.0 → 2.22.1-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. package/dist/FileSizeReporter.d.ts +16 -0
  2. package/dist/FileSizeReporter.js +162 -0
  3. package/dist/alias.d.ts +25 -0
  4. package/dist/alias.js +108 -0
  5. package/dist/analyzeProject.d.ts +2 -0
  6. package/dist/analyzeProject.js +71 -0
  7. package/dist/applyOptionsChain.d.ts +3 -0
  8. package/dist/applyOptionsChain.js +58 -0
  9. package/dist/babel.d.ts +3 -0
  10. package/dist/babel.js +136 -0
  11. package/dist/chainId.d.ts +244 -0
  12. package/dist/chainId.js +196 -0
  13. package/dist/clearConsole.d.ts +1 -0
  14. package/dist/clearConsole.js +31 -0
  15. package/dist/commands.d.ts +4 -0
  16. package/dist/commands.js +48 -0
  17. package/dist/compatRequire.d.ts +13 -0
  18. package/dist/compatRequire.js +82 -0
  19. package/dist/compiled.d.ts +43 -0
  20. package/dist/compiled.js +142 -0
  21. package/dist/constants.d.ts +244 -0
  22. package/dist/constants.js +320 -0
  23. package/dist/debug.d.ts +6 -0
  24. package/dist/debug.js +28 -0
  25. package/dist/emptyDir.d.ts +1 -0
  26. package/dist/emptyDir.js +52 -0
  27. package/dist/ensureAbsolutePath.d.ts +7 -0
  28. package/dist/ensureAbsolutePath.js +38 -0
  29. package/dist/ensureArray.d.ts +1 -0
  30. package/dist/ensureArray.js +32 -0
  31. package/dist/findExists.d.ts +6 -0
  32. package/dist/findExists.js +45 -0
  33. package/dist/generateMetaTags.d.ts +16 -0
  34. package/dist/generateMetaTags.js +61 -0
  35. package/dist/getBrowserslist.d.ts +2 -0
  36. package/dist/getBrowserslist.js +31 -0
  37. package/dist/getCoreJsVersion.d.ts +1 -0
  38. package/dist/getCoreJsVersion.js +46 -0
  39. package/dist/getEntryOptions.d.ts +1 -0
  40. package/dist/getEntryOptions.js +54 -0
  41. package/dist/getPackageManager.d.ts +1 -0
  42. package/dist/getPackageManager.js +87 -0
  43. package/dist/getPort.d.ts +14 -0
  44. package/dist/getPort.js +112 -0
  45. package/dist/getServerConfig.d.ts +1 -0
  46. package/dist/getServerConfig.js +67 -0
  47. package/dist/getTargetDir.d.ts +1 -0
  48. package/dist/getTargetDir.js +41 -0
  49. package/dist/import.d.ts +5 -0
  50. package/dist/import.js +33 -0
  51. package/dist/index.d.ts +44 -0
  52. package/dist/index.js +60 -0
  53. package/dist/is/index.d.ts +58 -0
  54. package/dist/is/index.js +114 -0
  55. package/dist/is/nodeEnv.d.ts +8 -0
  56. package/dist/is/nodeEnv.js +39 -0
  57. package/dist/is/platform.d.ts +2 -0
  58. package/dist/is/platform.js +30 -0
  59. package/dist/is/type.d.ts +8 -0
  60. package/dist/is/type.js +64 -0
  61. package/dist/logger.d.ts +65 -0
  62. package/dist/logger.js +145 -0
  63. package/dist/monorepo.d.ts +11 -0
  64. package/dist/monorepo.js +137 -0
  65. package/dist/nodeEnv.d.ts +3 -0
  66. package/dist/nodeEnv.js +81 -0
  67. package/dist/path.d.ts +18 -0
  68. package/dist/path.js +92 -0
  69. package/dist/pathSerializer.d.ts +16 -0
  70. package/dist/pathSerializer.js +76 -0
  71. package/dist/plugin.d.ts +2 -0
  72. package/dist/plugin.js +46 -0
  73. package/dist/prettyInstructions.d.ts +9 -0
  74. package/dist/prettyInstructions.js +112 -0
  75. package/dist/printBuildError.d.ts +8 -0
  76. package/dist/printBuildError.js +57 -0
  77. package/dist/react.d.ts +1 -0
  78. package/dist/react.js +64 -0
  79. package/dist/readTsConfig.d.ts +2 -0
  80. package/dist/readTsConfig.js +47 -0
  81. package/dist/removeSlash.d.ts +3 -0
  82. package/dist/removeSlash.js +33 -0
  83. package/dist/resolve.d.ts +13 -0
  84. package/dist/resolve.js +63 -0
  85. package/dist/routes.d.ts +2 -0
  86. package/dist/routes.js +58 -0
  87. package/dist/runtimeExports.d.ts +4 -0
  88. package/dist/runtimeExports.js +73 -0
  89. package/dist/ssr.d.ts +8 -0
  90. package/dist/ssr.js +30 -0
  91. package/dist/storage.d.ts +5 -0
  92. package/dist/storage.js +75 -0
  93. package/dist/testUtils.d.ts +5 -0
  94. package/dist/testUtils.js +38 -0
  95. package/dist/types.d.ts +1 -0
  96. package/dist/types.js +15 -0
  97. package/dist/universal/constants.d.ts +9 -0
  98. package/dist/universal/constants.js +30 -0
  99. package/dist/universal/formatWebpack.d.ts +13 -0
  100. package/dist/universal/formatWebpack.js +100 -0
  101. package/dist/universal/nestedRoutes.d.ts +8 -0
  102. package/dist/universal/nestedRoutes.js +131 -0
  103. package/dist/universal/remixRouter.d.ts +1 -0
  104. package/dist/universal/remixRouter.js +17 -0
  105. package/dist/universal/serialize.d.ts +1 -0
  106. package/dist/universal/serialize.js +40 -0
  107. package/dist/version.d.ts +2 -0
  108. package/dist/version.js +92 -0
  109. package/dist/wait.d.ts +2 -0
  110. package/dist/wait.js +29 -0
  111. package/dist/watch.d.ts +8 -0
  112. package/dist/watch.js +90 -0
  113. package/package.json +3 -3
package/dist/watch.js ADDED
@@ -0,0 +1,90 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var __async = (__this, __arguments, generator) => {
29
+ return new Promise((resolve, reject) => {
30
+ var fulfilled = (value) => {
31
+ try {
32
+ step(generator.next(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var rejected = (value) => {
38
+ try {
39
+ step(generator.throw(value));
40
+ } catch (e) {
41
+ reject(e);
42
+ }
43
+ };
44
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
+ step((generator = generator.apply(__this, __arguments)).next());
46
+ });
47
+ };
48
+ var watch_exports = {};
49
+ __export(watch_exports, {
50
+ WatchChangeType: () => WatchChangeType,
51
+ watch: () => watch
52
+ });
53
+ module.exports = __toCommonJS(watch_exports);
54
+ var path = __toESM(require("path"));
55
+ var import_compiled = require("./compiled");
56
+ const WatchChangeType = {
57
+ ADD: "add",
58
+ UNLINK: "unlink",
59
+ CHANGE: "change"
60
+ };
61
+ const watch = (watchDir, runTask, ignored = []) => {
62
+ let ready = false;
63
+ const watcher = import_compiled.chokidar.watch(watchDir, {
64
+ ignored
65
+ });
66
+ watcher.on("ready", () => ready = true);
67
+ watcher.on("change", (filePath) => __async(void 0, null, function* () {
68
+ const changedFilePath = path.resolve(filePath);
69
+ yield runTask({ changedFilePath, changeType: WatchChangeType.CHANGE });
70
+ }));
71
+ watcher.on("add", (filePath) => __async(void 0, null, function* () {
72
+ const changedFilePath = path.resolve(filePath);
73
+ if (ready) {
74
+ yield runTask({ changedFilePath, changeType: WatchChangeType.ADD });
75
+ }
76
+ }));
77
+ watcher.on("unlink", (filePath) => __async(void 0, null, function* () {
78
+ const changedFilePath = path.resolve(filePath);
79
+ yield runTask({ changedFilePath, changeType: WatchChangeType.UNLINK });
80
+ }));
81
+ watcher.on("error", (err) => {
82
+ throw err;
83
+ });
84
+ return watcher;
85
+ };
86
+ // Annotate the CommonJS export names for ESM import in node:
87
+ 0 && (module.exports = {
88
+ WatchChangeType,
89
+ watch
90
+ });
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.22.0",
18
+ "version": "2.22.1-alpha.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -232,8 +232,8 @@
232
232
  "webpack": "^5.82.1",
233
233
  "@types/serialize-javascript": "^5.0.1",
234
234
  "@modern-js/types": "2.22.0",
235
- "@scripts/jest-config": "2.22.0",
236
- "@scripts/build": "2.22.0"
235
+ "@scripts/build": "2.22.0",
236
+ "@scripts/jest-config": "2.22.0"
237
237
  },
238
238
  "sideEffects": false,
239
239
  "scripts": {