Remove unused polyfills and adjust support for Intl.getCanonicalLocales (#23264)
parent
e9b2a83411
commit
145a536156
|
@ -5,7 +5,7 @@ import paths from "../paths.cjs";
|
||||||
const POLYFILL_DIR = join(paths.polymer_dir, "src/resources/polyfills");
|
const POLYFILL_DIR = join(paths.polymer_dir, "src/resources/polyfills");
|
||||||
|
|
||||||
// List of polyfill keys with supported browser targets for the functionality
|
// List of polyfill keys with supported browser targets for the functionality
|
||||||
const PolyfillSupport = {
|
const polyfillSupport = {
|
||||||
// Note states and shadowRoot properties should be supported.
|
// Note states and shadowRoot properties should be supported.
|
||||||
"element-internals": {
|
"element-internals": {
|
||||||
android: 90,
|
android: 90,
|
||||||
|
@ -18,17 +18,6 @@ const PolyfillSupport = {
|
||||||
safari: 17.4,
|
safari: 17.4,
|
||||||
samsung: 15.0,
|
samsung: 15.0,
|
||||||
},
|
},
|
||||||
"element-append": {
|
|
||||||
android: 54,
|
|
||||||
chrome: 54,
|
|
||||||
edge: 17,
|
|
||||||
firefox: 49,
|
|
||||||
ios: 10.0,
|
|
||||||
opera: 41,
|
|
||||||
opera_mobile: 41,
|
|
||||||
safari: 10.0,
|
|
||||||
samsung: 6.0,
|
|
||||||
},
|
|
||||||
"element-getattributenames": {
|
"element-getattributenames": {
|
||||||
android: 61,
|
android: 61,
|
||||||
chrome: 61,
|
chrome: 61,
|
||||||
|
@ -51,27 +40,18 @@ const PolyfillSupport = {
|
||||||
safari: 12.0,
|
safari: 12.0,
|
||||||
samsung: 10.0,
|
samsung: 10.0,
|
||||||
},
|
},
|
||||||
fetch: {
|
// FormatJS polyfill detects fix for https://bugs.chromium.org/p/v8/issues/detail?id=10682,
|
||||||
android: 42,
|
// so adjusted to several months after that was marked fixed
|
||||||
chrome: 42,
|
|
||||||
edge: 14,
|
|
||||||
firefox: 39,
|
|
||||||
ios: 10.3,
|
|
||||||
opera: 29,
|
|
||||||
opera_mobile: 29,
|
|
||||||
safari: 10.1,
|
|
||||||
samsung: 4.0,
|
|
||||||
},
|
|
||||||
"intl-getcanonicallocales": {
|
"intl-getcanonicallocales": {
|
||||||
android: 54,
|
android: 90,
|
||||||
chrome: 54,
|
chrome: 90,
|
||||||
edge: 16,
|
edge: 90,
|
||||||
firefox: 48,
|
firefox: 48,
|
||||||
ios: 10.3,
|
ios: 10.3,
|
||||||
opera: 41,
|
opera: 76,
|
||||||
opera_mobile: 41,
|
opera_mobile: 64,
|
||||||
safari: 10.1,
|
safari: 10.1,
|
||||||
samsung: 6.0,
|
samsung: 15.0,
|
||||||
},
|
},
|
||||||
"intl-locale": {
|
"intl-locale": {
|
||||||
android: 74,
|
android: 74,
|
||||||
|
@ -87,17 +67,6 @@ const PolyfillSupport = {
|
||||||
"intl-other": {
|
"intl-other": {
|
||||||
// Not specified (i.e. always try polyfill) since compatibility depends on supported locales
|
// Not specified (i.e. always try polyfill) since compatibility depends on supported locales
|
||||||
},
|
},
|
||||||
proxy: {
|
|
||||||
android: 49,
|
|
||||||
chrome: 49,
|
|
||||||
edge: 12,
|
|
||||||
firefox: 18,
|
|
||||||
ios: 10.0,
|
|
||||||
opera: 36,
|
|
||||||
opera_mobile: 36,
|
|
||||||
safari: 10.0,
|
|
||||||
samsung: 5.0,
|
|
||||||
},
|
|
||||||
"resize-observer": {
|
"resize-observer": {
|
||||||
android: 64,
|
android: 64,
|
||||||
chrome: 64,
|
chrome: 64,
|
||||||
|
@ -115,8 +84,6 @@ const PolyfillSupport = {
|
||||||
// corresponding polyfill key and actual module to import
|
// corresponding polyfill key and actual module to import
|
||||||
const polyfillMap = {
|
const polyfillMap = {
|
||||||
global: {
|
global: {
|
||||||
fetch: { key: "fetch", module: "unfetch/polyfill" },
|
|
||||||
Proxy: { key: "proxy", module: "proxy-polyfill" },
|
|
||||||
ResizeObserver: {
|
ResizeObserver: {
|
||||||
key: "resize-observer",
|
key: "resize-observer",
|
||||||
module: join(POLYFILL_DIR, "resize-observer.ts"),
|
module: join(POLYFILL_DIR, "resize-observer.ts"),
|
||||||
|
@ -128,7 +95,7 @@ const polyfillMap = {
|
||||||
module: "element-internals-polyfill",
|
module: "element-internals-polyfill",
|
||||||
},
|
},
|
||||||
...Object.fromEntries(
|
...Object.fromEntries(
|
||||||
["append", "getAttributeNames", "toggleAttribute"].map((prop) => {
|
["getAttributeNames", "toggleAttribute"].map((prop) => {
|
||||||
const key = `element-${prop.toLowerCase()}`;
|
const key = `element-${prop.toLowerCase()}`;
|
||||||
return [prop, { key, module: join(POLYFILL_DIR, `${key}.ts`) }];
|
return [prop, { key, module: join(POLYFILL_DIR, `${key}.ts`) }];
|
||||||
})
|
})
|
||||||
|
@ -168,7 +135,7 @@ export default defineProvider(
|
||||||
const resolvePolyfill = createMetaResolver(polyfillMap);
|
const resolvePolyfill = createMetaResolver(polyfillMap);
|
||||||
return {
|
return {
|
||||||
name: "custom-polyfill",
|
name: "custom-polyfill",
|
||||||
polyfills: PolyfillSupport,
|
polyfills: polyfillSupport,
|
||||||
usageGlobal(meta, utils) {
|
usageGlobal(meta, utils) {
|
||||||
const polyfill = resolvePolyfill(meta);
|
const polyfill = resolvePolyfill(meta);
|
||||||
if (polyfill && shouldInjectPolyfill(polyfill.desc.key)) {
|
if (polyfill && shouldInjectPolyfill(polyfill.desc.key)) {
|
||||||
|
|
|
@ -128,7 +128,6 @@
|
||||||
"marked": "15.0.3",
|
"marked": "15.0.3",
|
||||||
"memoize-one": "6.0.0",
|
"memoize-one": "6.0.0",
|
||||||
"node-vibrant": "3.2.1-alpha.1",
|
"node-vibrant": "3.2.1-alpha.1",
|
||||||
"proxy-polyfill": "0.3.2",
|
|
||||||
"punycode": "2.3.1",
|
"punycode": "2.3.1",
|
||||||
"qr-scanner": "1.4.2",
|
"qr-scanner": "1.4.2",
|
||||||
"qrcode": "1.5.4",
|
"qrcode": "1.5.4",
|
||||||
|
@ -141,7 +140,6 @@
|
||||||
"tsparticles-engine": "2.12.0",
|
"tsparticles-engine": "2.12.0",
|
||||||
"tsparticles-preset-links": "2.12.0",
|
"tsparticles-preset-links": "2.12.0",
|
||||||
"ua-parser-js": "1.0.39",
|
"ua-parser-js": "1.0.39",
|
||||||
"unfetch": "5.0.0",
|
|
||||||
"vis-data": "7.1.9",
|
"vis-data": "7.1.9",
|
||||||
"vis-network": "9.1.9",
|
"vis-network": "9.1.9",
|
||||||
"vue": "2.7.16",
|
"vue": "2.7.16",
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/append()/append().md
|
|
||||||
(function (arr) {
|
|
||||||
arr.forEach((item) => {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(item, "append")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Object.defineProperty(item, "append", {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: true,
|
|
||||||
writable: true,
|
|
||||||
value: function append(...argArr) {
|
|
||||||
const docFrag = document.createDocumentFragment();
|
|
||||||
|
|
||||||
argArr.forEach((argItem) => {
|
|
||||||
const isNode = argItem instanceof Node;
|
|
||||||
docFrag.appendChild(
|
|
||||||
isNode ? argItem : document.createTextNode(String(argItem))
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.appendChild(docFrag);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})([Element.prototype, Document.prototype, DocumentFragment.prototype]);
|
|
16
yarn.lock
16
yarn.lock
|
@ -9315,7 +9315,6 @@ __metadata:
|
||||||
open: "npm:10.1.0"
|
open: "npm:10.1.0"
|
||||||
pinst: "npm:3.0.0"
|
pinst: "npm:3.0.0"
|
||||||
prettier: "npm:3.4.2"
|
prettier: "npm:3.4.2"
|
||||||
proxy-polyfill: "npm:0.3.2"
|
|
||||||
punycode: "npm:2.3.1"
|
punycode: "npm:2.3.1"
|
||||||
qr-scanner: "npm:1.4.2"
|
qr-scanner: "npm:1.4.2"
|
||||||
qrcode: "npm:1.5.4"
|
qrcode: "npm:1.5.4"
|
||||||
|
@ -9336,7 +9335,6 @@ __metadata:
|
||||||
tsparticles-preset-links: "npm:2.12.0"
|
tsparticles-preset-links: "npm:2.12.0"
|
||||||
typescript: "npm:5.7.2"
|
typescript: "npm:5.7.2"
|
||||||
ua-parser-js: "npm:1.0.39"
|
ua-parser-js: "npm:1.0.39"
|
||||||
unfetch: "npm:5.0.0"
|
|
||||||
vis-data: "npm:7.1.9"
|
vis-data: "npm:7.1.9"
|
||||||
vis-network: "npm:9.1.9"
|
vis-network: "npm:9.1.9"
|
||||||
vitest: "npm:2.1.8"
|
vitest: "npm:2.1.8"
|
||||||
|
@ -12319,13 +12317,6 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"proxy-polyfill@npm:0.3.2":
|
|
||||||
version: 0.3.2
|
|
||||||
resolution: "proxy-polyfill@npm:0.3.2"
|
|
||||||
checksum: 10/0e43c8ba9cc14d3ce12d029f5647b8c03120fb0b912a176bcb8fb2c560f8fb94e49f89707b6e2df0443e3514d0bb63cc1960d671b39904b479bb09e4ae7e09a4
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"punycode@npm:2.3.1, punycode@npm:^2.1.0, punycode@npm:^2.3.1":
|
"punycode@npm:2.3.1, punycode@npm:^2.1.0, punycode@npm:^2.3.1":
|
||||||
version: 2.3.1
|
version: 2.3.1
|
||||||
resolution: "punycode@npm:2.3.1"
|
resolution: "punycode@npm:2.3.1"
|
||||||
|
@ -14532,13 +14523,6 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"unfetch@npm:5.0.0":
|
|
||||||
version: 5.0.0
|
|
||||||
resolution: "unfetch@npm:5.0.0"
|
|
||||||
checksum: 10/8a59f9d910f179ef588aa30885849de7b4c895a85b3679ab4da7305be3751b85a4811d9164d87960fef1a388b9a7afdc23ab2154f517db040b27171578fa9e8b
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"unicode-canonical-property-names-ecmascript@npm:^2.0.0":
|
"unicode-canonical-property-names-ecmascript@npm:^2.0.0":
|
||||||
version: 2.0.1
|
version: 2.0.1
|
||||||
resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.1"
|
resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.1"
|
||||||
|
|
Loading…
Reference in New Issue