startupjs 0.59.0-canary.9 → 0.60.0-canary.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.
- package/index.d.ts +1 -4
- package/index.js +1 -5
- package/package.json +18 -14
- package/startWorker.js +2 -0
- package/plugins/cssMediaUpdater.plugin.js +0 -47
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { BASE_URL } from '@startupjs/utils/BASE_URL'
|
|
2
2
|
export { default as axios } from '@startupjs/utils/axios'
|
|
3
3
|
export * from 'teamplay'
|
|
4
|
+
export * from 'cssxjs'
|
|
4
5
|
export * from '@startupjs/hooks'
|
|
5
6
|
// HINT: `isomorphic` means that the code can be executed both
|
|
6
7
|
// on the server and on the client
|
|
@@ -8,10 +9,6 @@ export * from '@startupjs/isomorphic-helpers'
|
|
|
8
9
|
export { getSessionData, setSessionData, deleteSessionData } from '@startupjs/server/utils/clientSessionData'
|
|
9
10
|
export { default as login } from '@startupjs/server/utils/clientLogin'
|
|
10
11
|
export { default as logout } from '@startupjs/server/utils/clientLogout'
|
|
11
|
-
// dummy babel macro functions for @startupjs/babel-plugin-rn-stylename-inline
|
|
12
|
-
export function css (css: TemplateStringsArray): any
|
|
13
|
-
export function styl (styl: TemplateStringsArray): any
|
|
14
|
-
export function pug (pug: TemplateStringsArray): any
|
|
15
12
|
|
|
16
13
|
export function serverOnly (value: any): any
|
|
17
14
|
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { BASE_URL } from '@startupjs/utils/BASE_URL'
|
|
2
2
|
export { default as axios } from '@startupjs/utils/axios'
|
|
3
3
|
export * from 'teamplay'
|
|
4
|
+
export * from 'cssxjs'
|
|
4
5
|
export * from '@startupjs/hooks'
|
|
5
6
|
// HINT: `isomorphic` means that the code can be executed both
|
|
6
7
|
// on the server and on the client
|
|
@@ -8,11 +9,6 @@ export * from '@startupjs/isomorphic-helpers'
|
|
|
8
9
|
export { getSessionData, setSessionData, deleteSessionData, onInitSession } from '@startupjs/server/utils/clientSessionData'
|
|
9
10
|
export { default as login } from '@startupjs/server/utils/clientLogin'
|
|
10
11
|
export { default as logout } from '@startupjs/server/utils/clientLogout'
|
|
11
|
-
// dummy babel macro functions for @startupjs/babel-plugin-rn-stylename-inline.
|
|
12
|
-
export function css (cssString) { return cssString }
|
|
13
|
-
export function styl (stylString) { return stylString }
|
|
14
|
-
// dummy pug function (it gets compiled to jsx by babel pug plugin)
|
|
15
|
-
export function pug (pugString) { return pugString }
|
|
16
12
|
|
|
17
13
|
// wrap serverOnly around the value to remove it from the client bundle
|
|
18
14
|
// (it will be replaced with `undefined` on the client by the babel-plugin-eliminator)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "startupjs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.60.0-canary.1",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">= 14"
|
|
7
7
|
},
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"./server": "./server.js",
|
|
13
13
|
"./schema": "./schema.js",
|
|
14
14
|
"./startServer": "./startServer.js",
|
|
15
|
+
"./startWorker": "./startWorker.js",
|
|
15
16
|
"./registry": "./registry.js",
|
|
16
17
|
"./nodeRegister": "./nodeRegister.js",
|
|
17
18
|
"./nconf": "./nconf.js",
|
|
@@ -21,32 +22,35 @@
|
|
|
21
22
|
"./metro-babel-transformer": "./metro-babel-transformer.cjs",
|
|
22
23
|
"./babel": "./babel.cjs",
|
|
23
24
|
"./startupjs.config": "./startupjs.config.cjs",
|
|
24
|
-
"./package.json": "./package.json"
|
|
25
|
-
"./plugins/cssMediaUpdater.plugin": "./plugins/cssMediaUpdater.plugin.js"
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"bin": "./cli.js",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@startupjs/
|
|
31
|
-
"@startupjs/
|
|
32
|
-
"@startupjs/
|
|
33
|
-
"@startupjs/
|
|
34
|
-
"@startupjs/
|
|
35
|
-
"@startupjs/
|
|
36
|
-
"@startupjs/
|
|
37
|
-
"
|
|
38
|
-
"
|
|
30
|
+
"@startupjs/bundler": "^0.60.0-canary.1",
|
|
31
|
+
"@startupjs/cli": "^0.60.0-canary.0",
|
|
32
|
+
"@startupjs/hooks": "^0.60.0-canary.0",
|
|
33
|
+
"@startupjs/isomorphic-helpers": "^0.60.0-canary.0",
|
|
34
|
+
"@startupjs/registry": "^0.60.0-canary.0",
|
|
35
|
+
"@startupjs/server": "^0.60.0-canary.0",
|
|
36
|
+
"@startupjs/utils": "^0.60.0-canary.0",
|
|
37
|
+
"babel-preset-startupjs": "^0.60.0-canary.0",
|
|
38
|
+
"cssxjs": "^0.2.11",
|
|
39
39
|
"lodash": "^4.17.20",
|
|
40
|
-
"teamplay": "^0.3.
|
|
40
|
+
"teamplay": "^0.3.26"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
+
"@startupjs/worker": "*",
|
|
43
44
|
"react": "*",
|
|
44
45
|
"react-native": "*"
|
|
45
46
|
},
|
|
46
47
|
"peerDependenciesMeta": {
|
|
48
|
+
"@startupjs/worker": {
|
|
49
|
+
"optional": true
|
|
50
|
+
},
|
|
47
51
|
"react-native": {
|
|
48
52
|
"optional": true
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "302e7e8004b435ddf4310611d3b59247e4e3b89e"
|
|
52
56
|
}
|
package/startWorker.js
ADDED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { memo, Fragment, createElement as el, useCallback, useRef } from 'react'
|
|
2
|
-
import { useWindowDimensions } from 'react-native'
|
|
3
|
-
import dimensions from '@startupjs/babel-plugin-rn-stylename-to-style/dimensions'
|
|
4
|
-
import { createPlugin } from '@startupjs/registry'
|
|
5
|
-
import debounce from 'lodash/debounce'
|
|
6
|
-
|
|
7
|
-
const DEFAULT_UPDATE_DELAY = 200
|
|
8
|
-
|
|
9
|
-
export default createPlugin({
|
|
10
|
-
name: 'cssMediaUpdater',
|
|
11
|
-
enabled: true,
|
|
12
|
-
order: 'system root',
|
|
13
|
-
client: ({ updateDelay }) => ({
|
|
14
|
-
renderRoot ({ children }) {
|
|
15
|
-
return (
|
|
16
|
-
el(Fragment, null,
|
|
17
|
-
el(MediaUpdater, { updateDelay }),
|
|
18
|
-
children
|
|
19
|
-
)
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line react/display-name
|
|
26
|
-
const MediaUpdater = memo(({ updateDelay = DEFAULT_UPDATE_DELAY }) => {
|
|
27
|
-
const widthRef = useRef()
|
|
28
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
-
const updateWidth = useCallback(
|
|
30
|
-
debounce(width => {
|
|
31
|
-
if (dimensions.width !== width) {
|
|
32
|
-
console.log('> update window width:', width)
|
|
33
|
-
dimensions.width = width
|
|
34
|
-
}
|
|
35
|
-
}, updateDelay, { leading: false, trailing: true }),
|
|
36
|
-
[]
|
|
37
|
-
)
|
|
38
|
-
const { width } = useWindowDimensions()
|
|
39
|
-
if (widthRef.current == null) {
|
|
40
|
-
widthRef.current = width
|
|
41
|
-
dimensions.width = width
|
|
42
|
-
} else if (widthRef.current !== width) {
|
|
43
|
-
widthRef.current = width
|
|
44
|
-
updateWidth(width)
|
|
45
|
-
}
|
|
46
|
-
return null
|
|
47
|
-
})
|