@umijs/bundler-vite 4.7.6 → 4.7.8

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,65 @@
1
+ "use strict";
2
+ exports.id = 313;
3
+ exports.ids = [313];
4
+ exports.modules = {
5
+
6
+ /***/ 1313:
7
+ /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
8
+
9
+ __webpack_require__.r(__webpack_exports__);
10
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
+ /* harmony export */ "default": function() { return /* binding */ index; }
12
+ /* harmony export */ });
13
+ /* harmony import */ var _babel_helper_define_polyfill_provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8967);
14
+
15
+
16
+ const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
17
+ var index = (0,_babel_helper_define_polyfill_provider__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(({
18
+ debug,
19
+ targets,
20
+ babel
21
+ }, options) => {
22
+ if (!shallowEqual(targets, babel.targets())) {
23
+ throw new Error("This plugin does not use the targets option. Only preset-env's targets" + " or top-level targets need to be configured for this plugin to work." + " See https://github.com/babel/babel-polyfills/issues/36 for more" + " details.");
24
+ }
25
+ const {
26
+ [runtimeCompat]: {
27
+ moduleName = null,
28
+ useBabelRuntime = false
29
+ } = {}
30
+ } = options;
31
+ return {
32
+ name: "regenerator",
33
+ polyfills: ["regenerator-runtime"],
34
+ usageGlobal(meta, utils) {
35
+ if (isRegenerator(meta)) {
36
+ debug("regenerator-runtime");
37
+ utils.injectGlobalImport("regenerator-runtime/runtime.js");
38
+ }
39
+ },
40
+ usagePure(meta, utils, path) {
41
+ if (isRegenerator(meta)) {
42
+ let pureName = "regenerator-runtime";
43
+ if (useBabelRuntime) {
44
+ var _ref;
45
+ const runtimeName = (_ref = moduleName != null ? moduleName : path.hub.file.get("runtimeHelpersModuleName")) != null ? _ref : "@babel/runtime";
46
+ pureName = `${runtimeName}/regenerator`;
47
+ }
48
+ path.replaceWith(utils.injectDefaultImport(pureName, "regenerator-runtime"));
49
+ }
50
+ }
51
+ };
52
+ });
53
+ const isRegenerator = meta => meta.kind === "global" && meta.name === "regeneratorRuntime";
54
+ function shallowEqual(obj1, obj2) {
55
+ return JSON.stringify(obj1) === JSON.stringify(obj2);
56
+ }
57
+
58
+
59
+ //# sourceMappingURL=index.mjs.map
60
+
61
+
62
+ /***/ })
63
+
64
+ };
65
+ ;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ exports.id = 319;
3
+ exports.ids = [319];
4
+ exports.modules = {
5
+
6
+ /***/ 700:
7
+ /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
8
+
9
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
+ /* harmony export */ "default": function() { return /* binding */ browserslistToEsbuild; }
11
+ /* harmony export */ });
12
+ /* harmony import */ var browserslist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2639);
13
+
14
+
15
+ // convert the browserslist field in package.json to
16
+ // esbuild compatible array of browsers
17
+ function browserslistToEsbuild(browserslistConfig, options = {}) {
18
+ if (!browserslistConfig) {
19
+ // the path from where the script is run
20
+ const path = process.cwd()
21
+
22
+ // read config if none is passed
23
+ browserslistConfig = browserslist__WEBPACK_IMPORTED_MODULE_0__.loadConfig({ path, ...options })
24
+ }
25
+
26
+ const SUPPORTED_ESBUILD_TARGETS = [
27
+ 'es',
28
+ 'chrome',
29
+ 'edge',
30
+ 'firefox',
31
+ 'ios',
32
+ 'node',
33
+ 'safari',
34
+ 'opera',
35
+ 'ie',
36
+ ]
37
+
38
+ // https://github.com/eBay/browserslist-config/issues/16#issuecomment-863870093
39
+ const UNSUPPORTED = ['android 4']
40
+
41
+ const replaces = {
42
+ ios_saf: 'ios',
43
+ android: 'chrome',
44
+ }
45
+
46
+ const separator = ' '
47
+
48
+ return (
49
+ browserslist__WEBPACK_IMPORTED_MODULE_0__(browserslistConfig, options)
50
+ // filter out the unsupported ones
51
+ .filter((b) => !UNSUPPORTED.some((u) => b.startsWith(u)))
52
+ // replaces safari TP with latest safari version
53
+ .map((b) => {
54
+ if (b === 'safari TP') {
55
+ return browserslist__WEBPACK_IMPORTED_MODULE_0__('last 1 safari version')[0]
56
+ }
57
+
58
+ return b
59
+ })
60
+ // transform into ['chrome', '88']
61
+ .map((b) => b.split(separator))
62
+ // replace the similar browser
63
+ .map((b) => {
64
+ if (replaces[b[0]]) {
65
+ b[0] = replaces[b[0]]
66
+ }
67
+
68
+ return b
69
+ })
70
+ // 11.0-12.0 --> 11.0
71
+ .map((b) => {
72
+ if (b[1].includes('-')) {
73
+ b[1] = b[1].slice(0, b[1].indexOf('-'))
74
+ }
75
+
76
+ return b
77
+ })
78
+ // 11.0 --> 11
79
+ .map((b) => {
80
+ if (b[1].endsWith('.0')) {
81
+ b[1] = b[1].slice(0, -2)
82
+ }
83
+
84
+ return b
85
+ })
86
+ // removes invalid versions that will break esbuild
87
+ // https://github.com/evanw/esbuild/blob/35c0d65b9d4f29a26176404d2890d1b499634e9f/compat-table/src/caniuse.ts#L119-L122
88
+ .filter((b) => /^\d+(\.\d+)*$/.test(b[1]))
89
+ // only get the targets supported by esbuild
90
+ .filter((b) => SUPPORTED_ESBUILD_TARGETS.includes(b[0]))
91
+ // only get the oldest version, assuming that the older version
92
+ // is last in the array
93
+ .reduce((acc, b) => {
94
+ const existingIndex = acc.findIndex((br) => br[0] === b[0])
95
+
96
+ if (existingIndex !== -1) {
97
+ acc[existingIndex][1] = b[1]
98
+ } else {
99
+ acc.push(b)
100
+ }
101
+ return acc
102
+ }, [])
103
+ // remove separator
104
+ .map((b) => b.join(''))
105
+ )
106
+ }
107
+
108
+
109
+ /***/ })
110
+
111
+ };
112
+ ;