@gxp-dev/tools 2.0.78 → 2.0.79

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gxp-dev/tools",
3
- "version": "2.0.78",
3
+ "version": "2.0.79",
4
4
  "description": "Dev tools to create platform plugins",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
@@ -314,24 +314,34 @@ export default defineConfig(async (ctx) => {
314
314
  // GxP Inspector plugin for browser extension integration
315
315
  ...(useInspector ? [gxpInspectorPlugin()] : []),
316
316
  // `externalGlobals` rewrites `import ... from "vue"` → references to
317
- // the `Vue` global that the GxP platform exposes on `window`. This is
318
- // only desirable at **build** time — in dev, the toolkit runtime
319
- // bootstraps its own Vue + Pinia (via main.js → createApp + app.use),
320
- // and rewriting `from "pinia"` to a non-existent `window.Pinia`
321
- // crashes `getActivePinia()` at store init.
317
+ // the `Vue` global that the GxP platform exposes on `window`, and
318
+ // `@/stores/gxpPortalConfigStore` imports `window.useGxpStore`.
322
319
  //
323
- // Using `apply: "build"` restricts the transform to production builds,
324
- // where it rewrites every module in the final bundle (including
325
- // transitive node_modules deps) so no bare specifiers leak through.
326
- {
327
- ...externalGlobals({
320
+ // We want this to run in BOTH dev and build so user source code keeps
321
+ // the same external-store indirection regardless of mode. The only
322
+ // exception is the toolkit's own runtime code (`@gxp-dev/tools/runtime/
323
+ // *.js` and the workspace equivalent) — that code bootstraps its own
324
+ // local Vue + Pinia via main.js (createApp + app.use) and would crash
325
+ // with "getActivePinia() was called" if its `from "pinia"` were
326
+ // rewritten to a non-existent `window.Pinia`.
327
+ //
328
+ // So: exclude the toolkit's runtime from the transform.
329
+ externalGlobals(
330
+ {
328
331
  vue: "Vue",
329
332
  pinia: "Pinia",
330
333
  "@/stores/gxpPortalConfigStore":
331
334
  "(window.useGxpStore || (() => { console.warn('useGxpStore not found on window, using fallback'); return {}; }))",
332
- }),
333
- apply: "build",
334
- },
335
+ },
336
+ {
337
+ exclude: [
338
+ // Consumer install (published toolkit from npm)
339
+ "**/node_modules/@gxp-dev/tools/**",
340
+ // Workspace / `npm link` / self-dev: the runtime source itself
341
+ `${runtimeDir.replace(/\\/g, "/")}/**`,
342
+ ],
343
+ },
344
+ ),
335
345
  // Custom request logging and CORS plugin
336
346
  {
337
347
  name: "request-logger-cors",