@modern-js/prod-server 2.11.0 → 2.12.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @modern-js/prod-server
2
2
 
3
+ ## 2.12.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 7980842: fix: function injectServerData name typo
8
+
9
+ fix: 修复 injectServerData 函数命名错误
10
+
11
+ - Updated dependencies [c2ca6c8]
12
+ - Updated dependencies [6d86e34]
13
+ - @modern-js/utils@2.12.0
14
+ - @modern-js/server-core@2.12.0
15
+
3
16
  ## 2.11.0
4
17
 
5
18
  ### Patch Changes
@@ -88,7 +88,7 @@ const createRenderHandler = ({
88
88
  }
89
89
  }
90
90
  return {
91
- content: route.entryName ? (0, import_utils2.injectSeverData)(content.toString(), ctx) : content,
91
+ content: route.entryName ? (0, import_utils2.injectServerData)(content.toString(), ctx) : content,
92
92
  contentType: import_utils.mime.contentType(import_path.default.extname(templatePath))
93
93
  };
94
94
  };
@@ -100,7 +100,7 @@ const render = async (ctx, renderOptions, runner) => {
100
100
  }
101
101
  if (typeof content === "string") {
102
102
  return {
103
- content: (0, import_utils2.injectSeverData)(content, ctx),
103
+ content: (0, import_utils2.injectServerData)(content, ctx),
104
104
  contentType: import_utils.mime.contentType("html")
105
105
  };
106
106
  } else {
@@ -17,12 +17,12 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var utils_exports = {};
19
19
  __export(utils_exports, {
20
- injectServerDataStream: () => injectServerDataStream,
21
- injectSeverData: () => injectSeverData
20
+ injectServerData: () => injectServerData,
21
+ injectServerDataStream: () => injectServerDataStream
22
22
  });
23
23
  module.exports = __toCommonJS(utils_exports);
24
24
  var import_template = require("../hook-api/template");
25
- const injectSeverData = (content, context) => {
25
+ const injectServerData = (content, context) => {
26
26
  const template = new import_template.TemplateAPI(content);
27
27
  template.prependHead(
28
28
  `<script>window._SERVER_DATA=${JSON.stringify(
@@ -42,6 +42,6 @@ const injectServerDataStream = (content, context) => {
42
42
  };
43
43
  // Annotate the CommonJS export names for ESM import in node:
44
44
  0 && (module.exports = {
45
- injectServerDataStream,
46
- injectSeverData
45
+ injectServerData,
46
+ injectServerDataStream
47
47
  });
@@ -128,7 +128,7 @@ import { ERROR_DIGEST } from "../../constants";
128
128
  import { handleDirectory } from "./static";
129
129
  import { readFile } from "./reader";
130
130
  import * as ssr from "./ssr";
131
- import { injectSeverData } from "./utils";
131
+ import { injectServerData } from "./utils";
132
132
  var createRenderHandler = function(param) {
133
133
  var distDir = param.distDir, staticGenerate = param.staticGenerate, forceCSR = param.forceCSR;
134
134
  return function() {
@@ -219,7 +219,7 @@ var createRenderHandler = function(param) {
219
219
  return [
220
220
  2,
221
221
  {
222
- content: route.entryName ? injectSeverData(content.toString(), ctx) : content,
222
+ content: route.entryName ? injectServerData(content.toString(), ctx) : content,
223
223
  contentType: mime.contentType(path.extname(templatePath))
224
224
  }
225
225
  ];
@@ -127,7 +127,7 @@ import { fs, mime } from "@modern-js/utils";
127
127
  import { LOADABLE_STATS_FILE, ROUTE_MANIFEST_FILE, SERVER_RENDER_FUNCTION_NAME } from "@modern-js/utils/constants";
128
128
  import cache from "./cache";
129
129
  import { createLogger, createMetrics } from "./measure";
130
- import { injectServerDataStream, injectSeverData } from "./utils";
130
+ import { injectServerDataStream, injectServerData } from "./utils";
131
131
  var render = function() {
132
132
  var _ref = _asyncToGenerator(function(ctx, renderOptions, runner) {
133
133
  var _ctx_res, urlPath, bundle, distDir, template, entryName, staticGenerate, _renderOptions_enableUnsafeCtx, enableUnsafeCtx, bundleJS, loadableUri, loadableStats, routesManifestUri, routeManifest, context, serverRender, content, _context_redirection, url, _context_redirection_status, status;
@@ -198,7 +198,7 @@ var render = function() {
198
198
  return [
199
199
  2,
200
200
  {
201
- content: injectSeverData(content, ctx),
201
+ content: injectServerData(content, ctx),
202
202
  contentType: mime.contentType("html")
203
203
  }
204
204
  ];
@@ -1,5 +1,5 @@
1
1
  import { TemplateAPI, templateInjectableStream } from "../hook-api/template";
2
- var injectSeverData = function(content, context) {
2
+ var injectServerData = function(content, context) {
3
3
  var template = new TemplateAPI(content);
4
4
  template.prependHead("<script>window._SERVER_DATA=".concat(JSON.stringify(context.serverData), "</script>"));
5
5
  return template.get();
@@ -9,4 +9,4 @@ var injectServerDataStream = function(content, context) {
9
9
  prependHead: "<script>window._SERVER_DATA=".concat(JSON.stringify(context.serverData), "</script>")
10
10
  }));
11
11
  };
12
- export { injectServerDataStream, injectSeverData };
12
+ export { injectServerData, injectServerDataStream };
@@ -4,7 +4,7 @@ import { ERROR_DIGEST } from "../../constants";
4
4
  import { handleDirectory } from "./static";
5
5
  import { readFile } from "./reader";
6
6
  import * as ssr from "./ssr";
7
- import { injectSeverData } from "./utils";
7
+ import { injectServerData } from "./utils";
8
8
  const createRenderHandler = ({
9
9
  distDir,
10
10
  staticGenerate,
@@ -56,7 +56,7 @@ const createRenderHandler = ({
56
56
  }
57
57
  }
58
58
  return {
59
- content: route.entryName ? injectSeverData(content.toString(), ctx) : content,
59
+ content: route.entryName ? injectServerData(content.toString(), ctx) : content,
60
60
  contentType: mime.contentType(path.extname(templatePath))
61
61
  };
62
62
  };
@@ -7,7 +7,7 @@ import {
7
7
  } from "@modern-js/utils/constants";
8
8
  import cache from "./cache";
9
9
  import { createLogger, createMetrics } from "./measure";
10
- import { injectServerDataStream, injectSeverData } from "./utils";
10
+ import { injectServerDataStream, injectServerData } from "./utils";
11
11
  const render = async (ctx, renderOptions, runner) => {
12
12
  var _a;
13
13
  const {
@@ -72,7 +72,7 @@ const render = async (ctx, renderOptions, runner) => {
72
72
  }
73
73
  if (typeof content === "string") {
74
74
  return {
75
- content: injectSeverData(content, ctx),
75
+ content: injectServerData(content, ctx),
76
76
  contentType: mime.contentType("html")
77
77
  };
78
78
  } else {
@@ -1,5 +1,5 @@
1
1
  import { TemplateAPI, templateInjectableStream } from "../hook-api/template";
2
- const injectSeverData = (content, context) => {
2
+ const injectServerData = (content, context) => {
3
3
  const template = new TemplateAPI(content);
4
4
  template.prependHead(
5
5
  `<script>window._SERVER_DATA=${JSON.stringify(
@@ -18,6 +18,6 @@ const injectServerDataStream = (content, context) => {
18
18
  );
19
19
  };
20
20
  export {
21
- injectServerDataStream,
22
- injectSeverData
21
+ injectServerData,
22
+ injectServerDataStream
23
23
  };
@@ -2,7 +2,7 @@
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
4
  /// <reference types="node/http" />
5
- /// <reference types=".dts-temp/k52V3rAmkkpigea7EM0nH/src/type" />
5
+ /// <reference types=".dts-temp/DxlrmidoZSzE3A7elWdZ1/src/type" />
6
6
  import { IncomingMessage, ServerResponse } from 'http';
7
7
  import qs from 'querystring';
8
8
  import type { ModernServerContext as ModernServerContextInterface } from '@modern-js/types';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import { Readable } from 'stream';
3
3
  import type { ModernServerContext } from '@modern-js/types';
4
- export declare const injectSeverData: (content: string, context: ModernServerContext) => string;
4
+ export declare const injectServerData: (content: string, context: ModernServerContext) => string;
5
5
  export declare const injectServerDataStream: (content: Readable, context: ModernServerContext) => import("stream").Transform;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node/http" />
3
- /// <reference types=".dts-temp/k52V3rAmkkpigea7EM0nH/src/type" />
3
+ /// <reference types=".dts-temp/DxlrmidoZSzE3A7elWdZ1/src/type" />
4
4
  import { IncomingMessage } from 'http';
5
5
  import type { OutputNormalizedConfig, HtmlNormalizedConfig } from '@modern-js/server-core';
6
6
  export declare const debug: any;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.11.0",
14
+ "version": "2.12.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/cjs/index.js",
@@ -56,8 +56,8 @@
56
56
  "merge-deep": "^3.0.3",
57
57
  "path-to-regexp": "^6.2.0",
58
58
  "serve-static": "^1.14.1",
59
- "@modern-js/utils": "2.11.0",
60
- "@modern-js/server-core": "2.11.0"
59
+ "@modern-js/utils": "2.12.0",
60
+ "@modern-js/server-core": "2.12.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/cookie": "^0.4.1",
@@ -73,10 +73,10 @@
73
73
  "node-mocks-http": "^1.11.0",
74
74
  "portfinder": "^1.0.28",
75
75
  "typescript": "^4",
76
- "@modern-js/types": "2.11.0",
77
- "@modern-js/server-core": "2.11.0",
78
- "@scripts/jest-config": "2.11.0",
79
- "@scripts/build": "2.11.0"
76
+ "@modern-js/types": "2.12.0",
77
+ "@modern-js/server-core": "2.12.0",
78
+ "@scripts/jest-config": "2.12.0",
79
+ "@scripts/build": "2.12.0"
80
80
  },
81
81
  "sideEffects": false,
82
82
  "publishConfig": {