Skip to content

Commit 0c13154

Browse files
authored
Merge pull request #2406 from tf/entry-state-external
Bundle entryState as a separate package export
2 parents 9a0f05a + 94e3622 commit 0c13154

42 files changed

Lines changed: 76 additions & 37 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

entry_types/scrolled/package/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/node_modules
44
/contentElements
55
/editor.js
6+
/entryState.js
67
/frontend
78
/frontend-server.js
89
/contentElements-editor.js

entry_types/scrolled/package/.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,32 @@ module.exports = {
2222
'jest/globals': true,
2323
},
2424
"extends": ["plugin:jest/recommended"]
25+
},
26+
{
27+
// Content elements, widgets and the editor are bundled
28+
// separately and need to import from 'pageflow-scrolled/frontend'
29+
// and 'pageflow-scrolled/entryState' to keep that code external.
30+
// Stories are excluded because they legitimately import the
31+
// content element's sibling './frontend' aggregator via
32+
// '../frontend'.
33+
"files": ["src/contentElements/**/*.js", "src/widgets/**/*.js", "src/editor/**/*.js"],
34+
"excludedFiles": ["src/**/stories.js"],
35+
"rules": {
36+
"no-restricted-imports": ["error", {
37+
"patterns": ["**/frontend/**", "../**/frontend", "**/entryState/**"]
38+
}]
39+
}
40+
},
41+
{
42+
// The frontend is bundled separately from entryState and needs
43+
// to use 'pageflow-scrolled/entryState' to keep that code
44+
// external.
45+
"files": ["src/frontend/**/*.js"],
46+
"rules": {
47+
"no-restricted-imports": ["error", {
48+
"patterns": ["**/entryState/**", "../**/entryState"]
49+
}]
50+
}
2551
}
2652
]
2753
};

entry_types/scrolled/package/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/contentElements
33
/editor.js
44
/editor.css
5+
/entryState.js
56
/frontend
67
/frontend-server.js
78
/contentElements-editor.js

entry_types/scrolled/package/.storybook/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module.exports = {
3636
...config.resolve.alias,
3737
'pageflow/frontend': path.resolve(__dirname, '../../../../package/src/frontend'),
3838
'pageflow/review': path.resolve(__dirname, '../../../../package/src/review'),
39+
'pageflow-scrolled/entryState': path.resolve(__dirname, '../src/entryState'),
3940
'pageflow-scrolled/frontend': path.resolve(__dirname, '../src/frontend'),
4041
'pageflow-scrolled/review': path.resolve(__dirname, '../src/review'),
4142
'pageflow-scrolled/testHelpers': path.resolve(__dirname, '../src/testHelpers')

entry_types/scrolled/package/src/contentElements/inlineAudio/editor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {FileInputView, CheckBoxInputView} from 'pageflow/editor';
33
import {SelectInputView, SeparatorView, ColorInputView} from 'pageflow/ui';
44
import I18n from 'i18n-js';
55

6+
// eslint-disable-next-line no-restricted-imports
67
import {
78
defaultRemainingWaveformColor,
89
defaultRemainingWaveformColorInverted,

entry_types/scrolled/package/src/editor/controllers/PreviewMessageController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Object} from 'pageflow/ui';
22
import {ReviewMessageHandler} from 'pageflow-scrolled/review';
3-
import {watchCollections} from '../../entryState';
3+
import {watchCollections} from 'pageflow-scrolled/entryState';
44
import {InsertContentElementDialogView} from '../views/InsertContentElementDialogView'
55
import {SelectLinkDestinationDialogView} from '../views/SelectLinkDestinationDialogView'
66

entry_types/scrolled/package/src/editor/views/EditSectionTransitionView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {EditConfigurationView} from 'pageflow/editor';
22
import {EditSectionTransitionEffectView} from './EditSectionTransitionEffectView';
33
import {getAvailableTransitionNames} from 'pageflow-scrolled/frontend';
4-
import {normalizeSectionConfigurationData} from '../../entryState';
4+
import {normalizeSectionConfigurationData} from 'pageflow-scrolled/entryState';
55

66
export const EditSectionTransitionView = EditConfigurationView.extend({
77
translationKeyPrefix: 'pageflow_scrolled.editor.edit_section_transition',

entry_types/scrolled/package/src/editor/views/SectionThumbnailView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import ReactDOM from 'react-dom';
44

55
import {cssModulesUtils} from 'pageflow/ui';
6-
import {watchCollections} from '../../entryState';
6+
import {watchCollections} from 'pageflow-scrolled/entryState';
77
import {StandaloneSectionThumbnail} from 'pageflow-scrolled/frontend'
88

99
import styles from './SectionThumbnailView.module.css';

entry_types/scrolled/package/src/editor/views/inputs/TypographyVariantSelectInputView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Backbone from 'backbone';
55
import styles from './TypographyVariantSelectInputView.module.css';
66

77
import {ListboxInputView} from './ListboxInputView';
8-
import {watchCollections} from '../../../entryState';
8+
import {watchCollections} from 'pageflow-scrolled/entryState';
99
import {StandaloneSectionThumbnail} from 'pageflow-scrolled/frontend'
1010

1111
export const TypographyVariantSelectInputView = ListboxInputView.extend({

entry_types/scrolled/package/src/entryState/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export {
1717
useChapters,
1818
useChapter,
1919
useSectionForegroundContentElements,
20-
useContentElement
20+
useContentElement,
21+
useMainStoryline
2122
} from './structure';
2223
export {useFile} from './useFile';
2324
export {useFileWithInlineRights} from './useFileWithInlineRights';

0 commit comments

Comments
 (0)