@orpc/server 0.0.0-next.0787cc6 → 0.0.0-next.08f0a9e

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.
Files changed (84) hide show
  1. package/README.md +131 -0
  2. package/dist/adapters/fetch/index.d.mts +59 -0
  3. package/dist/adapters/fetch/index.d.ts +59 -0
  4. package/dist/adapters/fetch/index.mjs +105 -0
  5. package/dist/adapters/node/index.d.mts +58 -0
  6. package/dist/adapters/node/index.d.ts +58 -0
  7. package/dist/adapters/node/index.mjs +90 -0
  8. package/dist/adapters/standard/index.d.mts +26 -0
  9. package/dist/adapters/standard/index.d.ts +26 -0
  10. package/dist/adapters/standard/index.mjs +8 -0
  11. package/dist/index.d.mts +292 -0
  12. package/dist/index.d.ts +292 -0
  13. package/dist/{index.js → index.mjs} +115 -156
  14. package/dist/plugins/index.d.mts +125 -0
  15. package/dist/plugins/index.d.ts +125 -0
  16. package/dist/plugins/index.mjs +252 -0
  17. package/dist/shared/server.B1oIHH_j.d.mts +74 -0
  18. package/dist/shared/server.BVHsfJ99.d.mts +144 -0
  19. package/dist/shared/server.BVHsfJ99.d.ts +144 -0
  20. package/dist/shared/server.BVwwTHyO.mjs +9 -0
  21. package/dist/shared/server.BW-nUGgA.mjs +36 -0
  22. package/dist/shared/server.BuLPHTX1.d.mts +18 -0
  23. package/dist/shared/server.C37gDhSZ.mjs +364 -0
  24. package/dist/shared/server.CaWivVk3.d.ts +74 -0
  25. package/dist/shared/server.DFuJLDuo.mjs +190 -0
  26. package/dist/shared/server.DMhSfHk1.d.ts +10 -0
  27. package/dist/shared/server.D_vpYits.d.ts +18 -0
  28. package/dist/shared/server.Dwnm6cSk.d.mts +10 -0
  29. package/package.json +24 -40
  30. package/dist/chunk-2OH4QMZ4.js +0 -145
  31. package/dist/chunk-BFGSRNYZ.js +0 -319
  32. package/dist/chunk-EDQKEHUX.js +0 -377
  33. package/dist/chunk-XFBAK67J.js +0 -128
  34. package/dist/fetch.js +0 -16
  35. package/dist/hono.js +0 -40
  36. package/dist/next.js +0 -37
  37. package/dist/node.js +0 -170
  38. package/dist/plugins.js +0 -11
  39. package/dist/src/adapters/fetch/index.d.ts +0 -4
  40. package/dist/src/adapters/fetch/rpc-handler.d.ts +0 -10
  41. package/dist/src/adapters/fetch/types.d.ts +0 -13
  42. package/dist/src/adapters/fetch/utils.d.ts +0 -5
  43. package/dist/src/adapters/hono/index.d.ts +0 -3
  44. package/dist/src/adapters/hono/middleware.d.ts +0 -13
  45. package/dist/src/adapters/next/index.d.ts +0 -3
  46. package/dist/src/adapters/next/serve.d.ts +0 -20
  47. package/dist/src/adapters/node/index.d.ts +0 -4
  48. package/dist/src/adapters/node/rpc-handler.d.ts +0 -10
  49. package/dist/src/adapters/node/types.d.ts +0 -21
  50. package/dist/src/adapters/node/utils.d.ts +0 -5
  51. package/dist/src/adapters/standard/handler.d.ts +0 -51
  52. package/dist/src/adapters/standard/index.d.ts +0 -7
  53. package/dist/src/adapters/standard/rpc-codec.d.ts +0 -15
  54. package/dist/src/adapters/standard/rpc-handler.d.ts +0 -8
  55. package/dist/src/adapters/standard/rpc-matcher.d.ts +0 -10
  56. package/dist/src/adapters/standard/rpc-serializer.d.ts +0 -16
  57. package/dist/src/adapters/standard/types.d.ts +0 -44
  58. package/dist/src/builder-variants.d.ts +0 -74
  59. package/dist/src/builder.d.ts +0 -57
  60. package/dist/src/config.d.ts +0 -6
  61. package/dist/src/context.d.ts +0 -9
  62. package/dist/src/hidden.d.ts +0 -8
  63. package/dist/src/implementer-procedure.d.ts +0 -30
  64. package/dist/src/implementer-variants.d.ts +0 -17
  65. package/dist/src/implementer.d.ts +0 -28
  66. package/dist/src/index.d.ts +0 -23
  67. package/dist/src/lazy-utils.d.ts +0 -6
  68. package/dist/src/lazy.d.ts +0 -22
  69. package/dist/src/middleware-decorated.d.ts +0 -10
  70. package/dist/src/middleware-utils.d.ts +0 -5
  71. package/dist/src/middleware.d.ts +0 -37
  72. package/dist/src/plugins/base.d.ts +0 -13
  73. package/dist/src/plugins/cors.d.ts +0 -19
  74. package/dist/src/plugins/index.d.ts +0 -4
  75. package/dist/src/plugins/response-headers.d.ts +0 -10
  76. package/dist/src/procedure-client.d.ts +0 -31
  77. package/dist/src/procedure-decorated.d.ts +0 -21
  78. package/dist/src/procedure-utils.d.ts +0 -17
  79. package/dist/src/procedure.d.ts +0 -29
  80. package/dist/src/router-accessible-lazy.d.ts +0 -8
  81. package/dist/src/router-client.d.ts +0 -11
  82. package/dist/src/router.d.ts +0 -29
  83. package/dist/src/utils.d.ts +0 -24
  84. package/dist/standard.js +0 -17
@@ -0,0 +1,190 @@
1
+ import { toHttpPath, StandardRPCJsonSerializer, StandardRPCSerializer } from '@orpc/client/standard';
2
+ import { toArray, intercept, parseEmptyableJSON } from '@orpc/shared';
3
+ import '@orpc/standard-server/batch';
4
+ import { ORPCError, toORPCError } from '@orpc/client';
5
+ import { S as StrictGetMethodPlugin } from './server.BW-nUGgA.mjs';
6
+ import { c as createProcedureClient, t as traverseContractProcedures, i as isProcedure, u as unlazy, g as getRouter, a as createContractedProcedure } from './server.C37gDhSZ.mjs';
7
+
8
+ class CompositeStandardHandlerPlugin {
9
+ plugins;
10
+ constructor(plugins = []) {
11
+ this.plugins = [...plugins].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
12
+ }
13
+ init(options) {
14
+ for (const plugin of this.plugins) {
15
+ plugin.init?.(options);
16
+ }
17
+ }
18
+ }
19
+
20
+ class StandardHandler {
21
+ constructor(router, matcher, codec, options) {
22
+ this.matcher = matcher;
23
+ this.codec = codec;
24
+ const plugins = new CompositeStandardHandlerPlugin(options.plugins);
25
+ plugins.init(options);
26
+ this.interceptors = toArray(options.interceptors);
27
+ this.clientInterceptors = toArray(options.clientInterceptors);
28
+ this.rootInterceptors = toArray(options.rootInterceptors);
29
+ this.matcher.init(router);
30
+ }
31
+ interceptors;
32
+ clientInterceptors;
33
+ rootInterceptors;
34
+ async handle(request, options) {
35
+ const prefix = options.prefix?.replace(/\/$/, "") || void 0;
36
+ if (prefix && !request.url.pathname.startsWith(`${prefix}/`) && request.url.pathname !== prefix) {
37
+ return { matched: false, response: void 0 };
38
+ }
39
+ return intercept(
40
+ this.rootInterceptors,
41
+ { ...options, request, prefix },
42
+ async (interceptorOptions) => {
43
+ let isDecoding = false;
44
+ try {
45
+ return await intercept(
46
+ this.interceptors,
47
+ interceptorOptions,
48
+ async ({ request: request2, context, prefix: prefix2 }) => {
49
+ const method = request2.method;
50
+ const url = request2.url;
51
+ const pathname = prefix2 ? url.pathname.replace(prefix2, "") : url.pathname;
52
+ const match = await this.matcher.match(method, `/${pathname.replace(/^\/|\/$/g, "")}`);
53
+ if (!match) {
54
+ return { matched: false, response: void 0 };
55
+ }
56
+ const client = createProcedureClient(match.procedure, {
57
+ context,
58
+ path: match.path,
59
+ interceptors: this.clientInterceptors
60
+ });
61
+ isDecoding = true;
62
+ const input = await this.codec.decode(request2, match.params, match.procedure);
63
+ isDecoding = false;
64
+ const lastEventId = Array.isArray(request2.headers["last-event-id"]) ? request2.headers["last-event-id"].at(-1) : request2.headers["last-event-id"];
65
+ const output = await client(input, { signal: request2.signal, lastEventId });
66
+ const response = this.codec.encode(output, match.procedure);
67
+ return {
68
+ matched: true,
69
+ response
70
+ };
71
+ }
72
+ );
73
+ } catch (e) {
74
+ const error = isDecoding && !(e instanceof ORPCError) ? new ORPCError("BAD_REQUEST", {
75
+ message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
76
+ cause: e
77
+ }) : toORPCError(e);
78
+ const response = this.codec.encodeError(error);
79
+ return {
80
+ matched: true,
81
+ response
82
+ };
83
+ }
84
+ }
85
+ );
86
+ }
87
+ }
88
+
89
+ class StandardRPCCodec {
90
+ constructor(serializer) {
91
+ this.serializer = serializer;
92
+ }
93
+ async decode(request, _params, _procedure) {
94
+ const serialized = request.method === "GET" ? parseEmptyableJSON(request.url.searchParams.getAll("data").at(-1)) : await request.body();
95
+ return this.serializer.deserialize(serialized);
96
+ }
97
+ encode(output, _procedure) {
98
+ return {
99
+ status: 200,
100
+ headers: {},
101
+ body: this.serializer.serialize(output)
102
+ };
103
+ }
104
+ encodeError(error) {
105
+ return {
106
+ status: error.status,
107
+ headers: {},
108
+ body: this.serializer.serialize(error.toJSON())
109
+ };
110
+ }
111
+ }
112
+
113
+ class StandardRPCMatcher {
114
+ tree = {};
115
+ pendingRouters = [];
116
+ init(router, path = []) {
117
+ const laziedOptions = traverseContractProcedures({ router, path }, ({ path: path2, contract }) => {
118
+ const httpPath = toHttpPath(path2);
119
+ if (isProcedure(contract)) {
120
+ this.tree[httpPath] = {
121
+ path: path2,
122
+ contract,
123
+ procedure: contract,
124
+ // this mean dev not used contract-first so we can used contract as procedure directly
125
+ router
126
+ };
127
+ } else {
128
+ this.tree[httpPath] = {
129
+ path: path2,
130
+ contract,
131
+ procedure: void 0,
132
+ router
133
+ };
134
+ }
135
+ });
136
+ this.pendingRouters.push(...laziedOptions.map((option) => ({
137
+ ...option,
138
+ httpPathPrefix: toHttpPath(option.path)
139
+ })));
140
+ }
141
+ async match(_method, pathname) {
142
+ if (this.pendingRouters.length) {
143
+ const newPendingRouters = [];
144
+ for (const pendingRouter of this.pendingRouters) {
145
+ if (pathname.startsWith(pendingRouter.httpPathPrefix)) {
146
+ const { default: router } = await unlazy(pendingRouter.router);
147
+ this.init(router, pendingRouter.path);
148
+ } else {
149
+ newPendingRouters.push(pendingRouter);
150
+ }
151
+ }
152
+ this.pendingRouters = newPendingRouters;
153
+ }
154
+ const match = this.tree[pathname];
155
+ if (!match) {
156
+ return void 0;
157
+ }
158
+ if (!match.procedure) {
159
+ const { default: maybeProcedure } = await unlazy(getRouter(match.router, match.path));
160
+ if (!isProcedure(maybeProcedure)) {
161
+ throw new Error(`
162
+ [Contract-First] Missing or invalid implementation for procedure at path: ${toHttpPath(match.path)}.
163
+ Ensure that the procedure is correctly defined and matches the expected contract.
164
+ `);
165
+ }
166
+ match.procedure = createContractedProcedure(maybeProcedure, match.contract);
167
+ }
168
+ return {
169
+ path: match.path,
170
+ procedure: match.procedure
171
+ };
172
+ }
173
+ }
174
+
175
+ class StandardRPCHandler extends StandardHandler {
176
+ constructor(router, options) {
177
+ options.plugins ??= [];
178
+ const strictGetMethodPluginEnabled = options.strictGetMethodPluginEnabled ?? true;
179
+ if (strictGetMethodPluginEnabled) {
180
+ options.plugins.push(new StrictGetMethodPlugin());
181
+ }
182
+ const jsonSerializer = new StandardRPCJsonSerializer(options);
183
+ const serializer = new StandardRPCSerializer(jsonSerializer);
184
+ const matcher = new StandardRPCMatcher();
185
+ const codec = new StandardRPCCodec(serializer);
186
+ super(router, matcher, codec, options);
187
+ }
188
+ }
189
+
190
+ export { CompositeStandardHandlerPlugin as C, StandardHandler as S, StandardRPCCodec as a, StandardRPCHandler as b, StandardRPCMatcher as c };
@@ -0,0 +1,10 @@
1
+ import { C as Context } from './server.BVHsfJ99.js';
2
+ import { g as StandardHandleOptions } from './server.CaWivVk3.js';
3
+
4
+ type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
5
+ context?: T;
6
+ } : {
7
+ context: T;
8
+ });
9
+
10
+ export type { FriendlyStandardHandleOptions as F };
@@ -0,0 +1,18 @@
1
+ import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
2
+ import { C as Context, R as Router } from './server.BVHsfJ99.js';
3
+ import { b as StandardHandlerOptions, i as StandardHandler } from './server.CaWivVk3.js';
4
+
5
+ interface StandardRPCHandlerOptions<T extends Context> extends StandardHandlerOptions<T>, StandardRPCJsonSerializerOptions {
6
+ /**
7
+ * Enables or disables the StrictGetMethodPlugin.
8
+ *
9
+ * @default true
10
+ */
11
+ strictGetMethodPluginEnabled?: boolean;
12
+ }
13
+ declare class StandardRPCHandler<T extends Context> extends StandardHandler<T> {
14
+ constructor(router: Router<any, T>, options: StandardRPCHandlerOptions<T>);
15
+ }
16
+
17
+ export { StandardRPCHandler as a };
18
+ export type { StandardRPCHandlerOptions as S };
@@ -0,0 +1,10 @@
1
+ import { C as Context } from './server.BVHsfJ99.mjs';
2
+ import { g as StandardHandleOptions } from './server.B1oIHH_j.mjs';
3
+
4
+ type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
5
+ context?: T;
6
+ } : {
7
+ context: T;
8
+ });
9
+
10
+ export type { FriendlyStandardHandleOptions as F };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/server",
3
3
  "type": "module",
4
- "version": "0.0.0-next.0787cc6",
4
+ "version": "0.0.0-next.08f0a9e",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -15,63 +15,47 @@
15
15
  ],
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/src/index.d.ts",
19
- "import": "./dist/index.js",
20
- "default": "./dist/index.js"
18
+ "types": "./dist/index.d.mts",
19
+ "import": "./dist/index.mjs",
20
+ "default": "./dist/index.mjs"
21
21
  },
22
22
  "./plugins": {
23
- "types": "./dist/src/plugins/index.d.ts",
24
- "import": "./dist/plugins.js",
25
- "default": "./dist/plugins.js"
23
+ "types": "./dist/plugins/index.d.mts",
24
+ "import": "./dist/plugins/index.mjs",
25
+ "default": "./dist/plugins/index.mjs"
26
26
  },
27
27
  "./standard": {
28
- "types": "./dist/src/adapters/standard/index.d.ts",
29
- "import": "./dist/standard.js",
30
- "default": "./dist/standard.js"
28
+ "types": "./dist/adapters/standard/index.d.mts",
29
+ "import": "./dist/adapters/standard/index.mjs",
30
+ "default": "./dist/adapters/standard/index.mjs"
31
31
  },
32
32
  "./fetch": {
33
- "types": "./dist/src/adapters/fetch/index.d.ts",
34
- "import": "./dist/fetch.js",
35
- "default": "./dist/fetch.js"
36
- },
37
- "./hono": {
38
- "types": "./dist/src/adapters/hono/index.d.ts",
39
- "import": "./dist/hono.js",
40
- "default": "./dist/hono.js"
41
- },
42
- "./next": {
43
- "types": "./dist/src/adapters/next/index.d.ts",
44
- "import": "./dist/next.js",
45
- "default": "./dist/next.js"
33
+ "types": "./dist/adapters/fetch/index.d.mts",
34
+ "import": "./dist/adapters/fetch/index.mjs",
35
+ "default": "./dist/adapters/fetch/index.mjs"
46
36
  },
47
37
  "./node": {
48
- "types": "./dist/src/adapters/node/index.d.ts",
49
- "import": "./dist/node.js",
50
- "default": "./dist/node.js"
51
- },
52
- "./🔒/*": {
53
- "types": "./dist/src/*.d.ts"
38
+ "types": "./dist/adapters/node/index.d.mts",
39
+ "import": "./dist/adapters/node/index.mjs",
40
+ "default": "./dist/adapters/node/index.mjs"
54
41
  }
55
42
  },
56
43
  "files": [
57
- "!**/*.map",
58
- "!**/*.tsbuildinfo",
59
44
  "dist"
60
45
  ],
61
- "peerDependencies": {
62
- "hono": ">=4.6.0",
63
- "next": ">=14.0.0"
64
- },
65
46
  "dependencies": {
66
- "@tinyhttp/content-disposition": "^2.2.2",
67
- "@orpc/contract": "0.0.0-next.0787cc6",
68
- "@orpc/shared": "0.0.0-next.0787cc6"
47
+ "@orpc/client": "0.0.0-next.08f0a9e",
48
+ "@orpc/standard-server": "0.0.0-next.08f0a9e",
49
+ "@orpc/standard-server-fetch": "0.0.0-next.08f0a9e",
50
+ "@orpc/shared": "0.0.0-next.08f0a9e",
51
+ "@orpc/contract": "0.0.0-next.08f0a9e",
52
+ "@orpc/standard-server-node": "0.0.0-next.08f0a9e"
69
53
  },
70
54
  "devDependencies": {
71
- "light-my-request": "^6.5.1"
55
+ "supertest": "^7.1.0"
72
56
  },
73
57
  "scripts": {
74
- "build": "tsup --onSuccess='tsc -b --noCheck'",
58
+ "build": "unbuild",
75
59
  "build:watch": "pnpm run build --watch",
76
60
  "type:check": "tsc -b"
77
61
  }
@@ -1,145 +0,0 @@
1
- import {
2
- RPCCodec,
3
- RPCMatcher,
4
- StandardHandler
5
- } from "./chunk-BFGSRNYZ.js";
6
-
7
- // src/adapters/fetch/utils.ts
8
- import { once } from "@orpc/shared";
9
- import { contentDisposition, parse as parseContentDisposition } from "@tinyhttp/content-disposition";
10
- function fetchHeadersToStandardHeaders(headers) {
11
- const standardHeaders = {};
12
- for (const [key, value] of headers) {
13
- if (Array.isArray(standardHeaders[key])) {
14
- standardHeaders[key].push(value);
15
- } else if (standardHeaders[key] !== void 0) {
16
- standardHeaders[key] = [standardHeaders[key], value];
17
- } else {
18
- standardHeaders[key] = value;
19
- }
20
- }
21
- return standardHeaders;
22
- }
23
- async function fetchReToStandardBody(re) {
24
- if (!re.body) {
25
- return void 0;
26
- }
27
- const contentDisposition2 = re.headers.get("content-disposition");
28
- if (contentDisposition2) {
29
- const fileName = parseContentDisposition(contentDisposition2).parameters.filename;
30
- if (typeof fileName === "string") {
31
- const blob2 = await re.blob();
32
- return new File([blob2], fileName, {
33
- type: blob2.type
34
- });
35
- }
36
- }
37
- const contentType = re.headers.get("content-type");
38
- if (!contentType || contentType.startsWith("application/json")) {
39
- const text = await re.text();
40
- if (!text) {
41
- return void 0;
42
- }
43
- return JSON.parse(text);
44
- }
45
- if (contentType.startsWith("multipart/form-data")) {
46
- return await re.formData();
47
- }
48
- if (contentType.startsWith("application/x-www-form-urlencoded")) {
49
- return new URLSearchParams(await re.text());
50
- }
51
- if (contentType.startsWith("text/")) {
52
- return await re.text();
53
- }
54
- const blob = await re.blob();
55
- return new File([blob], "blob", {
56
- type: blob.type
57
- });
58
- }
59
- function fetchRequestToStandardRequest(request) {
60
- const url = new URL(request.url);
61
- return {
62
- raw: { request },
63
- url,
64
- signal: request.signal,
65
- method: request.method,
66
- body: once(() => {
67
- return fetchReToStandardBody(request);
68
- }),
69
- get headers() {
70
- const headers = fetchHeadersToStandardHeaders(request.headers);
71
- Object.defineProperty(this, "headers", { value: headers, writable: true });
72
- return headers;
73
- },
74
- set headers(value) {
75
- Object.defineProperty(this, "headers", { value, writable: true });
76
- }
77
- };
78
- }
79
- function standardResponseToFetchHeaders(response) {
80
- const fetchHeaders = new Headers();
81
- for (const [key, value] of Object.entries(response.headers)) {
82
- if (Array.isArray(value)) {
83
- for (const v of value) {
84
- fetchHeaders.append(key, v);
85
- }
86
- } else if (value !== void 0) {
87
- fetchHeaders.append(key, value);
88
- }
89
- }
90
- return fetchHeaders;
91
- }
92
- function standardResponseToFetchResponse(response) {
93
- const resHeaders = standardResponseToFetchHeaders(response);
94
- resHeaders.delete("content-type");
95
- resHeaders.delete("content-disposition");
96
- if (response.body === void 0) {
97
- return new Response(void 0, { headers: resHeaders, status: response.status });
98
- }
99
- if (response.body instanceof Blob) {
100
- resHeaders.set("content-type", response.body.type);
101
- resHeaders.set("content-length", response.body.size.toString());
102
- resHeaders.set(
103
- "content-disposition",
104
- contentDisposition(response.body instanceof File ? response.body.name : "blob", { type: "inline" })
105
- );
106
- return new Response(response.body, { headers: resHeaders, status: response.status });
107
- }
108
- if (response.body instanceof FormData) {
109
- return new Response(response.body, { headers: resHeaders, status: response.status });
110
- }
111
- if (response.body instanceof URLSearchParams) {
112
- return new Response(response.body, { headers: resHeaders, status: response.status });
113
- }
114
- resHeaders.set("content-type", "application/json");
115
- return new Response(JSON.stringify(response.body), { headers: resHeaders, status: response.status });
116
- }
117
-
118
- // src/adapters/fetch/rpc-handler.ts
119
- var RPCHandler = class {
120
- standardHandler;
121
- constructor(router, options) {
122
- const matcher = options?.matcher ?? new RPCMatcher();
123
- const codec = options?.codec ?? new RPCCodec();
124
- this.standardHandler = new StandardHandler(router, matcher, codec, options);
125
- }
126
- async handle(request, ...rest) {
127
- const standardRequest = fetchRequestToStandardRequest(request);
128
- const result = await this.standardHandler.handle(standardRequest, ...rest);
129
- if (!result.matched) {
130
- return result;
131
- }
132
- return {
133
- matched: true,
134
- response: standardResponseToFetchResponse(result.response)
135
- };
136
- }
137
- };
138
-
139
- export {
140
- fetchReToStandardBody,
141
- fetchRequestToStandardRequest,
142
- standardResponseToFetchResponse,
143
- RPCHandler
144
- };
145
- //# sourceMappingURL=chunk-2OH4QMZ4.js.map