@kbach/react 0.6.13 → 0.6.14

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.
@@ -3493,9 +3493,21 @@ function kbach(userConfigOrOptions) {
3493
3493
  },
3494
3494
  // When any JS/TS file imports kbach.css, prepend a disableRuntimeCSS() call
3495
3495
  // so styles come solely from the static stylesheet — no duplicate injection.
3496
+ //
3497
+ // Anchored to the START of a source line (^\s*, with the m flag) rather than a
3498
+ // bare \bimport\b anywhere in the file — disableRuntimeCSS() sets a globalThis
3499
+ // flag with no way to re-enable it, so a false match here doesn't just misfire
3500
+ // once, it silently kills ALL runtime CSS injection for the rest of that page's
3501
+ // JS lifetime, including on completely unrelated components. A real import
3502
+ // statement is always the first token on its line (give or take whitespace);
3503
+ // this same text appearing as part of a STRING — e.g. a docs site's own code
3504
+ // sample literally showing `import "./kbach.css";` as example text, which is
3505
+ // exactly what happened here — is never positioned that way, since something
3506
+ // always precedes it syntactically (a quote, JSX braces, an array bracket, …).
3496
3507
  transform(code, id) {
3497
3508
  if (!/\.(tsx?|jsx?|mjs?)$/.test(id)) return;
3498
- if (!/\bimport\b[^;]*['"].*kbach\.css['"]/i.test(code)) return;
3509
+ if (!/^\s*import\b[^;]*['"][^'"]*kbach\.css['"]/im.test(code)) return;
3510
+ warn(`disableRuntimeCSS() auto-triggered by an import in ${id.replace(/\\/g, "/")}`);
3499
3511
  return {
3500
3512
  code: `import { disableRuntimeCSS } from '@kbach/react';
3501
3513
  disableRuntimeCSS();
@@ -3459,9 +3459,21 @@ function kbach(userConfigOrOptions) {
3459
3459
  },
3460
3460
  // When any JS/TS file imports kbach.css, prepend a disableRuntimeCSS() call
3461
3461
  // so styles come solely from the static stylesheet — no duplicate injection.
3462
+ //
3463
+ // Anchored to the START of a source line (^\s*, with the m flag) rather than a
3464
+ // bare \bimport\b anywhere in the file — disableRuntimeCSS() sets a globalThis
3465
+ // flag with no way to re-enable it, so a false match here doesn't just misfire
3466
+ // once, it silently kills ALL runtime CSS injection for the rest of that page's
3467
+ // JS lifetime, including on completely unrelated components. A real import
3468
+ // statement is always the first token on its line (give or take whitespace);
3469
+ // this same text appearing as part of a STRING — e.g. a docs site's own code
3470
+ // sample literally showing `import "./kbach.css";` as example text, which is
3471
+ // exactly what happened here — is never positioned that way, since something
3472
+ // always precedes it syntactically (a quote, JSX braces, an array bracket, …).
3462
3473
  transform(code, id) {
3463
3474
  if (!/\.(tsx?|jsx?|mjs?)$/.test(id)) return;
3464
- if (!/\bimport\b[^;]*['"].*kbach\.css['"]/i.test(code)) return;
3475
+ if (!/^\s*import\b[^;]*['"][^'"]*kbach\.css['"]/im.test(code)) return;
3476
+ warn(`disableRuntimeCSS() auto-triggered by an import in ${id.replace(/\\/g, "/")}`);
3465
3477
  return {
3466
3478
  code: `import { disableRuntimeCSS } from '@kbach/react';
3467
3479
  disableRuntimeCSS();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.6.13",
3
+ "version": "0.6.14",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",