Skip to content

Commit 2e34aa5

Browse files
committed
Keep the Platform client build free of Node modules and refresh audit baselines
1 parent 8b65e98 commit 2e34aa5

4 files changed

Lines changed: 231 additions & 229 deletions

File tree

‎apps/sim/platform/AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Use [the shared Platform time formatters](lib/time.ts) for displayed ages, clock
5656

5757
## Phase 3 data seam
5858

59-
Only `lib/data/**` may import from outside this project: query hooks under `@/hooks/queries`, contracts and clients under `@/lib/api`, and the named helpers listed in `scripts/check-platform-design.ts`. `@/app`, `@/components` and `@sim/emcn` stay banned there too. Add a helper to that list only after reading its runtime import closure.
59+
Only `lib/data/**` may import from outside this project: query hooks under `@/hooks/queries/<domain>`, contracts and clients under `@/lib/api/<module>`, and the named helpers listed in `scripts/check-platform-design.ts`. `@/app/<route>`, `@/components/<name>` and the legacy `@sim/emcn` barrel stay banned there too. Add a helper to that list only after reading its runtime import closure.
6060

6161
Each `lib/data/<domain>.ts` wraps the existing hook and maps its contract shape to a Platform view model with a pure adapter. Never fork a hook, key factory, invalidation or contract; a hook that lacks a needed option gains it additively. A module's first import of a query hook that toasts resolves through `lib/data/emcn-shim.ts`, which webpack substitutes for `@sim/emcn` and which exports only `toast`, bridged to the notification tray. Any other name from that package fails the build, which is what proves no legacy UI entered.
6262

‎apps/sim/platform/next.config.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ const config: NextConfig = {
3535
]
3636
: []
3737
},
38-
webpack(webpackConfig) {
38+
webpack(webpackConfig, { isServer, webpack }) {
39+
// `@sim/logger` requires this behind a runtime Node check, so browsers never evaluate it.
40+
if (!isServer) {
41+
webpackConfig.plugins.push(new webpack.IgnorePlugin({ resourceRegExp: /^node:async_hooks$/ }))
42+
}
3943
// No `$`, so `@sim/emcn/icons` resolves beneath the shim file and fails the build as missing.
4044
webpackConfig.resolve.alias['@sim/emcn'] = emcnShim
4145
// A named import the shim lacks is an error in our sources, not webpack's default warning.

0 commit comments

Comments
 (0)