@histoire/shared 0.11.2 → 0.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/state.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare function clone(data: any): any;
2
2
  export declare function omit(data: any, keys: string[]): {};
3
- export declare function applyState(target: any, state: any, override?: boolean): void;
3
+ export declare function applyState(target: any, state: any): void;
package/dist/state.js CHANGED
@@ -22,13 +22,8 @@ export function omit(data, keys) {
22
22
  }
23
23
  return copy;
24
24
  }
25
- export function applyState(target, state, override = false) {
25
+ export function applyState(target, state) {
26
26
  for (const key in state) {
27
- if (!override && target[key] && !key.startsWith('_h') && typeof target[key] === 'object' && !Array.isArray(target[key])) {
28
- Object.assign(target[key], state[key]);
29
- }
30
- else {
31
- target[key] = state[key];
32
- }
27
+ target[key] = state[key];
33
28
  }
34
29
  }
@@ -119,6 +119,16 @@ export interface HistoireConfig {
119
119
  * Only loaded in the browser client.
120
120
  */
121
121
  browser: string;
122
+ } | {
123
+ /**
124
+ * Only loaded while collecting stories in the node server.
125
+ */
126
+ server: string;
127
+ } | {
128
+ /**
129
+ * Only loaded in the browser client.
130
+ */
131
+ browser: string;
122
132
  /**
123
133
  * Only loaded while collecting stories in the node server.
124
134
  */
@@ -125,6 +125,7 @@ export interface ServerStoryFile {
125
125
  markdownFile?: ServerMarkdownFile;
126
126
  }
127
127
  export interface ServerMarkdownFile {
128
+ id: string;
128
129
  relativePath: string;
129
130
  absolutePath: string;
130
131
  isRelatedToStory: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/shared",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "Shared utilities for Histoire",
5
5
  "license": "MIT",
6
6
  "author": {
package/src/state.ts CHANGED
@@ -22,12 +22,8 @@ export function omit (data, keys: string[]) {
22
22
  return copy
23
23
  }
24
24
 
25
- export function applyState (target: any, state: any, override = false) {
25
+ export function applyState (target: any, state: any) {
26
26
  for (const key in state) {
27
- if (!override && target[key] && !key.startsWith('_h') && typeof target[key] === 'object' && !Array.isArray(target[key])) {
28
- Object.assign(target[key], state[key])
29
- } else {
30
- target[key] = state[key]
31
- }
27
+ target[key] = state[key]
32
28
  }
33
29
  }
@@ -128,6 +128,16 @@ export interface HistoireConfig {
128
128
  * Only loaded in the browser client.
129
129
  */
130
130
  browser: string
131
+ } | {
132
+ /**
133
+ * Only loaded while collecting stories in the node server.
134
+ */
135
+ server: string
136
+ } | {
137
+ /**
138
+ * Only loaded in the browser client.
139
+ */
140
+ browser: string
131
141
  /**
132
142
  * Only loaded while collecting stories in the node server.
133
143
  */
@@ -133,6 +133,7 @@ export interface ServerStoryFile {
133
133
  }
134
134
 
135
135
  export interface ServerMarkdownFile {
136
+ id: string
136
137
  relativePath: string
137
138
  absolutePath: string
138
139
  isRelatedToStory: boolean