Skip to content
3 changes: 2 additions & 1 deletion client/invoke.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import deserialize from '../shared/deserialize'
import prefix from '../shared/prefix'
import { symbolHashJoin } from '../shared/symbolHash'
import page from './page'
import worker from './worker'
import client from './client'
Expand All @@ -13,7 +14,7 @@ export default function invoke(name, hash) {
} else {
worker.queues[name] = [...worker.queues[name], params]
}
let finalHash = hash === this.hash ? hash : `${hash}-${this.hash}`
let finalHash = hash === this.hash ? hash : symbolHashJoin(hash, this.hash)
let url = `${worker.api}/${prefix}/${finalHash}/${name}.json`
if (module.hot) {
const version = client.klasses[hash].__hashes[name]
Expand Down
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nullstack",
"version": "0.20.0",
"version": "0.20.1",
"description": "Feature-Driven Full Stack JavaScript Components",
"main": "./types/index.d.ts",
"author": "Mortaro",
Expand All @@ -16,29 +16,27 @@
},
"dependencies": {
"@swc/core": "1.3.35",
"babel-loader": "9.1.2",
"body-parser": "1.20.1",
"commander": "10.0.0",
"copy-webpack-plugin": "^11.0.0",
"copy-webpack-plugin": "11.0.0",
"css-loader": "6.7.3",
"css-minimizer-webpack-plugin": "^4.2.2",
"css-minimizer-webpack-plugin": "5.0.1",
"dotenv": "16.0.3",
"eslint-plugin-nullstack": "0.0.26",
"express": "4.18.2",
"fs-extra": "11.1.0",
"lightningcss": "^1.19.0",
"lightningcss": "1.21.5",
"mini-css-extract-plugin": "2.7.2",
"node-fetch": "2.6.7",
"nodemon-webpack-plugin": "^4.8.1",
"nodemon-webpack-plugin": "4.8.1",
"sass": "1.58.0",
"sass-loader": "13.2.0",
"style-loader": "^3.3.1",
"style-loader": "3.3.3",
"swc-loader": "0.2.3",
"swc-plugin-nullstack": "0.1.3",
"terser-webpack-plugin": "5.3.6",
"webpack": "^5.0.0",
"webpack-dev-server": "4.11.1",
"webpack-hot-middleware": "^2.25.3"
"webpack": "5.88.1",
"webpack-hot-middleware": "2.25.4"
},
"devDependencies": {
"webpack-dev-middleware": "github:Mortaro/webpack-dev-middleware#fix-write-to-disk-cleanup"
Expand Down
5 changes: 3 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import bodyParser from 'body-parser'
import express from 'express'
import path from 'path'
import deserialize from '../shared/deserialize'
import { symbolHashSplit } from '../shared/symbolHash'
import prefix from '../shared/prefix'
import context, { getCurrentContext, generateCurrentContext } from './context'
import emulatePrerender from './emulatePrerender'
Expand Down Expand Up @@ -123,7 +124,7 @@ server.start = function () {
const payload = request.method === 'GET' ? request.query.payload : request.body
const args = deserialize(payload)
const { hash, methodName } = request.params
const [invokerHash, boundHash] = hash.split('-')
const [invokerHash, boundHash] = symbolHashSplit(hash)
const key = `${invokerHash}.${methodName}`
await load(boundHash || invokerHash)
const invokerKlass = registry[invokerHash]
Expand Down Expand Up @@ -154,7 +155,7 @@ server.start = function () {
const payload = request.method === 'GET' ? request.query.payload : request.body
const args = deserialize(payload)
const { version, hash, methodName } = request.params
const [invokerHash, boundHash] = hash.split('-')
const [invokerHash, boundHash] = symbolHashSplit(hash)
let [filePath, klassName] = (invokerHash || boundHash).split("___")
const file = path.resolve('..', filePath.replaceAll('__', '/'))
console.info('\x1b[1;37m%s\x1b[0m', ` [${request.method}] ${request.path}`)
Expand Down
7 changes: 7 additions & 0 deletions shared/symbolHash.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function symbolHashSplit(hash) {
return hash.split('---')
}

export function symbolHashJoin(hash, joinHash) {
return `${hash}---${joinHash}`
}
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export default class Nullstack<TProps = unknown> {

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

[_property: `render${Capitalize<string>}`]: Nullstack['render']

prerendered: boolean

/**
Expand Down