@modern-js/utils 2.19.1 → 2.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/cjs/cli/alias.js +3 -7
  3. package/dist/cjs/cli/constants/chainId.js +2 -0
  4. package/dist/cjs/cli/constants/index.js +2 -14
  5. package/dist/cjs/cli/ensure.js +2 -6
  6. package/dist/cjs/cli/get/data.js +3 -7
  7. package/dist/cjs/cli/get/index.js +5 -21
  8. package/dist/cjs/cli/index.js +24 -37
  9. package/dist/cjs/cli/is/index.js +6 -18
  10. package/dist/cjs/cli/is/project.js +2 -6
  11. package/dist/cjs/cli/logger.js +7 -23
  12. package/dist/cjs/cli/monorepo.js +3 -7
  13. package/dist/cjs/cli/path.js +4 -8
  14. package/dist/cjs/cli/pathSerializer.js +3 -7
  15. package/dist/cjs/cli/port.js +2 -6
  16. package/dist/cjs/cli/prettyInstructions.js +2 -6
  17. package/dist/cjs/cli/routes.js +2 -6
  18. package/dist/cjs/cli/runtimeExports.js +2 -6
  19. package/dist/cjs/cli/watch.js +2 -6
  20. package/dist/cjs/compiled.js +28 -71
  21. package/dist/cjs/index.js +4 -16
  22. package/dist/cjs/runtime/nestedRoutes.js +2 -41
  23. package/dist/cjs/runtime/remixRouter.js +2 -14
  24. package/dist/cjs/runtime/router.js +2 -15
  25. package/dist/cjs/runtime-browser/index.js +2 -14
  26. package/dist/cjs/runtime-node/router.js +6 -0
  27. package/dist/cjs/runtime-node/serialize.js +2 -6
  28. package/dist/cjs/runtime-node/storage.js +2 -41
  29. package/dist/compiled/better-ajv-errors/index.js +1 -1
  30. package/dist/compiled/webpack-dev-middleware/index.js +2 -2
  31. package/dist/esm/cli/constants/chainId.js +2 -0
  32. package/dist/esm/cli/index.js +0 -1
  33. package/dist/esm/cli/logger.js +1 -13
  34. package/dist/esm/runtime/router.js +1 -2
  35. package/dist/esm/runtime-node/router.js +1 -0
  36. package/dist/types/cli/constants/chainId.d.ts +2 -73
  37. package/dist/types/cli/constants/index.d.ts +0 -21
  38. package/dist/types/cli/index.d.ts +0 -1
  39. package/dist/types/cli/is/config.d.ts +0 -2
  40. package/dist/types/cli/is/project.d.ts +0 -2
  41. package/dist/types/cli/is/type.d.ts +0 -1
  42. package/dist/types/cli/logger.d.ts +0 -2
  43. package/dist/types/cli/path.d.ts +0 -2
  44. package/dist/types/cli/require.d.ts +0 -1
  45. package/dist/types/compiled.d.ts +0 -1
  46. package/dist/types/runtime/router.d.ts +1 -2
  47. package/dist/types/runtime-node/index.d.ts +0 -1
  48. package/dist/types/runtime-node/router.d.ts +1 -0
  49. package/dist/types/universal/constants.d.ts +0 -1
  50. package/package.json +38 -12
  51. package/dist/cjs/cli/generateMetaTags.js +0 -42
  52. package/dist/esm/cli/generateMetaTags.js +0 -34
  53. package/dist/types/cli/generateMetaTags.d.ts +0 -16
@@ -13,49 +13,10 @@ _export(exports, {
13
13
  transformNestedRoutes: () => transformNestedRoutes,
14
14
  renderNestedRoute: () => renderNestedRoute
15
15
  });
16
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
16
17
  const _jsxruntime = require("react/jsx-runtime");
17
- const _react = /* @__PURE__ */ _interop_require_wildcard(require("react"));
18
+ const _react = /* @__PURE__ */ _interop_require_wildcard._(require("react"));
18
19
  const _reactrouterdom = require("react-router-dom");
19
- function _getRequireWildcardCache(nodeInterop) {
20
- if (typeof WeakMap !== "function")
21
- return null;
22
- var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
23
- var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
24
- return (_getRequireWildcardCache = function(nodeInterop2) {
25
- return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
26
- })(nodeInterop);
27
- }
28
- function _interop_require_wildcard(obj, nodeInterop) {
29
- if (!nodeInterop && obj && obj.__esModule) {
30
- return obj;
31
- }
32
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
33
- return {
34
- default: obj
35
- };
36
- }
37
- var cache = _getRequireWildcardCache(nodeInterop);
38
- if (cache && cache.has(obj)) {
39
- return cache.get(obj);
40
- }
41
- var newObj = {};
42
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
43
- for (var key in obj) {
44
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
45
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
46
- if (desc && (desc.get || desc.set)) {
47
- Object.defineProperty(newObj, key, desc);
48
- } else {
49
- newObj[key] = obj[key];
50
- }
51
- }
52
- }
53
- newObj.default = obj;
54
- if (cache) {
55
- cache.set(obj, newObj);
56
- }
57
- return newObj;
58
- }
59
20
  const transformNestedRoutes = (routes) => {
60
21
  const routeElements = [];
61
22
  for (const route of routes) {
@@ -2,17 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("@remix-run/router"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
18
- }
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("@remix-run/router"), exports);
@@ -2,18 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("./nestedRoutes"), exports);
6
- _export_star(require("./remixRouter"), exports);
7
- function _export_star(from, to) {
8
- Object.keys(from).forEach(function(k) {
9
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
10
- Object.defineProperty(to, k, {
11
- enumerable: true,
12
- get: function() {
13
- return from[k];
14
- }
15
- });
16
- }
17
- });
18
- return from;
19
- }
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("react-router-dom"), exports);
@@ -2,17 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("./parsed"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
18
- }
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./parsed"), exports);
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("react-router-dom/server"), exports);
@@ -6,12 +6,8 @@ Object.defineProperty(exports, "serializeJson", {
6
6
  enumerable: true,
7
7
  get: () => serializeJson
8
8
  });
9
- const _serializejavascript = /* @__PURE__ */ _interop_require_default(require("serialize-javascript"));
10
- function _interop_require_default(obj) {
11
- return obj && obj.__esModule ? obj : {
12
- default: obj
13
- };
14
- }
9
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
10
+ const _serializejavascript = /* @__PURE__ */ _interop_require_default._(require("serialize-javascript"));
15
11
  const serializeJson = (data) => {
16
12
  return (0, _serializejavascript.default)(data, {
17
13
  isJSON: true
@@ -6,47 +6,8 @@ Object.defineProperty(exports, "createStorage", {
6
6
  enumerable: true,
7
7
  get: () => createStorage
8
8
  });
9
- const _async_hooks = /* @__PURE__ */ _interop_require_wildcard(require("async_hooks"));
10
- function _getRequireWildcardCache(nodeInterop) {
11
- if (typeof WeakMap !== "function")
12
- return null;
13
- var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
14
- var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
15
- return (_getRequireWildcardCache = function(nodeInterop2) {
16
- return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
17
- })(nodeInterop);
18
- }
19
- function _interop_require_wildcard(obj, nodeInterop) {
20
- if (!nodeInterop && obj && obj.__esModule) {
21
- return obj;
22
- }
23
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
- return {
25
- default: obj
26
- };
27
- }
28
- var cache = _getRequireWildcardCache(nodeInterop);
29
- if (cache && cache.has(obj)) {
30
- return cache.get(obj);
31
- }
32
- var newObj = {};
33
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
- for (var key in obj) {
35
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
- if (desc && (desc.get || desc.set)) {
38
- Object.defineProperty(newObj, key, desc);
39
- } else {
40
- newObj[key] = obj[key];
41
- }
42
- }
43
- }
44
- newObj.default = obj;
45
- if (cache) {
46
- cache.set(obj, newObj);
47
- }
48
- return newObj;
49
- }
9
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
10
+ const _async_hooks = /* @__PURE__ */ _interop_require_wildcard._(require("async_hooks"));
50
11
  const createStorage = () => {
51
12
  let storage;
52
13
  if (typeof _async_hooks.AsyncLocalStorage !== "undefined") {