-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: rename destructuring #63
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for webcrack ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
c8f4452
to
16f575f
Compare
testing this with a 3MB input file rename should also affect imports, but this is also missing in wakaru import {
render as ak,
html as aq,
Component as az,
} from "/libs/preact/preact.js";
console.log(ak, aq, az); some rebindings are preserved i guess an optimal solution would require dynamic analysis let { sqrt } = Math;
let { sqrt: _sqrt } = Math;
let { sqrt: _sqrt2 } = Math;
let { sqrt: _sqrt3 } = Math; works for y, fails on x, because x is declared globally const x = "...";
let { x: _x2, y } = aD;
let { x: _x4, y } = DOMPoint.fromPoint(aP).matrixTransform(aN);
let { x: _x5, y } = DOMPoint.fromPoint(aV).matrixTransform(aT);
let { x: _x6, y } = Ha(...);
let { x: _x7, y } = Ha(...); here it also fails on y, because y is declared locally let { x: _x8, y } = aF.matrixTransform(aD);
let { x: _x9, y: _y } = aG.matrixTransform(aD); |
now also affects imports
can maybe be done later/separately because its not related to the renaming and potentially unsafe
hmm could be improved if it wont affect the performance too much const x = "...";
function f() {
let { x: _x2, y } = aD;
console.log(x);
}
expected |
similar situation with custom elements webcrack should infer the class name from the element name class aa extends HTMLElement {
static #V = html`<div>foo</div>`;
static #j = css`:host { display: block; }`;
#Y;
constructor() {
super();
this.#Y = this.attachShadow({ mode: "open" });
this.#Y.adoptedStyleSheets = [aa.#j];
this.#Y.append(document.importNode(aa.#V.content, true));
}
}
customElements.define("x-foo", aa); class XFoo extends HTMLElement {
// ...
}
customElements.define("x-foo", XFoo); maybe also add names to anonymous classes customElements.define(
"x-foo",
class extends HTMLElement { /* ... */ }
); |
closes #62