@modern-js/plugin-data-loader 2.0.0-canary.5 → 2.0.0-canary.7
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.
- package/dist/js/modern/cli/create-request.js +3 -2
- package/dist/js/modern/common/constants.js +4 -2
- package/dist/js/modern/server/index.js +2 -2
- package/dist/js/node/cli/create-request.js +2 -1
- package/dist/js/node/common/constants.js +6 -3
- package/dist/js/node/server/index.js +1 -1
- package/dist/js/treeshaking/cli/create-request.js +3 -2
- package/dist/js/treeshaking/common/constants.js +3 -2
- package/dist/js/treeshaking/server/index.js +2 -2
- package/dist/types/common/constants.d.ts +2 -1
- package/package.json +9 -10
|
@@ -20,7 +20,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
20
|
};
|
|
21
21
|
import { compile } from "path-to-regexp";
|
|
22
22
|
import { redirect } from "react-router-dom";
|
|
23
|
-
import {
|
|
23
|
+
import { LOADER_ID_PARAM, DIRECT_PARAM } from "../common/constants";
|
|
24
24
|
const getRequestUrl = ({
|
|
25
25
|
params,
|
|
26
26
|
request,
|
|
@@ -32,7 +32,8 @@ const getRequestUrl = ({
|
|
|
32
32
|
});
|
|
33
33
|
const newPathName = toPath(params);
|
|
34
34
|
url.pathname = newPathName;
|
|
35
|
-
url.searchParams.append(
|
|
35
|
+
url.searchParams.append(LOADER_ID_PARAM, routeId);
|
|
36
|
+
url.searchParams.append(DIRECT_PARAM, "true");
|
|
36
37
|
return url;
|
|
37
38
|
};
|
|
38
39
|
const handleRedirectResponse = (res) => {
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
matchRoutes
|
|
48
48
|
} from "react-router-dom";
|
|
49
49
|
import { LOADER_ROUTES_DIR, MAIN_ENTRY_NAME } from "@modern-js/utils";
|
|
50
|
-
import {
|
|
50
|
+
import { LOADER_ID_PARAM } from "../common/constants";
|
|
51
51
|
installGlobals();
|
|
52
52
|
const redirectStatusCodes = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
53
53
|
function isRedirectResponse(response) {
|
|
@@ -150,7 +150,7 @@ const handleRequest = (_0) => __async(void 0, [_0], function* ({
|
|
|
150
150
|
distDir
|
|
151
151
|
}) {
|
|
152
152
|
const { method, query } = context;
|
|
153
|
-
const routeId = query[
|
|
153
|
+
const routeId = query[LOADER_ID_PARAM];
|
|
154
154
|
if (!routeId || method.toLowerCase() !== "get") {
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
@@ -55,7 +55,8 @@ const getRequestUrl = ({
|
|
|
55
55
|
});
|
|
56
56
|
const newPathName = toPath(params);
|
|
57
57
|
url.pathname = newPathName;
|
|
58
|
-
url.searchParams.append(import_constants.
|
|
58
|
+
url.searchParams.append(import_constants.LOADER_ID_PARAM, routeId);
|
|
59
|
+
url.searchParams.append(import_constants.DIRECT_PARAM, "true");
|
|
59
60
|
return url;
|
|
60
61
|
};
|
|
61
62
|
const handleRedirectResponse = (res) => {
|
|
@@ -17,11 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var constants_exports = {};
|
|
19
19
|
__export(constants_exports, {
|
|
20
|
-
|
|
20
|
+
DIRECT_PARAM: () => DIRECT_PARAM,
|
|
21
|
+
LOADER_ID_PARAM: () => LOADER_ID_PARAM
|
|
21
22
|
});
|
|
22
23
|
module.exports = __toCommonJS(constants_exports);
|
|
23
|
-
const
|
|
24
|
+
const LOADER_ID_PARAM = "__loader";
|
|
25
|
+
const DIRECT_PARAM = "__ssrDirect";
|
|
24
26
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25
27
|
0 && (module.exports = {
|
|
26
|
-
|
|
28
|
+
DIRECT_PARAM,
|
|
29
|
+
LOADER_ID_PARAM
|
|
27
30
|
});
|
|
@@ -174,7 +174,7 @@ const handleRequest = (_0) => __async(void 0, [_0], function* ({
|
|
|
174
174
|
distDir
|
|
175
175
|
}) {
|
|
176
176
|
const { method, query } = context;
|
|
177
|
-
const routeId = query[import_constants.
|
|
177
|
+
const routeId = query[import_constants.LOADER_ID_PARAM];
|
|
178
178
|
if (!routeId || method.toLowerCase() !== "get") {
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
@@ -124,7 +124,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
124
124
|
};
|
|
125
125
|
import { compile } from "path-to-regexp";
|
|
126
126
|
import { redirect } from "react-router-dom";
|
|
127
|
-
import {
|
|
127
|
+
import { LOADER_ID_PARAM, DIRECT_PARAM } from "../common/constants";
|
|
128
128
|
var getRequestUrl = function(param) {
|
|
129
129
|
var params = param.params, request = param.request, routeId = param.routeId;
|
|
130
130
|
var url = new URL(request.url);
|
|
@@ -133,7 +133,8 @@ var getRequestUrl = function(param) {
|
|
|
133
133
|
});
|
|
134
134
|
var newPathName = toPath(params);
|
|
135
135
|
url.pathname = newPathName;
|
|
136
|
-
url.searchParams.append(
|
|
136
|
+
url.searchParams.append(LOADER_ID_PARAM, routeId);
|
|
137
|
+
url.searchParams.append(DIRECT_PARAM, "true");
|
|
137
138
|
return url;
|
|
138
139
|
};
|
|
139
140
|
var handleRedirectResponse = function(res) {
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var LOADER_ID_PARAM = "__loader";
|
|
2
|
+
var DIRECT_PARAM = "__ssrDirect";
|
|
3
|
+
export { DIRECT_PARAM, LOADER_ID_PARAM };
|
|
@@ -224,7 +224,7 @@ import path from "path";
|
|
|
224
224
|
import { installGlobals, writeReadableStreamToWritable, Response as NodeResponse } from "@remix-run/node";
|
|
225
225
|
import { matchRoutes } from "react-router-dom";
|
|
226
226
|
import { LOADER_ROUTES_DIR, MAIN_ENTRY_NAME } from "@modern-js/utils";
|
|
227
|
-
import {
|
|
227
|
+
import { LOADER_ID_PARAM } from "../common/constants";
|
|
228
228
|
installGlobals();
|
|
229
229
|
var redirectStatusCodes = /* @__PURE__ */ new Set([
|
|
230
230
|
301,
|
|
@@ -443,7 +443,7 @@ var handleRequest = function() {
|
|
|
443
443
|
case 0:
|
|
444
444
|
context = param.context, serverRoutes = param.serverRoutes, distDir = param.distDir;
|
|
445
445
|
method = context.method, query = context.query;
|
|
446
|
-
routeId = query[
|
|
446
|
+
routeId = query[LOADER_ID_PARAM];
|
|
447
447
|
if (!routeId || method.toLowerCase() !== "get") {
|
|
448
448
|
return [
|
|
449
449
|
2
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const LOADER_ID_PARAM = "__loader";
|
|
2
|
+
export declare const DIRECT_PARAM = "__ssrDirect";
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.0.0-canary.
|
|
14
|
+
"version": "2.0.0-canary.7",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@babel/core": "^7.18.0",
|
|
42
42
|
"@babel/runtime": "^7.18.0",
|
|
43
|
-
"@modern-js/babel-compiler": "2.0.0-beta.
|
|
44
|
-
"@modern-js/utils": "2.0.0-beta.
|
|
43
|
+
"@modern-js/babel-compiler": "2.0.0-beta.7",
|
|
44
|
+
"@modern-js/utils": "2.0.0-beta.7",
|
|
45
45
|
"@remix-run/node": "^1.9.0",
|
|
46
46
|
"path-to-regexp": "^6.2.0",
|
|
47
47
|
"react-router-dom": "^6.6.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@modern-js/core": "2.0.0-beta.
|
|
51
|
-
"@modern-js/server-core": "2.0.0-beta.
|
|
52
|
-
"@modern-js/types": "2.0.0-beta.
|
|
53
|
-
"@scripts/build": "2.0.0-beta.
|
|
54
|
-
"@scripts/jest-config": "2.0.0-beta.
|
|
50
|
+
"@modern-js/core": "2.0.0-beta.7",
|
|
51
|
+
"@modern-js/server-core": "2.0.0-beta.7",
|
|
52
|
+
"@modern-js/types": "2.0.0-beta.7",
|
|
53
|
+
"@scripts/build": "2.0.0-beta.7",
|
|
54
|
+
"@scripts/jest-config": "2.0.0-beta.7",
|
|
55
55
|
"@types/babel__core": "^7.1.15",
|
|
56
56
|
"@types/jest": "^27",
|
|
57
57
|
"@types/node": "^14",
|
|
@@ -75,6 +75,5 @@
|
|
|
75
75
|
"build": "modern-lib build",
|
|
76
76
|
"dev": "modern-lib build --watch",
|
|
77
77
|
"test": "jest --passWithNoTests"
|
|
78
|
-
}
|
|
79
|
-
"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"
|
|
78
|
+
}
|
|
80
79
|
}
|