@hook-sdk/template 0.23.0 → 0.23.2

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/index.d.cts CHANGED
@@ -208,18 +208,27 @@ type AppRootProps = AppRootSlots & {
208
208
  declare function AppRoot(props: AppRootProps): react_jsx_runtime.JSX.Element;
209
209
 
210
210
  /**
211
- * Build-time + runtime gate for dev-only tools (e.g. <DevSkipOnboardingFab>).
211
+ * Runtime gate for dev-only tools (e.g. <DevSkipOnboardingFab>).
212
212
  *
213
- * Two independent signals must agree:
213
+ * History:
214
+ * v0.23.0 / v0.23.1 also gated on `import.meta.env.VITE_HOOK_DEV_TOOLS`.
215
+ * That was intended as a build-time DCE signal so the dev module would
216
+ * tree-shake out of prod bundles. Empirically vite's static replacement
217
+ * does NOT apply to template code consumed from node_modules when the
218
+ * creator app uses `build.lib` mode — every consumer ended up with
219
+ * `undefined !== '1'` → DCE killed the FAB from STAGING bundles too.
214
220
  *
215
- * 1. Build-time: `import.meta.env.VITE_HOOK_DEV_TOOLS === '1'`. Vite folds
216
- * this constant at build time when unset, the entire dev tree is
217
- * tree-shaken from the prod bundle (sideEffects:false in package.json
218
- * makes that effective). Set `VITE_HOOK_DEV_TOOLS=1` only in
219
- * `.env.staging` builds.
221
+ * Pragmatic fix: drop the env gate and rely on the runtime hostname
222
+ * check alone. The FAB code now ships in prod bundles too (~5 KB), but
223
+ * it never renders on prod hostnames because `.staging.` / `localhost`
224
+ * is the only path that returns `true`. Visual safety = hostname check
225
+ * at render. Compliance / privacy = no real user can ever trigger the
226
+ * auto-signup branch on a `usehook.net` (prod) origin.
220
227
  *
221
- * 2. Runtime: hostname must be staging-ish. Belt-and-suspenders against
222
- * a misconfigured build that somehow ships the FAB to prod.
228
+ * If a creator app wants the build-time DCE back, the consumer's
229
+ * `vite.config.ts` `define` block must explicitly substitute
230
+ * `import.meta.env.VITE_HOOK_DEV_TOOLS` — vite's auto-replacement skips
231
+ * `node_modules` in lib mode.
223
232
  */
224
233
  declare function isDevToolsEnabled(): boolean;
225
234
 
package/dist/index.d.ts CHANGED
@@ -208,18 +208,27 @@ type AppRootProps = AppRootSlots & {
208
208
  declare function AppRoot(props: AppRootProps): react_jsx_runtime.JSX.Element;
209
209
 
210
210
  /**
211
- * Build-time + runtime gate for dev-only tools (e.g. <DevSkipOnboardingFab>).
211
+ * Runtime gate for dev-only tools (e.g. <DevSkipOnboardingFab>).
212
212
  *
213
- * Two independent signals must agree:
213
+ * History:
214
+ * v0.23.0 / v0.23.1 also gated on `import.meta.env.VITE_HOOK_DEV_TOOLS`.
215
+ * That was intended as a build-time DCE signal so the dev module would
216
+ * tree-shake out of prod bundles. Empirically vite's static replacement
217
+ * does NOT apply to template code consumed from node_modules when the
218
+ * creator app uses `build.lib` mode — every consumer ended up with
219
+ * `undefined !== '1'` → DCE killed the FAB from STAGING bundles too.
214
220
  *
215
- * 1. Build-time: `import.meta.env.VITE_HOOK_DEV_TOOLS === '1'`. Vite folds
216
- * this constant at build time when unset, the entire dev tree is
217
- * tree-shaken from the prod bundle (sideEffects:false in package.json
218
- * makes that effective). Set `VITE_HOOK_DEV_TOOLS=1` only in
219
- * `.env.staging` builds.
221
+ * Pragmatic fix: drop the env gate and rely on the runtime hostname
222
+ * check alone. The FAB code now ships in prod bundles too (~5 KB), but
223
+ * it never renders on prod hostnames because `.staging.` / `localhost`
224
+ * is the only path that returns `true`. Visual safety = hostname check
225
+ * at render. Compliance / privacy = no real user can ever trigger the
226
+ * auto-signup branch on a `usehook.net` (prod) origin.
220
227
  *
221
- * 2. Runtime: hostname must be staging-ish. Belt-and-suspenders against
222
- * a misconfigured build that somehow ships the FAB to prod.
228
+ * If a creator app wants the build-time DCE back, the consumer's
229
+ * `vite.config.ts` `define` block must explicitly substitute
230
+ * `import.meta.env.VITE_HOOK_DEV_TOOLS` — vite's auto-replacement skips
231
+ * `node_modules` in lib mode.
223
232
  */
224
233
  declare function isDevToolsEnabled(): boolean;
225
234
 
package/dist/index.js CHANGED
@@ -2099,8 +2099,6 @@ function I18nProvider({
2099
2099
 
2100
2100
  // src/dev/env.ts
2101
2101
  function isDevToolsEnabled() {
2102
- const meta = import.meta;
2103
- if (meta.env?.VITE_HOOK_DEV_TOOLS !== "1") return false;
2104
2102
  if (typeof window === "undefined") return false;
2105
2103
  const host = window.location.hostname;
2106
2104
  return host.includes(".staging.") || host === "localhost" || host === "127.0.0.1";