Skip to content

Commit

Permalink
fix md5 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSergey committed Jul 20, 2021
1 parent 25d3e10 commit e8ad411
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
8 changes: 0 additions & 8 deletions examples/1-simple-without-backend/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,4 @@ frontendCompiler({
html: {
template: path.resolve(__dirname, './index.ejs')
}
},
props => {
Object.assign(props.resolve, {
alias: {
'react-dom': path.resolve(__dirname, './node_modules/react-dom'),
react: path.resolve(__dirname, './node_modules/react')
}
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "issr",
"version": "1.0.2",
"version": "1.1.0",
"private": true,
"license": "MIT",
"description": "iSSR the easiest way to move your React application to Server Side Rendering",
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ const BabelISSRPlugin = (api) => {
CallExpression(path, { opts: options, file }) {
const { filename, cwd } = file.opts;

const id = md5(pathNode.relative(cwd, filename));

const effectName = options && (
typeof options.effect === 'string' ||
Array.isArray(options.effect)
Expand All @@ -57,6 +55,7 @@ const BabelISSRPlugin = (api) => {
// eslint-disable-next-line sonarjs/no-collapsible-if
if (path.node.callee.name === effect) {
if (path.node.arguments.length < 2) {
const id = md5(pathNode.relative(cwd, filename));
createDummy(globalCache, id, 'effect');
const effectID = `effect-${id}-${globalCache[id].effect++}`;
path.node.arguments.push(t.StringLiteral(effectID));
Expand All @@ -68,6 +67,7 @@ const BabelISSRPlugin = (api) => {
// eslint-disable-next-line sonarjs/no-collapsible-if
if (path.node.callee.name === stateName) {
if (path.node.arguments.length < 2) {
const id = md5(pathNode.relative(cwd, filename));
createDummy(globalCache, id, 'setState');
const setStateID = `state-${id}-${globalCache[id].setState++}`;
path.node.arguments.push(t.StringLiteral(setStateID));
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@issr/babel-plugin",
"version": "1.0.2",
"version": "1.1.0",
"description": "Babel plugin for iSSR",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@issr/core",
"version": "1.0.2",
"version": "1.1.0",
"description": "iSSR the easiest way to move your React application to Server Side Rendering",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,18 @@
unique-filename "^1.1.1"
which "^1.3.1"

"@issr/[email protected]":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@issr/babel-plugin/-/babel-plugin-1.0.0.tgz#1dec54a8912649a7354693223cd74e61eb9ce7f7"
integrity sha512-iiTXaFbPs9dEMD48W96sMfkx+UDINggsi7Kxw1pvoQ85MIzalfhciwCFoQCsOWIXnQCPndoAnOv+DD+r2+2sMw==
dependencies:
md5 "2.3.0"

"@issr/[email protected]":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@issr/core/-/core-1.0.0.tgz#5bb88f11879bf85156c787757ee8d364acf59793"
integrity sha512-X5SISHxUTta0wRWls8mcEUO3TEj/5aD3GmwvcepJZcPR7i8wodN1ZKDEjvP9I9o14uJsKM9rwSH4eX2uzeATMg==

"@istanbuljs/load-nyc-config@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
Expand Down

0 comments on commit e8ad411

Please sign in to comment.