@shrkcrft/presets 0.1.0-alpha.2 → 0.1.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtin/angular21-presets.d.ts +9 -0
- package/dist/builtin/angular21-presets.d.ts.map +1 -0
- package/dist/builtin/angular21-presets.js +218 -0
- package/dist/builtin/angular21-snippets.d.ts +28 -0
- package/dist/builtin/angular21-snippets.d.ts.map +1 -0
- package/dist/builtin/angular21-snippets.js +243 -0
- package/dist/builtin/builtin-presets.d.ts.map +1 -1
- package/dist/builtin/builtin-presets.js +40 -19
- package/dist/builtin/nest11-presets.d.ts +11 -0
- package/dist/builtin/nest11-presets.d.ts.map +1 -0
- package/dist/builtin/nest11-presets.js +257 -0
- package/dist/builtin/nest11-snippets.d.ts +32 -0
- package/dist/builtin/nest11-snippets.d.ts.map +1 -0
- package/dist/builtin/nest11-snippets.js +270 -0
- package/dist/builtin/r26-presets.d.ts +1 -3
- package/dist/builtin/r26-presets.d.ts.map +1 -1
- package/dist/builtin/r26-presets.js +5 -33
- package/dist/builtin/r26-snippets.d.ts +0 -2
- package/dist/builtin/r26-snippets.d.ts.map +1 -1
- package/dist/builtin/r26-snippets.js +0 -16
- package/dist/builtin/r45-presets.d.ts +1 -1
- package/dist/builtin/r45-presets.d.ts.map +1 -1
- package/dist/builtin/r45-presets.js +5 -5
- package/dist/builtin/r47-presets.d.ts +1 -1
- package/dist/builtin/r47-presets.d.ts.map +1 -1
- package/dist/builtin/r47-presets.js +4 -4
- package/dist/builtin/react19-presets.d.ts +12 -0
- package/dist/builtin/react19-presets.d.ts.map +1 -0
- package/dist/builtin/react19-presets.js +299 -0
- package/dist/builtin/react19-snippets.d.ts +43 -0
- package/dist/builtin/react19-snippets.d.ts.map +1 -0
- package/dist/builtin/react19-snippets.js +363 -0
- package/dist/builtin/shared-snippets.d.ts +25 -3
- package/dist/builtin/shared-snippets.d.ts.map +1 -1
- package/dist/builtin/shared-snippets.js +265 -0
- package/dist/emit/synthesize-files.d.ts.map +1 -1
- package/dist/emit/synthesize-files.js +76 -17
- package/dist/registry/recommend.d.ts.map +1 -1
- package/dist/registry/recommend.js +7 -3
- package/package.json +5 -5
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
// React 19+ preset family.
|
|
2
|
+
//
|
|
3
|
+
// Eight presets — seven focused on a single slice of the modernisation
|
|
4
|
+
// surface, one comprehensive `react-19-modern` that composes the rest.
|
|
5
|
+
// Targets HasReact workspaces with weight 11-12 so the recommender
|
|
6
|
+
// prefers these when the workspace is React-based. The existing legacy
|
|
7
|
+
// `frontend-app` (weight 6) stays for projects pinned to it.
|
|
8
|
+
//
|
|
9
|
+
// Each preset's `paths` references the canonical React SPA structure
|
|
10
|
+
// (src/components, src/hooks, src/pages, src/lib) — the init paths
|
|
11
|
+
// advisory annotator flags any of these that don't exist in the live
|
|
12
|
+
// workspace, so RSC-framework users (Next.js app router under app/) see
|
|
13
|
+
// the mismatch immediately.
|
|
14
|
+
import { WorkspaceProfile } from '@shrkcrft/workspace';
|
|
15
|
+
import { definePreset } from "../define/define-preset.js";
|
|
16
|
+
import { COMMON_AGENT_BRIEFING, COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV, COMMON_PIPELINE_UNIT_TEST, COMMON_SAFETY_RULE, OVERVIEW_DOC, REACT_PATH_COMPONENTS, REACT_PATH_HOOKS, REACT_PATH_LIB, REACT_PATH_PAGES, } from "./shared-snippets.js";
|
|
17
|
+
import { REACT19_ASYNC_TRANSITIONS, REACT19_AVOID_PROP_DRILLING, REACT19_CLIENT_STATE_PROPORTIONAL, REACT19_COMPILER_AUTO_MEMO, REACT19_CONTEXT_AS_PROVIDER, REACT19_CUSTOM_HOOK_NAMING, REACT19_DOCUMENT_METADATA, REACT19_EFFECT_CLEANUP, REACT19_FORMS_LIBRARY, REACT19_FORM_ACTIONS, REACT19_FUNCTION_COMPONENTS, REACT19_IMAGE_OPTIMIZATION, REACT19_KEYS_FOR_RESET, REACT19_LAZY_SUSPENSE, REACT19_MSW, REACT19_NO_DERIVED_STATE_IN_EFFECT, REACT19_NO_FETCH_IN_EFFECT, REACT19_NO_REACT_FC, REACT19_PROPS_INTERFACE, REACT19_REF_AS_PROP, REACT19_RULES_OF_HOOKS, REACT19_SELF_CLOSING, REACT19_SERVER_ACTIONS, REACT19_SERVER_COMPONENTS_DEFAULT, REACT19_SERVER_STATE_LIBRARY, REACT19_STABLE_KEYS, REACT19_STREAMING_SSR, REACT19_STRICT_MODE, REACT19_STYLESHEETS_IN_TREE, REACT19_SUSPENSE_BOUNDARIES, REACT19_TEST_BEHAVIOR_NOT_IMPL, REACT19_TESTING_LIBRARY, REACT19_USE_ACTION_STATE, REACT19_USE_CLIENT_BOUNDARY, REACT19_USE_DEFERRED_VALUE, REACT19_USE_EFFECT_FOR_EXTERNAL_SYNC, REACT19_USE_FORM_STATUS, REACT19_USE_HOOK, REACT19_USE_OPTIMISTIC, REACT19_USE_TRANSITION, REACT19_VIRTUALIZE_LISTS, REACT19_VITEST, } from "./react19-snippets.js";
|
|
18
|
+
const REACT19_TAGS = ['react', 'react-19', 'frontend'];
|
|
19
|
+
const REACT19_NEXT_COMMANDS = [
|
|
20
|
+
'shrk doctor',
|
|
21
|
+
'shrk task "<task>"',
|
|
22
|
+
'shrk ci scaffold github-actions --quickstart',
|
|
23
|
+
];
|
|
24
|
+
// ─── 1) Modern component shape ────────────────────────────────────────────
|
|
25
|
+
export const REACT_19_MODERN_COMPONENTS = definePreset({
|
|
26
|
+
id: 'react-19-modern-components',
|
|
27
|
+
title: 'React 19 — modern component shape',
|
|
28
|
+
description: 'Function components only (no class components, no React.FC), props declared as interfaces, ref accepted as a regular prop (no forwardRef in the common case), <Context> rendered as the provider directly, document metadata in the component tree, scoped stylesheets via <link precedence>.',
|
|
29
|
+
tags: [...REACT19_TAGS, 'components'],
|
|
30
|
+
appliesTo: [WorkspaceProfile.HasReact, WorkspaceProfile.IsFrontend],
|
|
31
|
+
weight: 11,
|
|
32
|
+
includes: {
|
|
33
|
+
knowledge: [COMMON_AGENT_BRIEFING],
|
|
34
|
+
rules: [
|
|
35
|
+
COMMON_SAFETY_RULE,
|
|
36
|
+
REACT19_FUNCTION_COMPONENTS,
|
|
37
|
+
REACT19_NO_REACT_FC,
|
|
38
|
+
REACT19_PROPS_INTERFACE,
|
|
39
|
+
REACT19_REF_AS_PROP,
|
|
40
|
+
REACT19_CONTEXT_AS_PROVIDER,
|
|
41
|
+
REACT19_DOCUMENT_METADATA,
|
|
42
|
+
REACT19_STYLESHEETS_IN_TREE,
|
|
43
|
+
REACT19_SELF_CLOSING,
|
|
44
|
+
],
|
|
45
|
+
paths: [REACT_PATH_COMPONENTS, REACT_PATH_HOOKS, REACT_PATH_LIB],
|
|
46
|
+
templates: [],
|
|
47
|
+
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV],
|
|
48
|
+
docs: {
|
|
49
|
+
'overview.md': OVERVIEW_DOC('React 19 modern components', 'Function components only. No React.FC, no class components for new code. Props live in interfaces. Refs are regular props. <MyContext value={x}>{children}</MyContext> — no .Provider. Document metadata (<title>, <meta>) renders inside the tree; React hoists it.'),
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
recommendedNextCommands: REACT19_NEXT_COMMANDS,
|
|
53
|
+
});
|
|
54
|
+
// ─── 2) Hooks discipline ──────────────────────────────────────────────────
|
|
55
|
+
export const REACT_19_HOOKS_DISCIPLINE = definePreset({
|
|
56
|
+
id: 'react-19-hooks-discipline',
|
|
57
|
+
title: 'React 19 — hooks discipline',
|
|
58
|
+
description: 'Rules of hooks enforced via eslint-plugin-react-hooks (errors, not warnings). useEffect is for external-system sync only — derived state is computed during render, event responses live in handlers, fetches live in a server-state library, state resets are keyed. Custom hooks start with `use` and clean up their subscriptions.',
|
|
59
|
+
tags: [...REACT19_TAGS, 'hooks'],
|
|
60
|
+
appliesTo: [WorkspaceProfile.HasReact],
|
|
61
|
+
weight: 11,
|
|
62
|
+
includes: {
|
|
63
|
+
knowledge: [COMMON_AGENT_BRIEFING],
|
|
64
|
+
rules: [
|
|
65
|
+
COMMON_SAFETY_RULE,
|
|
66
|
+
REACT19_RULES_OF_HOOKS,
|
|
67
|
+
REACT19_USE_EFFECT_FOR_EXTERNAL_SYNC,
|
|
68
|
+
REACT19_NO_DERIVED_STATE_IN_EFFECT,
|
|
69
|
+
REACT19_NO_FETCH_IN_EFFECT,
|
|
70
|
+
REACT19_CUSTOM_HOOK_NAMING,
|
|
71
|
+
REACT19_EFFECT_CLEANUP,
|
|
72
|
+
REACT19_KEYS_FOR_RESET,
|
|
73
|
+
],
|
|
74
|
+
paths: [REACT_PATH_HOOKS, REACT_PATH_COMPONENTS],
|
|
75
|
+
templates: [],
|
|
76
|
+
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV],
|
|
77
|
+
docs: {
|
|
78
|
+
'overview.md': OVERVIEW_DOC('React 19 hooks discipline', 'Hooks at the top, never conditional. useEffect ONLY for syncing with external systems. Derived values are computed in render. Fetches go through TanStack Query / SWR / RTK Query. State resets use a `key` prop on the consumer, not a useEffect.'),
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
recommendedNextCommands: REACT19_NEXT_COMMANDS,
|
|
82
|
+
});
|
|
83
|
+
// ─── 3) Actions + forms (React 19) ────────────────────────────────────────
|
|
84
|
+
export const REACT_19_ACTIONS_FORMS = definePreset({
|
|
85
|
+
id: 'react-19-actions-forms',
|
|
86
|
+
title: 'React 19 — Actions, async transitions, optimistic UI',
|
|
87
|
+
description: 'The React 19 Actions surface: <form action> for submission, useActionState for result + pending + error in one hook, useFormStatus for child-level pending UI, useOptimistic for instant feedback on mutations, use() for promises and contexts in conditionals, async functions passed to startTransition / useTransition.',
|
|
88
|
+
tags: [...REACT19_TAGS, 'actions', 'forms'],
|
|
89
|
+
appliesTo: [WorkspaceProfile.HasReact, WorkspaceProfile.IsFrontend],
|
|
90
|
+
weight: 11,
|
|
91
|
+
includes: {
|
|
92
|
+
knowledge: [COMMON_AGENT_BRIEFING],
|
|
93
|
+
rules: [
|
|
94
|
+
COMMON_SAFETY_RULE,
|
|
95
|
+
REACT19_FORM_ACTIONS,
|
|
96
|
+
REACT19_USE_ACTION_STATE,
|
|
97
|
+
REACT19_USE_FORM_STATUS,
|
|
98
|
+
REACT19_USE_OPTIMISTIC,
|
|
99
|
+
REACT19_USE_HOOK,
|
|
100
|
+
REACT19_ASYNC_TRANSITIONS,
|
|
101
|
+
],
|
|
102
|
+
paths: [REACT_PATH_COMPONENTS, REACT_PATH_HOOKS],
|
|
103
|
+
templates: [],
|
|
104
|
+
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV],
|
|
105
|
+
docs: {
|
|
106
|
+
'overview.md': OVERVIEW_DOC('React 19 Actions', '<form action={async (fd) => ...}> for submission. useActionState owns pending + result. useFormStatus inside form children for spinners. useOptimistic for instant UI on writes. use(promise) inside Suspense. startTransition accepts async functions.'),
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
recommendedNextCommands: REACT19_NEXT_COMMANDS,
|
|
110
|
+
});
|
|
111
|
+
// ─── 4) State management — server, client, forms ─────────────────────────
|
|
112
|
+
export const REACT_19_STATE = definePreset({
|
|
113
|
+
id: 'react-19-state',
|
|
114
|
+
title: 'React 19 — state management (server, client, forms)',
|
|
115
|
+
description: 'Server state in TanStack Query / SWR / RTK Query (never useState). Client state in the right shape for its scope: local useState, lifted state for siblings, Context for low-frequency cross-tree, a real store (Zustand / Jotai / RTK) for high-frequency cross-tree. Forms past trivial use React Hook Form + Zod.',
|
|
116
|
+
tags: [...REACT19_TAGS, 'state'],
|
|
117
|
+
appliesTo: [WorkspaceProfile.HasReact],
|
|
118
|
+
weight: 11,
|
|
119
|
+
includes: {
|
|
120
|
+
knowledge: [COMMON_AGENT_BRIEFING],
|
|
121
|
+
rules: [
|
|
122
|
+
COMMON_SAFETY_RULE,
|
|
123
|
+
REACT19_SERVER_STATE_LIBRARY,
|
|
124
|
+
REACT19_CLIENT_STATE_PROPORTIONAL,
|
|
125
|
+
REACT19_FORMS_LIBRARY,
|
|
126
|
+
REACT19_AVOID_PROP_DRILLING,
|
|
127
|
+
REACT19_KEYS_FOR_RESET,
|
|
128
|
+
],
|
|
129
|
+
paths: [REACT_PATH_COMPONENTS, REACT_PATH_HOOKS, REACT_PATH_LIB],
|
|
130
|
+
templates: [],
|
|
131
|
+
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV],
|
|
132
|
+
docs: {
|
|
133
|
+
'overview.md': OVERVIEW_DOC('React 19 state', 'Server state belongs in a query library — TanStack Query is the default. Client state is sized to its scope: local / lifted / Context (low-frequency only) / store (high-frequency). Non-trivial forms use React Hook Form + Zod. Long prop-drilling chains are a refactor signal.'),
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
recommendedNextCommands: REACT19_NEXT_COMMANDS,
|
|
137
|
+
});
|
|
138
|
+
// ─── 5) Performance — Compiler, lazy, virtualization, images ─────────────
|
|
139
|
+
export const REACT_19_PERFORMANCE = definePreset({
|
|
140
|
+
id: 'react-19-performance',
|
|
141
|
+
title: 'React 19 — performance baseline',
|
|
142
|
+
description: 'React Compiler for automatic memoization (drops most hand-rolled useMemo / useCallback). Route-level code-splitting via React.lazy + Suspense. Virtualization past ~100 visible rows. Stable list keys (never the array index). Image dimensions explicit; lazy by default.',
|
|
143
|
+
tags: [...REACT19_TAGS, 'performance'],
|
|
144
|
+
appliesTo: [WorkspaceProfile.HasReact],
|
|
145
|
+
weight: 11,
|
|
146
|
+
includes: {
|
|
147
|
+
knowledge: [COMMON_AGENT_BRIEFING],
|
|
148
|
+
rules: [
|
|
149
|
+
COMMON_SAFETY_RULE,
|
|
150
|
+
REACT19_COMPILER_AUTO_MEMO,
|
|
151
|
+
REACT19_LAZY_SUSPENSE,
|
|
152
|
+
REACT19_VIRTUALIZE_LISTS,
|
|
153
|
+
REACT19_STABLE_KEYS,
|
|
154
|
+
REACT19_IMAGE_OPTIMIZATION,
|
|
155
|
+
],
|
|
156
|
+
paths: [REACT_PATH_COMPONENTS, REACT_PATH_PAGES],
|
|
157
|
+
templates: [],
|
|
158
|
+
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV],
|
|
159
|
+
docs: {
|
|
160
|
+
'overview.md': OVERVIEW_DOC('React 19 performance', 'Turn on the React Compiler (babel-plugin-react-compiler) and stop hand-rolling memo unless the profiler says otherwise. Route boundaries lazy-load. Long lists virtualize. List keys are stable ids, never the array index. Images carry explicit width/height + loading="lazy".'),
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
recommendedNextCommands: REACT19_NEXT_COMMANDS,
|
|
164
|
+
});
|
|
165
|
+
// ─── 6) Concurrent rendering ──────────────────────────────────────────────
|
|
166
|
+
export const REACT_19_CONCURRENT = definePreset({
|
|
167
|
+
id: 'react-19-concurrent',
|
|
168
|
+
title: 'React 19 — concurrent rendering',
|
|
169
|
+
description: 'useTransition / startTransition to keep input responsive under slow updates, useDeferredValue (with React 19\'s initialValue) for lagged derived renders, deliberate Suspense-boundary placement for streaming reveal, StrictMode in dev to surface concurrency bugs early.',
|
|
170
|
+
tags: [...REACT19_TAGS, 'concurrent'],
|
|
171
|
+
appliesTo: [WorkspaceProfile.HasReact],
|
|
172
|
+
weight: 11,
|
|
173
|
+
includes: {
|
|
174
|
+
knowledge: [COMMON_AGENT_BRIEFING],
|
|
175
|
+
rules: [
|
|
176
|
+
COMMON_SAFETY_RULE,
|
|
177
|
+
REACT19_USE_TRANSITION,
|
|
178
|
+
REACT19_USE_DEFERRED_VALUE,
|
|
179
|
+
REACT19_SUSPENSE_BOUNDARIES,
|
|
180
|
+
REACT19_STRICT_MODE,
|
|
181
|
+
REACT19_ASYNC_TRANSITIONS,
|
|
182
|
+
],
|
|
183
|
+
paths: [REACT_PATH_COMPONENTS, REACT_PATH_PAGES],
|
|
184
|
+
templates: [],
|
|
185
|
+
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV],
|
|
186
|
+
docs: {
|
|
187
|
+
'overview.md': OVERVIEW_DOC('React 19 concurrent rendering', 'Slow updates go through startTransition. Derived expensive views use useDeferredValue. Suspense boundaries are placed where a UI region should reveal together. StrictMode catches missing cleanups and impure renders in dev. React 19: startTransition accepts async functions.'),
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
recommendedNextCommands: REACT19_NEXT_COMMANDS,
|
|
191
|
+
});
|
|
192
|
+
// ─── 7) Testing ──────────────────────────────────────────────────────────
|
|
193
|
+
export const REACT_19_TESTING = definePreset({
|
|
194
|
+
id: 'react-19-testing',
|
|
195
|
+
title: 'React 19 — Vitest + Testing Library + userEvent + MSW',
|
|
196
|
+
description: 'Vitest for Vite-based apps, @testing-library/react for rendering + querying, userEvent.setup() for interactions (not fireEvent), MSW for network mocking, behavior-not-implementation as the testing posture.',
|
|
197
|
+
tags: [...REACT19_TAGS, 'testing'],
|
|
198
|
+
appliesTo: [WorkspaceProfile.HasReact],
|
|
199
|
+
weight: 11,
|
|
200
|
+
includes: {
|
|
201
|
+
knowledge: [COMMON_AGENT_BRIEFING],
|
|
202
|
+
rules: [
|
|
203
|
+
COMMON_SAFETY_RULE,
|
|
204
|
+
REACT19_VITEST,
|
|
205
|
+
REACT19_TESTING_LIBRARY,
|
|
206
|
+
REACT19_TEST_BEHAVIOR_NOT_IMPL,
|
|
207
|
+
REACT19_MSW,
|
|
208
|
+
],
|
|
209
|
+
paths: [REACT_PATH_COMPONENTS, REACT_PATH_HOOKS],
|
|
210
|
+
templates: [],
|
|
211
|
+
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_UNIT_TEST],
|
|
212
|
+
docs: {
|
|
213
|
+
'overview.md': OVERVIEW_DOC('React 19 testing', 'Vitest runs the suite. @testing-library/react queries by role/label/text. userEvent.setup() drives the keyboard + pointer. MSW intercepts fetch at the network. Asserts target what the user sees — not internal hooks or state.'),
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
recommendedNextCommands: REACT19_NEXT_COMMANDS,
|
|
217
|
+
});
|
|
218
|
+
// ─── 8) React Server Components (RSC frameworks) ─────────────────────────
|
|
219
|
+
export const REACT_19_RSC = definePreset({
|
|
220
|
+
id: 'react-19-rsc',
|
|
221
|
+
title: 'React 19 — Server Components + Server Actions',
|
|
222
|
+
description: 'For framework-driven fullstack apps (Next.js app router, Remix, Waku): components are Server Components by default; "use client" is pushed to leaf components that actually need interactivity; Server Actions replace manual API routes for mutations; SSR streams through Suspense boundaries.',
|
|
223
|
+
tags: [...REACT19_TAGS, 'rsc', 'ssr'],
|
|
224
|
+
appliesTo: [WorkspaceProfile.HasReact, WorkspaceProfile.IsFrontend],
|
|
225
|
+
weight: 11,
|
|
226
|
+
includes: {
|
|
227
|
+
knowledge: [COMMON_AGENT_BRIEFING],
|
|
228
|
+
rules: [
|
|
229
|
+
COMMON_SAFETY_RULE,
|
|
230
|
+
REACT19_SERVER_COMPONENTS_DEFAULT,
|
|
231
|
+
REACT19_USE_CLIENT_BOUNDARY,
|
|
232
|
+
REACT19_SERVER_ACTIONS,
|
|
233
|
+
REACT19_STREAMING_SSR,
|
|
234
|
+
REACT19_SUSPENSE_BOUNDARIES,
|
|
235
|
+
],
|
|
236
|
+
paths: [REACT_PATH_COMPONENTS, REACT_PATH_PAGES, REACT_PATH_LIB],
|
|
237
|
+
templates: [],
|
|
238
|
+
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV],
|
|
239
|
+
docs: {
|
|
240
|
+
'overview.md': OVERVIEW_DOC('React 19 Server Components', 'Server-first by default in RSC frameworks. "use client" lives at the smallest interactive leaf, not the page root. Mutations go through Server Actions ("use server" functions) instead of manual API routes. SSR streams: shell ships first, slow data fills via Suspense.'),
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
recommendedNextCommands: REACT19_NEXT_COMMANDS,
|
|
244
|
+
});
|
|
245
|
+
// ─── 9) The whole stack — composes 1-7 ──────────────────────────────────
|
|
246
|
+
export const REACT_19_MODERN = definePreset({
|
|
247
|
+
id: 'react-19-modern',
|
|
248
|
+
title: 'React 19 — modern stack (components + hooks + actions + state + perf + concurrent + testing)',
|
|
249
|
+
description: 'The canonical preset for a new React 19+ app. Composes seven focused presets — components, hooks discipline, Actions, state, performance, concurrent, testing — and leaves RSC opt-in via the separate react-19-rsc preset (only relevant for framework apps).',
|
|
250
|
+
tags: [...REACT19_TAGS, 'comprehensive'],
|
|
251
|
+
appliesTo: [WorkspaceProfile.HasReact, WorkspaceProfile.IsFrontend],
|
|
252
|
+
weight: 12,
|
|
253
|
+
composes: [
|
|
254
|
+
'react-19-modern-components',
|
|
255
|
+
'react-19-hooks-discipline',
|
|
256
|
+
'react-19-actions-forms',
|
|
257
|
+
'react-19-state',
|
|
258
|
+
'react-19-performance',
|
|
259
|
+
'react-19-concurrent',
|
|
260
|
+
'react-19-testing',
|
|
261
|
+
],
|
|
262
|
+
includes: {
|
|
263
|
+
knowledge: [COMMON_AGENT_BRIEFING],
|
|
264
|
+
rules: [
|
|
265
|
+
COMMON_SAFETY_RULE,
|
|
266
|
+
// StrictMode and stable keys are baseline enough to repeat here.
|
|
267
|
+
REACT19_STRICT_MODE,
|
|
268
|
+
REACT19_STABLE_KEYS,
|
|
269
|
+
],
|
|
270
|
+
paths: [REACT_PATH_COMPONENTS, REACT_PATH_HOOKS, REACT_PATH_PAGES, REACT_PATH_LIB],
|
|
271
|
+
templates: [],
|
|
272
|
+
pipelines: [
|
|
273
|
+
COMMON_PIPELINE_CONTEXT_ONLY,
|
|
274
|
+
COMMON_PIPELINE_FEATURE_DEV,
|
|
275
|
+
COMMON_PIPELINE_UNIT_TEST,
|
|
276
|
+
],
|
|
277
|
+
docs: {
|
|
278
|
+
'overview.md': OVERVIEW_DOC('React 19 modern stack', 'Function components, no React.FC, ref-as-prop. Hooks at the top, useEffect only for external sync. <form action> + useActionState + useOptimistic for forms. TanStack Query for server state; the right shape for client state. React Compiler does memo for you. Lazy + Suspense for code-split. useTransition / useDeferredValue under load. Vitest + Testing Library + userEvent + MSW. Add react-19-rsc if the project is on a Server Components framework.'),
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
recommendedNextCommands: [
|
|
282
|
+
'shrk doctor',
|
|
283
|
+
'shrk surface list',
|
|
284
|
+
'shrk task "<task>"',
|
|
285
|
+
'shrk presets get react-19-rsc # add this preset if using Next.js / Remix / Waku',
|
|
286
|
+
],
|
|
287
|
+
surfaceProfile: 'small-app',
|
|
288
|
+
});
|
|
289
|
+
export const REACT_19_PRESETS = Object.freeze([
|
|
290
|
+
REACT_19_MODERN_COMPONENTS,
|
|
291
|
+
REACT_19_HOOKS_DISCIPLINE,
|
|
292
|
+
REACT_19_ACTIONS_FORMS,
|
|
293
|
+
REACT_19_STATE,
|
|
294
|
+
REACT_19_PERFORMANCE,
|
|
295
|
+
REACT_19_CONCURRENT,
|
|
296
|
+
REACT_19_TESTING,
|
|
297
|
+
REACT_19_RSC,
|
|
298
|
+
REACT_19_MODERN,
|
|
299
|
+
]);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const REACT19_FUNCTION_COMPONENTS: string;
|
|
2
|
+
export declare const REACT19_NO_REACT_FC: string;
|
|
3
|
+
export declare const REACT19_PROPS_INTERFACE: string;
|
|
4
|
+
export declare const REACT19_REF_AS_PROP: string;
|
|
5
|
+
export declare const REACT19_CONTEXT_AS_PROVIDER: string;
|
|
6
|
+
export declare const REACT19_DOCUMENT_METADATA: string;
|
|
7
|
+
export declare const REACT19_STYLESHEETS_IN_TREE: string;
|
|
8
|
+
export declare const REACT19_SELF_CLOSING: string;
|
|
9
|
+
export declare const REACT19_RULES_OF_HOOKS: string;
|
|
10
|
+
export declare const REACT19_USE_EFFECT_FOR_EXTERNAL_SYNC: string;
|
|
11
|
+
export declare const REACT19_NO_DERIVED_STATE_IN_EFFECT: string;
|
|
12
|
+
export declare const REACT19_NO_FETCH_IN_EFFECT: string;
|
|
13
|
+
export declare const REACT19_CUSTOM_HOOK_NAMING: string;
|
|
14
|
+
export declare const REACT19_EFFECT_CLEANUP: string;
|
|
15
|
+
export declare const REACT19_FORM_ACTIONS: string;
|
|
16
|
+
export declare const REACT19_USE_ACTION_STATE: string;
|
|
17
|
+
export declare const REACT19_USE_FORM_STATUS: string;
|
|
18
|
+
export declare const REACT19_USE_OPTIMISTIC: string;
|
|
19
|
+
export declare const REACT19_USE_HOOK: string;
|
|
20
|
+
export declare const REACT19_ASYNC_TRANSITIONS: string;
|
|
21
|
+
export declare const REACT19_SERVER_STATE_LIBRARY: string;
|
|
22
|
+
export declare const REACT19_CLIENT_STATE_PROPORTIONAL: string;
|
|
23
|
+
export declare const REACT19_FORMS_LIBRARY: string;
|
|
24
|
+
export declare const REACT19_AVOID_PROP_DRILLING: string;
|
|
25
|
+
export declare const REACT19_KEYS_FOR_RESET: string;
|
|
26
|
+
export declare const REACT19_COMPILER_AUTO_MEMO: string;
|
|
27
|
+
export declare const REACT19_LAZY_SUSPENSE: string;
|
|
28
|
+
export declare const REACT19_VIRTUALIZE_LISTS: string;
|
|
29
|
+
export declare const REACT19_STABLE_KEYS: string;
|
|
30
|
+
export declare const REACT19_IMAGE_OPTIMIZATION: string;
|
|
31
|
+
export declare const REACT19_USE_TRANSITION: string;
|
|
32
|
+
export declare const REACT19_USE_DEFERRED_VALUE: string;
|
|
33
|
+
export declare const REACT19_SUSPENSE_BOUNDARIES: string;
|
|
34
|
+
export declare const REACT19_STRICT_MODE: string;
|
|
35
|
+
export declare const REACT19_VITEST: string;
|
|
36
|
+
export declare const REACT19_TESTING_LIBRARY: string;
|
|
37
|
+
export declare const REACT19_TEST_BEHAVIOR_NOT_IMPL: string;
|
|
38
|
+
export declare const REACT19_MSW: string;
|
|
39
|
+
export declare const REACT19_SERVER_COMPONENTS_DEFAULT: string;
|
|
40
|
+
export declare const REACT19_USE_CLIENT_BOUNDARY: string;
|
|
41
|
+
export declare const REACT19_SERVER_ACTIONS: string;
|
|
42
|
+
export declare const REACT19_STREAMING_SSR: string;
|
|
43
|
+
//# sourceMappingURL=react19-snippets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react19-snippets.d.ts","sourceRoot":"","sources":["../../src/builtin/react19-snippets.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,2BAA2B,QAQtC,CAAC;AAEH,eAAO,MAAM,mBAAmB,QAQ9B,CAAC;AAEH,eAAO,MAAM,uBAAuB,QAQlC,CAAC;AAEH,eAAO,MAAM,mBAAmB,QAQ9B,CAAC;AAEH,eAAO,MAAM,2BAA2B,QAQtC,CAAC;AAEH,eAAO,MAAM,yBAAyB,QAQpC,CAAC;AAEH,eAAO,MAAM,2BAA2B,QAQtC,CAAC;AAEH,eAAO,MAAM,oBAAoB,QAQ/B,CAAC;AAIH,eAAO,MAAM,sBAAsB,QAQjC,CAAC;AAEH,eAAO,MAAM,oCAAoC,QAQ/C,CAAC;AAEH,eAAO,MAAM,kCAAkC,QAQ7C,CAAC;AAEH,eAAO,MAAM,0BAA0B,QAQrC,CAAC;AAEH,eAAO,MAAM,0BAA0B,QAQrC,CAAC;AAEH,eAAO,MAAM,sBAAsB,QAQjC,CAAC;AAIH,eAAO,MAAM,oBAAoB,QAQ/B,CAAC;AAEH,eAAO,MAAM,wBAAwB,QAQnC,CAAC;AAEH,eAAO,MAAM,uBAAuB,QAQlC,CAAC;AAEH,eAAO,MAAM,sBAAsB,QAQjC,CAAC;AAEH,eAAO,MAAM,gBAAgB,QAQ3B,CAAC;AAEH,eAAO,MAAM,yBAAyB,QAQpC,CAAC;AAIH,eAAO,MAAM,4BAA4B,QAQvC,CAAC;AAEH,eAAO,MAAM,iCAAiC,QAQ5C,CAAC;AAEH,eAAO,MAAM,qBAAqB,QAQhC,CAAC;AAEH,eAAO,MAAM,2BAA2B,QAQtC,CAAC;AAEH,eAAO,MAAM,sBAAsB,QAQjC,CAAC;AAIH,eAAO,MAAM,0BAA0B,QAQrC,CAAC;AAEH,eAAO,MAAM,qBAAqB,QAQhC,CAAC;AAEH,eAAO,MAAM,wBAAwB,QAQnC,CAAC;AAEH,eAAO,MAAM,mBAAmB,QAQ9B,CAAC;AAEH,eAAO,MAAM,0BAA0B,QAQrC,CAAC;AAIH,eAAO,MAAM,sBAAsB,QAQjC,CAAC;AAEH,eAAO,MAAM,0BAA0B,QAQrC,CAAC;AAEH,eAAO,MAAM,2BAA2B,QAQtC,CAAC;AAEH,eAAO,MAAM,mBAAmB,QAQ9B,CAAC;AAIH,eAAO,MAAM,cAAc,QAQzB,CAAC;AAEH,eAAO,MAAM,uBAAuB,QAQlC,CAAC;AAEH,eAAO,MAAM,8BAA8B,QAQzC,CAAC;AAEH,eAAO,MAAM,WAAW,QAQtB,CAAC;AAIH,eAAO,MAAM,iCAAiC,QAQ5C,CAAC;AAEH,eAAO,MAAM,2BAA2B,QAQtC,CAAC;AAEH,eAAO,MAAM,sBAAsB,QAQjC,CAAC;AAEH,eAAO,MAAM,qBAAqB,QAQhC,CAAC"}
|