mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Silence babel warnings (#9158)
This commit is contained in:
parent
d4720a9244
commit
9f554f4917
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const env = require("./env.js");
|
const env = require("./env.js");
|
||||||
const paths = require("./paths.js");
|
const paths = require("./paths.js");
|
||||||
@ -53,13 +54,13 @@ module.exports.babelOptions = ({ latestBuild }) => ({
|
|||||||
babelrc: false,
|
babelrc: false,
|
||||||
presets: [
|
presets: [
|
||||||
!latestBuild && [
|
!latestBuild && [
|
||||||
require("@babel/preset-env").default,
|
"@babel/preset-env",
|
||||||
{
|
{
|
||||||
useBuiltIns: "entry",
|
useBuiltIns: "entry",
|
||||||
corejs: "3.6",
|
corejs: "3.6",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
require("@babel/preset-typescript").default,
|
"@babel/preset-typescript",
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
plugins: [
|
plugins: [
|
||||||
// Part of ES2018. Converts {...a, b: 2} to Object.assign({}, a, {b: 2})
|
// Part of ES2018. Converts {...a, b: 2} to Object.assign({}, a, {b: 2})
|
||||||
@ -72,14 +73,9 @@ module.exports.babelOptions = ({ latestBuild }) => ({
|
|||||||
"@babel/plugin-syntax-dynamic-import",
|
"@babel/plugin-syntax-dynamic-import",
|
||||||
"@babel/plugin-proposal-optional-chaining",
|
"@babel/plugin-proposal-optional-chaining",
|
||||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||||
[
|
["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }],
|
||||||
require("@babel/plugin-proposal-decorators").default,
|
["@babel/plugin-proposal-private-methods", { loose: true }],
|
||||||
{ decoratorsBeforeExport: true },
|
["@babel/plugin-proposal-class-properties", { loose: true }],
|
||||||
],
|
|
||||||
[
|
|
||||||
require("@babel/plugin-proposal-class-properties").default,
|
|
||||||
{ loose: true },
|
|
||||||
],
|
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const paths = require("./paths.js");
|
const paths = require("./paths.js");
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const commonjs = require("@rollup/plugin-commonjs");
|
const commonjs = require("@rollup/plugin-commonjs");
|
||||||
@ -32,8 +33,7 @@ const createRollupConfig = ({
|
|||||||
publicPath,
|
publicPath,
|
||||||
dontHash,
|
dontHash,
|
||||||
isWDS,
|
isWDS,
|
||||||
}) => {
|
}) => ({
|
||||||
return {
|
|
||||||
/**
|
/**
|
||||||
* @type { import("rollup").InputOptions }
|
* @type { import("rollup").InputOptions }
|
||||||
*/
|
*/
|
||||||
@ -68,9 +68,7 @@ const createRollupConfig = ({
|
|||||||
// Import certain extensions as strings
|
// Import certain extensions as strings
|
||||||
include: [path.join(paths.polymer_dir, "node_modules/**/*.css")],
|
include: [path.join(paths.polymer_dir, "node_modules/**/*.css")],
|
||||||
}),
|
}),
|
||||||
replace(
|
replace(bundle.definedVars({ isProdBuild, latestBuild, defineOverlay })),
|
||||||
bundle.definedVars({ isProdBuild, latestBuild, defineOverlay })
|
|
||||||
),
|
|
||||||
!isWDS &&
|
!isWDS &&
|
||||||
manifest({
|
manifest({
|
||||||
publicPath,
|
publicPath,
|
||||||
@ -102,18 +100,15 @@ const createRollupConfig = ({
|
|||||||
// https://rollupjs.org/guide/en/#outputassetfilenames
|
// https://rollupjs.org/guide/en/#outputassetfilenames
|
||||||
entryFileNames:
|
entryFileNames:
|
||||||
isProdBuild && !isStatsBuild ? "[name]-[hash].js" : "[name].js",
|
isProdBuild && !isStatsBuild ? "[name]-[hash].js" : "[name].js",
|
||||||
chunkFileNames:
|
chunkFileNames: isProdBuild && !isStatsBuild ? "c.[hash].js" : "[name].js",
|
||||||
isProdBuild && !isStatsBuild ? "c.[hash].js" : "[name].js",
|
assetFileNames: isProdBuild && !isStatsBuild ? "a.[hash].js" : "[name].js",
|
||||||
assetFileNames:
|
|
||||||
isProdBuild && !isStatsBuild ? "a.[hash].js" : "[name].js",
|
|
||||||
// https://rollupjs.org/guide/en/#outputsourcemap
|
// https://rollupjs.org/guide/en/#outputsourcemap
|
||||||
sourcemap: isProdBuild ? true : "inline",
|
sourcemap: isProdBuild ? true : "inline",
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
};
|
|
||||||
|
|
||||||
const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild, isWDS }) => {
|
const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild, isWDS }) =>
|
||||||
return createRollupConfig(
|
createRollupConfig(
|
||||||
bundle.config.app({
|
bundle.config.app({
|
||||||
isProdBuild,
|
isProdBuild,
|
||||||
latestBuild,
|
latestBuild,
|
||||||
@ -121,31 +116,24 @@ const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild, isWDS }) => {
|
|||||||
isWDS,
|
isWDS,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
|
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) =>
|
||||||
return createRollupConfig(
|
createRollupConfig(
|
||||||
bundle.config.demo({
|
bundle.config.demo({
|
||||||
isProdBuild,
|
isProdBuild,
|
||||||
latestBuild,
|
latestBuild,
|
||||||
isStatsBuild,
|
isStatsBuild,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
const createCastConfig = ({ isProdBuild, latestBuild }) => {
|
const createCastConfig = ({ isProdBuild, latestBuild }) =>
|
||||||
return createRollupConfig(bundle.config.cast({ isProdBuild, latestBuild }));
|
createRollupConfig(bundle.config.cast({ isProdBuild, latestBuild }));
|
||||||
};
|
|
||||||
|
|
||||||
const createHassioConfig = ({ isProdBuild, latestBuild }) => {
|
const createHassioConfig = ({ isProdBuild, latestBuild }) =>
|
||||||
return createRollupConfig(bundle.config.hassio({ isProdBuild, latestBuild }));
|
createRollupConfig(bundle.config.hassio({ isProdBuild, latestBuild }));
|
||||||
};
|
|
||||||
|
|
||||||
const createGalleryConfig = ({ isProdBuild, latestBuild }) => {
|
const createGalleryConfig = ({ isProdBuild, latestBuild }) =>
|
||||||
return createRollupConfig(
|
createRollupConfig(bundle.config.gallery({ isProdBuild, latestBuild }));
|
||||||
bundle.config.gallery({ isProdBuild, latestBuild })
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createAppConfig,
|
createAppConfig,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
||||||
const paths = require("./paths.js");
|
const paths = require("./paths.js");
|
||||||
const bundle = require("./bundle");
|
const bundle = require("./bundle.js");
|
||||||
const log = require("fancy-log");
|
const log = require("fancy-log");
|
||||||
|
|
||||||
class LogStartCompilePlugin {
|
class LogStartCompilePlugin {
|
||||||
@ -94,6 +95,7 @@ const createWebpackConfig = ({
|
|||||||
? path.resolve(context, resource)
|
? path.resolve(context, resource)
|
||||||
: require.resolve(resource);
|
: require.resolve(resource);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error(
|
console.error(
|
||||||
"Error in Home Assistant ignore plugin",
|
"Error in Home Assistant ignore plugin",
|
||||||
resource,
|
resource,
|
||||||
@ -144,33 +146,24 @@ const createWebpackConfig = ({
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
|
const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild }) =>
|
||||||
return createWebpackConfig(
|
createWebpackConfig(
|
||||||
bundle.config.app({ isProdBuild, latestBuild, isStatsBuild })
|
bundle.config.app({ isProdBuild, latestBuild, isStatsBuild })
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
|
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) =>
|
||||||
return createWebpackConfig(
|
createWebpackConfig(
|
||||||
bundle.config.demo({ isProdBuild, latestBuild, isStatsBuild })
|
bundle.config.demo({ isProdBuild, latestBuild, isStatsBuild })
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
const createCastConfig = ({ isProdBuild, latestBuild }) => {
|
const createCastConfig = ({ isProdBuild, latestBuild }) =>
|
||||||
return createWebpackConfig(bundle.config.cast({ isProdBuild, latestBuild }));
|
createWebpackConfig(bundle.config.cast({ isProdBuild, latestBuild }));
|
||||||
};
|
|
||||||
|
|
||||||
const createHassioConfig = ({ isProdBuild, latestBuild }) => {
|
const createHassioConfig = ({ isProdBuild, latestBuild }) =>
|
||||||
return createWebpackConfig(
|
createWebpackConfig(bundle.config.hassio({ isProdBuild, latestBuild }));
|
||||||
bundle.config.hassio({ isProdBuild, latestBuild })
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const createGalleryConfig = ({ isProdBuild, latestBuild }) => {
|
const createGalleryConfig = ({ isProdBuild, latestBuild }) =>
|
||||||
return createWebpackConfig(
|
createWebpackConfig(bundle.config.gallery({ isProdBuild, latestBuild }));
|
||||||
bundle.config.gallery({ isProdBuild, latestBuild })
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createAppConfig,
|
createAppConfig,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user