Skip to content

Commit 67e9120

Browse files
committed
release
1 parent 28c2a16 commit 67e9120

File tree

12 files changed

+34
-21
lines changed

12 files changed

+34
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.25.0",
2+
"version": "0.25.1",
33
"private": true,
44
"license": "ISC",
55
"name": "metablock",

packages/metablock-cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metablock/cli",
3-
"version": "0.25.0",
3+
"version": "0.25.1",
44
"description": "A node client for interacting with metablock cloud",
55
"main": "dist/index.js",
66
"type": "module",
@@ -12,7 +12,7 @@
1212
"author": "Quantmind",
1313
"license": "ISC",
1414
"dependencies": {
15-
"@metablock/core": "^0.25.0",
15+
"@metablock/core": "^0.25.1",
1616
"@rollup/plugin-node-resolve": "^15.0.1",
1717
"archiver": "^5.1.0",
1818
"colors": "^1.4.0",

packages/metablock-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metablock/core",
3-
"version": "0.25.0",
3+
"version": "0.25.1",
44
"description": "Metablock core library",
55
"type": "module",
66
"browser": "dist/index.js",

packages/metablock-core/src/cli/photos.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import getWindow from "../window";
12
import HttpComponent from "./httpComponent";
23

34
class Photos extends HttpComponent {
@@ -7,8 +8,9 @@ class Photos extends HttpComponent {
78
}
89

910
fromStore(photoId: string): any | undefined {
10-
if (global.window) {
11-
const jsonStr = window.localStorage.getItem(`photo-${photoId}`);
11+
const w = getWindow();
12+
if (w) {
13+
const jsonStr = w.localStorage.getItem(`photo-${photoId}`);
1214
if (jsonStr) return JSON.parse(jsonStr);
1315
}
1416
}
@@ -19,7 +21,8 @@ class Photos extends HttpComponent {
1921
return data;
2022
} else {
2123
const photo = await this.get(photoId);
22-
if (global.window) {
24+
const w = getWindow();
25+
if (w) {
2326
window.localStorage.setItem(`photo-${photoId}`, JSON.stringify(photo));
2427
}
2528
return photo;

packages/metablock-core/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { default as getBlock, WebBlock } from "./block";
1+
export { WebBlock, default as getBlock } from "./block";
22
export * from "./cli";
33
export * from "./data";
44
export * from "./headers";
@@ -9,3 +9,4 @@ export { default as compileOptions } from "./options";
99
export { default as HttpResponse } from "./response";
1010
export { default as urlQuery } from "./url";
1111
export * from "./urls";
12+
export { default as getWindow } from "./window";

packages/metablock-core/src/url.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import getWindow from "./window";
12
export type QueryType = Record<string, any>;
23

34
const urlQuery = (url: string, query: QueryType): string => {
45
if (query) {
5-
const u = global.window
6-
? new URL(url, global.window.location.origin)
7-
: new URL(url);
6+
const w = getWindow();
7+
const u = w ? new URL(url, w.location.origin) : new URL(url);
88
Object.keys(query).forEach((key) => {
99
let values = query[key];
1010
if (!Array.isArray(values)) values = [values];

packages/metablock-core/src/window.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const getWindow = () => {
2+
try {
3+
return window;
4+
} catch {
5+
return undefined;
6+
}
7+
};
8+
9+
export default getWindow;

packages/metablock-notebook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metablock/notebook",
3-
"version": "0.25.0",
3+
"version": "0.25.1",
44
"description": "Metablock Notebook",
55
"type": "module",
66
"browser": "dist/index.js",

packages/metablock-react/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metablock/react",
3-
"version": "0.25.0",
3+
"version": "0.25.1",
44
"description": "React Components for Metablock",
55
"type": "module",
66
"browser": "dist/index.js",
@@ -22,8 +22,8 @@
2222
"@emotion/react": "^11.4.1",
2323
"@emotion/styled": "^11.3.0",
2424
"@loadable/component": "^5.14.1",
25-
"@metablock/core": "^0.25.0",
26-
"@metablock/notebook": "^0.25.0",
25+
"@metablock/core": "^0.25.1",
26+
"@metablock/notebook": "^0.25.1",
2727
"@mui/icons-material": "~5.11.16",
2828
"@mui/lab": "~5.0.0-alpha.50",
2929
"@mui/material": "~5.13.4",

packages/metablock-react/src/Components/NoSsr.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { ReactNode } from "react";
22

3-
const NoSsr = (props: { children: ReactNode }) => {
4-
const { children } = props;
3+
const NoSsr = ({ children }: { children?: ReactNode }) => {
4+
if (!children) return null;
55
return <>{isSsr() ? null : children}</>;
66
};
77

packages/metablock-server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metablock/server",
3-
"version": "0.25.0",
3+
"version": "0.25.1",
44
"description": "Metablock dev server",
55
"main": "dist/index.js",
66
"license": "ISC",
@@ -12,7 +12,7 @@
1212
"dev"
1313
],
1414
"dependencies": {
15-
"@metablock/core": "^0.25.0",
15+
"@metablock/core": "^0.25.1",
1616
"async-lock": "^1.2.4",
1717
"body-parser": "^1.19.0",
1818
"btoa": "^1.2.1",

packages/metablock-store/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metablock/store",
3-
"version": "0.25.0",
3+
"version": "0.25.1",
44
"description": "Metablock MobX store",
55
"main": "dist/index.js",
66
"repository": {
@@ -16,7 +16,7 @@
1616
"store"
1717
],
1818
"dependencies": {
19-
"@metablock/core": "^0.25.0",
19+
"@metablock/core": "^0.25.1",
2020
"mobx": "^6.0.3"
2121
},
2222
"scripts": {

0 commit comments

Comments
 (0)