@variousjs/various 0.6.0 → 1.0.1

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.
@@ -1,19 +1,18 @@
1
1
  declare module '@variousjs/various' {
2
2
  import { ComponentType } from 'react'
3
3
 
4
- type $dispatch = (type: string, method: string, value?: any) => unknown
4
+ type $dispatch = (type: string, method: string, value?: any) => Promise<any>
5
5
  type $render = (params: {
6
6
  name: string,
7
7
  url?: string,
8
8
  module?: string,
9
- props?: { [key: string]: any },
9
+ props?: Record<string, any>,
10
10
  target: Element | null,
11
11
  onMounted?: () => void,
12
12
  }) => () => void
13
13
  type $preload = (names: string[]) => Promise<void>
14
14
  type $postMessage = (name: string, value?: any) => void
15
15
  type $getMountedComponents = () => string[]
16
- type $isComponentLoaded = (name: string) => boolean
17
16
 
18
17
  export { default as Store, Connect, Dispatch } from 'nycticorax'
19
18
 
@@ -25,7 +24,6 @@ declare module '@variousjs/various' {
25
24
  $preload: $preload,
26
25
  $postMessage: $postMessage,
27
26
  $getMountedComponents: $getMountedComponents,
28
- $isComponentLoaded: $isComponentLoaded,
29
27
  }
30
28
 
31
29
  export interface ErrorProps {
@@ -42,18 +40,16 @@ declare module '@variousjs/various' {
42
40
  }>,
43
41
  }
44
42
 
45
- type Store<S> = {
46
- getStore: () => S,
47
- dispatch: (next: Partial<S>) => void,
48
- }
43
+ type Dispatch<T> = (
44
+ nycticorax: { getStore: () => T, emit: (next: Partial<T>) => void },
45
+ params: { value?: any, trigger: string },
46
+ ) => Promise<any>
49
47
 
50
- export type Actions<S = {}> = {
51
- [name: string]: (store: Store<S>, ...args: any[]) => unknown,
52
- }
48
+ export type Actions<S = {}> = Record<string, Dispatch<S>>
53
49
 
54
- export type OnMessage = (message: {
55
- type: string,
56
- name: string,
57
- value?: any,
58
- }) => void
50
+ export type MessageInvoker = (
51
+ message: { type: string, name: string, value?: any },
52
+ ) => any
53
+
54
+ export type Invoker = (params: { trigger: string, value?: any }) => any
59
55
  }
package/package.json CHANGED
@@ -1,22 +1,31 @@
1
1
  {
2
2
  "name": "@variousjs/various",
3
- "version": "0.6.0",
3
+ "version": "1.0.1",
4
4
  "description": "RequireJS(AMD) + React",
5
5
  "files": [
6
6
  "dist",
7
- "types"
7
+ "index.d.ts"
8
8
  ],
9
9
  "unpkg": "dist/index.js",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "types": "types/index.d.ts",
13
+ "nyc": {
14
+ "exclude": [
15
+ "examples/*"
16
+ ],
17
+ "excludeAfterRemap": true
18
+ },
19
+ "types": "index.d.ts",
14
20
  "scripts": {
15
21
  "lint": "tsc --noemit && eslint . --ext .ts,.tsx,.js",
22
+ "prestart": "mkdir -p demo/dist && cp demo/empty.js demo/dist/empty.js",
16
23
  "start": "webpack --config webpack/components.js --progress & webpack serve --config webpack/index.js --progress",
17
24
  "prebuild": "npm run lint",
18
- "build": "NODE_ENV=production webpack --progress --config webpack/components.js && NODE_ENV=production webpack --config webpack/index.js --progress",
19
- "postbuild": "cp -R dist/ docs/dist/"
25
+ "build": "NODE_ENV=production webpack --config webpack/index.js --progress",
26
+ "cy:run": "cypress run",
27
+ "ci": "start-server-and-test start http://127.0.0.1:2333 cy:run",
28
+ "cypress": "cypress open"
20
29
  },
21
30
  "repository": {
22
31
  "type": "git",
@@ -39,6 +48,7 @@
39
48
  "@babel/preset-react": "^7.14.5",
40
49
  "@babel/preset-typescript": "^7.14.5",
41
50
  "@babel/runtime-corejs3": "^7.14.8",
51
+ "@cypress/code-coverage": "^3.9.12",
42
52
  "@types/react": "^17.0.27",
43
53
  "@types/react-dom": "^17.0.9",
44
54
  "@types/react-router-dom": "^5.3.2",
@@ -46,19 +56,23 @@
46
56
  "@typescript-eslint/eslint-plugin": "^4.31.0",
47
57
  "@typescript-eslint/parser": "^4.31.0",
48
58
  "babel-loader": "^8.2.2",
59
+ "babel-plugin-istanbul": "^6.1.1",
60
+ "cypress": "^9.4.1",
49
61
  "eslint": "^7.31.0",
50
62
  "eslint-config-airbnb": "^18.2.1",
51
63
  "eslint-import-resolver-typescript": "^2.4.0",
64
+ "eslint-plugin-cypress": "^2.12.1",
52
65
  "eslint-plugin-import": "^2.23.4",
53
66
  "eslint-plugin-jsx-a11y": "^6.4.1",
54
67
  "eslint-plugin-react": "^7.24.0",
55
68
  "eslint-plugin-react-hooks": "^4.2.0",
69
+ "start-server-and-test": "^1.14.0",
56
70
  "typescript": "^4.4.2",
57
71
  "webpack": "^5.60.0",
58
72
  "webpack-cli": "^4.9.1",
59
73
  "webpack-dev-server": "^4.7.3"
60
74
  },
61
75
  "dependencies": {
62
- "nycticorax": "^2.1.0"
76
+ "nycticorax": "^3.0.3"
63
77
  }
64
78
  }
@@ -1,8 +0,0 @@
1
- /** @license React v16.13.1
2
- * react-is.production.min.js
3
- *
4
- * Copyright (c) Facebook, Inc. and its affiliates.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE file in the root directory of this source tree.
8
- */