-
Notifications
You must be signed in to change notification settings - Fork 167
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
Self recommendation of transformer related libraries #14
Comments
this is fabulous!!! the import reactReFreshTypescrpt from "https://esm.sh/react-refresh-typescript" this should work, i will test it later, great work thanks a lot! |
@Jack-Works currently i'm focusing on Aleph.js's new compiler with swc in Rust to get better prefs since tsc is slow, also needs a stable fast refresh plugin for the new compiler, would you be interested in the plugin in swc(Rust)? FYI please check the swc branch |
I know swc but never write a plugin for it. I may have a try 👀 |
@Jack-Works i just tested, something unexpected was going to happen. compile.ts import reactRefreshTS from 'https://esm.sh/react-refresh-typescript@1.0.4'
transformers.before!.push(reactRefreshTS({})) logo.tsx import React, { useState } from 'https://esm.sh/react'
export default function Logo({ width = 75 }: { width?: number }) {
const [height, setHeight] = useState(width)
return (
<img src="/logo.svg" width={width} height={height} title="Aleph.js" />
)
} i got an unfinished result: var _a;
import React, { useState } from "../-/esm.sh/react.js";
export default function Logo({ width = 75 }) {
const [height, setHeight] = useState(width);
return (React.createElement("img", { src: "/logo.svg", width: width, height: height, title: "Aleph.js", __source: { fileName: "/components/logo.tsx", lineNumber: 7 } }));
}
_a = Logo;
$RefreshReg$(_a, "Logo"); should be: const _s = $RefreshSig$();
import React, { useState } from "../-/esm.sh/react.js";
export default function Logo({ width = 75 }) {
_s();
const [height, setHeight] = useState(width);
return (React.createElement("img", { src: "/logo.svg", width: width, height: height, title: "Aleph.js", __source: { fileName: "/components/logo.tsx", lineNumber: 6 } }));
}
_s(Logo, "useState{[height, setHeight](width)}");
$RefreshReg$(Logo, "Logo"); anything i missed? |
Hooks signature are missing, strange, I'll investigate it later |
cool, thanks |
Sorry I cannot reproduce that. My result for your example code is: var _a;
var _b;
_b = $RefreshSig$();
import React, { useState } from 'https://esm.sh/react';
export default function Logo({ width = 75 }) {
_b();
const [height, setHeight] = useState(width);
return (React.createElement("img", { src: "/logo.svg", width: width, height: height, title: "Aleph.js" }));
}
_a = Logo;
$RefreshReg$(_a, "Logo");
_b(Logo, "B1bTgemxQeKxhnx7iLvvyxMpH2Y="); const ts = require("typescript");
const result = ts.transpileModule(
`import React, { useState } from 'https://esm.sh/react'
export default function Logo({ width = 75 }: { width?: number }) {
const [height, setHeight] = useState(width)
return (
<img src="/logo.svg" width={width} height={height} title="Aleph.js" />
)
}
`,
{
transformers: { before: [require("react-refresh-typescript").default()] },
compilerOptions: { jsx: ts.JsxEmit.React, module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ES2015 },
}
).outputText;
console.log(result); |
@Jack-Works i changed the transformers order(seems react-refresh-typescript should be the first one), it works now! var _a;
var _b;
_b = $RefreshSig$();
import React, { useState } from 'https://esm.sh/react';
export default function Logo({ width = 75 }) {
_b();
const [height, setHeight] = useState(width);
return (React.createElement("img", { src: "/logo.svg", width: width, height: height, title: "Aleph.js" }));
}
_a = Logo;
$RefreshReg$(_a, "Logo");
_b(Logo, "B1bTgemxQeKxhnx7iLvvyxMpH2Y="); what a feat! thanks! |
Fix typo in useDeno doc page
Hi! This library is cool, thanks for your work! When I view the source code, I found I can provide some better alternatives to some TS transformers.
React Refresh TS transformer: react-refresh-typescript (PR to React)
react-refresh-typescript
is provided in both ESM and CommonJS format. This package doesn't depend on any Node-JS specific functionalities. It's fully passed the test suit as the babel version does.Import path rewrite: @magic-works/ttypescript-browser-like-import-transformer is a fully functional import path rewrite library for converting any imports to Web-ready imports. This library also considers the non-Node environment in mind when design. All IO (including
import
statements) are delegated to anode
adaptor so if you need it, I can write adeno
adaptor and it's available fordeno
.Thanks!
The text was updated successfully, but these errors were encountered: