@stacksjs/stx 0.2.572 → 0.2.573
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/a11y.d.ts +51 -111
- package/dist/animation.d.ts +131 -74
- package/dist/api-client.d.ts +11 -21
- package/dist/api-handler.d.ts +4 -4
- package/dist/appearance-bootstrap.d.ts +16 -77
- package/dist/application-layers.d.ts +11 -20
- package/dist/asset-roots.d.ts +7 -27
- package/dist/assets.d.ts +7 -9
- package/dist/async-components.d.ts +56 -78
- package/dist/auth.d.ts +0 -3
- package/dist/browser-core-imports.d.ts +2 -2
- package/dist/build-externalize-repeated.d.ts +0 -25
- package/dist/build-externalize.d.ts +18 -53
- package/dist/build-id.d.ts +40 -28
- package/dist/build-message.d.ts +20 -44
- package/dist/builtins/attrs.d.ts +0 -14
- package/dist/builtins/drawer.d.ts +3 -22
- package/dist/builtins/icon.d.ts +17 -19
- package/dist/builtins/image-alpha.d.ts +8 -8
- package/dist/builtins/image-delivery.d.ts +38 -40
- package/dist/builtins/image-placeholder.d.ts +12 -50
- package/dist/builtins/image-warmup-worker.d.ts +1 -1
- package/dist/builtins/image-worker.d.ts +6 -32
- package/dist/builtins/index.d.ts +16 -6
- package/dist/builtins/modal.d.ts +13 -23
- package/dist/builtins/safe-image.d.ts +2 -42
- package/dist/builtins/stx-image.d.ts +44 -24
- package/dist/builtins/stx-link.d.ts +5 -8
- package/dist/builtins/stx-loading-indicator.d.ts +11 -10
- package/dist/builtins/suspense.d.ts +6 -27
- package/dist/builtins/toast.d.ts +15 -16
- package/dist/builtins/transition-group.d.ts +1 -25
- package/dist/caching.d.ts +24 -21
- package/dist/{chunk-f4jh9vrj.js → chunk-0s647d0b.js} +53 -53
- package/dist/{chunk-09gtbb1w.js → chunk-1bsafdnt.js} +1 -1
- package/dist/{chunk-m6mxqepz.js → chunk-1btr5tme.js} +1 -1
- package/dist/{chunk-01mxer9s.js → chunk-2g6wcnna.js} +1 -1
- package/dist/{chunk-rrj5m9xv.js → chunk-2hg2bqtj.js} +1 -1
- package/dist/{chunk-xckzvbvn.js → chunk-4f0fh2a9.js} +1 -1
- package/dist/chunk-557wtdps.js +2 -0
- package/dist/{chunk-vr36s2en.js → chunk-58vrf6kh.js} +1 -1
- package/dist/{chunk-qzbzn1yf.js → chunk-6tsnz28m.js} +1 -1
- package/dist/{chunk-cvswrbzw.js → chunk-6x8cwscv.js} +1 -1
- package/dist/{chunk-1n64749x.js → chunk-74ew8ajw.js} +1 -1
- package/dist/{chunk-jqefcghh.js → chunk-78d6yyxz.js} +2 -2
- package/dist/{chunk-83fdt4yj.js → chunk-824cnbac.js} +1 -1
- package/dist/{chunk-ntgy4e1q.js → chunk-864xm0jy.js} +1 -1
- package/dist/{chunk-nn174xjh.js → chunk-9fbkdrm8.js} +1 -1
- package/dist/{chunk-kzjrgh0b.js → chunk-a3gvw1q2.js} +1 -1
- package/dist/{chunk-pqcvh9pp.js → chunk-amtrg7pn.js} +1 -1
- package/dist/{chunk-pw9verqx.js → chunk-b5fpsp5n.js} +1 -1
- package/dist/{chunk-5afw7z6v.js → chunk-bcjr3fw7.js} +1 -1
- package/dist/{chunk-n6qp05t9.js → chunk-bkj0j5se.js} +1 -1
- package/dist/{chunk-mzqyv7s5.js → chunk-cf97xdqa.js} +1 -1
- package/dist/{chunk-cgwyd9aq.js → chunk-cr67dpx4.js} +1 -1
- package/dist/{chunk-f1apaqfk.js → chunk-dpqvacd1.js} +1 -1
- package/dist/{chunk-ghy82tsc.js → chunk-et8726at.js} +1 -1
- package/dist/{chunk-4bgfpkwx.js → chunk-ev8t5cxk.js} +1 -1
- package/dist/{chunk-s34g3awk.js → chunk-fynh3bkq.js} +1 -1
- package/dist/{chunk-gzgc8zk5.js → chunk-g8757f97.js} +2 -2
- package/dist/{chunk-3gft8zng.js → chunk-hm4j4d8q.js} +1 -1
- package/dist/{chunk-0bt0fbs1.js → chunk-j9qy9t3t.js} +5 -5
- package/dist/{chunk-2a1q5y6r.js → chunk-jhc47xzj.js} +1 -1
- package/dist/{chunk-79vdkvhf.js → chunk-kns5m52j.js} +1 -1
- package/dist/{chunk-2cqbyb8w.js → chunk-mjpewk4r.js} +1 -1
- package/dist/{chunk-2jjff8kv.js → chunk-nj488tj2.js} +2 -2
- package/dist/{chunk-dcpf6kas.js → chunk-q9chv68c.js} +1 -1
- package/dist/{chunk-xq2ck69k.js → chunk-qm280dp3.js} +1 -1
- package/dist/{chunk-ymawe0y5.js → chunk-sjcstv33.js} +1 -1
- package/dist/{chunk-tc5r2vmw.js → chunk-t0zdz8kd.js} +1 -1
- package/dist/{chunk-jwvzvapp.js → chunk-t3dnak1j.js} +1 -1
- package/dist/{chunk-2jsnrfc8.js → chunk-t64nnmmj.js} +1 -1
- package/dist/{chunk-m2a1fxpb.js → chunk-tvb8p7c0.js} +1 -1
- package/dist/{chunk-6f4qrd0s.js → chunk-tyhgq6rw.js} +1 -1
- package/dist/{chunk-4wfr074d.js → chunk-vn7tc8hm.js} +1 -1
- package/dist/{chunk-y4ajd836.js → chunk-xy6g8zb9.js} +1 -1
- package/dist/{chunk-zddzjd60.js → chunk-ya7xks9t.js} +1 -1
- package/dist/chunk-zpz6q2fh.js +2 -0
- package/dist/chunk-zxt94g45.js +2 -0
- package/dist/{chunk-cyg9w31a.js → chunk-zz7tw07b.js} +1 -1
- package/dist/{chunk-ta8bhz27.js → chunk-zzcxacjf.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/client/directive.d.ts +0 -7
- package/dist/client/index.d.ts +1 -0
- package/dist/client/signals-appearance-runtime.d.ts +1 -1
- package/dist/client/signals-binding-utils-runtime.d.ts +1 -1
- package/dist/client/signals-bootstrap-runtime.d.ts +2 -2
- package/dist/client/signals-class-runtime.d.ts +1 -1
- package/dist/client/signals-component-api-runtime.d.ts +1 -1
- package/dist/client/signals-component-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-component-props-runtime.d.ts +1 -1
- package/dist/client/signals-conditional-chain-runtime.d.ts +1 -1
- package/dist/client/signals-conditional-component-runtime.d.ts +1 -1
- package/dist/client/signals-container-cleanup-runtime.d.ts +1 -1
- package/dist/client/signals-context-runtime.d.ts +1 -1
- package/dist/client/signals-cookie-runtime.d.ts +1 -1
- package/dist/client/signals-devtools-runtime.d.ts +1 -1
- package/dist/client/signals-dialog-runtime.d.ts +1 -1
- package/dist/client/signals-dom-ready-runtime.d.ts +1 -1
- package/dist/client/signals-drawer-runtime.d.ts +1 -1
- package/dist/client/signals-effect-runtime.d.ts +1 -1
- package/dist/client/signals-event-shorthand-runtime.d.ts +1 -1
- package/dist/client/signals-expression-compiler-runtime.d.ts +1 -1
- package/dist/client/signals-expression-runtime.d.ts +1 -1
- package/dist/client/signals-fetch-transport-runtime.d.ts +1 -1
- package/dist/client/signals-for-runtime.d.ts +1 -1
- package/dist/client/signals-globals-runtime.d.ts +1 -1
- package/dist/client/signals-handler-runtime.d.ts +1 -1
- package/dist/client/signals-head-runtime.d.ts +1 -1
- package/dist/client/signals-helpers-runtime.d.ts +1 -1
- package/dist/client/signals-host-runtime.d.ts +1 -1
- package/dist/client/signals-hydration-audit-runtime.d.ts +1 -1
- package/dist/client/signals-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-if-chain-runtime.d.ts +1 -1
- package/dist/client/signals-if-runtime.d.ts +1 -1
- package/dist/client/signals-lazy-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-lifecycle-runtime.d.ts +1 -1
- package/dist/client/signals-loop-component-remap-runtime.d.ts +1 -1
- package/dist/client/signals-loop-conditional-runtime.d.ts +1 -1
- package/dist/client/signals-loop-row-runtime.d.ts +1 -1
- package/dist/client/signals-manifest-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-model-runtime.d.ts +1 -1
- package/dist/client/signals-mount-runtime.d.ts +1 -1
- package/dist/client/signals-navigation-runtime.d.ts +1 -1
- package/dist/client/signals-notify-runtime.d.ts +1 -1
- package/dist/client/signals-optimistic-runtime.d.ts +1 -1
- package/dist/client/signals-overlay-runtime.d.ts +1 -1
- package/dist/client/signals-pipe-runtime.d.ts +1 -1
- package/dist/client/signals-proxy-runtime.d.ts +1 -1
- package/dist/client/signals-query-runtime.d.ts +1 -1
- package/dist/client/signals-reactive-runtime.d.ts +1 -1
- package/dist/client/signals-ref-runtime.d.ts +1 -1
- package/dist/client/signals-scope-disposal-runtime.d.ts +1 -1
- package/dist/client/signals-scope-traversal-runtime.d.ts +1 -1
- package/dist/client/signals-show-runtime.d.ts +1 -1
- package/dist/client/signals-spa-load-control-runtime.d.ts +1 -1
- package/dist/client/signals-spa-load-runtime.d.ts +1 -1
- package/dist/client/signals-state-runtime.d.ts +1 -1
- package/dist/client/signals-storage-runtime.d.ts +1 -1
- package/dist/client/signals-store-registry-runtime.d.ts +1 -1
- package/dist/client/signals-style-runtime.d.ts +1 -1
- package/dist/client/signals-suspense-runtime.d.ts +1 -1
- package/dist/client/signals-timer-runtime.d.ts +1 -1
- package/dist/client/signals-toast-runtime.d.ts +1 -1
- package/dist/client/signals-tooltip-runtime.d.ts +1 -1
- package/dist/client/signals-transition-group-runtime.d.ts +1 -1
- package/dist/client/signals-websocket-runtime.d.ts +1 -1
- package/dist/client-helpers.d.ts +1 -312
- package/dist/client-module-registry.d.ts +4 -27
- package/dist/client-parameter-bindings.d.ts +1 -4
- package/dist/client-script-bundler.d.ts +55 -103
- package/dist/client-script.d.ts +69 -127
- package/dist/color-mode-boot.d.ts +21 -58
- package/dist/component-client-factories.d.ts +8 -9
- package/dist/component-contract-checks.d.ts +15 -18
- package/dist/component-contract.d.ts +6 -6
- package/dist/component-hmr.d.ts +8 -7
- package/dist/component-model.d.ts +14 -20
- package/dist/component-processing.d.ts +51 -59
- package/dist/component-registry.d.ts +28 -99
- package/dist/component-renderer.d.ts +19 -16
- package/dist/component-resolution.d.ts +8 -8
- package/dist/component-tags.d.ts +1 -1
- package/dist/composable-loader.d.ts +6 -41
- package/dist/composables/use-fetch.d.ts +45 -114
- package/dist/composables/use-form.d.ts +2 -56
- package/dist/composables/use-intersection-observer.d.ts +1 -1
- package/dist/composables.d.ts +75 -74
- package/dist/composition-api.d.ts +19 -43
- package/dist/computed.d.ts +93 -86
- package/dist/conditionals.d.ts +0 -24
- package/dist/config.d.ts +30 -24
- package/dist/config.js +3 -0
- package/dist/craft-bridge.d.ts +1 -467
- package/dist/craft-components.d.ts +234 -680
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/csp.d.ts +41 -107
- package/dist/database.d.ts +1 -1
- package/dist/defer.d.ts +0 -24
- package/dist/dev-server/terminal-colors.d.ts +32 -32
- package/dist/dev-server/ts-css.d.ts +26 -35
- package/dist/dev-server/types.d.ts +33 -29
- package/dist/directive-api.d.ts +42 -85
- package/dist/directive-arguments.d.ts +14 -39
- package/dist/document-shell.d.ts +49 -81
- package/dist/dynamic-components.d.ts +0 -9
- package/dist/engine-bindings.d.ts +1 -1
- package/dist/env.d.ts +26 -0
- package/dist/error-boundaries.d.ts +36 -43
- package/dist/error-handling.d.ts +1 -1
- package/dist/errors/codes.d.ts +43 -51
- package/dist/errors/formatter.d.ts +38 -58
- package/dist/errors/index.d.ts +61 -5
- package/dist/errors/logger.d.ts +40 -114
- package/dist/errors/sanitizer.d.ts +28 -53
- package/dist/errors/types.d.ts +31 -44
- package/dist/events.d.ts +32 -94
- package/dist/expressions.d.ts +57 -62
- package/dist/find-body-tag.d.ts +5 -34
- package/dist/first-script-tag.d.ts +0 -23
- package/dist/forms-validation.d.ts +117 -149
- package/dist/forms.d.ts +161 -120
- package/dist/framework-composables.d.ts +0 -32
- package/dist/head-injection.d.ts +30 -32
- package/dist/head-keys.d.ts +12 -15
- package/dist/head.d.ts +110 -139
- package/dist/heatmap.d.ts +76 -152
- package/dist/html-masking.d.ts +38 -62
- package/dist/hydration-runtime.d.ts +24 -20
- package/dist/hydration.d.ts +11 -10
- package/dist/i18n.d.ts +34 -95
- package/dist/image-optimization/auto-sibling.d.ts +4 -32
- package/dist/imported-signals.d.ts +0 -36
- package/dist/includes.d.ts +6 -69
- package/dist/index.d.ts +2 -1
- package/dist/init.d.ts +12 -20
- package/dist/internal-markdown.d.ts +8 -12
- package/dist/interpolation-context.d.ts +15 -15
- package/dist/island-chunking.d.ts +13 -30
- package/dist/keep-alive.d.ts +52 -72
- package/dist/layout-types.d.ts +2 -27
- package/dist/lazy-module.d.ts +0 -10
- package/dist/loading-indicator.d.ts +8 -5
- package/dist/loop-binding.d.ts +4 -7
- package/dist/loops.d.ts +25 -67
- package/dist/markdown.d.ts +1 -0
- package/dist/media/image/component.d.ts +9 -25
- package/dist/media/image/directive.d.ts +1 -15
- package/dist/media/image/placeholder.d.ts +9 -20
- package/dist/media/image/processor/cache.d.ts +18 -40
- package/dist/media/image/processor/index.d.ts +10 -1
- package/dist/media/image/processor/optimizer.d.ts +1 -12
- package/dist/media/image/processor/responsive.d.ts +6 -16
- package/dist/media/image/srcset.d.ts +49 -47
- package/dist/media/shared/cache.d.ts +31 -51
- package/dist/media/shared/hash.d.ts +0 -7
- package/dist/media/types.d.ts +754 -1235
- package/dist/media/video/directive.d.ts +1 -15
- package/dist/media/video/index.d.ts +17 -39
- package/dist/media/video/processor/cache.d.ts +19 -42
- package/dist/media/video/processor/index.d.ts +18 -1
- package/dist/media/video/processor/streaming.d.ts +10 -17
- package/dist/media/video/processor/thumbnail.d.ts +15 -21
- package/dist/media/video/processor/transcoder.d.ts +1 -11
- package/dist/meta-arguments.d.ts +14 -39
- package/dist/method-spoofing.d.ts +0 -7
- package/dist/middleware.d.ts +0 -60
- package/dist/native/bridge/protocol.d.ts +2 -1
- package/dist/native/compiler/headwind-to-style.d.ts +383 -359
- package/dist/native/compiler/icons.d.ts +249 -243
- package/dist/native/compiler/svg.d.ts +35 -24
- package/dist/native/runtime/jsc-globals.d.ts +1 -1
- package/dist/native/runtime/native-host.d.ts +1 -1
- package/dist/native/runtime/native-host.js +3 -0
- package/dist/offline/app-service-worker.d.ts +50 -114
- package/dist/offline/kept-store.d.ts +23 -37
- package/dist/offline/query-cache.d.ts +55 -126
- package/dist/owned-routes.d.ts +0 -31
- package/dist/page-response.d.ts +8 -39
- package/dist/parser/directive-parser.d.ts +45 -57
- package/dist/parser/expression-parser.d.ts +35 -33
- package/dist/parser/index.d.ts +39 -4
- package/dist/parser/tokenizer.d.ts +49 -61
- package/dist/partial-hydration.d.ts +51 -82
- package/dist/performance-utils.d.ts +115 -255
- package/dist/placeholder.d.ts +9 -18
- package/dist/plugin-system.d.ts +115 -264
- package/dist/process.d.ts +4 -9
- package/dist/process.js +6 -4
- package/dist/prop-sentinels.d.ts +11 -11
- package/dist/public-env.d.ts +0 -14
- package/dist/pwa/directives.d.ts +20 -12
- package/dist/pwa/inject.d.ts +0 -10
- package/dist/pwa/precache.d.ts +16 -22
- package/dist/pwa/service-worker.d.ts +0 -12
- package/dist/pwa.js +1 -1
- package/dist/reactive-bindings.d.ts +11 -34
- package/dist/reactive-tracking.d.ts +0 -36
- package/dist/reactive.d.ts +41 -58
- package/dist/render-memo.d.ts +5 -23
- package/dist/resolve-stx-targets.d.ts +6 -44
- package/dist/route-middleware.d.ts +35 -2
- package/dist/route-rules.d.ts +10 -13
- package/dist/router.d.ts +9 -8
- package/dist/routes.d.ts +3 -1
- package/dist/runtime-config-server.d.ts +14 -17
- package/dist/runtime-config.d.ts +2 -3
- package/dist/runtime-globals.d.ts +90 -122
- package/dist/runtime-injection.d.ts +0 -8
- package/dist/scaffolding.d.ts +30 -26
- package/dist/script-emit.d.ts +0 -30
- package/dist/script-validation.d.ts +6 -12
- package/dist/seo.d.ts +75 -153
- package/dist/server-api.d.ts +9 -12
- package/dist/server-bindings.d.ts +1 -26
- package/dist/server-data.d.ts +4 -5
- package/dist/sfc-template.d.ts +8 -8
- package/dist/signal-processing.d.ts +37 -53
- package/dist/signals-api.d.ts +58 -135
- package/dist/signals.d.ts +18 -24
- package/dist/site-url.d.ts +31 -28
- package/dist/slots.d.ts +20 -86
- package/dist/source-signature.d.ts +5 -28
- package/dist/ssg.d.ts +158 -337
- package/dist/ssg.js +2 -2
- package/dist/state-dir.d.ts +4 -4
- package/dist/store-loader.d.ts +0 -10
- package/dist/story/analytics.d.ts +60 -138
- package/dist/story/bookmarks.d.ts +34 -87
- package/dist/story/cli.d.ts +69 -123
- package/dist/story/collect/scanner.d.ts +0 -4
- package/dist/story/collect/tree.d.ts +1 -8
- package/dist/story/commands/build.d.ts +6 -11
- package/dist/story/commands/dev.d.ts +8 -15
- package/dist/story/commands/preview.d.ts +7 -13
- package/dist/story/config-watcher.d.ts +13 -20
- package/dist/story/config.d.ts +8 -11
- package/dist/story/context.d.ts +8 -14
- package/dist/story/hmr.d.ts +26 -24
- package/dist/story/hot-swap.d.ts +23 -34
- package/dist/story/keyboard-shortcuts.d.ts +18 -23
- package/dist/story/output.d.ts +44 -46
- package/dist/story/performance.d.ts +45 -107
- package/dist/story/presets.d.ts +41 -107
- package/dist/story/renderer.d.ts +27 -41
- package/dist/story/search.d.ts +12 -23
- package/dist/story/server.d.ts +11 -21
- package/dist/story/setup.d.ts +15 -23
- package/dist/story/testing.d.ts +40 -65
- package/dist/story/types.d.ts +160 -262
- package/dist/streaming.d.ts +57 -119
- package/dist/strip-literals.d.ts +1 -25
- package/dist/stx-module-imports.d.ts +7 -0
- package/dist/stx-virtual-ts.d.ts +102 -253
- package/dist/style-scoping.d.ts +8 -21
- package/dist/suspense.d.ts +52 -67
- package/dist/teleport.d.ts +0 -22
- package/dist/template-syntax-escape.d.ts +8 -8
- package/dist/template-tag-balance.d.ts +6 -22
- package/dist/testing.d.ts +26 -11
- package/dist/theme-tokens.d.ts +388 -134
- package/dist/transitions.d.ts +55 -66
- package/dist/ts-css-config.d.ts +12 -70
- package/dist/types/component-types.d.ts +122 -187
- package/dist/types/config-types.d.ts +341 -956
- package/dist/types/context-types.d.ts +24 -46
- package/dist/types/csp-types.d.ts +66 -70
- package/dist/types/directive-types.d.ts +156 -223
- package/dist/types/index.d.ts +110 -6
- package/dist/types/pwa-types.d.ts +148 -273
- package/dist/types.d.ts +1 -0
- package/dist/unresolved-identifiers.d.ts +22 -24
- package/dist/url-safety.d.ts +32 -32
- package/dist/utils.d.ts +21 -36
- package/dist/validator.d.ts +26 -28
- package/dist/variable-extractor.d.ts +19 -49
- package/dist/view-composers.d.ts +81 -80
- package/dist/virtual-scrolling.d.ts +82 -101
- package/dist/visual-testing.d.ts +10 -9
- package/dist/vue-template.d.ts +0 -23
- package/dist/web-components/css-scoping.d.ts +11 -21
- package/dist/web-components.d.ts +58 -81
- package/dist/x-element.d.ts +1 -0
- package/package.json +6 -6
- package/stx.d.ts +2 -2
- package/dist/app-service-worker.d.ts +0 -165
- package/dist/chunk-49gwmcrn.js +0 -2
- package/dist/chunk-6va5pe2m.js +0 -2
- package/dist/chunk-bm2q1srp.js +0 -2
- package/dist/signals-context-runtime.d.ts +0 -2
- package/dist/signals-drawer-runtime.d.ts +0 -2
- package/dist/signals-host-runtime.d.ts +0 -9
- package/dist/signals-loop-conditional-runtime.d.ts +0 -2
- package/dist/signals-manifest-hydration-runtime.d.ts +0 -2
- package/dist/signals-notify-runtime.d.ts +0 -2
- package/dist/signals-optimistic-runtime.d.ts +0 -2
- package/dist/signals-overlay-runtime.d.ts +0 -2
- package/dist/signals-scope-disposal-runtime.d.ts +0 -2
- package/dist/signals-spa-load-control-runtime.d.ts +0 -2
- package/dist/signals-storage-runtime.d.ts +0 -2
|
@@ -1,49 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client Script Bundler
|
|
3
|
-
*
|
|
4
|
-
* Uses Bun.build to resolve and bundle imports in `<script client>` blocks.
|
|
5
|
-
* Only activates when real user imports are detected (local files, npm packages).
|
|
6
|
-
* stx runtime, @stores, and @composables are marked as external — handled
|
|
7
|
-
* by existing auto-import and store-import transforms.
|
|
8
|
-
*
|
|
9
|
-
* @module client-script-bundler
|
|
10
|
-
*/
|
|
11
1
|
import type { BuildFailureDetail } from './build-message';
|
|
12
2
|
export declare function clientBundleDependencies(filePath: string): string[];
|
|
13
|
-
export declare function shouldLogBundlerDiagnostics(environment?: {
|
|
14
|
-
STX_DEBUG?: string;
|
|
15
|
-
}): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Client-script bundle failures recorded during the current process.
|
|
18
|
-
*
|
|
19
|
-
* When a `<script client>` block fails to bundle, the bundler falls back to
|
|
20
|
-
* shipping the ORIGINAL, unbundled source so the page still renders. That is a
|
|
21
|
-
* reasonable dev-server behaviour and a terrible build behaviour: imports never
|
|
22
|
-
* resolve, bindings silently do nothing, and `stx build` still exited 0, so CI
|
|
23
|
-
* published a broken page as a success.
|
|
24
|
-
*
|
|
25
|
-
* Nothing was counting these. `ssg.failedCount` only ever saw render-time throws,
|
|
26
|
-
* never a bundle failure, because the fallback swallowed it and returned a
|
|
27
|
-
* string. The registry gives the build a way to ask, without the bundler having
|
|
28
|
-
* to know whether it is running under a dev server or a build. See #1884.
|
|
29
|
-
*/
|
|
30
|
-
export interface BundleFailure {
|
|
31
|
-
filePath: string;
|
|
32
|
-
message: string;
|
|
33
|
-
/**
|
|
34
|
-
* The same failure with its position intact, for a dev-server overlay to
|
|
35
|
-
* draw a code frame from. Absent only when the thrower gave no position.
|
|
36
|
-
*/
|
|
37
|
-
details?: BuildFailureDetail[];
|
|
38
|
-
}
|
|
3
|
+
export declare function shouldLogBundlerDiagnostics(environment?: { STX_DEBUG?: string }): boolean;
|
|
39
4
|
/** Record a bundle failure. Called from the bundler's fallback path. */
|
|
40
5
|
export declare function recordBundleFailure(filePath: string, message: string, details?: BuildFailureDetail[]): void;
|
|
41
6
|
/** Every bundle failure since the last reset. */
|
|
42
7
|
export declare function getBundleFailures(): BundleFailure[];
|
|
43
8
|
/** Drop recorded failures — call at the start of a build, and in tests. */
|
|
44
9
|
export declare function clearBundleFailures(): void;
|
|
45
|
-
/** What to do when a client script will not bundle. */
|
|
46
|
-
export type BundlerFallbackMode = 'warn' | 'error';
|
|
47
10
|
/**
|
|
48
11
|
* Override the configured fallback mode, for tests and embedders.
|
|
49
12
|
*
|
|
@@ -69,27 +32,6 @@ export declare function resolveBundlerFallback(): BundlerFallbackMode;
|
|
|
69
32
|
* - `import { ... } from '@composables'` (handled by transformStoreImports)
|
|
70
33
|
*/
|
|
71
34
|
export declare function hasUserImports(code: string): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Specifier prefix for an import the PAGE serves rather than the bundle
|
|
74
|
-
* inlines (stacksjs/stx#1957).
|
|
75
|
-
*
|
|
76
|
-
* Every component's `<script client>` used to be bundled with its imports
|
|
77
|
-
* inlined, one Bun.build per script. Two components importing one module each
|
|
78
|
-
* carried their own copy of it, so module state -- a cache, a registry, an
|
|
79
|
-
* in-flight promise -- existed once per component instead of once per page,
|
|
80
|
-
* and the page shipped the same code several times. A real page made five
|
|
81
|
-
* `GET /api/me` calls on load because its auth module had five copies.
|
|
82
|
-
*
|
|
83
|
-
* A component's direct imports are now externalised to `stx-module:<id>` and
|
|
84
|
-
* rewritten into reads of `globalThis.__stxModules`, which one page-level
|
|
85
|
-
* bundle populates (see client-module-registry.ts): each imported module is
|
|
86
|
-
* bundled once and evaluated once per page.
|
|
87
|
-
*
|
|
88
|
-
* The id is the path relative to the project root, or `npm:<specifier>` for a
|
|
89
|
-
* package. Never an absolute path: that would put the server's filesystem
|
|
90
|
-
* layout into every page's HTML.
|
|
91
|
-
*/
|
|
92
|
-
export declare const MODULE_SPECIFIER_PREFIX = "stx-module:";
|
|
93
35
|
export declare function registryIdForPath(projectRoot: string, resolved: string): string;
|
|
94
36
|
/**
|
|
95
37
|
* Put the `stx-module:` specifier back on imports Bun printed with the one the
|
|
@@ -135,53 +77,63 @@ export declare function rewriteRegistryImports(code: string, reads: string[]): s
|
|
|
135
77
|
*/
|
|
136
78
|
export declare function queueClientBundleBuild<T>(task: () => Promise<T>): Promise<T>;
|
|
137
79
|
export declare function bundleClientScript(code: string, filePath: string, options?: {
|
|
138
|
-
projectRoot?: string
|
|
139
|
-
minify?: boolean
|
|
140
|
-
cacheDir?: string
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* the first caller gets the second's file list. That map is a
|
|
151
|
-
* process-global keyed on the host, so it cannot distinguish them; this
|
|
152
|
-
* hands each caller its own answer.
|
|
153
|
-
*/
|
|
154
|
-
collectInputs?: string[];
|
|
155
|
-
/**
|
|
156
|
-
* Serve the script's own imports from the page registry instead of
|
|
157
|
-
* inlining them (#1957). Default true; the registry's own build turns it
|
|
158
|
-
* off, since that bundle is where the modules are actually inlined.
|
|
159
|
-
*/
|
|
160
|
-
externalizeUserModules?: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Re-expose only these names outside the bundle's closure. By default every
|
|
163
|
-
* top-level binding of the script comes back, imports included, because a
|
|
164
|
-
* page's template reads whatever its script declared. A composable is
|
|
165
|
-
* concatenated with the others into one scope instead, and publishes only
|
|
166
|
-
* its exports: re-declaring a name it merely imported collided with the
|
|
167
|
-
* composable that owns it (`var X` here, `const X` there, a SyntaxError
|
|
168
|
-
* that took every composable on the page down).
|
|
169
|
-
*/
|
|
170
|
-
expose?: readonly string[];
|
|
171
|
-
/**
|
|
172
|
-
* Throw on a failed build instead of returning the script unbundled.
|
|
173
|
-
*
|
|
174
|
-
* The unbundled fallback keeps a dev server usable for a page's own
|
|
175
|
-
* script. It is no use to a caller whose source is nothing BUT imports -
|
|
176
|
-
* the page registry's entry is `import * as m from '...'` lines that only
|
|
177
|
-
* mean something once bundled, so falling back shipped them inside an IIFE,
|
|
178
|
-
* a SyntaxError, and the build error never reached the browser.
|
|
179
|
-
*/
|
|
180
|
-
throwOnFailure?: boolean;
|
|
181
|
-
}): Promise<string>;
|
|
80
|
+
projectRoot?: string
|
|
81
|
+
minify?: boolean
|
|
82
|
+
cacheDir?: string
|
|
83
|
+
|
|
84
|
+
collectInputs?: string[]
|
|
85
|
+
|
|
86
|
+
externalizeUserModules?: boolean
|
|
87
|
+
|
|
88
|
+
expose?: readonly string[]
|
|
89
|
+
|
|
90
|
+
throwOnFailure?: boolean
|
|
91
|
+
}): Promise<string>;
|
|
182
92
|
/**
|
|
183
93
|
* The name one build's temp entry and output directory go by: the script's
|
|
184
94
|
* hash, this process and a count, so no other build — here or in another dev
|
|
185
95
|
* server on the same checkout — shares them. See where they are made.
|
|
186
96
|
*/
|
|
187
97
|
export declare function tempBuildName(hash: string): string;
|
|
98
|
+
/**
|
|
99
|
+
* Specifier prefix for an import the PAGE serves rather than the bundle
|
|
100
|
+
* inlines (stacksjs/stx#1957).
|
|
101
|
+
*
|
|
102
|
+
* Every component's `<script client>` used to be bundled with its imports
|
|
103
|
+
* inlined, one Bun.build per script. Two components importing one module each
|
|
104
|
+
* carried their own copy of it, so module state -- a cache, a registry, an
|
|
105
|
+
* in-flight promise -- existed once per component instead of once per page,
|
|
106
|
+
* and the page shipped the same code several times. A real page made five
|
|
107
|
+
* `GET /api/me` calls on load because its auth module had five copies.
|
|
108
|
+
*
|
|
109
|
+
* A component's direct imports are now externalised to `stx-module:<id>` and
|
|
110
|
+
* rewritten into reads of `globalThis.__stxModules`, which one page-level
|
|
111
|
+
* bundle populates (see client-module-registry.ts): each imported module is
|
|
112
|
+
* bundled once and evaluated once per page.
|
|
113
|
+
*
|
|
114
|
+
* The id is the path relative to the project root, or `npm:<specifier>` for a
|
|
115
|
+
* package. Never an absolute path: that would put the server's filesystem
|
|
116
|
+
* layout into every page's HTML.
|
|
117
|
+
*/
|
|
118
|
+
export declare const MODULE_SPECIFIER_PREFIX: 'stx-module:';
|
|
119
|
+
/**
|
|
120
|
+
* Client-script bundle failures recorded during the current process.
|
|
121
|
+
*
|
|
122
|
+
* When a `<script client>` block fails to bundle, the bundler falls back to
|
|
123
|
+
* shipping the ORIGINAL, unbundled source so the page still renders. That is a
|
|
124
|
+
* reasonable dev-server behaviour and a terrible build behaviour: imports never
|
|
125
|
+
* resolve, bindings silently do nothing, and `stx build` still exited 0, so CI
|
|
126
|
+
* published a broken page as a success.
|
|
127
|
+
*
|
|
128
|
+
* Nothing was counting these. `ssg.failedCount` only ever saw render-time throws,
|
|
129
|
+
* never a bundle failure, because the fallback swallowed it and returned a
|
|
130
|
+
* string. The registry gives the build a way to ask, without the bundler having
|
|
131
|
+
* to know whether it is running under a dev server or a build. See #1884.
|
|
132
|
+
*/
|
|
133
|
+
export declare interface BundleFailure {
|
|
134
|
+
filePath: string
|
|
135
|
+
message: string
|
|
136
|
+
details?: BuildFailureDetail[]
|
|
137
|
+
}
|
|
138
|
+
/** What to do when a client script will not bundle. */
|
|
139
|
+
export type BundlerFallbackMode = 'warn' | 'error';
|
package/dist/client-script.d.ts
CHANGED
|
@@ -1,46 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Transforms <script client> blocks in SFC (.stx) components:
|
|
5
|
-
* 1. Auto-imports from 'stx' and '@stacksjs/browser' (no import statements needed)
|
|
6
|
-
* 2. Resolves `import { store } from '@stores'` to runtime store access
|
|
7
|
-
* 3. Transpiles TypeScript to JavaScript (strips type annotations, interfaces, import type)
|
|
8
|
-
* 4. Injects event binding code (from @click, @input, etc.) into the script scope
|
|
9
|
-
* 5. Auto-wraps in a scoped IIFE for isolation
|
|
10
|
-
*
|
|
11
|
-
* This enables clean component authoring:
|
|
12
|
-
* ```stx
|
|
13
|
-
* <template>
|
|
14
|
-
* <button @click="handleClick()">Count: {{ count() }}</button>
|
|
15
|
-
* </template>
|
|
16
|
-
*
|
|
17
|
-
* <script>
|
|
18
|
-
* // No imports needed! state, onMount, Trail, etc. are auto-imported
|
|
19
|
-
* const count = state(0)
|
|
20
|
-
*
|
|
21
|
-
* onMount(async () => {
|
|
22
|
-
* const trails = await Trail.all()
|
|
23
|
-
* console.log(trails)
|
|
24
|
-
* })
|
|
25
|
-
*
|
|
26
|
-
* function handleClick() {
|
|
27
|
-
* count.set(count() + 1)
|
|
28
|
-
* }
|
|
29
|
-
* </script>
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @module client-script
|
|
33
|
-
*/
|
|
1
|
+
import { BROWSER_CORE_IMPORTS } from './browser-core-imports';
|
|
2
|
+
import { findInterpolationEnd, stripCommentsAndLiterals } from './strip-literals';
|
|
34
3
|
import type { ParsedEvent } from './events';
|
|
35
|
-
export { findInterpolationEnd, stripCommentsAndLiterals } from './strip-literals';
|
|
36
|
-
export interface VendorCssImport {
|
|
37
|
-
/** The original specifier as written in the import — kept verbatim for the data attribute. */
|
|
38
|
-
source: string;
|
|
39
|
-
/** The resolved absolute filesystem path — used for dedupe and reads. */
|
|
40
|
-
resolvedPath: string;
|
|
41
|
-
/** The CSS file contents at build time. */
|
|
42
|
-
contents: string;
|
|
43
|
-
}
|
|
44
4
|
/**
|
|
45
5
|
* Strip side-effect `.css` imports from a `<script client>` body and read
|
|
46
6
|
* their contents off disk.
|
|
@@ -63,14 +23,7 @@ export interface VendorCssImport {
|
|
|
63
23
|
* call. Cross-component dedupe still relies on the caller's HTML response
|
|
64
24
|
* (CSS rules collapse harmlessly at the browser level either way).
|
|
65
25
|
*/
|
|
66
|
-
export declare function extractAndStripCssImports(code: string, options: {
|
|
67
|
-
filePath?: string;
|
|
68
|
-
projectRoot?: string;
|
|
69
|
-
}): {
|
|
70
|
-
code: string;
|
|
71
|
-
styles: VendorCssImport[];
|
|
72
|
-
unresolved: string[];
|
|
73
|
-
};
|
|
26
|
+
export declare function extractAndStripCssImports(code: string, options: { filePath?: string, projectRoot?: string }): { code: string, styles: VendorCssImport[], unresolved: string[] };
|
|
74
27
|
/**
|
|
75
28
|
* Render collected vendor CSS as one `<style>` tag per resolved source,
|
|
76
29
|
* each wrapped in `@layer vendor { … }` so the styles can never out-specificity
|
|
@@ -82,84 +35,7 @@ export declare function extractAndStripCssImports(code: string, options: {
|
|
|
82
35
|
* below un-layered rules, so vendor styles default to lowest precedence.
|
|
83
36
|
*/
|
|
84
37
|
export declare function renderVendorStyleTags(styles: VendorCssImport[]): string;
|
|
85
|
-
/**
|
|
86
|
-
* Exports from 'stx' auto-imported into classic `<script>` / `<script client>`
|
|
87
|
-
* blocks.
|
|
88
|
-
*
|
|
89
|
-
* Derived from {@link STX_RUNTIME_GLOBALS} rather than hand-maintained (#1804).
|
|
90
|
-
* This was a separate 82-name literal, and it had drifted: 16 of those names
|
|
91
|
-
* were not on `window.stx` at all. Because the generated prologue destructures
|
|
92
|
-
* (`var { … } = window.stx`), a missing name is not an error — it binds
|
|
93
|
-
* `undefined`, and the author sees "undefined is not a function" at the call
|
|
94
|
-
* site with nothing naming the identifier or saying why. `provide` worked and
|
|
95
|
-
* `inject` did not; `onMounted` worked and `onUpdated` did not.
|
|
96
|
-
*
|
|
97
|
-
* Five of the 16 (`isDerived`, `inject`, `useSlots`, `watchMultiple`,
|
|
98
|
-
* `onBeforeMount`) are now implemented in the runtime and live in the shared
|
|
99
|
-
* list. The remaining 11 are server- or compile-time only — `h` and `Fragment`
|
|
100
|
-
* belong to the JSX runtime, `useMeta`/`getCurrentInstance`/`useAttrs`/
|
|
101
|
-
* `onErrorCaptured`/`onBeforeUpdate`/`onUpdated`/`createStore`/`createSelector`
|
|
102
|
-
* are module exports with no client counterpart, and `action` has no
|
|
103
|
-
* implementation anywhere — so they are no longer offered. A `ReferenceError`
|
|
104
|
-
* naming the identifier beats a silent `undefined`.
|
|
105
|
-
*/
|
|
106
|
-
export declare const STX_AUTO_IMPORTS: readonly string[];
|
|
107
|
-
/**
|
|
108
|
-
* Core exports from '@stacksjs/browser' that are auto-imported.
|
|
109
|
-
* App-specific models are detected dynamically (PascalCase identifiers
|
|
110
|
-
* used with query methods like .all(), .find(), .where(), etc.)
|
|
111
|
-
*/
|
|
112
|
-
export { BROWSER_CORE_IMPORTS } from './browser-core-imports';
|
|
113
|
-
export interface BrowserCoreAutoImportResult {
|
|
114
|
-
code: string;
|
|
115
|
-
imports: string[];
|
|
116
|
-
models: string[];
|
|
117
|
-
}
|
|
118
38
|
export declare function injectBrowserCoreAutoImports(code: string): BrowserCoreAutoImportResult;
|
|
119
|
-
export interface ClientScriptOptions {
|
|
120
|
-
/** Event bindings collected from template @event attributes */
|
|
121
|
-
eventBindings?: ParsedEvent[];
|
|
122
|
-
/** Whether to enable auto-imports (default: true) */
|
|
123
|
-
autoImports?: boolean;
|
|
124
|
-
/** Original script tag attributes (e.g., 'type="module"') */
|
|
125
|
-
attrs?: string;
|
|
126
|
-
/** Whether the component template contains : prefix directives */
|
|
127
|
-
hasColonDirectives?: boolean;
|
|
128
|
-
/** Template HTML content for auto-binding analysis (Phase 2: auto-detect which scripts need stx.mount()) */
|
|
129
|
-
templateContent?: string;
|
|
130
|
-
/** File path of the template (for relative import resolution in bundler) */
|
|
131
|
-
filePath?: string;
|
|
132
|
-
/** Project root directory (for @/ path resolution in bundler) */
|
|
133
|
-
projectRoot?: string;
|
|
134
|
-
/** Whether this is a production build (enables minification in bundler) */
|
|
135
|
-
production?: boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Server → client data bridge. Top-level `<script server>` variables (and
|
|
138
|
-
* other template-context values) made available to `<script client>` code:
|
|
139
|
-
* any JSON-serializable value referenced — but not redeclared — by the client
|
|
140
|
-
* script is serialized into the client bundle, so reactive state can be seeded
|
|
141
|
-
* from build-time data (e.g. `const items = state(serverItems)`) without a
|
|
142
|
-
* round-trip fetch. Functions/non-serializable values are skipped.
|
|
143
|
-
*/
|
|
144
|
-
serverData?: Record<string, unknown>;
|
|
145
|
-
/**
|
|
146
|
-
* The component instance this script sets up, stamped on the emitted tag as
|
|
147
|
-
* data-stx-instance (#1958). Passed only by the component renderer, for a
|
|
148
|
-
* component with no scope root: a component with one names it in
|
|
149
|
-
* data-stx-owner instead. A page's own script runs on every navigation, so
|
|
150
|
-
* it is never stamped.
|
|
151
|
-
*
|
|
152
|
-
* Outside the router's container the stamp marks the script as part of the
|
|
153
|
-
* layout's chrome, whose instance a same-layout navigation leaves running:
|
|
154
|
-
* fragments leave it out, and the router's full-document path skips it.
|
|
155
|
-
*/
|
|
156
|
-
instanceId?: string;
|
|
157
|
-
}
|
|
158
|
-
interface AutoImportResult {
|
|
159
|
-
code: string;
|
|
160
|
-
stxImports: string[];
|
|
161
|
-
browserImports: string[];
|
|
162
|
-
}
|
|
163
39
|
export declare function transformAutoImports(code: string): AutoImportResult;
|
|
164
40
|
/**
|
|
165
41
|
* Whether `name` is used as a binding in `code`: not a property of something
|
|
@@ -216,3 +92,69 @@ export declare function generateServerDataBridge(code: string, serverData?: Reco
|
|
|
216
92
|
* @returns A complete `<script>...</script>` tag ready for browser injection
|
|
217
93
|
*/
|
|
218
94
|
export declare function processClientScript(scriptContent: string, options?: ClientScriptOptions): Promise<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Exports from 'stx' auto-imported into classic `<script>` / `<script client>`
|
|
97
|
+
* blocks.
|
|
98
|
+
*
|
|
99
|
+
* Derived from {@link STX_RUNTIME_GLOBALS} rather than hand-maintained (#1804).
|
|
100
|
+
* This was a separate 82-name literal, and it had drifted: 16 of those names
|
|
101
|
+
* were not on `window.stx` at all. Because the generated prologue destructures
|
|
102
|
+
* (`var { … } = window.stx`), a missing name is not an error — it binds
|
|
103
|
+
* `undefined`, and the author sees "undefined is not a function" at the call
|
|
104
|
+
* site with nothing naming the identifier or saying why. `provide` worked and
|
|
105
|
+
* `inject` did not; `onMounted` worked and `onUpdated` did not.
|
|
106
|
+
*
|
|
107
|
+
* Five of the 16 (`isDerived`, `inject`, `useSlots`, `watchMultiple`,
|
|
108
|
+
* `onBeforeMount`) are now implemented in the runtime and live in the shared
|
|
109
|
+
* list. The remaining 11 are server- or compile-time only — `h` and `Fragment`
|
|
110
|
+
* belong to the JSX runtime, `useMeta`/`getCurrentInstance`/`useAttrs`/
|
|
111
|
+
* `onErrorCaptured`/`onBeforeUpdate`/`onUpdated`/`createStore`/`createSelector`
|
|
112
|
+
* are module exports with no client counterpart, and `action` has no
|
|
113
|
+
* implementation anywhere — so they are no longer offered. A `ReferenceError`
|
|
114
|
+
* naming the identifier beats a silent `undefined`.
|
|
115
|
+
*/
|
|
116
|
+
export declare const STX_AUTO_IMPORTS: readonly string[];
|
|
117
|
+
export declare interface VendorCssImport {
|
|
118
|
+
source: string
|
|
119
|
+
resolvedPath: string
|
|
120
|
+
contents: string
|
|
121
|
+
}
|
|
122
|
+
export declare interface BrowserCoreAutoImportResult {
|
|
123
|
+
code: string
|
|
124
|
+
imports: string[]
|
|
125
|
+
models: string[]
|
|
126
|
+
}
|
|
127
|
+
// =============================================================================
|
|
128
|
+
// Types
|
|
129
|
+
// =============================================================================
|
|
130
|
+
export declare interface ClientScriptOptions {
|
|
131
|
+
eventBindings?: ParsedEvent[]
|
|
132
|
+
autoImports?: boolean
|
|
133
|
+
attrs?: string
|
|
134
|
+
hasColonDirectives?: boolean
|
|
135
|
+
templateContent?: string
|
|
136
|
+
filePath?: string
|
|
137
|
+
projectRoot?: string
|
|
138
|
+
production?: boolean
|
|
139
|
+
serverData?: Record<string, unknown>
|
|
140
|
+
instanceId?: string
|
|
141
|
+
}
|
|
142
|
+
// =============================================================================
|
|
143
|
+
// Auto-Import Transformation
|
|
144
|
+
// =============================================================================
|
|
145
|
+
declare interface AutoImportResult {
|
|
146
|
+
code: string
|
|
147
|
+
stxImports: string[]
|
|
148
|
+
browserImports: string[]
|
|
149
|
+
}
|
|
150
|
+
// Re-exported from its old home. It moved to `strip-literals.ts` so the
|
|
151
|
+
// editor-facing extractor could share it without pulling the bundler in behind
|
|
152
|
+
// it, and the runtime bridge and `stx typecheck` MUST agree on what counts as a
|
|
153
|
+
// reference (#1868 ask 4). Anything importing it from here keeps working.
|
|
154
|
+
export { findInterpolationEnd, stripCommentsAndLiterals } from './strip-literals';
|
|
155
|
+
/**
|
|
156
|
+
* Core exports from '@stacksjs/browser' that are auto-imported.
|
|
157
|
+
* App-specific models are detected dynamically (PascalCase identifiers
|
|
158
|
+
* used with query methods like .all(), .find(), .where(), etc.)
|
|
159
|
+
*/
|
|
160
|
+
export { BROWSER_CORE_IMPORTS } from './browser-core-imports';
|
|
@@ -1,61 +1,3 @@
|
|
|
1
|
-
/** Marker attribute — makes injection idempotent and findable by tests. */
|
|
2
|
-
export declare const COLOR_MODE_BOOT_MARKER = "data-stx-color-mode-boot";
|
|
3
|
-
/** The global the boot script publishes its resolved config on. */
|
|
4
|
-
export declare const COLOR_MODE_BOOT_GLOBAL = "__STX_COLOR_MODE__";
|
|
5
|
-
export type ColorModeBootMode = 'light' | 'dark' | 'auto' | 'system';
|
|
6
|
-
/** Spelling written to storage for "follow the system". */
|
|
7
|
-
export type ColorModeBootAutoValue = 'auto' | 'system';
|
|
8
|
-
/**
|
|
9
|
-
* Pre-paint options. A strict subset of `ColorModeOptions` — only the fields
|
|
10
|
-
* that affect what lands on the root element before paint. `disableTransitions`
|
|
11
|
-
* is deliberately absent: nothing has painted yet, so there is no transition to
|
|
12
|
-
* suppress, and forcing a reflow in the critical path would only cost time.
|
|
13
|
-
*/
|
|
14
|
-
export interface ColorModeBootConfig {
|
|
15
|
-
/** localStorage key holding the preference. @default 'stx-color-mode' */
|
|
16
|
-
storageKey?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Mode used when nothing valid is stored. @default 'auto'
|
|
19
|
-
* `'system'` is accepted as an alias for `'auto'`.
|
|
20
|
-
*/
|
|
21
|
-
initialMode?: ColorModeBootMode;
|
|
22
|
-
/**
|
|
23
|
-
* Class applied to `<html>` when dark. @default 'dark'
|
|
24
|
-
* Pass `null` to opt out — the attribute alone then carries the mode.
|
|
25
|
-
*/
|
|
26
|
-
darkClass?: string | null;
|
|
27
|
-
/**
|
|
28
|
-
* Attribute set to the resolved mode on `<html>`, e.g. `'data-theme'`.
|
|
29
|
-
* Applied *alongside* `darkClass`, mirroring `useColorMode` (#1788).
|
|
30
|
-
*/
|
|
31
|
-
attribute?: string | null;
|
|
32
|
-
/**
|
|
33
|
-
* Spelling `useColorMode` writes back for "follow the system". Published to
|
|
34
|
-
* the client so the composable doesn't convert an app's existing `'system'`
|
|
35
|
-
* key to `'auto'`. @default whatever is stored, else 'auto'
|
|
36
|
-
*/
|
|
37
|
-
autoValue?: ColorModeBootAutoValue;
|
|
38
|
-
/**
|
|
39
|
-
* Leave `attribute` alone when it already carries a concrete mode, and
|
|
40
|
-
* render that instead of the visitor's stored preference. @default false
|
|
41
|
-
*
|
|
42
|
-
* For a page whose theme is not the visitor's to choose: a public status
|
|
43
|
-
* page whose owner forces light or dark for everyone, stamped server-side
|
|
44
|
-
* during render. Without this the boot script computes from storage and
|
|
45
|
-
* stamps unconditionally, so a visitor who had browsed in dark saw the
|
|
46
|
-
* forced-light page in dark (stacksjs/stx#2050).
|
|
47
|
-
*
|
|
48
|
-
* Only `'light'` and `'dark'` count as concrete. `'auto'` and `'system'`
|
|
49
|
-
* are instructions to resolve, not answers, so they are ignored here and
|
|
50
|
-
* the stored preference wins as usual.
|
|
51
|
-
*
|
|
52
|
-
* The adopted value is published as `forced` on the boot global, because
|
|
53
|
-
* once this script has stamped the attribute nothing downstream can tell a
|
|
54
|
-
* forced value from a computed one by looking at the DOM. `useColorMode`
|
|
55
|
-
* reads it and renders it over its own resolution.
|
|
56
|
-
*/
|
|
57
|
-
respectExisting?: boolean;
|
|
58
|
-
}
|
|
59
1
|
/**
|
|
60
2
|
* Build the synchronous pre-paint `<script>`.
|
|
61
3
|
*
|
|
@@ -110,3 +52,24 @@ export declare function normalizeCriticalHeadOrder(html: string): string;
|
|
|
110
52
|
* A no-op when the document has no boot script or it is already in place.
|
|
111
53
|
*/
|
|
112
54
|
export declare function hoistColorModeBootScript(html: string): string;
|
|
55
|
+
/** Marker attribute — makes injection idempotent and findable by tests. */
|
|
56
|
+
export declare const COLOR_MODE_BOOT_MARKER: 'data-stx-color-mode-boot';
|
|
57
|
+
/** The global the boot script publishes its resolved config on. */
|
|
58
|
+
export declare const COLOR_MODE_BOOT_GLOBAL: '__STX_COLOR_MODE__';
|
|
59
|
+
/**
|
|
60
|
+
* Pre-paint options. A strict subset of `ColorModeOptions` — only the fields
|
|
61
|
+
* that affect what lands on the root element before paint. `disableTransitions`
|
|
62
|
+
* is deliberately absent: nothing has painted yet, so there is no transition to
|
|
63
|
+
* suppress, and forcing a reflow in the critical path would only cost time.
|
|
64
|
+
*/
|
|
65
|
+
export declare interface ColorModeBootConfig {
|
|
66
|
+
storageKey?: string
|
|
67
|
+
initialMode?: ColorModeBootMode
|
|
68
|
+
darkClass?: string | null
|
|
69
|
+
attribute?: string | null
|
|
70
|
+
autoValue?: ColorModeBootAutoValue
|
|
71
|
+
respectExisting?: boolean
|
|
72
|
+
}
|
|
73
|
+
export type ColorModeBootMode = 'light' | 'dark' | 'auto' | 'system';
|
|
74
|
+
/** Spelling written to storage for "follow the system". */
|
|
75
|
+
export type ColorModeBootAutoValue = 'auto' | 'system';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const COMPONENT_CLIENT_FACTORIES_CONTEXT_KEY = "__stx_component_client_factories";
|
|
2
1
|
export declare function initializeComponentClientFactories(context: Record<string, unknown>): void;
|
|
3
2
|
export declare function registerComponentClientFactory(context: Record<string, unknown>, factoryBody: string): string | null;
|
|
4
3
|
export declare function injectComponentClientFactories(html: string, context: Record<string, unknown>): string;
|
|
@@ -22,12 +21,12 @@ export declare function injectComponentClientFactories(html: string, context: Re
|
|
|
22
21
|
*/
|
|
23
22
|
export declare function snapshotComponentClientFactoryCounts(context: Record<string, unknown>): Map<string, number>;
|
|
24
23
|
/** The factories registered since `before`, with how many instances each gained. */
|
|
25
|
-
export declare function componentClientFactoriesRegisteredSince(context: Record<string, unknown>, before: Map<string, number>): Array<{
|
|
26
|
-
body: string;
|
|
27
|
-
count: number;
|
|
28
|
-
}>;
|
|
24
|
+
export declare function componentClientFactoriesRegisteredSince(context: Record<string, unknown>, before: Map<string, number>): Array<{ body: string, count: number }>;
|
|
29
25
|
/** Re-register what a cached render registered, so the instance counts match. */
|
|
30
|
-
export declare function replayComponentClientFactories(context: Record<string, unknown>, registered: Array<{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
export declare function replayComponentClientFactories(context: Record<string, unknown>, registered: Array<{ body: string, count: number }>): void;
|
|
27
|
+
export declare const COMPONENT_CLIENT_FACTORIES_CONTEXT_KEY: '__stx_component_client_factories';
|
|
28
|
+
declare interface ComponentClientFactory {
|
|
29
|
+
body: string
|
|
30
|
+
instances: number
|
|
31
|
+
}
|
|
32
|
+
declare type ComponentClientFactoryRegistry = Map<string, ComponentClientFactory>;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import type { TemplateExpression } from './stx-virtual-ts';
|
|
2
|
-
export interface ContractCheck {
|
|
3
|
-
expression: TemplateExpression;
|
|
4
|
-
statement: {
|
|
5
|
-
text: string;
|
|
6
|
-
prefixLength: number;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export interface ContractCheckOptions {
|
|
10
|
-
filePath: string;
|
|
11
|
-
componentsDir?: string;
|
|
12
|
-
projectRoot?: string;
|
|
13
|
-
readComponent?: (file: string) => string | undefined;
|
|
14
|
-
scriptCode: (source: string, file: string) => string;
|
|
15
|
-
}
|
|
16
2
|
/** Parent call-site checks; shared unchanged by CLI and editor virtual buffers. */
|
|
17
3
|
export declare function componentContractChecks(source: string, masked: string, options: ContractCheckOptions): {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
declarations: string
|
|
5
|
+
checks: ContractCheck[]
|
|
6
|
+
events: Map<number, string>
|
|
7
|
+
dependencies: Map<string, string>
|
|
22
8
|
};
|
|
9
|
+
export declare interface ContractCheck {
|
|
10
|
+
expression: TemplateExpression
|
|
11
|
+
statement: { text: string, prefixLength: number }
|
|
12
|
+
}
|
|
13
|
+
export declare interface ContractCheckOptions {
|
|
14
|
+
filePath: string
|
|
15
|
+
componentsDir?: string
|
|
16
|
+
projectRoot?: string
|
|
17
|
+
readComponent?: (file: string) => string | undefined
|
|
18
|
+
scriptCode: (source: string, file: string) => string
|
|
19
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export interface ComponentContract {
|
|
2
|
-
declarations: string;
|
|
3
|
-
props: string | null;
|
|
4
|
-
events: string | null;
|
|
5
|
-
}
|
|
6
|
-
export declare const COMPONENT_CONTRACT_HELPERS = "\ntype __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;\ntype __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;\ntype __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;\ntype __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];\ntype __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];\ntype __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };\ntype __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;\n";
|
|
7
1
|
/**
|
|
8
2
|
* Project a child's declared contract into its parent's virtual TS module.
|
|
9
3
|
* TypeScript, not this scanner, resolves aliases, imports and assignability.
|
|
10
4
|
* Original script bodies stay isolated inside a namespace; they are never run.
|
|
11
5
|
*/
|
|
12
6
|
export declare function componentContract(code: string, namespace: string): ComponentContract;
|
|
7
|
+
export declare const COMPONENT_CONTRACT_HELPERS: string;
|
|
8
|
+
export declare interface ComponentContract {
|
|
9
|
+
declarations: string
|
|
10
|
+
props: string | null
|
|
11
|
+
events: string | null
|
|
12
|
+
}
|
package/dist/component-hmr.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ export declare function getHMRHandler(config?: ComponentHMRConfig): ComponentHMR
|
|
|
14
14
|
* Reset global HMR handler
|
|
15
15
|
*/
|
|
16
16
|
export declare function resetHMRHandler(): void;
|
|
17
|
+
declare const __dtsx_default_export__: {
|
|
18
|
+
ComponentHMRHandler: typeof ComponentHMRHandler;
|
|
19
|
+
getHMRHandler: typeof getHMRHandler;
|
|
20
|
+
resetHMRHandler: typeof resetHMRHandler;
|
|
21
|
+
generateHMRClientScript: typeof generateHMRClientScript;
|
|
22
|
+
wrapComponentForHMR: typeof wrapComponentForHMR
|
|
23
|
+
};
|
|
17
24
|
/* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
|
|
18
25
|
/**
|
|
19
26
|
* Component HMR (Hot Module Replacement)
|
|
@@ -98,10 +105,4 @@ export declare class ComponentHMRHandler {
|
|
|
98
105
|
// =============================================================================
|
|
99
106
|
// Exports
|
|
100
107
|
// =============================================================================
|
|
101
|
-
export default
|
|
102
|
-
ComponentHMRHandler,
|
|
103
|
-
getHMRHandler,
|
|
104
|
-
resetHMRHandler,
|
|
105
|
-
generateHMRClientScript,
|
|
106
|
-
wrapComponentForHMR,
|
|
107
|
-
};
|
|
108
|
+
export default __dtsx_default_export__;
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
import type { Signal } from './signals-api';
|
|
2
|
-
export type ModelModifiers = Readonly<Record<string, boolean>>;
|
|
3
|
-
export interface ModelOptions<T> {
|
|
4
|
-
default?: T;
|
|
5
|
-
parse?: (value: string) => T;
|
|
6
|
-
get?: (value: T) => T;
|
|
7
|
-
set?: (value: T, modifiers: ModelModifiers) => T;
|
|
8
|
-
}
|
|
9
|
-
export interface ModelSignal<T> extends Signal<T> {
|
|
10
|
-
readonly modifiers: ModelModifiers;
|
|
11
|
-
/** Input-event write; deferred when the parent supplied .lazy. */
|
|
12
|
-
input(value: T): void;
|
|
13
|
-
/** Change-event write; used only when the parent supplied .lazy. */
|
|
14
|
-
change(value: T): void;
|
|
15
|
-
}
|
|
16
2
|
/**
|
|
17
3
|
* Shared by module imports and the generated browser runtime. Keep this
|
|
18
4
|
* function closure-free: the runtime embeds its JavaScript source, with all
|
|
19
5
|
* reactive and lifecycle dependencies supplied explicitly.
|
|
20
6
|
*/
|
|
21
7
|
export declare function createModelSignal<T>(source: Signal<T>, modifiers: () => ModelModifiers, emit: (value: T) => void, options: ModelOptions<T>, cleanup: (fn: () => void) => void): ModelSignal<T>;
|
|
22
|
-
export declare function useModel<T>(options: ModelOptions<T> & {
|
|
23
|
-
|
|
24
|
-
}): ModelSignal<T>;
|
|
25
|
-
export declare function useModel<T>(name: string, options: ModelOptions<T> & {
|
|
26
|
-
default: T;
|
|
27
|
-
}): ModelSignal<T>;
|
|
8
|
+
export declare function useModel<T>(options: ModelOptions<T> & { default: T }): ModelSignal<T>;
|
|
9
|
+
export declare function useModel<T>(name: string, options: ModelOptions<T> & { default: T }): ModelSignal<T>;
|
|
28
10
|
export declare function useModel<T = unknown>(name?: string, options?: ModelOptions<T>): ModelSignal<T | undefined>;
|
|
29
11
|
export declare function useModel<T = unknown>(options?: ModelOptions<T>): ModelSignal<T | undefined>;
|
|
12
|
+
export declare interface ModelOptions<T> {
|
|
13
|
+
default?: T
|
|
14
|
+
parse?: (value: string) => T
|
|
15
|
+
get?: (value: T) => T
|
|
16
|
+
set?: (value: T, modifiers: ModelModifiers) => T
|
|
17
|
+
}
|
|
18
|
+
export declare interface ModelSignal<T> extends Signal<T> {
|
|
19
|
+
readonly modifiers: ModelModifiers
|
|
20
|
+
input(value: T): void
|
|
21
|
+
change(value: T): void
|
|
22
|
+
}
|
|
23
|
+
export type ModelModifiers = Readonly<Record<string, boolean>>;
|