Skip to content

Commit 8b43069

Browse files
committed
- [web] .proto 和 .bin 网络请求优先
1 parent 9ed2f62 commit 8b43069

File tree

12 files changed

+110
-72
lines changed

12 files changed

+110
-72
lines changed

.ondevice/doctools.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
import { extractArgTypes } from "@storybook/react/dist/modern/client/docs/extractArgTypes";
2-
import { addArgTypesEnhancer, addParameters } from "@storybook/react-native";
3-
import { enhanceArgTypes } from "@storybook/docs-tools";
1+
/*
2+
* @Author: czy0729
3+
* @Date: 2024-01-13 22:05:53
4+
* @Last Modified by: czy0729
5+
* @Last Modified time: 2024-01-13 22:05:53
6+
*/
7+
import { extractArgTypes } from '@storybook/react/dist/modern/client/docs/extractArgTypes'
8+
import { addArgTypesEnhancer, addParameters } from '@storybook/react-native'
9+
import { enhanceArgTypes } from '@storybook/docs-tools'
410

5-
addArgTypesEnhancer(enhanceArgTypes);
11+
addArgTypesEnhancer(enhanceArgTypes)
612
addParameters({
713
docs: {
8-
extractArgTypes,
9-
},
10-
});
14+
extractArgTypes
15+
}
16+
})

.ondevice/index.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* @Author: czy0729
3+
* @Date: 2024-01-13 22:06:21
4+
* @Last Modified by: czy0729
5+
* @Last Modified time: 2024-01-13 22:06:21
6+
*/
17
import { getStorybookUI } from '@storybook/react-native'
28
// import "./doctools";
39
import './storybook.requires'

.ondevice/main.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
/*
2+
* @Author: czy0729
3+
* @Date: 2024-01-13 22:05:57
4+
* @Last Modified by: czy0729
5+
* @Last Modified time: 2024-01-13 22:05:57
6+
*/
17
module.exports = {
2-
stories: ["../src/**/*.stories.?(ts|tsx|js|jsx)"],
8+
stories: ['../src/**/*.stories.?(ts|tsx|js|jsx)'],
39
addons: [
4-
"@storybook/addon-ondevice-notes",
5-
"@storybook/addon-ondevice-controls",
6-
"@storybook/addon-ondevice-backgrounds",
7-
"@storybook/addon-ondevice-actions",
8-
],
9-
};
10+
'@storybook/addon-ondevice-notes',
11+
'@storybook/addon-ondevice-controls',
12+
'@storybook/addon-ondevice-backgrounds',
13+
'@storybook/addon-ondevice-actions'
14+
]
15+
}

.ondevice/preview.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
import { withBackgrounds } from "@storybook/addon-ondevice-backgrounds";
1+
/*
2+
* @Author: czy0729
3+
* @Date: 2024-01-13 22:06:00
4+
* @Last Modified by: czy0729
5+
* @Last Modified time: 2024-01-13 22:06:00
6+
*/
7+
import { withBackgrounds } from '@storybook/addon-ondevice-backgrounds'
28

3-
export const decorators = [withBackgrounds];
9+
export const decorators = [withBackgrounds]
410
export const parameters = {
511
backgrounds: [
6-
{ name: "plain", value: "white", default: true },
7-
{ name: "warm", value: "hotpink" },
8-
{ name: "cool", value: "deepskyblue" },
12+
{ name: 'plain', value: 'white', default: true },
13+
{ name: 'warm', value: 'hotpink' },
14+
{ name: 'cool', value: 'deepskyblue' }
915
],
1016
controls: {
1117
matchers: {
1218
color: /(background|color)$/i,
13-
date: /Date$/,
14-
},
15-
},
16-
};
19+
date: /Date$/
20+
}
21+
}
22+
}

.ondevice/storybook.requires.js

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,60 @@
1+
/*
2+
* @Author: czy0729
3+
* @Date: 2024-01-13 22:06:03
4+
* @Last Modified by: czy0729
5+
* @Last Modified time: 2024-01-13 22:06:03
6+
*/
17
/* do not change this file, it is auto generated by storybook. */
2-
38
import {
49
configure,
510
addDecorator,
611
addParameters,
712
addArgsEnhancer,
8-
clearDecorators,
9-
} from "@storybook/react-native";
13+
clearDecorators
14+
} from '@storybook/react-native'
15+
import '@storybook/addon-ondevice-notes/register'
16+
import '@storybook/addon-ondevice-controls/register'
17+
import '@storybook/addon-ondevice-backgrounds/register'
18+
import '@storybook/addon-ondevice-actions/register'
1019

1120
global.STORIES = [
1221
{
13-
titlePrefix: "",
14-
directory: "./stories",
15-
files: "**/*.stories.?(ts|tsx|js|jsx)",
22+
titlePrefix: '',
23+
directory: './stories',
24+
files: '**/*.stories.?(ts|tsx|js|jsx)',
1625
importPathMatcher:
17-
"^\\.[\\\\/](?:stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(?:ts|tsx|js|jsx)?)$",
18-
},
19-
];
20-
21-
import "@storybook/addon-ondevice-notes/register";
22-
import "@storybook/addon-ondevice-controls/register";
23-
import "@storybook/addon-ondevice-backgrounds/register";
24-
import "@storybook/addon-ondevice-actions/register";
26+
'^\\.[\\\\/](?:stories(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(?:ts|tsx|js|jsx)?)$'
27+
}
28+
]
2529

26-
import { argsEnhancers } from "@storybook/addon-actions/dist/modern/preset/addArgs";
30+
import { argsEnhancers } from '@storybook/addon-actions/dist/modern/preset/addArgs'
2731

28-
import { decorators, parameters } from "./preview";
32+
import { decorators, parameters } from './preview'
2933

3034
if (decorators) {
3135
if (__DEV__) {
3236
// stops the warning from showing on every HMR
33-
require("react-native").LogBox.ignoreLogs([
34-
"`clearDecorators` is deprecated and will be removed in Storybook 7.0",
35-
]);
37+
require('react-native').LogBox.ignoreLogs([
38+
'`clearDecorators` is deprecated and will be removed in Storybook 7.0'
39+
])
3640
}
3741
// workaround for global decorators getting infinitely applied on HMR, see https://github.com/storybookjs/react-native/issues/185
38-
clearDecorators();
39-
decorators.forEach((decorator) => addDecorator(decorator));
42+
clearDecorators()
43+
decorators.forEach(decorator => addDecorator(decorator))
4044
}
4145

4246
if (parameters) {
43-
addParameters(parameters);
47+
addParameters(parameters)
4448
}
4549

4650
try {
47-
argsEnhancers.forEach((enhancer) => addArgsEnhancer(enhancer));
51+
argsEnhancers.forEach(enhancer => addArgsEnhancer(enhancer))
4852
} catch {}
4953

5054
const getStories = () => {
5155
return {
52-
"./stories/MyButton.stories.js": require("../stories/MyButton.stories.js"),
53-
};
54-
};
56+
'./stories/MyButton.stories.js': require('../stories/MyButton.stories.js')
57+
}
58+
}
5559

56-
configure(getStories, module, false);
60+
configure(getStories, module, false)

.storybook/ds.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: czy0729
33
* @Date: 2023-11-02 15:07:05
44
* @Last Modified by: czy0729
5-
* @Last Modified time: 2023-12-12 17:31:20
5+
* @Last Modified time: 2024-01-13 22:06:38
66
*/
77
import Provider from '@ant-design/react-native/lib/provider'
88
import { GestureHandlerRootView } from 'react-native-gesture-handler'

.storybook/main.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: czy0729
33
* @Date: 2023-04-10 16:27:31
44
* @Last Modified by: czy0729
5-
* @Last Modified time: 2023-12-13 04:36:46
5+
* @Last Modified time: 2024-01-13 22:13:44
66
*/
77
const path = require('path')
88
const sass = require('node-sass')
@@ -99,6 +99,10 @@ module.exports = {
9999
maxAgeSeconds: 60 * 60 * 24 * 30
100100
}
101101
}
102+
},
103+
{
104+
urlPattern: /\.(proto|bin)$/,
105+
handler: 'NetworkFirst'
102106
}
103107
],
104108
maximumFileSizeToCacheInBytes: 15 * 1024 * 1024
@@ -111,17 +115,12 @@ module.exports = {
111115
// 搜索 existingUglifyPlugin
112116
const existingUglifyPluginIndex = config.optimization.minimizer.findIndex(
113117
plugin =>
114-
plugin.constructor.name === 'TerserPlugin' ||
115-
plugin.constructor.name === 'UglifyJsPlugin'
118+
plugin.constructor.name === 'TerserPlugin' || plugin.constructor.name === 'UglifyJsPlugin'
116119
)
117120

118121
if (existingUglifyPluginIndex > -1) {
119122
// 替换 existingUglifyPlugin
120-
config.optimization.minimizer.splice(
121-
existingUglifyPluginIndex,
122-
1,
123-
new UglifyJsPlugin()
124-
)
123+
config.optimization.minimizer.splice(existingUglifyPluginIndex, 1, new UglifyJsPlugin())
125124
} else {
126125
// 添加新的 UglifyJsPlugin
127126
config.optimization.minimizer.push(new UglifyJsPlugin())

.storybook/preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: czy0729
33
* @Date: 2023-04-10 20:43:26
44
* @Last Modified by: czy0729
5-
* @Last Modified time: 2023-12-12 17:28:12
5+
* @Last Modified time: 2024-01-13 22:06:43
66
*/
77
import { addons } from '@storybook/addons'
88
import { SET_CURRENT_STORY, FORCE_REMOUNT } from '@storybook/core-events'

.storybook/styles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* @Author: czy0729
33
* @Date: 2023-11-02 15:06:33
4-
* @Last Modified by: czy0729
5-
* @Last Modified time: 2023-11-02 15:06:33
4+
* @Last Modified by: czy0729
5+
* @Last Modified time: 2024-01-13 22:06:45
66
*/
77
import { _ } from '@stores'
88

.storybook/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* @Author: czy0729
33
* @Date: 2023-11-02 15:05:50
4-
* @Last Modified by: czy0729
5-
* @Last Modified time: 2023-11-02 15:05:50
4+
* @Last Modified by: czy0729
5+
* @Last Modified time: 2024-01-13 22:06:46
66
*/
77
export function parseUrlParams() {
88
const params = new URLSearchParams(window.location.search)

0 commit comments

Comments
 (0)