@hook-sdk/template 0.23.0 → 0.23.1

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
@@ -213,13 +213,21 @@ declare function AppRoot(props: AppRootProps): react_jsx_runtime.JSX.Element;
213
213
  * Two independent signals must agree:
214
214
  *
215
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.
216
+ * this constant at the consumer app's build time — when unset, the
217
+ * entire dev tree is tree-shaken from the prod bundle. Set
218
+ * `VITE_HOOK_DEV_TOOLS=1` only in the staging build env.
220
219
  *
221
220
  * 2. Runtime: hostname must be staging-ish. Belt-and-suspenders against
222
221
  * a misconfigured build that somehow ships the FAB to prod.
222
+ *
223
+ * IMPORTANT: the env access MUST be the literal token
224
+ * `import.meta.env.VITE_HOOK_DEV_TOOLS`. Vite's static replacement is a
225
+ * text substitution that only fires on this exact form. Going through a
226
+ * local alias (`const meta = import.meta; meta.env.X`) defeats the
227
+ * substitution and the consumer bundle ends up with `undefined` regardless
228
+ * of what the build env actually has set. See `../vite-env.d.ts` for the
229
+ * ambient ImportMeta augmentation that keeps TypeScript happy without a
230
+ * cast at the access site.
223
231
  */
224
232
  declare function isDevToolsEnabled(): boolean;
225
233
 
package/dist/index.d.ts CHANGED
@@ -213,13 +213,21 @@ declare function AppRoot(props: AppRootProps): react_jsx_runtime.JSX.Element;
213
213
  * Two independent signals must agree:
214
214
  *
215
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.
216
+ * this constant at the consumer app's build time — when unset, the
217
+ * entire dev tree is tree-shaken from the prod bundle. Set
218
+ * `VITE_HOOK_DEV_TOOLS=1` only in the staging build env.
220
219
  *
221
220
  * 2. Runtime: hostname must be staging-ish. Belt-and-suspenders against
222
221
  * a misconfigured build that somehow ships the FAB to prod.
222
+ *
223
+ * IMPORTANT: the env access MUST be the literal token
224
+ * `import.meta.env.VITE_HOOK_DEV_TOOLS`. Vite's static replacement is a
225
+ * text substitution that only fires on this exact form. Going through a
226
+ * local alias (`const meta = import.meta; meta.env.X`) defeats the
227
+ * substitution and the consumer bundle ends up with `undefined` regardless
228
+ * of what the build env actually has set. See `../vite-env.d.ts` for the
229
+ * ambient ImportMeta augmentation that keeps TypeScript happy without a
230
+ * cast at the access site.
223
231
  */
224
232
  declare function isDevToolsEnabled(): boolean;
225
233
 
package/dist/index.js CHANGED
@@ -2099,8 +2099,7 @@ 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;
2102
+ if (import.meta.env.VITE_HOOK_DEV_TOOLS !== "1") return false;
2104
2103
  if (typeof window === "undefined") return false;
2105
2104
  const host = window.location.hostname;
2106
2105
  return host.includes(".staging.") || host === "localhost" || host === "127.0.0.1";