@modern-js/plugin-polyfill 2.4.1-beta.0 → 2.6.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.
- package/CHANGELOG.md +19 -2
- package/dist/{js/node → cjs}/cli.js +1 -1
- package/dist/{js/node → cjs}/index.js +7 -23
- package/dist/{js/node → cjs}/libs/cache.js +4 -0
- package/dist/{js/modern → esm-node}/cli.js +1 -1
- package/dist/{js/modern → esm-node}/index.js +3 -23
- package/package.json +19 -20
- /package/dist/{js/node → cjs}/const.js +0 -0
- /package/dist/{js/node → cjs}/type.js +0 -0
- /package/dist/{js/treeshaking → esm}/cli.js +0 -0
- /package/dist/{js/treeshaking → esm}/const.js +0 -0
- /package/dist/{js/treeshaking → esm}/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/libs/cache.js +0 -0
- /package/dist/{js/treeshaking → esm}/type.js +0 -0
- /package/dist/{js/modern → esm-node}/const.js +0 -0
- /package/dist/{js/modern → esm-node}/libs/cache.js +0 -0
- /package/dist/{js/modern → esm-node}/type.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
# @modern-js/plugin-polyfill
|
|
2
2
|
|
|
3
|
-
## 2.
|
|
3
|
+
## 2.6.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- Updated dependencies [e1f799e]
|
|
8
|
+
- Updated dependencies [7915ab3]
|
|
9
|
+
- Updated dependencies [0fe658a]
|
|
10
|
+
- @modern-js/utils@2.6.0
|
|
11
|
+
|
|
12
|
+
## 2.5.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 89ca6cc: refactor: merge build-config into scripts/build
|
|
17
|
+
|
|
18
|
+
refactor: 把 build-config 合并进 scripts/build
|
|
19
|
+
|
|
20
|
+
- 30614fa: chore: modify package.json entry fields and build config
|
|
21
|
+
chore: 更改 package.json entry 字段以及构建配置
|
|
22
|
+
- Updated dependencies [30614fa]
|
|
23
|
+
- Updated dependencies [1b0ce87]
|
|
7
24
|
- Updated dependencies [11c053b]
|
|
8
|
-
- @modern-js/utils@2.
|
|
25
|
+
- @modern-js/utils@2.5.0
|
|
9
26
|
|
|
10
27
|
## 2.4.0
|
|
11
28
|
|
|
@@ -28,7 +28,7 @@ var cli_default = () => ({
|
|
|
28
28
|
const resolvedConfig = api.useResolvedConfigContext();
|
|
29
29
|
if (resolvedConfig.output.polyfill === "ua") {
|
|
30
30
|
partials.top.push(
|
|
31
|
-
`<script src="${import_const.defaultPolyfill}" crossorigin
|
|
31
|
+
`<script src="${import_const.defaultPolyfill}" crossorigin></script>`
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
return { partials, entrypoint };
|
|
@@ -17,30 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
23
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
28
|
var src_exports = {};
|
|
45
29
|
__export(src_exports, {
|
|
46
30
|
default: () => src_default
|
|
@@ -64,7 +48,7 @@ var src_default = () => ({
|
|
|
64
48
|
const flagStr = flags.join(",");
|
|
65
49
|
return `${name}-${flagStr}`;
|
|
66
50
|
}).join(",");
|
|
67
|
-
return (context, next) =>
|
|
51
|
+
return async (context, next) => {
|
|
68
52
|
if (context.url !== route) {
|
|
69
53
|
return next();
|
|
70
54
|
}
|
|
@@ -84,7 +68,7 @@ var src_default = () => ({
|
|
|
84
68
|
);
|
|
85
69
|
return context.res.end(matched);
|
|
86
70
|
}
|
|
87
|
-
const polyfill =
|
|
71
|
+
const polyfill = await (0, import_polyfill_lib.getPolyfillString)({
|
|
88
72
|
uaString: context.headers["user-agent"],
|
|
89
73
|
minify,
|
|
90
74
|
features
|
|
@@ -92,7 +76,7 @@ var src_default = () => ({
|
|
|
92
76
|
cache.set(cacheKey, polyfill);
|
|
93
77
|
context.res.setHeader("content-type", import_utils.mime.contentType("js"));
|
|
94
78
|
return context.res.end(polyfill);
|
|
95
|
-
}
|
|
79
|
+
};
|
|
96
80
|
}
|
|
97
81
|
})
|
|
98
82
|
});
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -6,7 +6,7 @@ var cli_default = () => ({
|
|
|
6
6
|
const resolvedConfig = api.useResolvedConfigContext();
|
|
7
7
|
if (resolvedConfig.output.polyfill === "ua") {
|
|
8
8
|
partials.top.push(
|
|
9
|
-
`<script src="${defaultPolyfill}" crossorigin
|
|
9
|
+
`<script src="${defaultPolyfill}" crossorigin></script>`
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
return { partials, entrypoint };
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
1
|
import { getPolyfillString } from "@modern-js/polyfill-lib";
|
|
22
2
|
import { mime } from "@modern-js/utils";
|
|
23
3
|
import Parser from "ua-parser-js";
|
|
@@ -36,7 +16,7 @@ var src_default = () => ({
|
|
|
36
16
|
const flagStr = flags.join(",");
|
|
37
17
|
return `${name}-${flagStr}`;
|
|
38
18
|
}).join(",");
|
|
39
|
-
return (context, next) =>
|
|
19
|
+
return async (context, next) => {
|
|
40
20
|
if (context.url !== route) {
|
|
41
21
|
return next();
|
|
42
22
|
}
|
|
@@ -56,7 +36,7 @@ var src_default = () => ({
|
|
|
56
36
|
);
|
|
57
37
|
return context.res.end(matched);
|
|
58
38
|
}
|
|
59
|
-
const polyfill =
|
|
39
|
+
const polyfill = await getPolyfillString({
|
|
60
40
|
uaString: context.headers["user-agent"],
|
|
61
41
|
minify,
|
|
62
42
|
features
|
|
@@ -64,7 +44,7 @@ var src_default = () => ({
|
|
|
64
44
|
cache.set(cacheKey, polyfill);
|
|
65
45
|
context.res.setHeader("content-type", mime.contentType("js"));
|
|
66
46
|
return context.res.end(polyfill);
|
|
67
|
-
}
|
|
47
|
+
};
|
|
68
48
|
}
|
|
69
49
|
})
|
|
70
50
|
});
|
package/package.json
CHANGED
|
@@ -11,36 +11,35 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.6.0",
|
|
15
15
|
"jsnext:source": "./src/cli.ts",
|
|
16
16
|
"types": "./dist/types/cli.d.ts",
|
|
17
|
-
"main": "./dist/
|
|
18
|
-
"module": "./dist/
|
|
19
|
-
"jsnext:modern": "./dist/js/modern/cli.js",
|
|
17
|
+
"main": "./dist/cjs/cli.js",
|
|
18
|
+
"module": "./dist/esm/cli.js",
|
|
20
19
|
"exports": {
|
|
21
20
|
".": {
|
|
22
21
|
"jsnext:source": "./src/cli.ts",
|
|
23
22
|
"node": {
|
|
24
|
-
"import": "./dist/
|
|
25
|
-
"require": "./dist/
|
|
23
|
+
"import": "./dist/cjs/cli.js",
|
|
24
|
+
"require": "./dist/cjs/cli.js"
|
|
26
25
|
},
|
|
27
|
-
"default": "./dist/
|
|
26
|
+
"default": "./dist/cjs/cli.js"
|
|
28
27
|
},
|
|
29
28
|
"./cli": {
|
|
30
29
|
"jsnext:source": "./src/cli.ts",
|
|
31
30
|
"node": {
|
|
32
|
-
"import": "./dist/
|
|
33
|
-
"require": "./dist/
|
|
31
|
+
"import": "./dist/cjs/cli.js",
|
|
32
|
+
"require": "./dist/cjs/cli.js"
|
|
34
33
|
},
|
|
35
|
-
"default": "./dist/
|
|
34
|
+
"default": "./dist/cjs/cli.js"
|
|
36
35
|
},
|
|
37
36
|
"./server": {
|
|
38
37
|
"node": {
|
|
39
38
|
"jsnext:source": "./src/index.ts",
|
|
40
|
-
"import": "./dist/
|
|
41
|
-
"require": "./dist/
|
|
39
|
+
"import": "./dist/esm-node/index.js",
|
|
40
|
+
"require": "./dist/cjs/index.js"
|
|
42
41
|
},
|
|
43
|
-
"default": "./dist/
|
|
42
|
+
"default": "./dist/esm/index.js"
|
|
44
43
|
}
|
|
45
44
|
},
|
|
46
45
|
"dependencies": {
|
|
@@ -48,7 +47,7 @@
|
|
|
48
47
|
"@modern-js/polyfill-lib": "^1.0.0",
|
|
49
48
|
"lru-cache": "^6.0.0",
|
|
50
49
|
"ua-parser-js": "^0.7.28",
|
|
51
|
-
"@modern-js/utils": "2.
|
|
50
|
+
"@modern-js/utils": "2.6.0"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
53
|
"@types/jest": "^27",
|
|
@@ -57,12 +56,12 @@
|
|
|
57
56
|
"@types/ua-parser-js": "^0.7.36",
|
|
58
57
|
"typescript": "^4",
|
|
59
58
|
"jest": "^27",
|
|
60
|
-
"@modern-js/server-core": "2.
|
|
61
|
-
"@modern-js/app-tools": "
|
|
62
|
-
"@modern-js/types": "2.
|
|
63
|
-
"@modern-js/core": "2.
|
|
64
|
-
"@scripts/build": "2.
|
|
65
|
-
"@scripts/jest-config": "2.
|
|
59
|
+
"@modern-js/server-core": "2.6.0",
|
|
60
|
+
"@modern-js/app-tools": "2.6.0",
|
|
61
|
+
"@modern-js/types": "2.6.0",
|
|
62
|
+
"@modern-js/core": "2.6.0",
|
|
63
|
+
"@scripts/build": "2.6.0",
|
|
64
|
+
"@scripts/jest-config": "2.6.0"
|
|
66
65
|
},
|
|
67
66
|
"sideEffects": false,
|
|
68
67
|
"publishConfig": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|