Skip to content

Commit ba8e341

Browse files
authored
refactor(tiny-refresh): remove ./transform exports from root (#171)
1 parent 7b74198 commit ba8e341

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

packages/tiny-refresh/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This simplified runtime architecture is inspired by [`solid-refresh`](https://gi
1212
- By default, any change will cause components to remount and thus hook states are not preserved.
1313
- Adding `// @hmr-unsafe` comment above the component definition will preserve hook states, but each hot update must keep same hook count.
1414
- Each component will be wrapped with extra component `(ComponentName)_refresh`.
15+
- Changing constants outside of component defnition won't trigger refresh since `Function.toString` is used to detect change.
1516

1617
## usages
1718

packages/tiny-refresh/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hiogawa/tiny-refresh",
3-
"version": "0.0.1-pre.8",
3+
"version": "0.0.1-pre.9",
44
"homepage": "https://github.com/hi-ogawa/js-utils/tree/main/packages/tiny-refresh",
55
"repository": {
66
"type": "git",

packages/tiny-refresh/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
export * from "./runtime";
2-
export * from "./transform";

packages/tiny-refresh/src/transform.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function hmrTransform(
1717
const extraCodes: string[] = [];
1818

1919
for (let i = 0; i < lines.length; i++) {
20-
const prevLine = lines[i - 1] || ""; // TODO: it should be "??" but it breaks old webpack.
20+
const prevLine = lines[i - 1] ?? "";
2121
const line = lines[i];
2222
// disable per file
2323
if (line.startsWith("// @hmr-disable-all")) {
@@ -53,8 +53,8 @@ export function hmrTransform(
5353
return [
5454
headerCode(
5555
options.runtime,
56-
options.refreshRuntime || "@hiogawa/tiny-refresh",
57-
options.debug || false
56+
options.refreshRuntime ?? "@hiogawa/tiny-refresh",
57+
options.debug ?? false
5858
),
5959
...newLines,
6060
...extraCodes,

0 commit comments

Comments
 (0)