@modern-js/utils 2.11.0 → 2.12.1-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{alias.js → cjs/alias.js} +4 -15
  3. package/dist/{analyzeProject.js → cjs/analyzeProject.js} +5 -25
  4. package/dist/{babel.js → cjs/babel.js} +9 -16
  5. package/dist/{commands.js → cjs/commands.js} +7 -2
  6. package/dist/{compatRequire.js → cjs/compatRequire.js} +4 -17
  7. package/dist/cjs/emptyDir.js +32 -0
  8. package/dist/{getEntryOptions.js → cjs/getEntryOptions.js} +1 -15
  9. package/dist/{getPackageManager.js → cjs/getPackageManager.js} +19 -41
  10. package/dist/{getPort.js → cjs/getPort.js} +4 -24
  11. package/dist/{getServerConfig.js → cjs/getServerConfig.js} +2 -22
  12. package/dist/{logger.js → cjs/logger.js} +5 -16
  13. package/dist/{monorepo.js → cjs/monorepo.js} +4 -15
  14. package/dist/cjs/nodeEnv.js +55 -0
  15. package/dist/{path.js → cjs/path.js} +1 -1
  16. package/dist/{pathSerializer.js → cjs/pathSerializer.js} +1 -1
  17. package/dist/{prettyInstructions.js → cjs/prettyInstructions.js} +13 -16
  18. package/dist/{react.js → cjs/react.js} +4 -15
  19. package/dist/{runtimeExports.js → cjs/runtimeExports.js} +1 -1
  20. package/dist/{universal → cjs/universal}/nestedRoutes.js +2 -19
  21. package/dist/cjs/version.js +59 -0
  22. package/dist/{watch.js → cjs/watch.js} +9 -29
  23. package/dist/esm/FileSizeReporter.js +180 -0
  24. package/dist/esm/alias.js +83 -0
  25. package/dist/esm/analyzeProject.js +168 -0
  26. package/dist/esm/applyOptionsChain.js +26 -0
  27. package/dist/esm/babel.js +169 -0
  28. package/dist/esm/chainId.js +92 -0
  29. package/dist/esm/clearConsole.js +6 -0
  30. package/dist/esm/commands.js +17 -0
  31. package/dist/esm/compatRequire.js +68 -0
  32. package/dist/esm/compiled.js +34 -0
  33. package/dist/esm/constants.js +317 -0
  34. package/dist/esm/debug.js +5 -0
  35. package/dist/esm/emptyDir.js +158 -0
  36. package/dist/esm/ensureAbsolutePath.js +5 -0
  37. package/dist/esm/ensureArray.js +9 -0
  38. package/dist/esm/findExists.js +27 -0
  39. package/dist/esm/generateMetaTags.js +40 -0
  40. package/dist/esm/getBrowserslist.js +12 -0
  41. package/dist/esm/getCoreJsVersion.js +57 -0
  42. package/dist/esm/getEntryOptions.js +45 -0
  43. package/dist/esm/getPackageManager.js +187 -0
  44. package/dist/esm/getPort.js +215 -0
  45. package/dist/esm/getServerConfig.js +145 -0
  46. package/dist/esm/getTargetDir.js +6 -0
  47. package/dist/esm/import.js +8 -0
  48. package/dist/esm/index.js +44 -0
  49. package/dist/esm/is/index.js +85 -0
  50. package/dist/esm/is/nodeEnv.js +16 -0
  51. package/dist/esm/is/platform.js +7 -0
  52. package/dist/esm/is/type.js +25 -0
  53. package/dist/esm/logger.js +207 -0
  54. package/dist/esm/monorepo.js +109 -0
  55. package/dist/esm/nodeEnv.js +258 -0
  56. package/dist/esm/path.js +85 -0
  57. package/dist/esm/pathSerializer.js +85 -0
  58. package/dist/esm/plugin.js +45 -0
  59. package/dist/esm/prettyInstructions.js +96 -0
  60. package/dist/esm/printBuildError.js +24 -0
  61. package/dist/esm/react.js +43 -0
  62. package/dist/esm/readTsConfig.js +10 -0
  63. package/dist/esm/removeSlash.js +10 -0
  64. package/dist/esm/resolve.js +42 -0
  65. package/dist/esm/routes.js +19 -0
  66. package/dist/esm/runtimeExports.js +65 -0
  67. package/dist/esm/ssr.js +3 -0
  68. package/dist/esm/storage.js +36 -0
  69. package/dist/esm/testUtils.js +13 -0
  70. package/dist/esm/types.js +1 -0
  71. package/dist/esm/universal/constants.js +3 -0
  72. package/dist/esm/universal/formatWebpack.js +108 -0
  73. package/dist/esm/universal/nestedRoutes.js +174 -0
  74. package/dist/esm/universal/remixRouter.js +1 -0
  75. package/dist/esm/universal/serialize.js +7 -0
  76. package/dist/esm/version.js +193 -0
  77. package/dist/esm/wait.js +7 -0
  78. package/dist/esm/watch.js +230 -0
  79. package/dist/esm-node/FileSizeReporter.js +133 -0
  80. package/dist/esm-node/alias.js +61 -0
  81. package/dist/esm-node/analyzeProject.js +17 -0
  82. package/dist/esm-node/applyOptionsChain.js +35 -0
  83. package/dist/esm-node/babel.js +105 -0
  84. package/dist/esm-node/chainId.js +173 -0
  85. package/dist/esm-node/clearConsole.js +8 -0
  86. package/dist/esm-node/commands.js +22 -0
  87. package/dist/esm-node/compatRequire.js +42 -0
  88. package/dist/esm-node/compiled.js +77 -0
  89. package/dist/esm-node/constants.js +264 -0
  90. package/dist/esm-node/debug.js +5 -0
  91. package/dist/esm-node/emptyDir.js +9 -0
  92. package/dist/esm-node/ensureAbsolutePath.js +5 -0
  93. package/dist/esm-node/ensureArray.js +9 -0
  94. package/dist/esm-node/findExists.js +12 -0
  95. package/dist/esm-node/generateMetaTags.js +38 -0
  96. package/dist/esm-node/getBrowserslist.js +7 -0
  97. package/dist/esm-node/getCoreJsVersion.js +13 -0
  98. package/dist/esm-node/getEntryOptions.js +17 -0
  99. package/dist/esm-node/getPackageManager.js +32 -0
  100. package/dist/esm-node/getPort.js +59 -0
  101. package/dist/esm-node/getServerConfig.js +14 -0
  102. package/dist/esm-node/getTargetDir.js +8 -0
  103. package/dist/esm-node/import.js +9 -0
  104. package/dist/esm-node/index.js +44 -0
  105. package/dist/esm-node/is/index.js +71 -0
  106. package/dist/esm-node/is/nodeEnv.js +12 -0
  107. package/dist/esm-node/is/platform.js +6 -0
  108. package/dist/esm-node/is/type.js +34 -0
  109. package/dist/esm-node/logger.js +100 -0
  110. package/dist/esm-node/monorepo.js +87 -0
  111. package/dist/esm-node/nodeEnv.js +30 -0
  112. package/dist/esm-node/path.js +50 -0
  113. package/dist/esm-node/pathSerializer.js +46 -0
  114. package/dist/esm-node/plugin.js +23 -0
  115. package/dist/esm-node/prettyInstructions.js +77 -0
  116. package/dist/esm-node/printBuildError.js +34 -0
  117. package/dist/esm-node/react.js +20 -0
  118. package/dist/esm-node/readTsConfig.js +13 -0
  119. package/dist/esm-node/removeSlash.js +8 -0
  120. package/dist/esm-node/resolve.js +38 -0
  121. package/dist/esm-node/routes.js +24 -0
  122. package/dist/esm-node/runtimeExports.js +40 -0
  123. package/dist/esm-node/ssr.js +6 -0
  124. package/dist/esm-node/storage.js +42 -0
  125. package/dist/esm-node/testUtils.js +15 -0
  126. package/dist/esm-node/types.js +0 -0
  127. package/dist/esm-node/universal/constants.js +6 -0
  128. package/dist/esm-node/universal/formatWebpack.js +77 -0
  129. package/dist/esm-node/universal/nestedRoutes.js +93 -0
  130. package/dist/esm-node/universal/remixRouter.js +1 -0
  131. package/dist/esm-node/universal/serialize.js +7 -0
  132. package/dist/esm-node/version.js +25 -0
  133. package/dist/esm-node/wait.js +6 -0
  134. package/dist/esm-node/watch.js +36 -0
  135. package/dist/types/commands.d.ts +4 -0
  136. package/dist/{prettyInstructions.d.ts → types/prettyInstructions.d.ts} +4 -3
  137. package/package.json +4 -4
  138. package/dist/commands.d.ts +0 -3
  139. package/dist/emptyDir.js +0 -52
  140. package/dist/nodeEnv.js +0 -81
  141. package/dist/version.js +0 -92
  142. /package/dist/{FileSizeReporter.js → cjs/FileSizeReporter.js} +0 -0
  143. /package/dist/{applyOptionsChain.js → cjs/applyOptionsChain.js} +0 -0
  144. /package/dist/{chainId.js → cjs/chainId.js} +0 -0
  145. /package/dist/{clearConsole.js → cjs/clearConsole.js} +0 -0
  146. /package/dist/{compiled.js → cjs/compiled.js} +0 -0
  147. /package/dist/{constants.js → cjs/constants.js} +0 -0
  148. /package/dist/{debug.js → cjs/debug.js} +0 -0
  149. /package/dist/{ensureAbsolutePath.js → cjs/ensureAbsolutePath.js} +0 -0
  150. /package/dist/{ensureArray.js → cjs/ensureArray.js} +0 -0
  151. /package/dist/{findExists.js → cjs/findExists.js} +0 -0
  152. /package/dist/{generateMetaTags.js → cjs/generateMetaTags.js} +0 -0
  153. /package/dist/{getBrowserslist.js → cjs/getBrowserslist.js} +0 -0
  154. /package/dist/{getCoreJsVersion.js → cjs/getCoreJsVersion.js} +0 -0
  155. /package/dist/{getTargetDir.js → cjs/getTargetDir.js} +0 -0
  156. /package/dist/{import.js → cjs/import.js} +0 -0
  157. /package/dist/{index.js → cjs/index.js} +0 -0
  158. /package/dist/{is → cjs/is}/index.js +0 -0
  159. /package/dist/{is → cjs/is}/nodeEnv.js +0 -0
  160. /package/dist/{is → cjs/is}/platform.js +0 -0
  161. /package/dist/{is → cjs/is}/type.js +0 -0
  162. /package/dist/{plugin.js → cjs/plugin.js} +0 -0
  163. /package/dist/{printBuildError.js → cjs/printBuildError.js} +0 -0
  164. /package/dist/{readTsConfig.js → cjs/readTsConfig.js} +0 -0
  165. /package/dist/{removeSlash.js → cjs/removeSlash.js} +0 -0
  166. /package/dist/{resolve.js → cjs/resolve.js} +0 -0
  167. /package/dist/{routes.js → cjs/routes.js} +0 -0
  168. /package/dist/{ssr.js → cjs/ssr.js} +0 -0
  169. /package/dist/{storage.js → cjs/storage.js} +0 -0
  170. /package/dist/{testUtils.js → cjs/testUtils.js} +0 -0
  171. /package/dist/{types.js → cjs/types.js} +0 -0
  172. /package/dist/{universal → cjs/universal}/constants.js +0 -0
  173. /package/dist/{universal → cjs/universal}/formatWebpack.js +0 -0
  174. /package/dist/{universal → cjs/universal}/remixRouter.js +0 -0
  175. /package/dist/{universal → cjs/universal}/serialize.js +0 -0
  176. /package/dist/{wait.js → cjs/wait.js} +0 -0
  177. /package/dist/{FileSizeReporter.d.ts → types/FileSizeReporter.d.ts} +0 -0
  178. /package/dist/{alias.d.ts → types/alias.d.ts} +0 -0
  179. /package/dist/{analyzeProject.d.ts → types/analyzeProject.d.ts} +0 -0
  180. /package/dist/{applyOptionsChain.d.ts → types/applyOptionsChain.d.ts} +0 -0
  181. /package/dist/{babel.d.ts → types/babel.d.ts} +0 -0
  182. /package/dist/{chainId.d.ts → types/chainId.d.ts} +0 -0
  183. /package/dist/{clearConsole.d.ts → types/clearConsole.d.ts} +0 -0
  184. /package/dist/{compatRequire.d.ts → types/compatRequire.d.ts} +0 -0
  185. /package/dist/{compiled.d.ts → types/compiled.d.ts} +0 -0
  186. /package/dist/{constants.d.ts → types/constants.d.ts} +0 -0
  187. /package/dist/{debug.d.ts → types/debug.d.ts} +0 -0
  188. /package/dist/{emptyDir.d.ts → types/emptyDir.d.ts} +0 -0
  189. /package/dist/{ensureAbsolutePath.d.ts → types/ensureAbsolutePath.d.ts} +0 -0
  190. /package/dist/{ensureArray.d.ts → types/ensureArray.d.ts} +0 -0
  191. /package/dist/{findExists.d.ts → types/findExists.d.ts} +0 -0
  192. /package/dist/{generateMetaTags.d.ts → types/generateMetaTags.d.ts} +0 -0
  193. /package/dist/{getBrowserslist.d.ts → types/getBrowserslist.d.ts} +0 -0
  194. /package/dist/{getCoreJsVersion.d.ts → types/getCoreJsVersion.d.ts} +0 -0
  195. /package/dist/{getEntryOptions.d.ts → types/getEntryOptions.d.ts} +0 -0
  196. /package/dist/{getPackageManager.d.ts → types/getPackageManager.d.ts} +0 -0
  197. /package/dist/{getPort.d.ts → types/getPort.d.ts} +0 -0
  198. /package/dist/{getServerConfig.d.ts → types/getServerConfig.d.ts} +0 -0
  199. /package/dist/{getTargetDir.d.ts → types/getTargetDir.d.ts} +0 -0
  200. /package/dist/{import.d.ts → types/import.d.ts} +0 -0
  201. /package/dist/{index.d.ts → types/index.d.ts} +0 -0
  202. /package/dist/{is → types/is}/index.d.ts +0 -0
  203. /package/dist/{is → types/is}/nodeEnv.d.ts +0 -0
  204. /package/dist/{is → types/is}/platform.d.ts +0 -0
  205. /package/dist/{is → types/is}/type.d.ts +0 -0
  206. /package/dist/{logger.d.ts → types/logger.d.ts} +0 -0
  207. /package/dist/{monorepo.d.ts → types/monorepo.d.ts} +0 -0
  208. /package/dist/{nodeEnv.d.ts → types/nodeEnv.d.ts} +0 -0
  209. /package/dist/{path.d.ts → types/path.d.ts} +0 -0
  210. /package/dist/{pathSerializer.d.ts → types/pathSerializer.d.ts} +0 -0
  211. /package/dist/{plugin.d.ts → types/plugin.d.ts} +0 -0
  212. /package/dist/{printBuildError.d.ts → types/printBuildError.d.ts} +0 -0
  213. /package/dist/{react.d.ts → types/react.d.ts} +0 -0
  214. /package/dist/{readTsConfig.d.ts → types/readTsConfig.d.ts} +0 -0
  215. /package/dist/{removeSlash.d.ts → types/removeSlash.d.ts} +0 -0
  216. /package/dist/{resolve.d.ts → types/resolve.d.ts} +0 -0
  217. /package/dist/{routes.d.ts → types/routes.d.ts} +0 -0
  218. /package/dist/{runtimeExports.d.ts → types/runtimeExports.d.ts} +0 -0
  219. /package/dist/{ssr.d.ts → types/ssr.d.ts} +0 -0
  220. /package/dist/{storage.d.ts → types/storage.d.ts} +0 -0
  221. /package/dist/{testUtils.d.ts → types/testUtils.d.ts} +0 -0
  222. /package/dist/{types.d.ts → types/types.d.ts} +0 -0
  223. /package/dist/{universal → types/universal}/constants.d.ts +0 -0
  224. /package/dist/{universal → types/universal}/formatWebpack.d.ts +0 -0
  225. /package/dist/{universal → types/universal}/nestedRoutes.d.ts +0 -0
  226. /package/dist/{universal → types/universal}/remixRouter.d.ts +0 -0
  227. /package/dist/{universal → types/universal}/serialize.d.ts +0 -0
  228. /package/dist/{version.d.ts → types/version.d.ts} +0 -0
  229. /package/dist/{wait.d.ts → types/wait.d.ts} +0 -0
  230. /package/dist/{watch.d.ts → types/watch.d.ts} +0 -0
@@ -0,0 +1,169 @@
1
+ function _arrayLikeToArray(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _arrayWithoutHoles(arr) {
7
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
8
+ }
9
+ function _defineProperty(obj, key, value) {
10
+ if (key in obj) {
11
+ Object.defineProperty(obj, key, {
12
+ value: value,
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true
16
+ });
17
+ } else {
18
+ obj[key] = value;
19
+ }
20
+ return obj;
21
+ }
22
+ function _iterableToArray(iter) {
23
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
24
+ }
25
+ function _nonIterableSpread() {
26
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
27
+ }
28
+ function _objectSpread(target) {
29
+ for(var i = 1; i < arguments.length; i++){
30
+ var source = arguments[i] != null ? arguments[i] : {};
31
+ var ownKeys = Object.keys(source);
32
+ if (typeof Object.getOwnPropertySymbols === "function") {
33
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
34
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
35
+ }));
36
+ }
37
+ ownKeys.forEach(function(key) {
38
+ _defineProperty(target, key, source[key]);
39
+ });
40
+ }
41
+ return target;
42
+ }
43
+ function _toConsumableArray(arr) {
44
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
45
+ }
46
+ function _unsupportedIterableToArray(o, minLen) {
47
+ if (!o) return;
48
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
49
+ var n = Object.prototype.toString.call(o).slice(8, -1);
50
+ if (n === "Object" && o.constructor) n = o.constructor.name;
51
+ if (n === "Map" || n === "Set") return Array.from(n);
52
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
53
+ }
54
+ import { isAbsolute, sep } from "path";
55
+ import { applyOptionsChain } from "./applyOptionsChain";
56
+ import { ensureArray } from "./ensureArray";
57
+ import { normalizeToPosixPath } from "./path";
58
+ var formatPath = function(originPath) {
59
+ if (isAbsolute(originPath)) {
60
+ return originPath.split(sep).join("/");
61
+ }
62
+ return originPath;
63
+ };
64
+ var getPluginItemName = function(item) {
65
+ if (typeof item === "string") {
66
+ return formatPath(item);
67
+ }
68
+ if (Array.isArray(item) && typeof item[0] === "string") {
69
+ return formatPath(item[0]);
70
+ }
71
+ return null;
72
+ };
73
+ var addPlugins = function(plugins, config) {
74
+ if (config.plugins) {
75
+ var _config_plugins;
76
+ (_config_plugins = config.plugins).push.apply(_config_plugins, _toConsumableArray(plugins));
77
+ } else {
78
+ config.plugins = plugins;
79
+ }
80
+ };
81
+ var addPresets = function(presets, config) {
82
+ if (config.presets) {
83
+ var _config_presets;
84
+ (_config_presets = config.presets).push.apply(_config_presets, _toConsumableArray(presets));
85
+ } else {
86
+ config.presets = presets;
87
+ }
88
+ };
89
+ var removePlugins = function(plugins, config) {
90
+ if (!config.plugins) {
91
+ return;
92
+ }
93
+ var removeList = ensureArray(plugins);
94
+ config.plugins = config.plugins.filter(function(item) {
95
+ var name = getPluginItemName(item);
96
+ if (name) {
97
+ return !removeList.find(function(removeItem) {
98
+ return name.includes(removeItem);
99
+ });
100
+ }
101
+ return true;
102
+ });
103
+ };
104
+ var removePresets = function(presets, config) {
105
+ if (!config.presets) {
106
+ return;
107
+ }
108
+ var removeList = ensureArray(presets);
109
+ config.presets = config.presets.filter(function(item) {
110
+ var name = getPluginItemName(item);
111
+ if (name) {
112
+ return !removeList.find(function(removeItem) {
113
+ return name.includes(removeItem);
114
+ });
115
+ }
116
+ return true;
117
+ });
118
+ };
119
+ var modifyPresetOptions = function(presetName, options) {
120
+ var presets = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
121
+ presets.forEach(function(preset, index) {
122
+ if (Array.isArray(preset)) {
123
+ if (typeof preset[0] === "string" && normalizeToPosixPath(preset[0]).includes(presetName)) {
124
+ preset[1] = _objectSpread({}, preset[1] || {}, options);
125
+ }
126
+ } else if (typeof preset === "string" && normalizeToPosixPath(preset).includes(presetName)) {
127
+ presets[index] = [
128
+ preset,
129
+ options
130
+ ];
131
+ }
132
+ });
133
+ };
134
+ var getBabelUtils = function(config) {
135
+ var noop = function() {};
136
+ return {
137
+ addPlugins: function(plugins) {
138
+ return addPlugins(plugins, config);
139
+ },
140
+ addPresets: function(presets) {
141
+ return addPresets(presets, config);
142
+ },
143
+ removePlugins: function(plugins) {
144
+ return removePlugins(plugins, config);
145
+ },
146
+ removePresets: function(presets) {
147
+ return removePresets(presets, config);
148
+ },
149
+ // `addIncludes` and `addExcludes` are noop functions by default,
150
+ // It can be overridden by `extraBabelUtils`.
151
+ addIncludes: noop,
152
+ addExcludes: noop,
153
+ // Compat `presetEnvOptions` and `presetReactOptions` in Eden.
154
+ modifyPresetEnvOptions: function(options) {
155
+ return modifyPresetOptions("@babel/preset-env", options, config.presets || []);
156
+ },
157
+ modifyPresetReactOptions: function(options) {
158
+ return modifyPresetOptions("@babel/preset-react", options, config.presets || []);
159
+ }
160
+ };
161
+ };
162
+ var applyUserBabelConfig = function(defaultOptions, userBabelConfig, extraBabelUtils) {
163
+ if (userBabelConfig) {
164
+ var babelUtils = _objectSpread({}, getBabelUtils(defaultOptions), extraBabelUtils);
165
+ return applyOptionsChain(defaultOptions, userBabelConfig || {}, babelUtils);
166
+ }
167
+ return defaultOptions;
168
+ };
169
+ export { applyUserBabelConfig, getBabelUtils };
@@ -0,0 +1,92 @@
1
+ var CHAIN_ID = {
2
+ /** Predefined rules */ RULE: {
3
+ /** Rule for .mjs */ MJS: "mjs",
4
+ /** Rule for predefined loaders */ LOADERS: "loaders",
5
+ /** Rule for fonts */ FONT: "font",
6
+ /** Rule for images */ IMAGE: "image",
7
+ /** Rule for media */ MEDIA: "media",
8
+ /** Rule for js */ JS: "js",
9
+ /** Rule for data uri encoded javascript */ JS_DATA_URI: "js-data-uri",
10
+ /** Rule for ts */ TS: "ts",
11
+ /** Rule for css */ CSS: "css",
12
+ /** Rule for less */ LESS: "less",
13
+ /** Rule for sass */ SASS: "sass",
14
+ /** Rule for stylus */ STYLUS: "stylus",
15
+ /** Rule for svg */ SVG: "svg",
16
+ /** Rule for pug */ PUG: "pug",
17
+ /** Rule for toml */ TOML: "toml",
18
+ /** Rule for yaml */ YAML: "yaml",
19
+ /** Rule for bff */ JS_BFF_API: "js-bff-api"
20
+ },
21
+ /** Predefined rule groups */ ONE_OF: {
22
+ SVG: "svg",
23
+ SVG_URL: "svg-url",
24
+ SVG_ASSET: "svg-asset",
25
+ SVG_INLINE: "svg-inline"
26
+ },
27
+ /** Predefined loaders */ USE: {
28
+ /** ts-loader */ TS: "ts",
29
+ /** css-loader */ CSS: "css",
30
+ /** sass-loader */ SASS: "sass",
31
+ /** less-loader */ LESS: "less",
32
+ /** stylus-loader */ STYLUS: "stylus",
33
+ /** url-loader */ URL: "url",
34
+ /** pug-loader */ PUG: "pug",
35
+ /** file-loader */ FILE: "file",
36
+ /** @svgr/webpack */ SVGR: "svgr",
37
+ /** yaml-loader */ YAML: "yaml",
38
+ /** toml-loader */ TOML: "toml",
39
+ /** html-loader */ HTML: "html",
40
+ /** babel-loader */ BABEL: "babel",
41
+ /** esbuild-loader */ ESBUILD: "esbuild",
42
+ /** swc-loader */ SWC: "swc",
43
+ /** style-loader */ STYLE: "style-loader",
44
+ /** postcss-loader */ POSTCSS: "postcss",
45
+ /** markdown-loader */ MARKDOWN: "markdown",
46
+ /** ignore-css-loader */ IGNORE_CSS: "ignore-css",
47
+ /** css-modules-typescript-loader */ CSS_MODULES_TS: "css-modules-typescript",
48
+ /** mini-css-extract-plugin.loader */ MINI_CSS_EXTRACT: "mini-css-extract",
49
+ /** builder-plugin-image-compress.loader */ IMAGE_COMPRESS: "image-compress",
50
+ /** builder-plugin-image-compress svgo-loader */ SVGO: "svgo",
51
+ /** builder-plugin-imagex */ IMAGEX: "imagex"
52
+ },
53
+ /** Predefined plugins */ PLUGIN: {
54
+ /** HotModuleReplacementPlugin */ HMR: "hmr",
55
+ /** CopyWebpackPlugin */ COPY: "copy",
56
+ /** HtmlWebpackPlugin */ HTML: "html",
57
+ /** DefinePlugin */ DEFINE: "define",
58
+ /** IgnorePlugin */ IGNORE: "ignore",
59
+ /** BannerPlugin */ BANNER: "banner",
60
+ /** Webpackbar */ PROGRESS: "progress",
61
+ /** Inspector */ INSPECTOR: "inspector",
62
+ /** AppIconPlugin */ APP_ICON: "app-icon",
63
+ /** FaviconUrlPlugin */ FAVICON_URL: "favicon-url",
64
+ /** LoadableWebpackPlugin */ LOADABLE: "loadable",
65
+ /** WebpackManifestPlugin */ MANIFEST: "webpack-manifest",
66
+ /** ForkTsCheckerWebpackPlugin */ TS_CHECKER: "ts-checker",
67
+ /** InlineChunkHtmlPlugin */ INLINE_HTML: "inline-html",
68
+ /** WebpackBundleAnalyzer */ BUNDLE_ANALYZER: "bundle-analyze",
69
+ /** BottomTemplatePlugin */ BOTTOM_TEMPLATE: "bottom-template",
70
+ /** HtmlCrossOriginPlugin */ HTML_CROSS_ORIGIN: "html-cross-origin",
71
+ /** MiniCssExtractPlugin */ MINI_CSS_EXTRACT: "mini-css-extract",
72
+ /** ReactFastRefreshPlugin */ REACT_FAST_REFRESH: "react-fast-refresh",
73
+ /** ProvidePlugin for node polyfill */ NODE_POLYFILL_PROVIDE: "node-polyfill-provide",
74
+ /** WebpackSRIPlugin */ SUBRESOURCE_INTEGRITY: "subresource-integrity",
75
+ /** WebpackAssetsRetryPlugin */ ASSETS_RETRY: "ASSETS_RETRY",
76
+ /** AutoSetRootFontSizePlugin */ AUTO_SET_ROOT_SIZE: "auto-set-root-size",
77
+ /** HtmlAsyncChunkPlugin */ HTML_ASYNC_CHUNK: "html-async-chunk",
78
+ /** SWC_POLYFILL_CHECKER */ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
79
+ /** HtmlTagsPlugin */ HTML_TAGS: "html-tags"
80
+ },
81
+ /** Predefined minimizers */ MINIMIZER: {
82
+ /** TerserWebpackPlugin */ JS: "js",
83
+ /** CssMinimizerWebpackPlugin */ CSS: "css",
84
+ /** ESBuildPlugin */ ESBUILD: "js-css",
85
+ /** SWCPlugin */ SWC: "swc"
86
+ },
87
+ /** Predefined resolve plugins */ RESOLVE_PLUGIN: {
88
+ /** ModuleScopePlugin */ MODULE_SCOPE: "module-scope",
89
+ /** TsConfigPathsPlugin */ TS_CONFIG_PATHS: "ts-config-paths"
90
+ }
91
+ };
92
+ export { CHAIN_ID };
@@ -0,0 +1,6 @@
1
+ var clearConsole = function() {
2
+ if (process.stdout.isTTY && !process.env.DEBUG) {
3
+ process.stdout.write("\x1b[H\x1b[2J");
4
+ }
5
+ };
6
+ export { clearConsole };
@@ -0,0 +1,17 @@
1
+ var getFullArgv = function() {
2
+ var _process_env_MODERN_ARGV;
3
+ return ((_process_env_MODERN_ARGV = process.env.MODERN_ARGV) === null || _process_env_MODERN_ARGV === void 0 ? void 0 : _process_env_MODERN_ARGV.split(" ")) || process.argv;
4
+ };
5
+ var getArgv = function() {
6
+ return getFullArgv().slice(2);
7
+ };
8
+ var getCommand = function() {
9
+ var args = getArgv();
10
+ var command = args[0];
11
+ return command;
12
+ };
13
+ var isDevCommand = function() {
14
+ var command = getCommand();
15
+ return command === "dev" || command === "start";
16
+ };
17
+ export { getArgv, getCommand, getFullArgv, isDevCommand };
@@ -0,0 +1,68 @@
1
+ function _defineProperty(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _objectSpread(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i] != null ? arguments[i] : {};
17
+ var ownKeys = Object.keys(source);
18
+ if (typeof Object.getOwnPropertySymbols === "function") {
19
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
+ }));
22
+ }
23
+ ownKeys.forEach(function(key) {
24
+ _defineProperty(target, key, source[key]);
25
+ });
26
+ }
27
+ return target;
28
+ }
29
+ import { findExists } from "./findExists";
30
+ var compatRequire = function(filePath) {
31
+ var interop = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
32
+ var mod = require(filePath);
33
+ var rtnESMDefault = interop && (mod === null || mod === void 0 ? void 0 : mod.__esModule);
34
+ return rtnESMDefault ? mod.default : mod;
35
+ };
36
+ var dynamicImport = new Function("modulePath", "return import(modulePath)");
37
+ var requireExistModule = function(filename, opt) {
38
+ var final = _objectSpread({
39
+ extensions: [
40
+ ".ts",
41
+ ".js"
42
+ ],
43
+ interop: true
44
+ }, opt);
45
+ var exist = findExists(final.extensions.map(function(ext) {
46
+ return "".concat(filename).concat(ext);
47
+ }));
48
+ if (!exist) {
49
+ return null;
50
+ }
51
+ return compatRequire(exist, final.interop);
52
+ };
53
+ var cleanRequireCache = function(filelist) {
54
+ filelist.forEach(function(filepath) {
55
+ delete require.cache[filepath];
56
+ });
57
+ };
58
+ function deleteRequireCache(path) {
59
+ if (require.cache[path]) {
60
+ delete require.cache[path];
61
+ }
62
+ if (module.children) {
63
+ module.children = module.children.filter(function(item) {
64
+ return item.filename !== path;
65
+ });
66
+ }
67
+ }
68
+ export { cleanRequireCache, compatRequire, deleteRequireCache, dynamicImport, requireExistModule };
@@ -0,0 +1,34 @@
1
+ import { Import } from "./import";
2
+ import { default as default2 } from "../compiled/fs-extra";
3
+ import { default as default3 } from "../compiled/ora";
4
+ import { default as default4 } from "../compiled/glob";
5
+ import { default as default5 } from "../compiled/js-yaml";
6
+ import { default as default6 } from "../compiled/chalk";
7
+ import { default as default7 } from "../compiled/debug";
8
+ import { default as default8 } from "../compiled/slash";
9
+ import { default as default9 } from "../compiled/execa";
10
+ import { default as default10 } from "../compiled/json5";
11
+ import { default as default11 } from "../compiled/upath";
12
+ import { default as default12 } from "../compiled/pkg-up";
13
+ import { nanoid } from "../compiled/nanoid";
14
+ import { default as default13 } from "../compiled/semver";
15
+ import { default as default14 } from "../compiled/dotenv";
16
+ import { default as default15 } from "../compiled/lodash";
17
+ import { default as default16 } from "../compiled/globby";
18
+ import { default as default17 } from "../compiled/address";
19
+ import { default as default18 } from "../compiled/signale";
20
+ import { default as default19 } from "../compiled/url-join";
21
+ import { default as default20 } from "../compiled/minimist";
22
+ import { default as default21 } from "../compiled/fast-glob";
23
+ import { default as default22 } from "../compiled/filesize";
24
+ import { default as default23 } from "../compiled/gzip-size";
25
+ import { default as default24 } from "../compiled/strip-ansi";
26
+ import { default as default25 } from "../compiled/dotenv-expand";
27
+ import { default as default26 } from "../compiled/browserslist";
28
+ import { default as default27 } from "../compiled/recursive-readdir";
29
+ import { program, Command } from "../compiled/commander";
30
+ import { Signale } from "../compiled/signale";
31
+ var mime = Import.lazy("../compiled/mime-types", require);
32
+ var chokidar = Import.lazy("../compiled/chokidar", require);
33
+ var inquirer = Import.lazy("../compiled/inquirer", require);
34
+ export { Command, Signale, default17 as address, default26 as browserslist, default6 as chalk, chokidar, default7 as debug, default14 as dotenv, default25 as dotenvExpand, default9 as execa, default21 as fastGlob, default22 as filesize, default2 as fs, default4 as glob, default16 as globby, default23 as gzipSize, inquirer, default10 as json5, default15 as lodash, mime, default20 as minimist, nanoid, default3 as ora, default12 as pkgUp, program, default27 as recursiveReaddir, default13 as semver, default18 as signale, default8 as slash, default24 as stripAnsi, default11 as upath, default19 as urlJoin, default5 as yaml };