Skip to content

Commit fc2250b

Browse files
authored
Merge pull request nullstack#377 from nullstack/next
Next
2 parents 6033054 + a9ec053 commit fc2250b

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

client/invoke.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import deserialize from '../shared/deserialize'
22
import prefix from '../shared/prefix'
3+
import { symbolHashJoin } from '../shared/symbolHash'
34
import page from './page'
45
import worker from './worker'
56
import client from './client'
@@ -13,7 +14,7 @@ export default function invoke(name, hash) {
1314
} else {
1415
worker.queues[name] = [...worker.queues[name], params]
1516
}
16-
let finalHash = hash === this.hash ? hash : `${hash}-${this.hash}`
17+
let finalHash = hash === this.hash ? hash : symbolHashJoin(hash, this.hash)
1718
let url = `${worker.api}/${prefix}/${finalHash}/${name}.json`
1819
if (module.hot) {
1920
const version = client.klasses[hash].__hashes[name]

package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nullstack",
3-
"version": "0.20.0",
3+
"version": "0.20.1",
44
"description": "Feature-Driven Full Stack JavaScript Components",
55
"main": "./types/index.d.ts",
66
"author": "Mortaro",
@@ -16,29 +16,27 @@
1616
},
1717
"dependencies": {
1818
"@swc/core": "1.3.35",
19-
"babel-loader": "9.1.2",
2019
"body-parser": "1.20.1",
2120
"commander": "10.0.0",
22-
"copy-webpack-plugin": "^11.0.0",
21+
"copy-webpack-plugin": "11.0.0",
2322
"css-loader": "6.7.3",
24-
"css-minimizer-webpack-plugin": "^4.2.2",
23+
"css-minimizer-webpack-plugin": "5.0.1",
2524
"dotenv": "16.0.3",
2625
"eslint-plugin-nullstack": "0.0.26",
2726
"express": "4.18.2",
2827
"fs-extra": "11.1.0",
29-
"lightningcss": "^1.19.0",
28+
"lightningcss": "1.21.5",
3029
"mini-css-extract-plugin": "2.7.2",
3130
"node-fetch": "2.6.7",
32-
"nodemon-webpack-plugin": "^4.8.1",
31+
"nodemon-webpack-plugin": "4.8.1",
3332
"sass": "1.58.0",
3433
"sass-loader": "13.2.0",
35-
"style-loader": "^3.3.1",
34+
"style-loader": "3.3.3",
3635
"swc-loader": "0.2.3",
3736
"swc-plugin-nullstack": "0.1.3",
3837
"terser-webpack-plugin": "5.3.6",
39-
"webpack": "^5.0.0",
40-
"webpack-dev-server": "4.11.1",
41-
"webpack-hot-middleware": "^2.25.3"
38+
"webpack": "5.88.1",
39+
"webpack-hot-middleware": "2.25.4"
4240
},
4341
"devDependencies": {
4442
"webpack-dev-middleware": "github:Mortaro/webpack-dev-middleware#fix-write-to-disk-cleanup"

server/server.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import bodyParser from 'body-parser'
22
import express from 'express'
33
import path from 'path'
44
import deserialize from '../shared/deserialize'
5+
import { symbolHashSplit } from '../shared/symbolHash'
56
import prefix from '../shared/prefix'
67
import context, { getCurrentContext, generateCurrentContext } from './context'
78
import emulatePrerender from './emulatePrerender'
@@ -123,7 +124,7 @@ server.start = function () {
123124
const payload = request.method === 'GET' ? request.query.payload : request.body
124125
const args = deserialize(payload)
125126
const { hash, methodName } = request.params
126-
const [invokerHash, boundHash] = hash.split('-')
127+
const [invokerHash, boundHash] = symbolHashSplit(hash)
127128
const key = `${invokerHash}.${methodName}`
128129
await load(boundHash || invokerHash)
129130
const invokerKlass = registry[invokerHash]
@@ -154,7 +155,7 @@ server.start = function () {
154155
const payload = request.method === 'GET' ? request.query.payload : request.body
155156
const args = deserialize(payload)
156157
const { version, hash, methodName } = request.params
157-
const [invokerHash, boundHash] = hash.split('-')
158+
const [invokerHash, boundHash] = symbolHashSplit(hash)
158159
let [filePath, klassName] = (invokerHash || boundHash).split("___")
159160
const file = path.resolve('..', filePath.replaceAll('__', '/'))
160161
console.info('\x1b[1;37m%s\x1b[0m', ` [${request.method}] ${request.path}`)

shared/symbolHash.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function symbolHashSplit(hash) {
2+
return hash.split('---')
3+
}
4+
5+
export function symbolHashJoin(hash, joinHash) {
6+
return `${hash}---${joinHash}`
7+
}

types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ export default class Nullstack<TProps = unknown> {
100100

101101
render?(context: NullstackClientContext<TProps>): NullstackNode
102102

103+
[_property: `render${Capitalize<string>}`]: Nullstack['render']
104+
103105
prerendered: boolean
104106

105107
/**

0 commit comments

Comments
 (0)