Skip to content

Commit 52a0039

Browse files
merge: resolve conflicts with origin/main (plugin-lifecycle)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 parents 0818137 + 39dbf81 commit 52a0039

11 files changed

Lines changed: 1094 additions & 1 deletion

File tree

.changeset/add-lifecycle-plugin.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@stackflow/plugin-lifecycle": minor
3+
---
4+
5+
Add lifecyclePlugin and useFocusEffect hook for activity focus/blur lifecycle
6+
7+
- `useFocusEffect(callback)` hook to register per-activity focus/blur callbacks
8+
- Detection and invocation in plugin `onChanged` (outside React render cycle)
9+
- `callbackRef` pattern for always-latest callback without `useCallback`
10+
- Error isolation via `runSafely()` for all user callbacks

.pnp.cjs

Lines changed: 180 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const { context } = require("esbuild");
2+
const config = require("@stackflow/esbuild-config");
3+
const pkg = require("./package.json");
4+
5+
const watch = process.argv.includes("--watch");
6+
const external = Object.keys({
7+
...pkg.dependencies,
8+
...pkg.peerDependencies,
9+
});
10+
11+
Promise.all([
12+
context({
13+
...config({}),
14+
format: "cjs",
15+
external,
16+
}).then((ctx) =>
17+
watch ? ctx.watch() : ctx.rebuild().then(() => ctx.dispose()),
18+
),
19+
context({
20+
...config({}),
21+
format: "esm",
22+
outExtension: {
23+
".js": ".mjs",
24+
},
25+
external,
26+
}).then((ctx) =>
27+
watch ? ctx.watch() : ctx.rebuild().then(() => ctx.dispose()),
28+
),
29+
]).catch(() => process.exit(1));
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"name": "@stackflow/plugin-lifecycle",
3+
"version": "0.0.1",
4+
"repository": {
5+
"type": "git",
6+
"url": "https://github.com/daangn/stackflow.git",
7+
"directory": "extensions/plugin-lifecycle"
8+
},
9+
"license": "MIT",
10+
"exports": {
11+
".": {
12+
"types": "./dist/index.d.ts",
13+
"require": "./dist/index.js",
14+
"import": "./dist/index.mjs"
15+
}
16+
},
17+
"main": "./dist/index.js",
18+
"module": "./dist/index.mjs",
19+
"types": "./dist/index.d.ts",
20+
"files": [
21+
"dist",
22+
"src",
23+
"README.md"
24+
],
25+
"scripts": {
26+
"build": "yarn build:js && yarn build:dts",
27+
"build:dts": "tsc --emitDeclarationOnly",
28+
"build:js": "node ./esbuild.config.js",
29+
"clean": "rimraf dist",
30+
"dev": "yarn build:js --watch && yarn build:dts --watch",
31+
"test": "yarn jest",
32+
"typecheck": "tsc --noEmit"
33+
},
34+
"jest": {
35+
"testEnvironment": "jsdom",
36+
"coveragePathIgnorePatterns": [
37+
"index.ts"
38+
],
39+
"transform": {
40+
"^.+\\.(t|j)sx?$": "@swc/jest"
41+
}
42+
},
43+
"devDependencies": {
44+
"@stackflow/config": "^1.2.2",
45+
"@stackflow/core": "^1.3.0",
46+
"@stackflow/esbuild-config": "^1.0.3",
47+
"@stackflow/plugin-renderer-basic": "^1.1.13",
48+
"@stackflow/react": "^1.12.0",
49+
"@swc/core": "^1.6.6",
50+
"@swc/jest": "^0.2.36",
51+
"@testing-library/dom": "^10.4.0",
52+
"@testing-library/react": "^16.3.2",
53+
"@types/jest": "^29.5.12",
54+
"@types/react": "^18.3.3",
55+
"esbuild": "^0.27.3",
56+
"jest": "^29.7.0",
57+
"jest-environment-jsdom": "^29.7.0",
58+
"react": "^18.3.1",
59+
"react-dom": "^18.3.1",
60+
"rimraf": "^6.1.3",
61+
"typescript": "^5.5.3"
62+
},
63+
"peerDependencies": {
64+
"@stackflow/core": "^1.1.0-canary.0",
65+
"@stackflow/react": "^1.3.2-canary.0",
66+
"react": ">=16.8.0"
67+
},
68+
"publishConfig": {
69+
"access": "public"
70+
}
71+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { lifecyclePlugin } from "./lifecyclePlugin";
2+
export { useFocusEffect } from "./useFocusEffect";

0 commit comments

Comments
 (0)