Integrate compatibility into other entrypoints (#6029)
parent
d73b3d77ea
commit
050cdf3783
|
@ -20,7 +20,10 @@ module.exports.emptyPackages = ({ latestBuild }) =>
|
||||||
// Loads stuff from a CDN
|
// Loads stuff from a CDN
|
||||||
require.resolve("@polymer/font-roboto/roboto.js"),
|
require.resolve("@polymer/font-roboto/roboto.js"),
|
||||||
require.resolve("@vaadin/vaadin-material-styles/font-roboto.js"),
|
require.resolve("@vaadin/vaadin-material-styles/font-roboto.js"),
|
||||||
// Polyfill only needed for ES5 workers so filter out in latestBuild
|
// Compatibility not needed for latest builds
|
||||||
|
latestBuild &&
|
||||||
|
path.resolve(paths.polymer_dir, "src/entrypoints/compatibility.ts"),
|
||||||
|
// This polyfill is loaded in workers to support ES5, filter it out.
|
||||||
latestBuild && require.resolve("proxy-polyfill/src/index.js"),
|
latestBuild && require.resolve("proxy-polyfill/src/index.js"),
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
|
|
||||||
|
@ -112,7 +115,6 @@ module.exports.config = {
|
||||||
authorize: "./src/entrypoints/authorize.ts",
|
authorize: "./src/entrypoints/authorize.ts",
|
||||||
onboarding: "./src/entrypoints/onboarding.ts",
|
onboarding: "./src/entrypoints/onboarding.ts",
|
||||||
core: "./src/entrypoints/core.ts",
|
core: "./src/entrypoints/core.ts",
|
||||||
compatibility: "./src/entrypoints/compatibility.ts",
|
|
||||||
"custom-panel": "./src/entrypoints/custom-panel.ts",
|
"custom-panel": "./src/entrypoints/custom-panel.ts",
|
||||||
},
|
},
|
||||||
outputPath: outputPath(paths.app_output_root, latestBuild),
|
outputPath: outputPath(paths.app_output_root, latestBuild),
|
||||||
|
@ -127,10 +129,6 @@ module.exports.config = {
|
||||||
return {
|
return {
|
||||||
entry: {
|
entry: {
|
||||||
main: path.resolve(paths.demo_dir, "src/entrypoint.ts"),
|
main: path.resolve(paths.demo_dir, "src/entrypoint.ts"),
|
||||||
compatibility: path.resolve(
|
|
||||||
paths.polymer_dir,
|
|
||||||
"src/entrypoints/compatibility.ts"
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
outputPath: outputPath(paths.demo_output_root, latestBuild),
|
outputPath: outputPath(paths.demo_output_root, latestBuild),
|
||||||
publicPath: publicPath(latestBuild),
|
publicPath: publicPath(latestBuild),
|
||||||
|
|
|
@ -53,7 +53,6 @@ gulp.task("gen-pages-dev", (done) => {
|
||||||
const content = renderTemplate(page, {
|
const content = renderTemplate(page, {
|
||||||
latestPageJS: `/frontend_latest/${page}.js`,
|
latestPageJS: `/frontend_latest/${page}.js`,
|
||||||
|
|
||||||
es5Compatibility: "/frontend_es5/compatibility.js",
|
|
||||||
es5PageJS: `/frontend_es5/${page}.js`,
|
es5PageJS: `/frontend_es5/${page}.js`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,7 +78,6 @@ gulp.task("gen-pages-prod", (done) => {
|
||||||
const content = renderTemplate(page, {
|
const content = renderTemplate(page, {
|
||||||
latestPageJS: latestManifest[`${page}.js`],
|
latestPageJS: latestManifest[`${page}.js`],
|
||||||
|
|
||||||
es5Compatibility: es5Manifest["compatibility.js"],
|
|
||||||
es5PageJS: es5Manifest[`${page}.js`],
|
es5PageJS: es5Manifest[`${page}.js`],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -99,7 +97,6 @@ gulp.task("gen-index-app-dev", (done) => {
|
||||||
latestCoreJS: "/frontend_latest/core.js",
|
latestCoreJS: "/frontend_latest/core.js",
|
||||||
latestCustomPanelJS: "/frontend_latest/custom-panel.js",
|
latestCustomPanelJS: "/frontend_latest/custom-panel.js",
|
||||||
|
|
||||||
es5Compatibility: "/frontend_es5/compatibility.js",
|
|
||||||
es5AppJS: "/frontend_es5/app.js",
|
es5AppJS: "/frontend_es5/app.js",
|
||||||
es5CoreJS: "/frontend_es5/core.js",
|
es5CoreJS: "/frontend_es5/core.js",
|
||||||
es5CustomPanelJS: "/frontend_es5/custom-panel.js",
|
es5CustomPanelJS: "/frontend_es5/custom-panel.js",
|
||||||
|
@ -123,7 +120,6 @@ gulp.task("gen-index-app-prod", (done) => {
|
||||||
latestCoreJS: latestManifest["core.js"],
|
latestCoreJS: latestManifest["core.js"],
|
||||||
latestCustomPanelJS: latestManifest["custom-panel.js"],
|
latestCustomPanelJS: latestManifest["custom-panel.js"],
|
||||||
|
|
||||||
es5Compatibility: es5Manifest["compatibility.js"],
|
|
||||||
es5AppJS: es5Manifest["app.js"],
|
es5AppJS: es5Manifest["app.js"],
|
||||||
es5CoreJS: es5Manifest["core.js"],
|
es5CoreJS: es5Manifest["core.js"],
|
||||||
es5CustomPanelJS: es5Manifest["custom-panel.js"],
|
es5CustomPanelJS: es5Manifest["custom-panel.js"],
|
||||||
|
@ -210,7 +206,6 @@ gulp.task("gen-index-demo-dev", (done) => {
|
||||||
const content = renderDemoTemplate("index", {
|
const content = renderDemoTemplate("index", {
|
||||||
latestDemoJS: "/frontend_latest/main.js",
|
latestDemoJS: "/frontend_latest/main.js",
|
||||||
|
|
||||||
es5Compatibility: "/frontend_es5/compatibility.js",
|
|
||||||
es5DemoJS: "/frontend_es5/main.js",
|
es5DemoJS: "/frontend_es5/main.js",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -233,7 +228,6 @@ gulp.task("gen-index-demo-prod", (done) => {
|
||||||
const content = renderDemoTemplate("index", {
|
const content = renderDemoTemplate("index", {
|
||||||
latestDemoJS: latestManifest["main.js"],
|
latestDemoJS: latestManifest["main.js"],
|
||||||
|
|
||||||
es5Compatibility: es5Manifest["compatibility.js"],
|
|
||||||
es5DemoJS: es5Manifest["main.js"],
|
es5DemoJS: es5Manifest["main.js"],
|
||||||
});
|
});
|
||||||
const minified = minifyHtml(content);
|
const minified = minifyHtml(content);
|
||||||
|
|
|
@ -14,32 +14,6 @@ module.exports = function (userOptions = {}) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: "ignore",
|
name: "ignore",
|
||||||
resolveId(importee, importer) {
|
|
||||||
// Only use ignore to intercept imports that we don't control
|
|
||||||
// inside node_module dependencies.
|
|
||||||
if (
|
|
||||||
importee.endsWith("commonjsHelpers.js") ||
|
|
||||||
importee.endsWith("rollupPluginBabelHelpers.js") ||
|
|
||||||
importee.endsWith("?commonjs-proxy") ||
|
|
||||||
!importer ||
|
|
||||||
!importer.includes("/node_modules/")
|
|
||||||
) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let fullPath;
|
|
||||||
try {
|
|
||||||
fullPath = importee.startsWith(".")
|
|
||||||
? path.resolve(importee, importer)
|
|
||||||
: require.resolve(importee);
|
|
||||||
} catch (err) {
|
|
||||||
console.error("Error in ignore plugin", { importee, importer }, err);
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return files.some((toIgnorePath) => fullPath.startsWith(toIgnorePath))
|
|
||||||
? fullPath
|
|
||||||
: null;
|
|
||||||
},
|
|
||||||
|
|
||||||
load(id) {
|
load(id) {
|
||||||
return files.some((toIgnorePath) => id.startsWith(toIgnorePath))
|
return files.some((toIgnorePath) => id.startsWith(toIgnorePath))
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import "../../src/resources/compatibility";
|
||||||
import { isNavigationClick } from "../../src/common/dom/is-navigation-click";
|
import { isNavigationClick } from "../../src/common/dom/is-navigation-click";
|
||||||
import { navigate } from "../../src/common/navigate";
|
import { navigate } from "../../src/common/navigate";
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -106,12 +106,9 @@
|
||||||
_ls("/static/polyfills/custom-elements-es5-adapter.js");
|
_ls("/static/polyfills/custom-elements-es5-adapter.js");
|
||||||
<% if (useRollup) { %>
|
<% if (useRollup) { %>
|
||||||
_ls("/static/js/s.min.js").onload = function() {
|
_ls("/static/js/s.min.js").onload = function() {
|
||||||
System.import("<%= es5Compatibility %>").then(function() {
|
|
||||||
System.import("<%= es5DemoJS %>");
|
System.import("<%= es5DemoJS %>");
|
||||||
});
|
|
||||||
};
|
};
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
_ls("<%= es5Compatibility %>");
|
|
||||||
_ls("<%= es5DemoJS %>");
|
_ls("<%= es5DemoJS %>");
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// Compat needs to be first import
|
||||||
|
import "../resources/compatibility";
|
||||||
import "@polymer/polymer/lib/elements/dom-if";
|
import "@polymer/polymer/lib/elements/dom-if";
|
||||||
import "@polymer/polymer/lib/elements/dom-repeat";
|
import "@polymer/polymer/lib/elements/dom-repeat";
|
||||||
import "../auth/ha-authorize";
|
import "../auth/ha-authorize";
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// Compat needs to be first import
|
||||||
|
import "../resources/compatibility";
|
||||||
import {
|
import {
|
||||||
Auth,
|
Auth,
|
||||||
Connection,
|
Connection,
|
||||||
|
|
|
@ -21,7 +21,7 @@ window.loadES5Adapter = () => {
|
||||||
loadJS(
|
loadJS(
|
||||||
`${__STATIC_PATH__}polyfills/custom-elements-es5-adapter.js`
|
`${__STATIC_PATH__}polyfills/custom-elements-es5-adapter.js`
|
||||||
).catch(),
|
).catch(),
|
||||||
import(/* webpackChunkName: "compat" */ "./compatibility"),
|
import(/* webpackChunkName: "compat" */ "../resources/compatibility"),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return es5Loaded;
|
return es5Loaded;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// Compat needs to be first import
|
||||||
|
import "../resources/compatibility";
|
||||||
import "../onboarding/ha-onboarding";
|
import "../onboarding/ha-onboarding";
|
||||||
import "../resources/ha-style";
|
import "../resources/ha-style";
|
||||||
import "../resources/roboto";
|
import "../resources/roboto";
|
||||||
|
|
|
@ -61,12 +61,9 @@
|
||||||
_ls("/static/polyfills/custom-elements-es5-adapter.js");
|
_ls("/static/polyfills/custom-elements-es5-adapter.js");
|
||||||
<% if (useRollup) { %>
|
<% if (useRollup) { %>
|
||||||
_ls("/static/js/s.min.js").onload = function() {
|
_ls("/static/js/s.min.js").onload = function() {
|
||||||
System.import("<%= es5Compatibility %>").then(function() {
|
|
||||||
System.import("<%= es5PageJS %>");
|
System.import("<%= es5PageJS %>");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
_ls("<%= es5Compatibility %>");
|
|
||||||
_ls("<%= es5PageJS %>");
|
_ls("<%= es5PageJS %>");
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,14 +81,11 @@
|
||||||
|
|
||||||
<% if (useRollup) { %>
|
<% if (useRollup) { %>
|
||||||
_ls("/static/js/s.min.js").onload = function() {
|
_ls("/static/js/s.min.js").onload = function() {
|
||||||
System.import("<%= es5Compatibility %>").then(function() {
|
return System.import("<%= es5CoreJS %>").then(function() {
|
||||||
return System.import("<%= es5CoreJS %>");
|
|
||||||
}).then(function() {
|
|
||||||
System.import("<%= es5AppJS %>");
|
System.import("<%= es5AppJS %>");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
_ls("<%= es5Compatibility %>");
|
|
||||||
_ls("<%= es5CoreJS %>");
|
_ls("<%= es5CoreJS %>");
|
||||||
_ls("<%= es5AppJS %>");
|
_ls("<%= es5AppJS %>");
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
|
@ -63,12 +63,9 @@
|
||||||
_ls("/static/polyfills/custom-elements-es5-adapter.js");
|
_ls("/static/polyfills/custom-elements-es5-adapter.js");
|
||||||
<% if (useRollup) { %>
|
<% if (useRollup) { %>
|
||||||
_ls("/static/js/s.min.js").onload = function() {
|
_ls("/static/js/s.min.js").onload = function() {
|
||||||
System.import("<%= es5Compatibility %>").then(function() {
|
|
||||||
System.import("<%= es5PageJS %>");
|
System.import("<%= es5PageJS %>");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
_ls("<%= es5Compatibility %>");
|
|
||||||
_ls("<%= es5PageJS %>");
|
_ls("<%= es5PageJS %>");
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue