startupjs 0.57.0-canary.9 → 0.59.0-canary.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/index.d.ts +6 -1
- package/index.js +9 -4
- package/package.json +14 -13
- package/schema.js +1 -0
- package/initClient.auto.js +0 -6
- package/initClient.js +0 -52
package/index.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
export {
|
|
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
4
|
export * from '@startupjs/hooks'
|
|
5
5
|
// HINT: `isomorphic` means that the code can be executed both
|
|
6
6
|
// on the server and on the client
|
|
7
7
|
export * from '@startupjs/isomorphic-helpers'
|
|
8
|
+
export { getSessionData, setSessionData, deleteSessionData } from '@startupjs/server/utils/clientSessionData'
|
|
9
|
+
export { default as login } from '@startupjs/server/utils/clientLogin'
|
|
10
|
+
export { default as logout } from '@startupjs/server/utils/clientLogout'
|
|
8
11
|
// dummy babel macro functions for @startupjs/babel-plugin-rn-stylename-inline
|
|
9
12
|
export function css (css: TemplateStringsArray): any
|
|
10
13
|
export function styl (styl: TemplateStringsArray): any
|
|
11
14
|
export function pug (pug: TemplateStringsArray): any
|
|
12
15
|
|
|
16
|
+
export function serverOnly (value: any): any
|
|
17
|
+
|
|
13
18
|
export { default as StartupjsProvider } from './StartupjsProvider.js'
|
package/index.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
export {
|
|
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
4
|
export * from '@startupjs/hooks'
|
|
5
5
|
// HINT: `isomorphic` means that the code can be executed both
|
|
6
6
|
// on the server and on the client
|
|
7
7
|
export * from '@startupjs/isomorphic-helpers'
|
|
8
|
+
export { getSessionData, setSessionData, deleteSessionData, onInitSession } from '@startupjs/server/utils/clientSessionData'
|
|
9
|
+
export { default as login } from '@startupjs/server/utils/clientLogin'
|
|
10
|
+
export { default as logout } from '@startupjs/server/utils/clientLogout'
|
|
8
11
|
// dummy babel macro functions for @startupjs/babel-plugin-rn-stylename-inline.
|
|
9
12
|
export function css (cssString) { return cssString }
|
|
10
13
|
export function styl (stylString) { return stylString }
|
|
11
14
|
// dummy pug function (it gets compiled to jsx by babel pug plugin)
|
|
12
15
|
export function pug (pugString) { return pugString }
|
|
16
|
+
|
|
17
|
+
// wrap serverOnly around the value to remove it from the client bundle
|
|
18
|
+
// (it will be replaced with `undefined` on the client by the babel-plugin-eliminator)
|
|
19
|
+
export function serverOnly (value) { return value }
|
|
20
|
+
|
|
13
21
|
export { default as StartupjsProvider } from './StartupjsProvider.js'
|
|
14
22
|
|
|
15
23
|
// loading config should be performed first
|
|
16
24
|
export { default as __dummyLoadConfig } from '@startupjs/registry/loadStartupjsConfig.auto'
|
|
17
|
-
|
|
18
|
-
// init client at the very end. This is hacky solution to handle import loops
|
|
19
|
-
export { default as __dummyInitClient } from './initClient.auto.js'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "startupjs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.59.0-canary.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">= 14"
|
|
7
7
|
},
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./index.js",
|
|
12
12
|
"./server": "./server.js",
|
|
13
|
+
"./schema": "./schema.js",
|
|
13
14
|
"./startServer": "./startServer.js",
|
|
14
15
|
"./registry": "./registry.js",
|
|
15
|
-
"./
|
|
16
|
+
"./nodeRegister": "./nodeRegister.js",
|
|
16
17
|
"./nconf": "./nconf.js",
|
|
17
18
|
"./isomorphicHelpers": "./isomorphicHelpers.js",
|
|
18
19
|
"./loadConfig": "./loadConfig.js",
|
|
@@ -26,17 +27,17 @@
|
|
|
26
27
|
"bin": "./cli.js",
|
|
27
28
|
"license": "MIT",
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@startupjs/babel-plugin-rn-stylename-to-style": "^0.
|
|
30
|
-
"@startupjs/bundler": "^0.
|
|
31
|
-
"@startupjs/cli": "^0.
|
|
32
|
-
"@startupjs/hooks": "^0.
|
|
33
|
-
"@startupjs/isomorphic-helpers": "^0.
|
|
34
|
-
"@startupjs/registry": "^0.
|
|
35
|
-
"@startupjs/server": "^0.
|
|
36
|
-
"@startupjs/utils": "^0.
|
|
37
|
-
"babel-preset-startupjs": "^0.
|
|
30
|
+
"@startupjs/babel-plugin-rn-stylename-to-style": "^0.59.0-canary.0",
|
|
31
|
+
"@startupjs/bundler": "^0.59.0-canary.0",
|
|
32
|
+
"@startupjs/cli": "^0.59.0-canary.0",
|
|
33
|
+
"@startupjs/hooks": "^0.59.0-canary.0",
|
|
34
|
+
"@startupjs/isomorphic-helpers": "^0.59.0-canary.0",
|
|
35
|
+
"@startupjs/registry": "^0.59.0-canary.0",
|
|
36
|
+
"@startupjs/server": "^0.59.0-canary.0",
|
|
37
|
+
"@startupjs/utils": "^0.59.0-canary.0",
|
|
38
|
+
"babel-preset-startupjs": "^0.59.0-canary.0",
|
|
38
39
|
"lodash": "^4.17.20",
|
|
39
|
-
"teamplay": "^0.
|
|
40
|
+
"teamplay": "^0.3.21"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
43
|
"react": "*",
|
|
@@ -47,5 +48,5 @@
|
|
|
47
48
|
"optional": true
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "636c3e75125e95db209ac5b44c21d1e2b4c523b5"
|
|
51
52
|
}
|
package/schema.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'teamplay/schema'
|
package/initClient.auto.js
DELETED
package/initClient.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// IMPORTANT: you should run client init only after the startupjs config is loaded
|
|
2
|
-
// - init connection to ShareDB server
|
|
3
|
-
// - setup baseUrl for axios
|
|
4
|
-
|
|
5
|
-
import DEFAULT_BASE_URL from '@startupjs/utils/BASE_URL'
|
|
6
|
-
import isDevelopment from '@startupjs/utils/isDevelopment'
|
|
7
|
-
import isExpo from '@startupjs/utils/isExpo'
|
|
8
|
-
import isWeb from '@startupjs/utils/isWeb'
|
|
9
|
-
import axios from '@startupjs/utils/axios'
|
|
10
|
-
import { ROOT_MODULE as MODULE } from '@startupjs/registry'
|
|
11
|
-
import connect from 'teamplay/connect'
|
|
12
|
-
|
|
13
|
-
const NO_BASE_URL_WARN = `
|
|
14
|
-
!!! WARNING !!! baseUrl option is not specified.
|
|
15
|
-
Defaulting to ${DEFAULT_BASE_URL}
|
|
16
|
-
|
|
17
|
-
!!! IMPORTANT !!!
|
|
18
|
-
This might only work fine in development mode or if you are on Web.
|
|
19
|
-
In order for the app to work in production on React Native (iOS and Android),
|
|
20
|
-
you MUST explicitly provide the baseUrl option because the app can't guess it.
|
|
21
|
-
The simplest way to do it is to create a file \`.env.production\`
|
|
22
|
-
and put \`BASE_URL=https://mydomain.com\` there.
|
|
23
|
-
`
|
|
24
|
-
|
|
25
|
-
export default function init (options = {}) {
|
|
26
|
-
options.baseUrl ??= MODULE.options.baseUrl
|
|
27
|
-
const hasExplicitBaseUrl = Boolean(options.baseUrl)
|
|
28
|
-
|
|
29
|
-
// on web we always use the default base url
|
|
30
|
-
if (isWeb) options.baseUrl = DEFAULT_BASE_URL
|
|
31
|
-
if (!options.baseUrl) {
|
|
32
|
-
if (!(isWeb || (isExpo && isDevelopment))) console.warn(NO_BASE_URL_WARN)
|
|
33
|
-
options.baseUrl = DEFAULT_BASE_URL
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
axios.defaults.baseURL = options.baseUrl
|
|
37
|
-
|
|
38
|
-
// Connect model to the server
|
|
39
|
-
// Do this only if startupjs server exists and is enabled.
|
|
40
|
-
// Alternatively, we can connect to the arbitrary server if `enableConnection` is enabled instead.
|
|
41
|
-
if (MODULE.options.enableServer || MODULE.options.enableConnection) {
|
|
42
|
-
connect({
|
|
43
|
-
baseUrl: options.baseUrl,
|
|
44
|
-
// In dev we embed startupjs server as middleware into Metro server itself.
|
|
45
|
-
// We have to use XHR since there is no way to easily access Metro's WebSocket endpoints.
|
|
46
|
-
// In production we run our own server and can use WebSocket without any problems.
|
|
47
|
-
forceXhrFallback: MODULE.options.enableXhrFallback !== false && (
|
|
48
|
-
isDevelopment || (isExpo && !isWeb && !hasExplicitBaseUrl)
|
|
49
|
-
)
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
}
|