@modern-js/plugin-v2 2.67.4 → 2.67.6-alpha.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.
@@ -102,6 +102,9 @@ function initPluginAPI({ context, pluginManager }) {
102
102
  modifyServerRoutes: hooks.modifyServerRoutes.tap,
103
103
  ...extendsPluginApi
104
104
  };
105
+ if (typeof Proxy === "undefined") {
106
+ return pluginAPI;
107
+ }
105
108
  return new Proxy(pluginAPI, {
106
109
  get(target, prop) {
107
110
  if (prop === "then") {
@@ -72,6 +72,9 @@ function initPluginAPI({ context, plugins }) {
72
72
  pickContext: hooks.pickContext.tap,
73
73
  ...extendsPluginApi
74
74
  };
75
+ if (typeof Proxy === "undefined") {
76
+ return pluginAPI;
77
+ }
75
78
  return new Proxy(pluginAPI, {
76
79
  get(target, prop) {
77
80
  if (prop === "then") {
@@ -65,7 +65,7 @@ function initPluginAPI({ context, pluginManager }) {
65
65
  const pluginAPI = {
66
66
  isPluginExists: pluginManager.isPluginExists,
67
67
  getServerContext,
68
- getConfig,
68
+ getServerConfig: getConfig,
69
69
  getHooks,
70
70
  updateServerContext,
71
71
  modifyConfig: hooks.modifyConfig.tap,
@@ -73,6 +73,9 @@ function initPluginAPI({ context, pluginManager }) {
73
73
  onReset: hooks.onReset.tap,
74
74
  ...extendsPluginApi
75
75
  };
76
+ if (typeof Proxy === "undefined") {
77
+ return pluginAPI;
78
+ }
76
79
  return new Proxy(pluginAPI, {
77
80
  get(target, prop) {
78
81
  if (prop === "then") {
@@ -87,6 +87,9 @@ function initPluginAPI(param) {
87
87
  _internalServerPlugins: hooks._internalServerPlugins.tap,
88
88
  modifyServerRoutes: hooks.modifyServerRoutes.tap
89
89
  }, extendsPluginApi);
90
+ if (typeof Proxy === "undefined") {
91
+ return pluginAPI;
92
+ }
90
93
  return new Proxy(pluginAPI, {
91
94
  get: function get(target, prop) {
92
95
  if (prop === "then") {
@@ -53,6 +53,9 @@ function initPluginAPI(param) {
53
53
  wrapRoot: hooks.wrapRoot.tap,
54
54
  pickContext: hooks.pickContext.tap
55
55
  }, extendsPluginApi);
56
+ if (typeof Proxy === "undefined") {
57
+ return pluginAPI;
58
+ }
56
59
  return new Proxy(pluginAPI, {
57
60
  get: function get(target, prop) {
58
61
  if (prop === "then") {
@@ -49,13 +49,16 @@ function initPluginAPI(param) {
49
49
  var pluginAPI = _object_spread({
50
50
  isPluginExists: pluginManager.isPluginExists,
51
51
  getServerContext,
52
- getConfig,
52
+ getServerConfig: getConfig,
53
53
  getHooks,
54
54
  updateServerContext,
55
55
  modifyConfig: hooks.modifyConfig.tap,
56
56
  onPrepare: hooks.onPrepare.tap,
57
57
  onReset: hooks.onReset.tap
58
58
  }, extendsPluginApi);
59
+ if (typeof Proxy === "undefined") {
60
+ return pluginAPI;
61
+ }
59
62
  return new Proxy(pluginAPI, {
60
63
  get: function get(target, prop) {
61
64
  if (prop === "then") {
@@ -79,6 +79,9 @@ function initPluginAPI({ context, pluginManager }) {
79
79
  modifyServerRoutes: hooks.modifyServerRoutes.tap,
80
80
  ...extendsPluginApi
81
81
  };
82
+ if (typeof Proxy === "undefined") {
83
+ return pluginAPI;
84
+ }
82
85
  return new Proxy(pluginAPI, {
83
86
  get(target, prop) {
84
87
  if (prop === "then") {
@@ -49,6 +49,9 @@ function initPluginAPI({ context, plugins }) {
49
49
  pickContext: hooks.pickContext.tap,
50
50
  ...extendsPluginApi
51
51
  };
52
+ if (typeof Proxy === "undefined") {
53
+ return pluginAPI;
54
+ }
52
55
  return new Proxy(pluginAPI, {
53
56
  get(target, prop) {
54
57
  if (prop === "then") {
@@ -41,7 +41,7 @@ function initPluginAPI({ context, pluginManager }) {
41
41
  const pluginAPI = {
42
42
  isPluginExists: pluginManager.isPluginExists,
43
43
  getServerContext,
44
- getConfig,
44
+ getServerConfig: getConfig,
45
45
  getHooks,
46
46
  updateServerContext,
47
47
  modifyConfig: hooks.modifyConfig.tap,
@@ -49,6 +49,9 @@ function initPluginAPI({ context, pluginManager }) {
49
49
  onReset: hooks.onReset.tap,
50
50
  ...extendsPluginApi
51
51
  };
52
+ if (typeof Proxy === "undefined") {
53
+ return pluginAPI;
54
+ }
52
55
  return new Proxy(pluginAPI, {
53
56
  get(target, prop) {
54
57
  if (prop === "then") {
@@ -8,6 +8,6 @@ interface ContextParams<Extends extends ServerPluginExtends> {
8
8
  export declare function initServerContext<Extends extends ServerPluginExtends>(params: {
9
9
  options: ServerCreateOptions;
10
10
  plugins: ServerPlugin<Extends>[];
11
- }): ServerContext<Extends>;
11
+ }): ServerContext<Extends> & Extends['extendContext'];
12
12
  export declare function createServerContext<Extends extends ServerPluginExtends>({ serverContext, config, }: ContextParams<Extends>): InternalServerContext<Extends>;
13
13
  export {};
@@ -4,8 +4,8 @@ import type { ServerContext } from './context';
4
4
  import type { Hooks, ModifyConfigFn, OnPrepareFn, OnResetFn } from './hooks';
5
5
  import type { ServerPluginExtends } from './plugin';
6
6
  export type ServerPluginAPI<Extends extends ServerPluginExtends> = Readonly<{
7
- getServerContext: () => Readonly<ServerContext<Extends>>;
8
- updateServerContext: (updateContext: DeepPartial<ServerContext<Extends>>) => void;
7
+ getServerContext: () => Readonly<ServerContext<Extends> & Extends['extendContext']>;
8
+ updateServerContext: (updateContext: DeepPartial<ServerContext<Extends> & Extends['extendContext']>) => void;
9
9
  getHooks: () => Readonly<Hooks<Extends['config']> & Extends['extendHooks']>;
10
10
  getServerConfig: () => Readonly<Extends['config']>;
11
11
  modifyConfig: PluginHookTap<ModifyConfigFn<Extends['config']>>;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.67.4",
18
+ "version": "2.67.6-alpha.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -79,20 +79,20 @@
79
79
  }
80
80
  },
81
81
  "dependencies": {
82
- "@swc/helpers": "0.5.13",
82
+ "@swc/helpers": "^0.5.17",
83
83
  "jiti": "1.21.7",
84
- "@modern-js/runtime-utils": "2.67.4",
85
- "@modern-js/utils": "2.67.4"
84
+ "@modern-js/runtime-utils": "2.67.5",
85
+ "@modern-js/utils": "2.67.5"
86
86
  },
87
87
  "devDependencies": {
88
- "@rsbuild/core": "1.3.16",
88
+ "@rsbuild/core": "1.3.20",
89
89
  "@types/jest": "^29",
90
90
  "@types/node": "^14",
91
91
  "@types/react": "^18.3.11",
92
92
  "jest": "^29",
93
93
  "typescript": "^5",
94
- "@modern-js/types": "2.67.4",
95
- "@modern-js/uni-builder": "2.67.4",
94
+ "@modern-js/types": "2.67.5",
95
+ "@modern-js/uni-builder": "2.67.5",
96
96
  "@scripts/build": "2.66.0",
97
97
  "@scripts/jest-config": "2.66.0"
98
98
  },