diff --git a/client/invoke.js b/client/invoke.js index 83b6df1a..315a06a6 100644 --- a/client/invoke.js +++ b/client/invoke.js @@ -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' @@ -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] diff --git a/package.json b/package.json index 3317b859..005279b0 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" diff --git a/server/server.js b/server/server.js index 45e73617..26721640 100644 --- a/server/server.js +++ b/server/server.js @@ -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' @@ -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] @@ -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}`) diff --git a/shared/symbolHash.js b/shared/symbolHash.js new file mode 100644 index 00000000..53d59ad0 --- /dev/null +++ b/shared/symbolHash.js @@ -0,0 +1,7 @@ +export function symbolHashSplit(hash) { + return hash.split('---') +} + +export function symbolHashJoin(hash, joinHash) { + return `${hash}---${joinHash}` +} \ No newline at end of file diff --git a/types/index.d.ts b/types/index.d.ts index b2243c41..380e297b 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -100,6 +100,8 @@ export default class Nullstack { render?(context: NullstackClientContext): NullstackNode + [_property: `render${Capitalize}`]: Nullstack['render'] + prerendered: boolean /**