Skip to content

Commit 51d5dda

Browse files
committed
feat(pack): add es6 compiler
1 parent 2a0410d commit 51d5dda

File tree

17 files changed

+192
-45
lines changed

17 files changed

+192
-45
lines changed

examples/pack-amd/dist/bundle.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,37 @@
4444
/* 0 */
4545
/***/ function(module, exports, __webpack_require__) {
4646

47-
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(m1, m2) {
48-
document.write("<h1>require following modules1:</h1>")
49-
m1()
50-
m2()
51-
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
47+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
5248

49+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function (m1, m2) {
50+
document.write("<h2>require following modules1:</h2>");
51+
m1();
52+
m2();
53+
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
5354

5455
/***/ },
5556
/* 1 */
5657
/***/ function(module, exports, __webpack_require__) {
5758

58-
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
59-
return function(){
60-
document.write("<h2>module 1</h2>")
61-
}
62-
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
59+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;"use strict";
6360

61+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
62+
return function () {
63+
document.write("<h3>module 1</h3>");
64+
};
65+
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
6466

6567
/***/ },
6668
/* 2 */
6769
/***/ function(module, exports, __webpack_require__) {
6870

69-
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
70-
return function(){
71-
document.write("<h2>module 2</h2>")
72-
}
73-
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
71+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;"use strict";
7472

73+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
74+
return function () {
75+
document.write("<h3>module 2</h3>");
76+
};
77+
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
7578

7679
/***/ }
7780
/******/ ]);

examples/pack-amd/src/entry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
define(['./module1.js', './module2.js'], function(m1, m2) {
2-
document.write("<h1>require following modules1:</h1>")
2+
document.write("<h2>require following modules1:</h2>")
33
m1()
44
m2()
55
})

examples/pack-amd/src/module1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
define('module1', [], function() {
22
return function(){
3-
document.write("<h2>module 1</h2>")
3+
document.write("<h3>module 1</h3>")
44
}
55
})

examples/pack-amd/src/module2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
define('module2', [], function() {
22
return function(){
3-
document.write("<h2>module 2</h2>")
3+
document.write("<h3>module 2</h3>")
44
}
55
})

examples/pack-commonjs/dist/bundle.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,34 @@
4444
/* 0 */
4545
/***/ function(module, exports, __webpack_require__) {
4646

47-
var m1Log = __webpack_require__(1)
48-
var m2Log = __webpack_require__(2)
47+
'use strict';
4948

50-
document.write("<h1>require following modules:</h1>")
51-
m1Log()
52-
m2Log()
49+
var m1Log = __webpack_require__(1);
50+
var m2Log = __webpack_require__(2);
5351

52+
document.write("<h2>require following modules:</h2>");
53+
m1Log();
54+
m2Log();
5455

5556
/***/ },
5657
/* 1 */
5758
/***/ function(module, exports) {
5859

59-
module.exports = function () {
60-
document.write("<h2>module 1</h2>")
61-
}
60+
"use strict";
6261

62+
module.exports = function () {
63+
document.write("<h3>module 1</h3>");
64+
};
6365

6466
/***/ },
6567
/* 2 */
6668
/***/ function(module, exports) {
6769

68-
module.exports = function () {
69-
document.write("<h2>module 2</h2>")
70-
}
70+
"use strict";
7171

72+
module.exports = function () {
73+
document.write("<h3>module 2</h3>");
74+
};
7275

7376
/***/ }
7477
/******/ ]);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var m1Log = require('./module1')
22
var m2Log = require('./module2')
33

4-
document.write("<h1>require following modules:</h1>")
4+
document.write("<h2>require following modules:</h2>")
55
m1Log()
66
m2Log()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = function () {
2-
document.write("<h2>module 1</h2>")
2+
document.write("<h3>module 1</h3>")
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = function () {
2-
document.write("<h2>module 2</h2>")
2+
document.write("<h3>module 2</h3>")
33
}

examples/pack-es6/dist/bundle.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // The module cache
3+
/******/ var installedModules = {};
4+
5+
/******/ // The require function
6+
/******/ function __webpack_require__(moduleId) {
7+
8+
/******/ // Check if module is in cache
9+
/******/ if(installedModules[moduleId])
10+
/******/ return installedModules[moduleId].exports;
11+
12+
/******/ // Create a new module (and put it into the cache)
13+
/******/ var module = installedModules[moduleId] = {
14+
/******/ exports: {},
15+
/******/ id: moduleId,
16+
/******/ loaded: false
17+
/******/ };
18+
19+
/******/ // Execute the module function
20+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21+
22+
/******/ // Flag the module as loaded
23+
/******/ module.loaded = true;
24+
25+
/******/ // Return the exports of the module
26+
/******/ return module.exports;
27+
/******/ }
28+
29+
30+
/******/ // expose the modules object (__webpack_modules__)
31+
/******/ __webpack_require__.m = modules;
32+
33+
/******/ // expose the module cache
34+
/******/ __webpack_require__.c = installedModules;
35+
36+
/******/ // __webpack_public_path__
37+
/******/ __webpack_require__.p = "";
38+
39+
/******/ // Load entry module and return exports
40+
/******/ return __webpack_require__(0);
41+
/******/ })
42+
/************************************************************************/
43+
/******/ ([
44+
/* 0 */
45+
/***/ function(module, exports, __webpack_require__) {
46+
47+
'use strict';
48+
49+
var _module = __webpack_require__(1);
50+
51+
var _module2 = _interopRequireDefault(_module);
52+
53+
var _module3 = __webpack_require__(2);
54+
55+
var _module4 = _interopRequireDefault(_module3);
56+
57+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
58+
59+
document.write("<h2>require following modules:</h2>");
60+
(0, _module2.default)();
61+
(0, _module4.default)();
62+
63+
/***/ },
64+
/* 1 */
65+
/***/ function(module, exports) {
66+
67+
"use strict";
68+
69+
module.exports = function () {
70+
document.write("<h3>module 1</h3>");
71+
};
72+
73+
/***/ },
74+
/* 2 */
75+
/***/ function(module, exports) {
76+
77+
"use strict";
78+
79+
module.exports = function () {
80+
document.write("<h3>module 2</h3>");
81+
};
82+
83+
/***/ }
84+
/******/ ]);

examples/pack-es6/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html>
2+
3+
<head>
4+
<meta charset="utf-8">
5+
<title>YKit Pack-ES6 Test</title>
6+
</head>
7+
8+
<body>
9+
<h1 id="ykit">YKit Pack-ES6 Test</h1>
10+
<script src="./dist/bundle.js"></script>
11+
</body>
12+
13+
</html>

0 commit comments

Comments
 (0)