yimi-builder-webpack 1.0.0

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.
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "my-project",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "build": "webpack --config webpack.prod.js",
9
+ "watch": "webpack --watch",
10
+ "dev": "webpack-dev-server --config webpack.dev.js --open",
11
+ "build:ssr": "webpack --config webpack.ssr.js"
12
+ },
13
+ "keywords": [],
14
+ "author": "",
15
+ "license": "ISC",
16
+ "devDependencies": {
17
+ "@babel/core": "^7.4.4",
18
+ "@babel/plugin-syntax-dynamic-import": "^7.2.0",
19
+ "@babel/preset-env": "^7.4.4",
20
+ "@babel/preset-react": "^7.0.0",
21
+ "autoprefixer": "^9.5.1",
22
+ "babel-eslint": "^10.0.1",
23
+ "babel-loader": "^8.0.5",
24
+ "clean-webpack-plugin": "^2.0.2",
25
+ "css-loader": "^2.1.1",
26
+ "cssnano": "^4.1.10",
27
+ "eslint": "^5.16.0",
28
+ "eslint-config-airbnb": "^17.1.0",
29
+ "eslint-config-airbnb-base": "^13.1.0",
30
+ "eslint-loader": "^2.1.2",
31
+ "eslint-plugin-import": "^2.17.3",
32
+ "eslint-plugin-jsx-a11y": "^6.2.1",
33
+ "eslint-plugin-react": "^7.13.0",
34
+ "express": "^4.17.1",
35
+ "file-loader": "^3.0.1",
36
+ "friendly-errors-webpack-plugin": "^1.7.0",
37
+ "glob": "^7.1.4",
38
+ "html-inline-css-webpack-plugin": "^1.2.1",
39
+ "html-loader": "^0.5.5",
40
+ "html-webpack-externals-plugin": "^3.8.0",
41
+ "html-webpack-inline-source-plugin": "0.0.10",
42
+ "html-webpack-plugin": "^3.2.0",
43
+ "less": "^3.9.0",
44
+ "less-loader": "^5.0.0",
45
+ "mini-css-extract-plugin": "^0.6.0",
46
+ "node-notifier": "^5.4.0",
47
+ "optimize-css-assets-webpack-plugin": "^5.0.1",
48
+ "postcss-loader": "^3.0.0",
49
+ "postcss-preset-env": "^6.6.0",
50
+ "px2rem-loader": "^0.1.9",
51
+ "raw-loader": "^0.5.1",
52
+ "react": "^16.8.6",
53
+ "react-dom": "^16.8.6",
54
+ "rimraf": "^2.6.3",
55
+ "style-loader": "^0.23.1",
56
+ "uglifyjs-webpack-plugin": "^2.1.2",
57
+ "url-loader": "^1.1.2",
58
+ "webpack": "^4.31.0",
59
+ "webpack-cli": "^3.3.2",
60
+ "webpack-dev-server": "^3.3.1"
61
+ },
62
+ "dependencies": {
63
+ "large-number": "^1.0.1",
64
+ "lib-flexible": "^0.3.2"
65
+ }
66
+ }
@@ -0,0 +1,235 @@
1
+ {
2
+ "error": [],
3
+ "extra": [],
4
+ "data": {
5
+ "list": [
6
+ [{
7
+ "sub_count": 5556,
8
+ "column_type": 1,
9
+ "id": 192,
10
+ "column_price_market": 9900,
11
+ "column_bgcolor": "#F6F7FB",
12
+ "column_title": "SQL必知必会",
13
+ "column_cover_small": "https:\/\/static001.geekbang.org\/resource\/image\/1c\/38\/1c5a5b154b543af952312eef33217438.jpg",
14
+ "column_cover": "https:\/\/static001.geekbang.org\/resource\/image\/c7\/0d\/c7ee0aabbcb6d2da09a1b4a56c1a730d.jpg",
15
+ "had_sub": false,
16
+ "price_type": 2,
17
+ "column_unit": "45讲",
18
+ "is_experience": false,
19
+ "column_ctime": 1559640855,
20
+ "update_frequency": "每周一 \/ 三 \/ 五更新",
21
+ "is_onboard": true,
22
+ "author_intro": "清华大学计算机博士",
23
+ "column_sku": 100029501,
24
+ "column_cover_wxlite": "https:\/\/static001.geekbang.org\/resource\/image\/cd\/f0\/cd26b744d388dbd4387dcfaa66dd8bf0.jpg",
25
+ "column_price": 6800,
26
+ "column_price_sale": 6800,
27
+ "author_name": "陈旸",
28
+ "column_subtitle": "从入门到数据实战"
29
+ }, {
30
+ "sub_count": 5446,
31
+ "column_type": 1,
32
+ "id": 191,
33
+ "column_price_market": 9900,
34
+ "column_bgcolor": "#F6F7FB",
35
+ "column_title": "Kafka核心技术与实战",
36
+ "column_cover_small": "https:\/\/static001.geekbang.org\/resource\/image\/be\/d9\/be55e9cfe7b542ef6284e3e5722b9bd9.jpg",
37
+ "column_cover": "https:\/\/static001.geekbang.org\/resource\/image\/49\/92\/49d8686324a61b106f9fbeb45c9d7192.jpg",
38
+ "had_sub": false,
39
+ "price_type": 1,
40
+ "column_unit": "42讲",
41
+ "is_experience": false,
42
+ "column_ctime": 1559009326,
43
+ "update_frequency": "每周二 \/ 四 \/ 六更新",
44
+ "is_onboard": true,
45
+ "author_intro": "人人贷计算平台部总监,Apache Kafka Contributor",
46
+ "column_sku": 100029201,
47
+ "column_cover_wxlite": "https:\/\/static001.geekbang.org\/resource\/image\/fc\/f6\/fcddac07fdd4530b99b5a1049b6aa5f6.jpg",
48
+ "column_price": 9900,
49
+ "column_price_sale": 9900,
50
+ "author_name": "胡夕",
51
+ "column_subtitle": "全面提升你的Kafka实战能力"
52
+ }, {
53
+ "sub_count": 4209,
54
+ "column_type": 1,
55
+ "id": 189,
56
+ "column_price_market": 9900,
57
+ "column_bgcolor": "#F6F7FB",
58
+ "column_title": "透视HTTP协议",
59
+ "column_cover_small": "https:\/\/static001.geekbang.org\/resource\/image\/7f\/6e\/7ff02fbdbc37331b10c5435dc86e4f6e.jpg",
60
+ "column_cover": "https:\/\/static001.geekbang.org\/resource\/image\/2a\/10\/2ac9b106533a4904f66041143a0e1b10.jpg",
61
+ "had_sub": false,
62
+ "price_type": 1,
63
+ "column_unit": "40讲",
64
+ "is_experience": false,
65
+ "column_ctime": 1558689100,
66
+ "update_frequency": "每周一/三/五更新",
67
+ "is_onboard": true,
68
+ "author_intro": "奇虎360技术专家,Nginx\/OpenResty开源项目贡献者",
69
+ "column_sku": 100029001,
70
+ "column_cover_wxlite": "https:\/\/static001.geekbang.org\/resource\/image\/b6\/53\/b60efb231d0ccc797b4329cd58b57453.jpg",
71
+ "column_price": 9900,
72
+ "column_price_sale": 9900,
73
+ "author_name": "罗剑锋(Chrono)",
74
+ "column_subtitle": "深入理解HTTP协议本质与应用"
75
+ }],
76
+ [{
77
+ "sub_count": 1196,
78
+ "column_type": 3,
79
+ "id": 181,
80
+ "column_price_market": 12900,
81
+ "column_bgcolor": "#FFFFFF",
82
+ "column_title": "零基础学Java",
83
+ "column_cover_small": "https:\/\/static001.geekbang.org\/resource\/image\/1e\/d5\/1eb010e6535872bf773b222a68ef48d5.jpg",
84
+ "column_cover": "https:\/\/static001.geekbang.org\/resource\/image\/18\/b2\/18540a6c839dcd85527417e0a20ad5b2.jpg",
85
+ "had_sub": false,
86
+ "price_type": 1,
87
+ "column_unit": "141讲",
88
+ "is_experience": false,
89
+ "column_ctime": 1557310171,
90
+ "update_frequency": "141课时,约1500分钟",
91
+ "is_onboard": true,
92
+ "author_intro": "PayPal数据处理组技术负责人",
93
+ "column_sku": 100027801,
94
+ "column_cover_wxlite": "https:\/\/static001.geekbang.org\/resource\/image\/f2\/56\/f24feba110c1c9a2d45799fe19ea9f56.jpg",
95
+ "column_price": 12900,
96
+ "column_price_sale": 12900,
97
+ "author_name": "臧萌",
98
+ "column_subtitle": "通俗易懂的Java入门课"
99
+ }, {
100
+ "sub_count": 5120,
101
+ "column_type": 3,
102
+ "id": 175,
103
+ "column_price_market": 12900,
104
+ "column_bgcolor": "#FFFFFF",
105
+ "column_title": "Web协议详解与抓包实战",
106
+ "column_cover_small": "https:\/\/static001.geekbang.org\/resource\/image\/6f\/46\/6f1e665a01d20dd237cbdd2210563f46.jpg",
107
+ "column_cover": "https:\/\/static001.geekbang.org\/resource\/image\/04\/0a\/0430f8402be85def96111b2d4950290a.jpg",
108
+ "had_sub": false,
109
+ "price_type": 1,
110
+ "column_unit": "83讲",
111
+ "is_experience": false,
112
+ "column_ctime": 1556262573,
113
+ "update_frequency": "83课时,约1000分钟",
114
+ "is_onboard": true,
115
+ "author_intro": "智链达CTO,前阿里云高级技术专家",
116
+ "column_sku": 100026801,
117
+ "column_cover_wxlite": "https:\/\/static001.geekbang.org\/resource\/image\/cf\/6d\/cf98743409df276e2dce76631dd1a56d.jpg",
118
+ "column_price": 12900,
119
+ "column_price_sale": 12900,
120
+ "author_name": "陶辉",
121
+ "column_subtitle": "系统掌握Web协议,高效解决网络难题"
122
+ }, {
123
+ "sub_count": 1390,
124
+ "column_type": 3,
125
+ "id": 169,
126
+ "column_price_market": 12900,
127
+ "column_bgcolor": "#FFFFFF",
128
+ "column_title": "从0开发一款iOS App",
129
+ "column_cover_small": "https:\/\/static001.geekbang.org\/resource\/image\/fd\/c6\/fd828461c4a3cfa0a6a93dd1817001c6.jpg",
130
+ "column_cover": "https:\/\/static001.geekbang.org\/resource\/image\/19\/46\/198d9604ea72cfb812442ab2b5d01b46.jpg",
131
+ "had_sub": false,
132
+ "price_type": 3,
133
+ "column_unit": "61讲",
134
+ "is_experience": false,
135
+ "column_ctime": 1555323160,
136
+ "update_frequency": "61课时,约500分钟",
137
+ "is_onboard": true,
138
+ "author_intro": "腾讯高级工程师",
139
+ "column_sku": 100025901,
140
+ "column_cover_wxlite": "https:\/\/static001.geekbang.org\/resource\/image\/b6\/78\/b67742c736399370628bfc202b646f78.jpg",
141
+ "column_price": 9900,
142
+ "column_price_sale": 12900,
143
+ "author_name": "朱德权",
144
+ "column_subtitle": "手把手带你构建类今日头条的App"
145
+ }],
146
+ [{
147
+ "sub_count": 9580,
148
+ "column_type": 2,
149
+ "id": 75,
150
+ "column_price_market": 900,
151
+ "column_bgcolor": "#ffffff",
152
+ "column_title": "深入浅出gRPC",
153
+ "column_cover_small": "https:\/\/static001.geekbang.org\/resource\/image\/f3\/f6\/f3abb28a927bf207332f7ce41c5e3bf6.png",
154
+ "column_cover": "https:\/\/static001.geekbang.org\/resource\/image\/73\/a0\/73abcab9cd7e8127d15dc11e84339ea0.jpg",
155
+ "had_sub": false,
156
+ "price_type": 1,
157
+ "column_unit": "6讲",
158
+ "is_experience": false,
159
+ "column_ctime": 1520409029,
160
+ "update_frequency": "全集",
161
+ "is_onboard": true,
162
+ "author_intro": "《Netty 权威指南》、《分布式服务框架原理与实践》作者。",
163
+ "column_sku": 100005601,
164
+ "column_cover_wxlite": "https:\/\/static001.geekbang.org\/resource\/image\/fe\/57\/fe319ec636d61d7b30a46bedf6b80657.jpg",
165
+ "column_price": 900,
166
+ "column_price_sale": 900,
167
+ "author_name": "李林锋",
168
+ "column_subtitle": "详解gRPC运作机制与原理"
169
+ }, {
170
+ "sub_count": 5761,
171
+ "column_type": 2,
172
+ "id": 73,
173
+ "column_price_market": 900,
174
+ "column_bgcolor": "#ffffff",
175
+ "column_title": "Service Mesh实践指南",
176
+ "column_cover_small": "https:\/\/static001.geekbang.org\/resource\/image\/62\/c8\/6219bb77d64a1d4f0492e462fbc914c8.png",
177
+ "column_cover": "https:\/\/static001.geekbang.org\/resource\/image\/3d\/75\/3d12373859e03012332614996351ce75.jpg",
178
+ "had_sub": false,
179
+ "price_type": 1,
180
+ "column_unit": "6讲",
181
+ "is_experience": false,
182
+ "column_ctime": 1518082159,
183
+ "update_frequency": "全集",
184
+ "is_onboard": true,
185
+ "author_intro": "微博平台研发技术专家,高性能OpenResty开发框架Vanilla作者。",
186
+ "column_sku": 100005401,
187
+ "column_cover_wxlite": "https:\/\/static001.geekbang.org\/resource\/image\/ea\/54\/eacd1c6a1889c86f7d514f049228af54.jpg",
188
+ "column_price": 900,
189
+ "column_price_sale": 900,
190
+ "author_name": "周晶",
191
+ "column_subtitle": "来自一线大厂的第一手经验总结"
192
+ }, {
193
+ "sub_count": 15259,
194
+ "column_type": 2,
195
+ "id": 61,
196
+ "column_price_market": 100,
197
+ "column_bgcolor": "#eac44b",
198
+ "column_title": "如何做好一场技术演讲",
199
+ "column_cover_small": "https:\/\/static001.geekbang.org\/resource\/image\/cc\/fb\/ccb3acf6fcfab959aee1d800b882f7fb.png",
200
+ "column_cover": "https:\/\/static001.geekbang.org\/resource\/image\/0a\/2d\/0a3ec20c90b059cab58e15e91d02662d.jpg",
201
+ "had_sub": false,
202
+ "price_type": 1,
203
+ "column_unit": "6讲",
204
+ "is_experience": false,
205
+ "column_ctime": 1511953968,
206
+ "update_frequency": "全集",
207
+ "is_onboard": true,
208
+ "author_intro": "极客时间编辑部",
209
+ "column_sku": 100003001,
210
+ "column_cover_wxlite": "https:\/\/static001.geekbang.org\/resource\/image\/d3\/a4\/d33c2ee1b89006207992bcc7d26ff8a4.jpg",
211
+ "column_price": 100,
212
+ "column_price_sale": 100,
213
+ "author_name": "极客时间",
214
+ "column_subtitle": "程序员都应该学学怎么表达"
215
+ }]
216
+ ],
217
+ "nav": [{
218
+ "id": 1,
219
+ "name": "专栏",
220
+ "color": "#5ba6ff",
221
+ "icon": "https:\/\/static001.geekbang.org\/resource\/image\/dd\/9e\/dd8cbc79f017d1b01f643c7ea929d79e.png"
222
+ }, {
223
+ "id": 3,
224
+ "name": "视频课程",
225
+ "color": "#79c109",
226
+ "icon": "https:\/\/static001.geekbang.org\/resource\/image\/4a\/c3\/4aebe8fb752fa21a0fd989a45d9847c3.png"
227
+ }, {
228
+ "id": 2,
229
+ "name": "微课",
230
+ "color": "#5ba6ff",
231
+ "icon": "https:\/\/static001.geekbang.org\/resource\/image\/9c\/f1\/9c223ccae33c5245a3009857582f1df1.png"
232
+ }]
233
+ },
234
+ "code": 0
235
+ }
@@ -0,0 +1,34 @@
1
+
2
+ if (typeof window === 'undefined') {
3
+ global.window = {};
4
+ }
5
+
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const express = require('express');
9
+ const { renderToString } = require('react-dom/server');
10
+ const SSR = require('../dist/search-server');
11
+ const template = fs.readFileSync(path.join(__dirname, '../dist/search.html'), 'utf-8');
12
+ const data = require('./data.json');
13
+
14
+ const server = (port) => {
15
+ const app = express();
16
+
17
+ app.use(express.static('dist'));
18
+ app.get('/search', (req, res) => {
19
+ const html = renderMarkup(renderToString(SSR));
20
+ res.status(200).send(html);
21
+ });
22
+
23
+ app.listen(port, () => {
24
+ console.log('Server is running on port:' + port);
25
+ });
26
+ };
27
+
28
+ server(process.env.PORT || 3000);
29
+
30
+ const renderMarkup = (str) => {
31
+ const dataStr = JSON.stringify(data);
32
+ return template.replace('<!--HTML_PLACEHOLDER-->', str)
33
+ .replace('<!--INITIAL_DATA_PLACEHOLDER-->', `<script>window.__initial_data=${dataStr}</script>`);
34
+ }
@@ -0,0 +1,3 @@
1
+ export function helloworld() {
2
+ return 'Hello webpack 111222';
3
+ }
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
+ <title>Document</title>
8
+ </head>
9
+ <body>
10
+
11
+ </body>
12
+ </html>
@@ -0,0 +1,10 @@
1
+ import { helloworld } from './helloworld'
2
+ document.write(helloworld())
3
+
4
+ if (module.hot) {
5
+ module.hot.accept('./helloworld.js', function () {
6
+ //告诉 webpack 接受热替换的模块
7
+ console.log('Accepting the updated printMe module!')
8
+ document.write(helloworld())
9
+ })
10
+ }
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ // import React from 'react';
4
+ // import largeNumber from 'large-number';
5
+ // import logo from './images/logo.png';
6
+ // import './search.less';
7
+ const React = require('react');
8
+ const largeNumber = require('large-number');
9
+ const logo = require('./images/logo.png');
10
+ const s = require('./search.less');
11
+
12
+ class Search extends React.Component {
13
+
14
+ constructor() {
15
+ super(...arguments);
16
+
17
+ this.state = {
18
+ Text: null
19
+ };
20
+ }
21
+
22
+ loadComponent() {
23
+ import('./text.js').then((Text) => {
24
+ this.setState({
25
+ Text: Text.default
26
+ });
27
+ });
28
+ }
29
+
30
+ render() {
31
+ const { Text } = this.state;
32
+ const addResult = largeNumber('999', '1');
33
+ return <div className="search-text">
34
+ {
35
+ Text ? <Text /> : null
36
+ }
37
+ { addResult }
38
+ 搜索文字的内容<img src={ logo } onClick={ this.loadComponent.bind(this) } />
39
+ </div>;
40
+ }
41
+ }
42
+
43
+ module.exports = <Search />;
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ ${ require('raw-loader!./meta.html')}
5
+ <title>Document</title>
6
+ <script>${ require('raw-loader!babel-loader!../../node_modules/lib-flexible/flexible.js')}</script>
7
+ </head>
8
+ <body>
9
+ <div id="root"><!--HTML_PLACEHOLDER--></div>
10
+ <script type="text/javascript" src="https://11.url.cn/now/lib/16.2.0/react.min.js"></script>
11
+ <script type="text/javascript" src="https://11.url.cn/now/lib/16.2.0/react-dom.min.js"></script>
12
+ <!--INITIAL_DATA_PLACEHOLDER-->
13
+ </body>
14
+ </html>
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+ // import logo from './images/logo.png';
3
+
4
+ console.log('search text', 123)
5
+
6
+ // class Search extends React.Component {
7
+
8
+ // constructor() {
9
+ // super(...arguments);
10
+
11
+ // this.state = {
12
+ // Text: null
13
+ // };
14
+ // }
15
+
16
+ // loadComponent() {
17
+ // import('./text.js').then((Text) => {
18
+ // this.setState({
19
+ // Text: Text.default
20
+ // });
21
+ // });
22
+ // }
23
+
24
+ // render() {
25
+ // const { Text } = this.state;
26
+ // const addResult = largeNumber('999', '1');
27
+ // return <div className="search-text">
28
+ // {
29
+ // Text ? <Text /> : null
30
+ // }
31
+ // { addResult }
32
+ // 搜索文字的内容<img src={ logo } onClick={ this.loadComponent.bind(this) } />
33
+ // </div>;
34
+ // }
35
+ // }
36
+
37
+ // ReactDOM.render(
38
+ // <Search />,
39
+ // document.getElementById('root')
40
+ // );
@@ -0,0 +1,10 @@
1
+ <meta charset="UTF-8">
2
+ <meta name="viewport" content="viewport-fit=cover,width=device-width,initial-scale=1,user-scalable=no">
3
+ <meta name="format-detection" content="telephone=no">
4
+ <meta name="keywords" content="now,now直播,直播,腾讯直播,QQ直播,美女直播,附近直播,才艺直播,小视频,个人直播,美女视频,在线直播,手机直播">
5
+ <meta name="name" itemprop="name" content="NOW直播—腾讯旗下全民视频社交直播平台"><meta name="description" itemprop="description" content="NOW直播,腾讯旗下全民高清视频直播平台,汇集中外大咖,最in网红,草根偶像,明星艺人,校花,小鲜肉,逗逼段子手,各类美食、音乐、旅游、时尚、健身达人与你24小时不间断互动直播,各种奇葩刺激的直播玩法,让你跃跃欲试,你会发现,原来人人都可以当主播赚钱!">
6
+ <meta name="image" itemprop="image" content="https://pub.idqqimg.com/pc/misc/files/20170831/60b60446e34b40b98fa26afcc62a5f74.jpg"><meta name="baidu-site-verification" content="G4ovcyX25V">
7
+ <meta name="apple-mobile-web-app-capable" content="no">
8
+ <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
9
+ <link rel="dns-prefetch" href="//11.url.cn/">
10
+ <link rel="dns-prefetch" href="//open.mobile.qq.com/">
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+
3
+ export default() => <div>动态 import</div>;
@@ -0,0 +1,8 @@
1
+
2
+ export function a() {
3
+ return 'This is func a';
4
+ }
5
+
6
+ export function b() {
7
+ return 'This is func b';
8
+ }
@@ -0,0 +1,12 @@
1
+
2
+ const assert = require('assert');
3
+
4
+ describe('webpack.base.js test case', () => {
5
+
6
+ const baseConfig = require('../../lib/webpack.base.js')
7
+
8
+ it('entry', () => {
9
+ assert.equal(baseConfig.entry.index, 'D:/HTML CSS JS/webpack/webpack2026/webpack07/test/smoke/template/src/index/index.js');
10
+ assert.equal(baseConfig.entry.search, 'D:/HTML CSS JS/webpack/webpack2026/webpack07/test/smoke/template/src/search/index.js');
11
+ });
12
+ });