Skip to content

Commit

Permalink
Drop Babel
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Sep 9, 2019
1 parent fe31f53 commit 7f10bcb
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 12 deletions.
19 changes: 18 additions & 1 deletion build-scripts/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,24 @@ const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
devtool: genDevTool(isProdBuild),
entry,
module: {
rules: [babelLoaderConfig({ latestBuild }), cssLoader, htmlLoader],
rules: [
{
test: /\.ts|tsx$/,
exclude: /node_modules/,
use: [
{
loader: "ts-loader",
options: {
compilerOptions: latestBuild
? { noEmit: false }
: { target: "es5", noEmit: false },
},
},
],
},
cssLoader,
htmlLoader,
],
},
optimization: optimization(latestBuild),
plugins: [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"require-dir": "^1.2.0",
"sinon": "^7.3.1",
"terser-webpack-plugin": "^1.2.3",
"ts-loader": "^6.0.4",
"ts-mocha": "^6.0.0",
"tslint": "^5.14.0",
"tslint-config-prettier": "^1.18.0",
Expand Down
9 changes: 7 additions & 2 deletions src/layouts/home-assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { HassElement } from "../state/hass-element";

export class HomeAssistantAppEl extends HassElement {
@property() private _route?: Route;
@property() private _error?: boolean;
@property() private _error = false;
@property() private _panelUrl?: string;

protected render() {
Expand Down Expand Up @@ -49,6 +49,7 @@ export class HomeAssistantAppEl extends HassElement {
}

protected updated(changedProps: PropertyValues): void {
super.updated(changedProps);
if (changedProps.has("_panelUrl")) {
this.panelUrlChanged(this._panelUrl!);
this._updateHass({ panelUrl: this._panelUrl });
Expand All @@ -70,7 +71,11 @@ export class HomeAssistantAppEl extends HassElement {
}
}

private _routeChanged(ev) {
private async _routeChanged(ev) {
// routeChangged event listener is called while we're doing the fist render,
// causing the update to be ignored. So delay it to next task (Lit render is sync).
await new Promise((resolve) => setTimeout(resolve, 0));

const route = ev.detail.value as Route;
// If it's the first route that we process,
// check if we should navigate away from /
Expand Down
1 change: 1 addition & 0 deletions src/panels/custom/ha-panel-custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class HaPanelCustom extends UpdatingElement {
return;
}
const props = {};
// @ts-ignore
for (const key of changedProps.keys()) {
props[key] = this[key];
}
Expand Down
4 changes: 3 additions & 1 deletion src/panels/lovelace/cards/hui-picture-elements-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard {

set hass(hass: HomeAssistant) {
this._hass = hass;
for (const el of this.shadowRoot!.querySelectorAll("#root > *")) {
for (const el of Array.from(
this.shadowRoot!.querySelectorAll("#root > *")
)) {
const element = el as LovelaceElement;
element.hass = this._hass;
}
Expand Down
8 changes: 4 additions & 4 deletions src/resources/jquery.roundslider.ondemand.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { TemplateResult } from "lit-element";

type LoadedRoundSlider = Promise<{
interface LoadedRoundSlider {
roundSliderStyle: TemplateResult;
jQuery: any;
}>;
}

let loaded: LoadedRoundSlider;
let loaded: Promise<LoadedRoundSlider>;

export const loadRoundslider = async (): LoadedRoundSlider => {
export const loadRoundslider = async (): Promise<LoadedRoundSlider> => {
if (!loaded) {
loaded = import(/* webpackChunkName: "jquery-roundslider" */ "./jquery.roundslider");
}
Expand Down
12 changes: 10 additions & 2 deletions src/state/hass-base-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
Constructor,
// @ts-ignore
property,
PropertyDeclarations,
} from "lit-element";
import { Auth, Connection } from "home-assistant-js-websocket";
import { HomeAssistant } from "../types";
Expand All @@ -26,8 +27,15 @@ export default <T>(superClass: Constructor<T>): Constructor<T & HassBaseEl> =>
class extends superClass {
protected _pendingHass: Partial<HomeAssistant> = {};
private __provideHass: HTMLElement[] = [];
// @ts-ignore
@property() protected hass: HomeAssistant;

// Decorators not possible in anonymous classes
static get properties(): PropertyDeclarations {
return {
hass: {},
};
}

protected hass!: HomeAssistant;

// Exists so all methods can safely call super method
protected hassConnected() {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"strict": true,
"sourceMap": true,
"noImplicitAny": false,
"skipLibCheck": true,
"resolveJsonModule": true,
Expand Down
54 changes: 52 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3653,6 +3653,13 @@ braces@^2.3.1, braces@^2.3.2:
split-string "^3.0.2"
to-regex "^3.0.1"

braces@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
dependencies:
fill-range "^7.0.1"

brorand@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
Expand Down Expand Up @@ -5518,7 +5525,7 @@ engine.io@~3.3.1:
engine.io-parser "~2.1.0"
ws "~6.1.0"

enhanced-resolve@^4.1.0:
enhanced-resolve@^4.0.0, enhanced-resolve@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f"
integrity sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==
Expand Down Expand Up @@ -6287,6 +6294,13 @@ fill-range@^4.0.0:
repeat-string "^1.6.1"
to-regex-range "^2.1.0"

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
dependencies:
to-regex-range "^5.0.1"

filled-array@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/filled-array/-/filled-array-1.1.0.tgz#c3c4f6c663b923459a9aa29912d2d031f1507f84"
Expand Down Expand Up @@ -8070,6 +8084,11 @@ is-number@^4.0.0:
resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff"
integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==

is-number@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==

is-obj@^1.0.0, is-obj@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f"
Expand Down Expand Up @@ -9504,6 +9523,14 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8:
snapdragon "^0.8.1"
to-regex "^3.0.2"

micromatch@^4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259"
integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==
dependencies:
braces "^3.0.1"
picomatch "^2.0.5"

miller-rabin@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d"
Expand Down Expand Up @@ -10689,6 +10716,11 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=

picomatch@^2.0.5:
version "2.0.7"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.0.7.tgz#514169d8c7cd0bdbeecc8a2609e34a7163de69f6"
integrity sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA==

pify@^2.0.0, pify@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
Expand Down Expand Up @@ -12075,7 +12107,7 @@ semver-greatest-satisfied-range@^1.1.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"
integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==

semver@^6.1.2:
semver@^6.0.0, semver@^6.1.2:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
Expand Down Expand Up @@ -13257,6 +13289,13 @@ to-regex-range@^2.1.0:
is-number "^3.0.0"
repeat-string "^1.6.1"

to-regex-range@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
dependencies:
is-number "^7.0.0"

to-regex@^3.0.1, to-regex@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce"
Expand Down Expand Up @@ -13321,6 +13360,17 @@ triple-beam@^1.2.0, triple-beam@^1.3.0:
resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9"
integrity sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==

ts-loader@^6.0.4:
version "6.0.4"
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.0.4.tgz#bc331ad91a887a60632d94c9f79448666f2c4b63"
integrity sha512-p2zJYe7OtwR+49kv4gs7v4dMrfYD1IPpOtqiSPCbe8oR+4zEBtdHwzM7A7M91F+suReqgzZrlClk4LRSSp882g==
dependencies:
chalk "^2.3.0"
enhanced-resolve "^4.0.0"
loader-utils "^1.0.2"
micromatch "^4.0.0"
semver "^6.0.0"

ts-mocha@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-6.0.0.tgz#40b8c5462ffce6f5dcee5ff729655b2958f26e50"
Expand Down

0 comments on commit 7f10bcb

Please sign in to comment.