@modern-js/create-request 1.2.5 → 1.2.8

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.
@@ -1,6 +1,6 @@
1
1
  import nodeFetch from 'node-fetch';
2
2
  import { compile, pathToRegexp } from 'path-to-regexp';
3
- import { useHeaders } from '@modern-js/utils';
3
+ import { useHeaders } from '@modern-js/utils/ssr';
4
4
  import qs from 'query-string';
5
5
  import { handleRes } from "./handleRes";
6
6
  let realRequest;
@@ -9,7 +9,7 @@ var _nodeFetch = _interopRequireDefault(require("node-fetch"));
9
9
 
10
10
  var _pathToRegexp = require("path-to-regexp");
11
11
 
12
- var _utils = require("@modern-js/utils");
12
+ var _ssr = require("@modern-js/utils/ssr");
13
13
 
14
14
  var _queryString = _interopRequireDefault(require("query-string"));
15
15
 
@@ -51,7 +51,7 @@ fetch = _nodeFetch.default) => {
51
51
  (0, _pathToRegexp.pathToRegexp)(path, keys);
52
52
 
53
53
  const sender = (...args) => {
54
- const webRequestHeaders = (0, _utils.useHeaders)();
54
+ const webRequestHeaders = (0, _ssr.useHeaders)();
55
55
  const payload = typeof args[args.length - 1] === 'object' ? args[args.length - 1] : {};
56
56
  payload.params = payload.params || {};
57
57
  keys.forEach((key, index) => {
@@ -1,11 +1,6 @@
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
1
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
-
7
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
-
9
4
  import { compile, pathToRegexp } from 'path-to-regexp';
10
5
  import qs from 'query-string';
11
6
  import { handleRes } from "./handleRes";
@@ -1,14 +1,8 @@
1
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
2
-
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
-
5
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
6
-
7
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8
-
1
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
9
3
  import nodeFetch from 'node-fetch';
10
4
  import { compile, pathToRegexp } from 'path-to-regexp';
11
- import { useHeaders } from '@modern-js/utils';
5
+ import { useHeaders } from '@modern-js/utils/ssr';
12
6
  import qs from 'query-string';
13
7
  import { handleRes } from "./handleRes";
14
8
  var realRequest;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.2.5",
14
+ "version": "1.2.8",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -63,8 +63,8 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@babel/runtime": "^7",
66
- "@modern-js/plugin-ssr": "^1.2.8",
67
- "@modern-js/utils": "^1.6.0",
66
+ "@modern-js/plugin-ssr": "^1.3.2",
67
+ "@modern-js/utils": "^1.7.3",
68
68
  "node-fetch": "^2.6.1",
69
69
  "path-to-regexp": "^6.2.0",
70
70
  "query-string": "^7.1.1"
@@ -72,7 +72,7 @@
72
72
  "devDependencies": {
73
73
  "@scripts/build": "0.0.0",
74
74
  "@scripts/jest-config": "0.0.0",
75
- "@types/jest": "^27.0.3",
75
+ "@types/jest": "^27",
76
76
  "@types/node": "^14",
77
77
  "@types/node-fetch": "^2.6.1",
78
78
  "@types/react": "^17",
@@ -87,10 +87,32 @@
87
87
  "registry": "https://registry.npmjs.org/",
88
88
  "access": "public"
89
89
  },
90
+ "wireit": {
91
+ "build": {
92
+ "command": "modern build",
93
+ "files": [
94
+ "src/**/*",
95
+ "tsconfig.json",
96
+ "package.json"
97
+ ],
98
+ "output": [
99
+ "dist/**/*"
100
+ ]
101
+ },
102
+ "test": {
103
+ "command": "jest --passWithNoTests",
104
+ "files": [
105
+ "src/**/*",
106
+ "tsconfig.json",
107
+ "package.json"
108
+ ],
109
+ "output": []
110
+ }
111
+ },
90
112
  "scripts": {
91
113
  "new": "modern new",
92
- "build": "modern build",
93
- "test": "jest --passWithNoTests"
114
+ "build": "wireit",
115
+ "test": "wireit"
94
116
  },
95
117
  "readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
96
118
  }