@shuvi/platform-shared 1.0.0 → 1.0.2

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.
@@ -62,6 +62,9 @@ export function runInParallerAndBail(fns) {
62
62
  });
63
63
  }
64
64
  function redirectHelper(to, status = 302) {
65
+ if (process.env.NODE_ENV === 'development') {
66
+ invariant(typeof to === 'string', `redirect fist argument should be string, now is ${typeof to}`);
67
+ }
65
68
  throw createRedirect(to, status);
66
69
  }
67
70
  function errorHelper(msg, statusCode = 500) {
@@ -1 +1 @@
1
- export declare type IRuntimeConfig = Record<string, string>;
1
+ export declare type IRuntimeConfig = Record<string, any>;
@@ -5,7 +5,7 @@ import { IRuntimeConfig } from './runtimeConfigTypes';
5
5
  * @returns serverRuntimeConfig
6
6
  */
7
7
  export declare function getRuntimeConfig(): {
8
- [x: string]: string;
8
+ [x: string]: any;
9
9
  };
10
10
  export declare function getPublicRuntimeConfig(): IRuntimeConfig | undefined | null;
11
11
  export declare function setPublicRuntimeConfig(config: IRuntimeConfig | null): void;
@@ -0,0 +1,14 @@
1
+ import { extendedHooks } from './plugins/main/hooks';
2
+ import { IRuntimeConfig } from '../../shared';
3
+ declare global {
4
+ namespace ShuviService {
5
+ interface CustomConfig {
6
+ publicRuntimeConfig?: IRuntimeConfig;
7
+ serverRuntimeConfig?: IRuntimeConfig;
8
+ }
9
+ interface CustomCorePluginHooks {
10
+ addEntryCode: typeof extendedHooks.addEntryCode;
11
+ modifyRuntimeConfig: typeof extendedHooks.modifyRuntimeConfig;
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -69,6 +69,9 @@ function runInParallerAndBail(fns) {
69
69
  }
70
70
  exports.runInParallerAndBail = runInParallerAndBail;
71
71
  function redirectHelper(to, status = 302) {
72
+ if (process.env.NODE_ENV === 'development') {
73
+ (0, invariant_1.default)(typeof to === 'string', `redirect fist argument should be string, now is ${typeof to}`);
74
+ }
72
75
  throw (0, response_1.redirect)(to, status);
73
76
  }
74
77
  function errorHelper(msg, statusCode = 500) {
@@ -1 +1 @@
1
- export declare type IRuntimeConfig = Record<string, string>;
1
+ export declare type IRuntimeConfig = Record<string, any>;
@@ -5,7 +5,7 @@ import { IRuntimeConfig } from './runtimeConfigTypes';
5
5
  * @returns serverRuntimeConfig
6
6
  */
7
7
  export declare function getRuntimeConfig(): {
8
- [x: string]: string;
8
+ [x: string]: any;
9
9
  };
10
10
  export declare function getPublicRuntimeConfig(): IRuntimeConfig | undefined | null;
11
11
  export declare function setPublicRuntimeConfig(config: IRuntimeConfig | null): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shuvi/platform-shared",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/shuvijs/shuvi.git",
@@ -13,7 +13,7 @@
13
13
  "esm",
14
14
  "lib",
15
15
  "template",
16
- "shuvi-type-extensions-node.d.js",
16
+ "shuvi-type-extensions-node.d.ts",
17
17
  "shuvi-type-extensions-node.js",
18
18
  "shuvi-type-extensions-runtime.d.ts"
19
19
  ],
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "./template/*": "./template/*",
66
66
  "./shuvi-type-extensions-node": {
67
- "types": "./shuvi-type-extensions-node.d.js",
67
+ "types": "./shuvi-type-extensions-node.d.ts",
68
68
  "default": "./shuvi-type-extensions-node.js"
69
69
  },
70
70
  "./shuvi-type-extensions-runtime": "./shuvi-type-extensions-runtime.d.ts",
@@ -83,18 +83,18 @@
83
83
  "node": ">= 12.0.0"
84
84
  },
85
85
  "dependencies": {
86
- "@shuvi/hook": "1.0.0",
86
+ "@shuvi/hook": "1.0.2",
87
87
  "@shuvi/redox": "0.0.7",
88
- "@shuvi/router": "1.0.0",
89
- "@shuvi/runtime": "1.0.0",
90
- "@shuvi/service": "1.0.0",
91
- "@shuvi/shared": "1.0.0",
92
- "@shuvi/toolpack": "1.0.0",
93
- "@shuvi/utils": "1.0.0",
88
+ "@shuvi/router": "1.0.2",
89
+ "@shuvi/runtime": "1.0.2",
90
+ "@shuvi/service": "1.0.2",
91
+ "@shuvi/shared": "1.0.2",
92
+ "@shuvi/toolpack": "1.0.2",
93
+ "@shuvi/utils": "1.0.2",
94
94
  "redux": "4.1.2"
95
95
  },
96
96
  "peerDependencies": {
97
- "@shuvi/service": "1.0.0"
97
+ "@shuvi/service": "1.0.2"
98
98
  },
99
99
  "devDependencies": {
100
100
  "@types/minimatch": "3.0.5"
@@ -0,0 +1 @@
1
+ /// <reference types="./lib/node/platform/shuvi-type-extensions-node" />