bitboss-ui 3.0.0-beta.69 → 3.0.0-beta.71
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/README.md +20 -11
- package/bin/bitboss-ui-mcp.mjs +7 -4
- package/bin/bitboss-ui.mjs +0 -0
- package/bin/cli.mjs +47 -28
- package/dist/ai/BbBaseButton.md +4 -4
- package/dist/ai/BbBreadcrumbs.md +3 -0
- package/dist/ai/BbCarousel.md +32 -29
- package/dist/ai/BbCheckbox.md +5 -6
- package/dist/ai/BbCheckboxGroup.md +28 -26
- package/dist/ai/BbColorInput.md +9 -14
- package/dist/ai/BbDatePickerInput.md +3 -4
- package/dist/ai/BbDropdown.md +35 -1
- package/dist/ai/BbDropdownButton.md +4 -3
- package/dist/ai/BbDropzone.md +3 -3
- package/dist/ai/BbGallery.md +2034 -0
- package/dist/ai/BbNumberInput.md +3 -4
- package/dist/ai/BbPopover.md +12 -6
- package/dist/ai/BbRadio.md +5 -6
- package/dist/ai/BbRadioGroup.md +28 -31
- package/dist/ai/BbRating.md +6 -16
- package/dist/ai/BbSelect.md +10 -11
- package/dist/ai/BbSlider.md +3 -9
- package/dist/ai/BbSwitch.md +6 -6
- package/dist/ai/BbSwitchGroup.md +4 -7
- package/dist/ai/BbTag.md +3 -4
- package/dist/ai/BbTextInput.md +19 -19
- package/dist/ai/BbTextarea.md +8 -8
- package/dist/ai/BbTimePickerInput.md +3 -4
- package/dist/ai/BbTooltip.md +17 -13
- package/dist/ai/CommonField.md +2 -10
- package/dist/ai/OptionsContainer.md +7 -12
- package/dist/ai/changelog.json +119 -4
- package/dist/ai/components.json +37 -32
- package/dist/ai/guides/ai-router.md +3 -2
- package/dist/ai/guides/component-picker.md +1 -0
- package/dist/ai/guides/eslint-rules.md +3 -3
- package/dist/ai/guides/installation-and-plugin-setup.md +5 -5
- package/dist/ai/guides/migration/v2-to-v3.md +53 -1
- package/dist/ai/guides/migration/v3-beta-tooling.md +25 -15
- package/dist/ai/guides/passthrough.md +2 -1
- package/dist/ai/guides/preset-components.md +53 -19
- package/dist/ai/helpers/definePreset.json +8 -1
- package/dist/ai/helpers/definePreset.ts +42 -13
- package/dist/ai/helpers/inertia/manifest.json +1 -1
- package/dist/ai/index.md +2 -1
- package/dist/ai/manifest/common.json +2 -2
- package/dist/ai/manifest/components/BbBreadcrumbs.json +1 -1
- package/dist/ai/manifest/components/BbCarousel.json +3 -2
- package/dist/ai/manifest/components/BbCarousel.tree.json +7 -0
- package/dist/ai/manifest/components/BbCheckbox.json +2 -2
- package/dist/ai/manifest/components/BbCheckbox.tree.json +1 -1
- package/dist/ai/manifest/components/BbCheckboxGroup.tree.json +10 -18
- package/dist/ai/manifest/components/BbColorInput.json +2 -2
- package/dist/ai/manifest/components/BbColorInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbConfigScope.json +1 -1
- package/dist/ai/manifest/components/BbDatePickerInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbDropdown.json +2 -2
- package/dist/ai/manifest/components/BbDropdownButton.json +2 -2
- package/dist/ai/manifest/components/BbGallery.json +54 -0
- package/dist/ai/manifest/components/BbGallery.tree.json +139 -0
- package/dist/ai/manifest/components/BbNumberInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbRadio.tree.json +1 -1
- package/dist/ai/manifest/components/BbRadioGroup.tree.json +9 -17
- package/dist/ai/manifest/components/BbRating.removed.json +1 -1
- package/dist/ai/manifest/components/BbRating.tree.json +1 -1
- package/dist/ai/manifest/components/BbSelect.json +15 -15
- package/dist/ai/manifest/components/BbSelect.tree.json +1 -1
- package/dist/ai/manifest/components/BbSlider.json +1 -1
- package/dist/ai/manifest/components/BbSlider.tree.json +1 -1
- package/dist/ai/manifest/components/BbSwitch.tree.json +1 -1
- package/dist/ai/manifest/components/BbSwitchGroup.tree.json +2 -2
- package/dist/ai/manifest/components/BbTabs.removed.json +4 -4
- package/dist/ai/manifest/components/BbTabsList.removed.json +4 -4
- package/dist/ai/manifest/components/BbTag.tree.json +1 -1
- package/dist/ai/manifest/components/BbTextInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbTextarea.tree.json +1 -1
- package/dist/ai/manifest/components/BbTimePickerInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbTooltip.json +1 -1
- package/dist/ai/manifest/components/BbTooltip.tree.json +2 -2
- package/dist/ai/manifest/components/CommonField.tree.json +5 -10
- package/dist/ai/manifest/components/OptionsContainer.tree.json +7 -12
- package/dist/ai/manifest/index.json +4 -3
- package/dist/ai/manifest/meta.json +5 -1
- package/dist/ai/manifest/types.advanced.json +4 -2
- package/dist/ai/manifest/types.api.json +3 -3
- package/dist/ai/manifest/types.wrapper.json +1 -0
- package/dist/ai/recipes/inertia/onboarding.md +5 -8
- package/dist/ai/recipes/inertia/record-form.md +33 -12
- package/dist/ai/recipes/nuxt/onboarding.md +5 -8
- package/dist/ai/recipes/nuxt/record-form.md +27 -11
- package/dist/ai/recipes/vue/onboarding.md +5 -8
- package/dist/ai/recipes/vue/record-form.md +25 -11
- package/dist/ai/source/BbBreadcrumbs.md +31 -12
- package/dist/ai/source/BbCalendar.md +2 -0
- package/dist/ai/source/BbCarousel.md +135 -32
- package/dist/ai/source/BbCheckbox.md +36 -42
- package/dist/ai/source/BbCheckboxGroup.md +2 -4
- package/dist/ai/source/BbColorInput.md +2 -4
- package/dist/ai/source/BbDatePickerInput.md +2 -4
- package/dist/ai/source/BbDropdown.md +13 -2
- package/dist/ai/source/BbDropdownButton.md +4 -1
- package/dist/ai/source/BbDropdownGroup.md +11 -2
- package/dist/ai/source/BbGallery.md +2027 -0
- package/dist/ai/source/BbNumberInput.md +2 -4
- package/dist/ai/source/BbRadio.md +36 -42
- package/dist/ai/source/BbRadioGroup.md +4 -6
- package/dist/ai/source/BbRating.md +2 -14
- package/dist/ai/source/BbSelect.md +30 -13
- package/dist/ai/source/BbSelectPopover.md +1 -0
- package/dist/ai/source/BbSlider.md +2 -4
- package/dist/ai/source/BbSwitch.md +34 -38
- package/dist/ai/source/BbSwitchGroup.md +1 -0
- package/dist/ai/source/BbTable.md +15 -8
- package/dist/ai/source/BbTag.md +2 -4
- package/dist/ai/source/BbTextInput.md +2 -4
- package/dist/ai/source/BbTextarea.md +2 -4
- package/dist/ai/source/BbTimePickerInput.md +2 -4
- package/dist/ai/source/BbTooltip.md +9 -3
- package/dist/ai/source/BbTree.md +7 -3
- package/dist/ai/source/CommonField.md +17 -106
- package/dist/ai/source/CommonPopover.md +13 -3
- package/dist/ai/source/FlatListBox.md +3 -3
- package/dist/ai/source/GroupedListBox.md +3 -3
- package/dist/ai/source/GuidesComponent.md +3 -0
- package/dist/ai/source/ListBox.md +4 -4
- package/dist/ai/source/OptionsContainer.md +4 -4
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue_vue_type_script_setup_true_lang.js +106 -106
- package/dist/components/BbBreadcrumbs/types.d.ts +6 -0
- package/dist/components/BbCalendar/useDayjsLocale.js +5 -3
- package/dist/components/BbCarousel/BbCarousel.vue.d.ts +1 -1
- package/dist/components/BbCarousel/BbCarousel.vue_vue_type_script_setup_true_lang.js +506 -481
- package/dist/components/BbCarousel/dragRelease.js +14 -0
- package/dist/components/BbCarousel/ptKeys.generated.d.ts +4 -0
- package/dist/components/BbCarousel/types.d.ts +11 -6
- package/dist/components/BbCarousel/types.js +1 -0
- package/dist/components/BbCheckbox/types.d.ts +2 -4
- package/dist/components/BbCheckboxGroup/types.d.ts +2 -4
- package/dist/components/BbColorInput/types.d.ts +2 -4
- package/dist/components/BbDatePickerInput/types.d.ts +2 -4
- package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue_vue_type_script_setup_true_lang.js +121 -120
- package/dist/components/BbDropdown/normalizeGroups.js +37 -33
- package/dist/components/BbDropdown/types.d.ts +9 -2
- package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +95 -94
- package/dist/components/BbGallery/BbGallery.vue.d.ts +50 -0
- package/dist/components/BbGallery/BbGallery.vue.js +5 -0
- package/dist/components/BbGallery/BbGallery.vue_vue_type_script_setup_true_lang.js +587 -0
- package/dist/components/BbGallery/findItem.js +41 -0
- package/dist/components/BbGallery/ptKeys.generated.d.ts +112 -0
- package/dist/components/BbGallery/types.d.ts +177 -0
- package/dist/components/BbGallery/types.js +29 -0
- package/dist/components/BbNumberInput/types.d.ts +2 -4
- package/dist/components/BbOffCanvas/sheetSnap.d.ts +2 -0
- package/dist/components/BbOffCanvas/sheetSnap.js +5 -5
- package/dist/components/BbRadio/types.d.ts +2 -4
- package/dist/components/BbRadioGroup/types.d.ts +4 -6
- package/dist/components/BbRating/BbRating.vue_vue_type_script_setup_true_lang.js +116 -118
- package/dist/components/BbRating/types.d.ts +2 -4
- package/dist/components/BbSelect/BbSelect.vue.d.ts +10 -4
- package/dist/components/BbSelect/types.d.ts +4 -6
- package/dist/components/BbSlider/types.d.ts +2 -4
- package/dist/components/BbTable/types.d.ts +8 -8
- package/dist/components/BbTag/types.d.ts +2 -4
- package/dist/components/BbTextInput/types.d.ts +2 -4
- package/dist/components/BbTextarea/types.d.ts +2 -4
- package/dist/components/BbTimePickerInput/types.d.ts +2 -4
- package/dist/components/BbTooltip/ptKeys.generated.d.ts +4 -4
- package/dist/components/BbTooltip/types.d.ts +3 -1
- package/dist/components/BbTree/types.d.ts +3 -3
- package/dist/components/CommonField/types.d.ts +2 -4
- package/dist/components/CommonPopover/CommonPopover.vue_vue_type_script_setup_true_lang.js +28 -26
- package/dist/composables/overlayRegistry.d.ts +17 -0
- package/dist/composables/overlayRegistry.js +16 -9
- package/dist/composables/useChoiceIndicator.js +66 -63
- package/dist/deprecation/ai-deprecations.json.js +1 -1
- package/dist/directives/bbDropdown.js +1 -1
- package/dist/directives/bbGallery.d.ts +64 -0
- package/dist/directives/bbGallery.js +38 -0
- package/dist/i18n/locales/ar.json +3 -1
- package/dist/i18n/locales/cs.json +3 -1
- package/dist/i18n/locales/da.json +3 -1
- package/dist/i18n/locales/de-CH.json +3 -1
- package/dist/i18n/locales/de.json +3 -1
- package/dist/i18n/locales/el.json +3 -1
- package/dist/i18n/locales/en-GB.json +3 -1
- package/dist/i18n/locales/en.json +3 -1
- package/dist/i18n/locales/es-MX.json +3 -1
- package/dist/i18n/locales/es.json +3 -1
- package/dist/i18n/locales/fa.json +3 -1
- package/dist/i18n/locales/fi.json +3 -1
- package/dist/i18n/locales/fr.json +3 -1
- package/dist/i18n/locales/he.json +3 -1
- package/dist/i18n/locales/hu.json +3 -1
- package/dist/i18n/locales/it.json +3 -1
- package/dist/i18n/locales/ja.json +3 -1
- package/dist/i18n/locales/ko.json +3 -1
- package/dist/i18n/locales/nb.json +3 -1
- package/dist/i18n/locales/nl.json +3 -1
- package/dist/i18n/locales/pl.json +3 -1
- package/dist/i18n/locales/pt-BR.json +3 -1
- package/dist/i18n/locales/pt-PT.json +3 -1
- package/dist/i18n/locales/ro.json +3 -1
- package/dist/i18n/locales/ru.json +3 -1
- package/dist/i18n/locales/sv.json +3 -1
- package/dist/i18n/locales/tr.json +3 -1
- package/dist/i18n/locales/uk.json +3 -1
- package/dist/i18n/locales/zh-CN.json +3 -1
- package/dist/i18n/locales/zh-HK.json +3 -1
- package/dist/i18n/locales/zh-TW.json +3 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +38 -36
- package/dist/llms-full.txt +2534 -346
- package/dist/llms-medium.txt +10 -7
- package/dist/llms.txt +1 -1
- package/dist/locale-blueprint.json +3 -1
- package/dist/nuxt-auto-imports.js +1 -1
- package/dist/plugin.js +18 -17
- package/dist/project-dts.js +17 -16
- package/dist/runtime/nuxt-plugin.js +22 -21
- package/dist/scripts/lib/atomic-write.js +42 -0
- package/dist/styles.css +2 -2
- package/dist/types/FieldLayout.d.ts +4 -1
- package/dist/types/ItemAccessor.d.ts +3 -1
- package/dist/types/ItemPath.d.ts +33 -0
- package/dist/types/passthrough.d.ts +2 -2
- package/dist/types/ptComponentMap.d.ts +2 -1
- package/dist/utilities/calendar/canonicalParts.js +10 -2
- package/dist/utils/versionCheck.js +1 -1
- package/dist/vite.js +361 -331
- package/llms.txt +2 -2
- package/package.json +7 -4
- package/scripts/README.md +31 -29
- package/scripts/lib/agent-refresh.mjs +15 -9
- package/scripts/lib/agent-setup.mjs +46 -15
- package/scripts/lib/atomic-write.d.mts +6 -0
- package/scripts/lib/atomic-write.mjs +85 -0
- package/scripts/lib/define-preset-copy.mjs +24 -4
- package/scripts/lib/eslint-plugin.mjs +74 -36
- package/scripts/lib/hand-imported-styles.mjs +44 -99
- package/scripts/lib/helpers-add.mjs +3 -1
- package/scripts/lib/linked-target.mjs +1 -1
- package/scripts/lib/locale-check.mjs +41 -25
- package/scripts/lib/mcp-config.mjs +250 -133
- package/scripts/lib/mcp-sdk.mjs +24 -0
- package/scripts/lib/plugin-options-check.mjs +22 -15
- package/scripts/lib/pnp.mjs +1 -1
- package/scripts/lib/project-variant-dts.mjs +80 -136
- package/scripts/lib/release-results.mjs +331 -0
- package/scripts/lib/setup.mjs +61 -3
- package/scripts/lib/toolchain-check.mjs +134 -14
- package/scripts/lib/tooling-options.mjs +357 -38
- package/scripts/lib/validate-bb-markup.mjs +1 -1
- package/dist/components/BbBadge/BadgeBodyContent.vue.d.ts +0 -15
- package/dist/components/BbBadge/badgeButtonContext.d.ts +0 -55
- package/dist/components/BbBaseButton/RouterComponent.vue.d.ts +0 -18
- package/dist/components/BbBaseButton/useLinkState.d.ts +0 -43
- package/dist/components/BbBreadcrumbs/estimateBreadcrumbItemWidth.d.ts +0 -18
- package/dist/components/BbButton/toggleRoving.d.ts +0 -6
- package/dist/components/BbCalendar/CalendarMonthPanel.vue.d.ts +0 -5
- package/dist/components/BbCalendar/CalendarYearPanel.vue.d.ts +0 -5
- package/dist/components/BbCalendar/calendarHost.d.ts +0 -29
- package/dist/components/BbCalendar/calendarMath.d.ts +0 -102
- package/dist/components/BbCalendar/useCalendarContext.d.ts +0 -116
- package/dist/components/BbCalendar/useCalendarGrid.d.ts +0 -411
- package/dist/components/BbCalendar/useDayGrid.d.ts +0 -122
- package/dist/components/BbCalendar/useDayjsLocale.d.ts +0 -93
- package/dist/components/BbCalendar/useToday.d.ts +0 -25
- package/dist/components/BbConfirm/BbConfirm.vue.d.ts +0 -4
- package/dist/components/BbConfirm/BbConfirmHost.d.ts +0 -10
- package/dist/components/BbConfirm/confirmEntry.d.ts +0 -4
- package/dist/components/BbDatePickerInput/calendarFields.d.ts +0 -91
- package/dist/components/BbDatePickerInput/dateFieldLayout.d.ts +0 -29
- package/dist/components/BbDialog/useDialogStack.d.ts +0 -19
- package/dist/components/BbDropdown/AdaptiveDropdown.vue.d.ts +0 -26
- package/dist/components/BbDropdown/BbDropdownList.vue.d.ts +0 -38
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue.d.ts +0 -16
- package/dist/components/BbDropdown/DropdownRow.vue.d.ts +0 -41
- package/dist/components/BbDropdown/normalizeGroups.d.ts +0 -39
- package/dist/components/BbDropdown/pointerTrail.d.ts +0 -5
- package/dist/components/BbDropdown/useDropdownContext.d.ts +0 -131
- package/dist/components/BbDropdown/useDropdownGroupRegistry.d.ts +0 -170
- package/dist/components/BbForm/BbFormCustomField.d.ts +0 -14
- package/dist/components/BbForm/bindFormField.d.ts +0 -56
- package/dist/components/BbForm/formFields.d.ts +0 -77
- package/dist/components/BbHost/BbHostOpening.d.ts +0 -27
- package/dist/components/BbHoverCard/hoverCardFocus.d.ts +0 -29
- package/dist/components/BbIcon/iconCache.d.ts +0 -63
- package/dist/components/BbNumberInput/numberDisplay.d.ts +0 -255
- package/dist/components/BbNumberInput/platform.d.ts +0 -7
- package/dist/components/BbOffCanvas/hostCloseLabel.d.ts +0 -3
- package/dist/components/BbOffCanvas/sheetAttrs.d.ts +0 -9
- package/dist/components/BbOffCanvas/useOffCanvasStack.d.ts +0 -37
- package/dist/components/BbPagination/paginationFit.d.ts +0 -38
- package/dist/components/BbSelectPopover/knownItems.d.ts +0 -65
- package/dist/components/BbSelectPopover/reclickClears.d.ts +0 -17
- package/dist/components/BbSelectPopover/sheetChipAttrs.d.ts +0 -18
- package/dist/components/BbTable/BbTableDataRow.d.ts +0 -204
- package/dist/components/BbTable/BbTableEdgeRow.d.ts +0 -112
- package/dist/components/BbTable/BbTableExpandRow.d.ts +0 -84
- package/dist/components/BbTable/BbTableSelectToggle.d.ts +0 -128
- package/dist/components/BbTable/estimatedFloors.golden.d.ts +0 -25
- package/dist/components/BbTable/gridWidgets.d.ts +0 -30
- package/dist/components/BbTable/measuredFloors.d.ts +0 -46
- package/dist/components/BbTable/measuredFloorsTestKit.d.ts +0 -27
- package/dist/components/BbTable/textRuler.d.ts +0 -73
- package/dist/components/BbTable/useRowReorder.d.ts +0 -60
- package/dist/components/BbTable/utils.d.ts +0 -375
- package/dist/components/BbTabs/tablistName.d.ts +0 -4
- package/dist/components/BbToast/BbToast.vue.d.ts +0 -5
- package/dist/components/BbToast/BbToastMessage.vue.d.ts +0 -22
- package/dist/components/BbToast/BbToastRegion.vue.d.ts +0 -15
- package/dist/components/BbTooltip/tooltipWarmup.d.ts +0 -23
- package/dist/components/BbTree/BbTreeLevel.vue.d.ts +0 -19
- package/dist/components/BbTree/context.d.ts +0 -25
- package/dist/components/ChipsBox/ChipsBox.vue.d.ts +0 -21
- package/dist/components/ChipsBox/types.d.ts +0 -28
- package/dist/components/ClearableButton/ClearableButton.vue.d.ts +0 -6
- package/dist/components/ClearableButton/types.d.ts +0 -9
- package/dist/components/CloseIcon/CloseButton.vue.d.ts +0 -7
- package/dist/components/CloseIcon/types.d.ts +0 -2
- package/dist/components/CommaBox/CommaBox.vue.d.ts +0 -21
- package/dist/components/CommaBox/types.d.ts +0 -20
- package/dist/components/CommonField/CommonField.vue.d.ts +0 -20
- package/dist/components/CommonField/messageHeightMatrix.d.ts +0 -2
- package/dist/components/CommonFieldInput/CommonFieldInput.vue.d.ts +0 -22
- package/dist/components/CommonFieldInput/boxBorderMatrix.d.ts +0 -10
- package/dist/components/CommonFieldInput/types.d.ts +0 -114
- package/dist/components/CommonPopover/CommonPopover.vue.d.ts +0 -42
- package/dist/components/CommonPopover/resolvePlacement.d.ts +0 -9
- package/dist/components/CommonPopover/types.d.ts +0 -120
- package/dist/components/CommonTimeSelector/CommonTimeSelector.vue.d.ts +0 -48
- package/dist/components/CommonTimeSelector/useMeridiem.d.ts +0 -19
- package/dist/components/ErrorIcon/ErrorIcon.vue.d.ts +0 -7
- package/dist/components/ErrorIcon/types.d.ts +0 -3
- package/dist/components/FlatListBox/FlatListBox.vue.d.ts +0 -39
- package/dist/components/FlatListBox/types.d.ts +0 -140
- package/dist/components/GroupedListBox/GroupedListBox.vue.d.ts +0 -39
- package/dist/components/GroupedListBox/types.d.ts +0 -163
- package/dist/components/ListBox/ListBox.vue.d.ts +0 -39
- package/dist/components/ListBox/types.d.ts +0 -180
- package/dist/components/OptionsContainer/OptionsContainer.vue.d.ts +0 -20
- package/dist/components/OptionsContainer/types.d.ts +0 -168
- package/dist/components/Transitions/ScaleFade.vue.d.ts +0 -28
- package/dist/components/Transitions/Slide.vue.d.ts +0 -39
- package/dist/components/WarningIcon/WarningIcon.vue.d.ts +0 -7
- package/dist/components/WarningIcon/types.d.ts +0 -3
- package/dist/composables/__testResets.d.ts +0 -1
- package/dist/composables/autoHost.d.ts +0 -22
- package/dist/composables/formSubmitLock.d.ts +0 -48
- package/dist/composables/hostOpenings.d.ts +0 -88
- package/dist/composables/hostRegistry.d.ts +0 -47
- package/dist/composables/ssrMarker.d.ts +0 -15
- package/dist/composables/useActiveInactiveState.d.ts +0 -4
- package/dist/composables/useArray.d.ts +0 -7
- package/dist/composables/useBaseOptions.d.ts +0 -51
- package/dist/composables/useBodyScrollLock.d.ts +0 -4
- package/dist/composables/useBreakpoint.d.ts +0 -13
- package/dist/composables/useCancelableFunction.d.ts +0 -17
- package/dist/composables/useChoiceIndicator.d.ts +0 -58
- package/dist/composables/useClosingInert.d.ts +0 -28
- package/dist/composables/useCoarsePointer.d.ts +0 -9
- package/dist/composables/useCoherence.d.ts +0 -21
- package/dist/composables/useConfig.d.ts +0 -59
- package/dist/composables/useConfigDefaults.d.ts +0 -54
- package/dist/composables/useDirection.d.ts +0 -43
- package/dist/composables/useEscapeStackEntry.d.ts +0 -13
- package/dist/composables/useFrameworkDetection.d.ts +0 -12
- package/dist/composables/useHashedWatcher.d.ts +0 -19
- package/dist/composables/useHydrated.d.ts +0 -37
- package/dist/composables/useImeDismissBlur.d.ts +0 -103
- package/dist/composables/useIndexById.d.ts +0 -11
- package/dist/composables/useInertiaPage.d.ts +0 -10
- package/dist/composables/useItemText.d.ts +0 -17
- package/dist/composables/useItemValue.d.ts +0 -7
- package/dist/composables/useItemsGetter.d.ts +0 -83
- package/dist/composables/useKeyboardInset.d.ts +0 -28
- package/dist/composables/useListboxFocus.d.ts +0 -21
- package/dist/composables/useLocale.d.ts +0 -5
- package/dist/composables/useLogger.d.ts +0 -5
- package/dist/composables/useMinimalQueue.d.ts +0 -9
- package/dist/composables/useOnFalsy.d.ts +0 -2
- package/dist/composables/useOnTruthy.d.ts +0 -7
- package/dist/composables/useOverlayNavigation.d.ts +0 -37
- package/dist/composables/useOverlayYield.d.ts +0 -23
- package/dist/composables/usePrefill.d.ts +0 -44
- package/dist/composables/useQuery.d.ts +0 -39
- package/dist/composables/useRefusedCloseAnnouncement.d.ts +0 -13
- package/dist/composables/useRoute.d.ts +0 -3
- package/dist/composables/useRouter.d.ts +0 -2
- package/dist/composables/useSegmentedFields.d.ts +0 -129
- package/dist/composables/useServerPrefetch.d.ts +0 -28
- package/dist/composables/useSheetSurface.d.ts +0 -39
- package/dist/composables/useSsrState.d.ts +0 -28
- package/dist/composables/useTableWidthContext.d.ts +0 -73
- package/dist/composables/useToggleInput.d.ts +0 -44
- package/dist/composables/useTopLayer.d.ts +0 -9
- package/dist/composables/useTypeahead.d.ts +0 -112
- package/dist/composables/useUntil.d.ts +0 -7
- package/dist/composables/useUrlQueryParam.d.ts +0 -21
- package/dist/composables/useViewportWidth.d.ts +0 -14
- package/dist/deprecation/ai-deprecations.json.d.ts +0 -2984
- package/dist/deprecation/removedProps.d.ts +0 -3
- package/dist/directives/createPopoverDirective.d.ts +0 -111
- package/dist/directives/renderingInstance.d.ts +0 -2
- package/dist/i18n/eraNames.d.ts +0 -2
- package/dist/i18n/regionHints.d.ts +0 -16
- package/dist/icons-whitelist.d.ts +0 -9
- package/dist/reset.d.ts +0 -0
- package/dist/runtime/nuxt-plugin.d.ts +0 -2
- package/dist/styles.d.ts +0 -0
- package/dist/types/ExtractGenericFromComputedRef.d.ts +0 -2
- package/dist/types/ExtractGenericFromRef.d.ts +0 -2
- package/dist/types/NestedKeyOf.d.ts +0 -3
- package/dist/types/PrefixWith.d.ts +0 -1
- package/dist/types/ShapeErased.d.ts +0 -15
- package/dist/types/Simplify.d.ts +0 -6
- package/dist/utilities/calendar/canonicalParts.d.ts +0 -29
- package/dist/utilities/calendar/digits.d.ts +0 -18
- package/dist/utilities/calendar/gregorian.d.ts +0 -2
- package/dist/utilities/calendar/index.d.ts +0 -3
- package/dist/utilities/calendar/international.d.ts +0 -19
- package/dist/utilities/calendar/resolve.d.ts +0 -32
- package/dist/utilities/calendar/runtime.d.ts +0 -49
- package/dist/utilities/functions/animationsSettled.d.ts +0 -7
- package/dist/utilities/functions/bytesToUnit.d.ts +0 -2
- package/dist/utilities/functions/chunk.d.ts +0 -1
- package/dist/utilities/functions/clamp.d.ts +0 -9
- package/dist/utilities/functions/clampPrecision.d.ts +0 -1
- package/dist/utilities/functions/convertDateValue.d.ts +0 -57
- package/dist/utilities/functions/curry.d.ts +0 -6
- package/dist/utilities/functions/deburr.d.ts +0 -1
- package/dist/utilities/functions/elementLabel.d.ts +0 -8
- package/dist/utilities/functions/empty.d.ts +0 -1
- package/dist/utilities/functions/extractDomContainer.d.ts +0 -20
- package/dist/utilities/functions/findInTree.d.ts +0 -4
- package/dist/utilities/functions/flattenTree.d.ts +0 -1
- package/dist/utilities/functions/get.d.ts +0 -3
- package/dist/utilities/functions/hasVnodeListener.d.ts +0 -16
- package/dist/utilities/functions/hash.d.ts +0 -1
- package/dist/utilities/functions/head.d.ts +0 -2
- package/dist/utilities/functions/identity.d.ts +0 -1
- package/dist/utilities/functions/indexBy.d.ts +0 -11
- package/dist/utilities/functions/isDateDisabled.d.ts +0 -25
- package/dist/utilities/functions/isEqual.d.ts +0 -1
- package/dist/utilities/functions/isHex.d.ts +0 -1
- package/dist/utilities/functions/isImeComposing.d.ts +0 -7
- package/dist/utilities/functions/isNil.d.ts +0 -6
- package/dist/utilities/functions/isNotEmpty.d.ts +0 -1
- package/dist/utilities/functions/isNotNil.d.ts +0 -6
- package/dist/utilities/functions/isTextEntry.d.ts +0 -5
- package/dist/utilities/functions/isoWeek.d.ts +0 -36
- package/dist/utilities/functions/itemProps.d.ts +0 -46
- package/dist/utilities/functions/last.d.ts +0 -2
- package/dist/utilities/functions/negative.d.ts +0 -1
- package/dist/utilities/functions/noop.d.ts +0 -1
- package/dist/utilities/functions/normalizeDateBound.d.ts +0 -69
- package/dist/utilities/functions/parsePaginationNumber.d.ts +0 -22
- package/dist/utilities/functions/parseSize.d.ts +0 -3
- package/dist/utilities/functions/parseWidthString.d.ts +0 -6
- package/dist/utilities/functions/percentage.d.ts +0 -26
- package/dist/utilities/functions/pickBy.d.ts +0 -1
- package/dist/utilities/functions/range.d.ts +0 -1
- package/dist/utilities/functions/readableValue.d.ts +0 -6
- package/dist/utilities/functions/reject.d.ts +0 -25
- package/dist/utilities/functions/resolveEnumProp.d.ts +0 -19
- package/dist/utilities/functions/responsiveDefault.d.ts +0 -7
- package/dist/utilities/functions/searchRank.d.ts +0 -19
- package/dist/utilities/functions/settlesVisible.d.ts +0 -20
- package/dist/utilities/functions/snapToStep.d.ts +0 -1
- package/dist/utilities/functions/sort.d.ts +0 -6
- package/dist/utilities/functions/throttle.d.ts +0 -1
- package/dist/utilities/functions/toggleInput.d.ts +0 -114
- package/dist/utilities/functions/transpose.d.ts +0 -1
- package/dist/utilities/functions/validateDateFormat.d.ts +0 -8
- package/dist/utilities/functions/wait.d.ts +0 -2
- package/dist/utilities/functions/waitFor.d.ts +0 -9
- package/dist/utilities/functions/warnRemovedAttrs.d.ts +0 -49
- package/dist/utilities/functions/when.d.ts +0 -9
- package/dist/utilities/misc/autofocus.d.ts +0 -20
- package/dist/utilities/misc/iconsInjectionKey.d.ts +0 -15
- package/dist/utilities/misc/listboxMetrics.d.ts +0 -47
- package/dist/utilities/misc/maskaDataOptions.d.ts +0 -12
- package/dist/utilities/misc/pageText.d.ts +0 -16
- package/dist/utilities/misc/ssrValue.d.ts +0 -20
- package/dist/utilities/misc/transitions.d.ts +0 -5
- package/dist/utils/configDefaults.d.ts +0 -43
- package/dist/utils/configScope.d.ts +0 -43
- package/dist/utils/copyData.d.ts +0 -13
- package/dist/utils/focusVisibility.d.ts +0 -15
- package/dist/utils/injectLibraryStyles.d.ts +0 -8
- package/dist/utils/overlayEscapeStack.d.ts +0 -52
- package/dist/utils/overlaySurfaceIsolation.d.ts +0 -1
- package/dist/utils/passthroughDeduper.d.ts +0 -16
- package/dist/utils/releasedActivator.d.ts +0 -20
- package/dist/utils/versionCheck.d.ts +0 -19
package/scripts/lib/setup.mjs
CHANGED
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
* half edit); nothing is committed; every step is idempotent, so a second run
|
|
12
12
|
* changes nothing.
|
|
13
13
|
*/
|
|
14
|
-
import { existsSync, readFileSync
|
|
14
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
15
|
+
import { writeFileAtomicSync } from './atomic-write.mjs';
|
|
15
16
|
import { join } from 'node:path';
|
|
16
17
|
import { createInterface } from 'node:readline/promises';
|
|
17
18
|
import { spawnSync } from 'node:child_process';
|
|
18
19
|
import { parseArgs } from 'node:util';
|
|
19
20
|
import { fileURLToPath } from 'node:url';
|
|
20
21
|
import { refreshAgentSetup } from './agent-refresh.mjs';
|
|
22
|
+
import { ensureStrictVModel, isNewProject } from './toolchain-check.mjs';
|
|
21
23
|
import { refuseLinkedTarget } from './linked-target.mjs';
|
|
22
24
|
import { createRequire } from 'node:module';
|
|
23
25
|
import { detectPackageManager, mcpLaunch } from './mcp-config.mjs';
|
|
@@ -79,6 +81,47 @@ async function runInstalledRefresh(root, version) {
|
|
|
79
81
|
return true;
|
|
80
82
|
}
|
|
81
83
|
|
|
84
|
+
/**
|
|
85
|
+
* The restart line for an install that changed the bitboss-ui version, or
|
|
86
|
+
* `null`. A dev server keeps serving through the build plugin it loaded at
|
|
87
|
+
* start, so a swapped package strands it on the old one — the new runtime
|
|
88
|
+
* then asks it for things it predates. A fresh install (nothing before)
|
|
89
|
+
* has no running old plugin to strand, and a same-version run changed
|
|
90
|
+
* nothing.
|
|
91
|
+
*/
|
|
92
|
+
export function restartNoteForVersionChange(before, after) {
|
|
93
|
+
if (!before || !after || before === after) return null;
|
|
94
|
+
return `[bitboss-ui] bitboss-ui is now ${after} (was ${before}): restart the dev server so it loads the new build plugin.`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The installed bitboss-ui version at `root`, read fresh off disk: a
|
|
99
|
+
* `require` would serve the copy cached before an install in this same
|
|
100
|
+
* process swapped the package — the exact staleness the caller compares.
|
|
101
|
+
*/
|
|
102
|
+
function installedVersionAt(root) {
|
|
103
|
+
const candidates = [];
|
|
104
|
+
try {
|
|
105
|
+
candidates.push(
|
|
106
|
+
createRequire(join(root, 'package.json')).resolve(
|
|
107
|
+
'bitboss-ui/package.json'
|
|
108
|
+
)
|
|
109
|
+
);
|
|
110
|
+
} catch {
|
|
111
|
+
/* not resolvable from the root: the node_modules path may still answer */
|
|
112
|
+
}
|
|
113
|
+
candidates.push(join(root, 'node_modules', 'bitboss-ui', 'package.json'));
|
|
114
|
+
for (const candidate of candidates) {
|
|
115
|
+
try {
|
|
116
|
+
const version = JSON.parse(readFileSync(candidate, 'utf-8')).version;
|
|
117
|
+
if (version) return version;
|
|
118
|
+
} catch {
|
|
119
|
+
/* try the next home */
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
|
|
82
125
|
/**
|
|
83
126
|
* The options setup writes into `bitbossUi()` / the Nuxt `bitboss` key. Only
|
|
84
127
|
* missing keys are ever added. `resetCss` only for an app without Tailwind
|
|
@@ -169,7 +212,7 @@ function applyEdit(root, rel, result, manualSteps, label) {
|
|
|
169
212
|
});
|
|
170
213
|
return 'manual';
|
|
171
214
|
}
|
|
172
|
-
|
|
215
|
+
writeFileAtomicSync(join(root, rel), result.code, 'utf-8');
|
|
173
216
|
return 'updated';
|
|
174
217
|
}
|
|
175
218
|
|
|
@@ -282,6 +325,8 @@ export async function setupCommand(options) {
|
|
|
282
325
|
}
|
|
283
326
|
|
|
284
327
|
const pm = detectPackageManager(root);
|
|
328
|
+
// Before any install: the version a running dev server's plugin is on.
|
|
329
|
+
const installedBefore = installedVersionAt(root);
|
|
285
330
|
const runtime = [];
|
|
286
331
|
// The version running this setup: its edits are that version's API.
|
|
287
332
|
// BITBOSS_UI_SPEC (tests, a local tarball) names another source.
|
|
@@ -308,6 +353,8 @@ export async function setupCommand(options) {
|
|
|
308
353
|
app.framework === 'nuxt'
|
|
309
354
|
? /['"]bitboss-ui\/nuxt['"]/.test(configCode)
|
|
310
355
|
: /\bbitbossUi\s*\(/.test(configCode);
|
|
356
|
+
// Read before anything here commits or wires: the project as it was found.
|
|
357
|
+
const newProject = isNewProject(root, { alreadyWired });
|
|
311
358
|
const pluginOptions = pluginOptionsFor({
|
|
312
359
|
locale,
|
|
313
360
|
tailwind,
|
|
@@ -371,7 +418,7 @@ export async function setupCommand(options) {
|
|
|
371
418
|
const text = readFileSync(pkgPath, 'utf-8');
|
|
372
419
|
const indent = /^([ \t]+)"/m.exec(text)?.[1] ?? ' ';
|
|
373
420
|
const eol = text.includes('\r\n') ? '\r\n' : '\n';
|
|
374
|
-
|
|
421
|
+
writeFileAtomicSync(
|
|
375
422
|
pkgPath,
|
|
376
423
|
`${JSON.stringify(fresh, null, indent).replace(/\n/g, eol)}${eol}`,
|
|
377
424
|
'utf-8'
|
|
@@ -379,6 +426,11 @@ export async function setupCommand(options) {
|
|
|
379
426
|
done.push(['package.json', 'updated (postinstall)']);
|
|
380
427
|
}
|
|
381
428
|
|
|
429
|
+
// Before the agent refresh, whose strict-set suggestion reads the result.
|
|
430
|
+
if (newProject) {
|
|
431
|
+
const strict = ensureStrictVModel(root);
|
|
432
|
+
if (strict?.action === 'updated') done.push([strict.path, 'updated']);
|
|
433
|
+
}
|
|
382
434
|
console.log('\n[bitboss-ui] setup:');
|
|
383
435
|
for (const [file, action] of done) console.log(` - ${action}: ${file}`);
|
|
384
436
|
await runInstalledRefresh(root, version);
|
|
@@ -388,6 +440,12 @@ export async function setupCommand(options) {
|
|
|
388
440
|
`\n[bitboss-ui] Add ${step.label} to ${step.file} yourself (${step.reason}):\n\n${step.snippet}\n`
|
|
389
441
|
);
|
|
390
442
|
|
|
443
|
+
const restartNote = restartNoteForVersionChange(
|
|
444
|
+
installedBefore,
|
|
445
|
+
installedVersionAt(root)
|
|
446
|
+
);
|
|
447
|
+
if (restartNote) console.log(`\n${restartNote}`);
|
|
448
|
+
|
|
391
449
|
const off = scriptsOff(root);
|
|
392
450
|
if (off && ai)
|
|
393
451
|
console.log(
|
|
@@ -8,9 +8,12 @@
|
|
|
8
8
|
* `vueCompilerOptions.checkUnknownComponents: true` is a recommended second
|
|
9
9
|
* net, no longer warned about: `check`'s `unimported-component` and
|
|
10
10
|
* `bitboss-ui/no-unimported-component` catch an unimported `<BbTabs>`
|
|
11
|
-
* themselves. `
|
|
11
|
+
* themselves. The agent refresh (`update --no-install`, the app's
|
|
12
|
+
* postinstall) still writes the flag (`ensureCheckUnknownComponents`).
|
|
12
13
|
*/
|
|
13
|
-
import {
|
|
14
|
+
import { spawnSync } from 'node:child_process';
|
|
15
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
16
|
+
import { writeFileAtomicSync } from './atomic-write.mjs';
|
|
14
17
|
import { dirname, join, relative, resolve } from 'node:path';
|
|
15
18
|
import { refuseLinkedTarget } from './linked-target.mjs';
|
|
16
19
|
|
|
@@ -26,15 +29,15 @@ const STRICT_ON = /["']?strictTemplates["']?\s*:\s*true\b/;
|
|
|
26
29
|
|
|
27
30
|
/**
|
|
28
31
|
* The `vueCompilerOptions` the installation guide's checklist recommends, as
|
|
29
|
-
* it prints them (a node test pins the two together).
|
|
30
|
-
* set and never writes it: strict templates surface errors in
|
|
31
|
-
* templates, which are the app's to fix first.
|
|
32
|
+
* it prints them (a node test pins the two together). The agent refresh
|
|
33
|
+
* suggests the set and never writes it: strict templates surface errors in
|
|
34
|
+
* the app's own templates, which are the app's to fix first.
|
|
32
35
|
*/
|
|
33
36
|
export const STRICT_TEMPLATE_SET =
|
|
34
37
|
'{ "strictTemplates": true, "strictVModel": true, "dataAttributes": ["data-*"] }';
|
|
35
38
|
|
|
36
39
|
/**
|
|
37
|
-
*
|
|
40
|
+
* The agent refresh's suggestion line, or `null` when the project already turns
|
|
38
41
|
* `strictTemplates` on (or has no tsconfig and no Nuxt config).
|
|
39
42
|
*
|
|
40
43
|
* @param {string} root
|
|
@@ -48,7 +51,11 @@ export function strictTemplateSuggestion(root) {
|
|
|
48
51
|
existsSync(join(root, name))
|
|
49
52
|
);
|
|
50
53
|
if (!target) return null;
|
|
51
|
-
|
|
54
|
+
// An option the project already sets, either way, is its choice: name only the rest.
|
|
55
|
+
const set = flagSet(root, STRICT_V_MODEL_CHOSEN)
|
|
56
|
+
? STRICT_TEMPLATE_SET.replace(' "strictVModel": true,', '')
|
|
57
|
+
: STRICT_TEMPLATE_SET;
|
|
58
|
+
return `Recommended: \`"vueCompilerOptions": ${set}\` in ${target}, so vue-tsc checks every template attribute and event (installation guide, checklist). Not written: it can surface errors in your own templates to fix first.`;
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
/**
|
|
@@ -100,9 +107,20 @@ function readText(path) {
|
|
|
100
107
|
}
|
|
101
108
|
}
|
|
102
109
|
|
|
110
|
+
/** A package `extends` (`@vue/tsconfig/tsconfig.dom.json`) → its file in the nearest node_modules. */
|
|
111
|
+
function packageConfig(from, ref) {
|
|
112
|
+
for (let dir = dirname(from); ; dir = dirname(dir)) {
|
|
113
|
+
const base = join(dir, 'node_modules', ref);
|
|
114
|
+
for (const path of [base, `${base}.json`, join(base, 'tsconfig.json')])
|
|
115
|
+
if (existsSync(path) && statSync(path).isFile()) return path;
|
|
116
|
+
if (dirname(dir) === dir) return undefined;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
103
120
|
/** A local `extends` / `references` path → the config file it names. */
|
|
104
121
|
function localConfig(from, ref) {
|
|
105
|
-
if (typeof ref !== 'string'
|
|
122
|
+
if (typeof ref !== 'string') return undefined;
|
|
123
|
+
if (!ref.startsWith('.')) return packageConfig(from, ref);
|
|
106
124
|
const path = resolve(dirname(from), ref);
|
|
107
125
|
try {
|
|
108
126
|
if (statSync(path).isDirectory()) return join(path, 'tsconfig.json');
|
|
@@ -185,7 +203,7 @@ const lineIndent = (text, at) =>
|
|
|
185
203
|
/^[ \t]*/.exec(text.slice(text.lastIndexOf('\n', at) + 1))[0];
|
|
186
204
|
|
|
187
205
|
/**
|
|
188
|
-
*
|
|
206
|
+
* Set `vueCompilerOptions.checkUnknownComponents: true` in the
|
|
189
207
|
* tsconfig vue-tsc reads (`tsconfig.app.json` in a Vite layout, else
|
|
190
208
|
* `tsconfig.json`). A text insertion, so comments and layout survive. Leaves a
|
|
191
209
|
* config alone that already names the flag (any value: `false` is a choice),
|
|
@@ -224,25 +242,127 @@ export function ensureCheckUnknownComponents(root) {
|
|
|
224
242
|
return { path, action: 'skipped', reason: error.message };
|
|
225
243
|
}
|
|
226
244
|
|
|
245
|
+
return insertVueCompilerFlag(target, path, 'checkUnknownComponents');
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** `"flag": true` into the config's `vueCompilerOptions`, as text: comments, layout and line endings stay. */
|
|
249
|
+
function insertVueCompilerFlag(target, path, flag) {
|
|
227
250
|
const text = readFileSync(target, 'utf-8');
|
|
228
251
|
const bare = blankJsonComments(text);
|
|
229
252
|
const unit = indentUnit(text);
|
|
253
|
+
const eol = text.includes('\r\n') ? '\r\n' : '\n';
|
|
230
254
|
const nested = /"vueCompilerOptions"\s*:\s*\{/.exec(bare);
|
|
231
255
|
const open = nested ? nested.index + nested[0].length : bare.search(/\S/) + 1;
|
|
232
256
|
if (!nested && bare[open - 1] !== '{')
|
|
233
257
|
return { path, action: 'skipped', reason: 'not a JSON object' };
|
|
234
|
-
const
|
|
258
|
+
const rest = bare.slice(open);
|
|
259
|
+
const empty = /^\s*\}/.test(rest);
|
|
260
|
+
const oneLine =
|
|
261
|
+
nested && !empty && !rest.slice(0, rest.indexOf('}')).includes('\n');
|
|
235
262
|
const indent = nested ? lineIndent(text, nested.index) + unit : unit;
|
|
236
263
|
const entry = nested
|
|
237
|
-
?
|
|
238
|
-
:
|
|
239
|
-
const updated =
|
|
264
|
+
? `"${flag}": true`
|
|
265
|
+
: `"vueCompilerOptions": { "${flag}": true }`;
|
|
266
|
+
const updated = oneLine
|
|
267
|
+
? `${text.slice(0, open)} ${entry},${text.slice(open)}`
|
|
268
|
+
: `${text.slice(0, open)}${eol}${indent}${entry}${empty ? eol + (nested ? lineIndent(text, nested.index) : '') : ','}${text.slice(open)}`;
|
|
240
269
|
if (parseJsonc(text) !== undefined && parseJsonc(updated) === undefined)
|
|
241
270
|
return {
|
|
242
271
|
path,
|
|
243
272
|
action: 'skipped',
|
|
244
273
|
reason: 'could not insert the flag safely',
|
|
245
274
|
};
|
|
246
|
-
|
|
275
|
+
writeFileAtomicSync(target, updated, 'utf-8');
|
|
247
276
|
return { path, action: 'updated' };
|
|
248
277
|
}
|
|
278
|
+
|
|
279
|
+
const STRICT_V_MODEL_CHOSEN = /["']?(?:strictVModel|strictTemplates)["']?\s*:/;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Turn `strictVModel` on in a new project's tsconfig. `setup` alone calls it,
|
|
283
|
+
* after `isNewProject`: a running project's templates are its own to migrate.
|
|
284
|
+
* Any existing `strictVModel` or `strictTemplates`, either value, in the config
|
|
285
|
+
* or what it extends, stays the answer. Nuxt generates its tsconfig: not written.
|
|
286
|
+
*
|
|
287
|
+
* @param {string} root
|
|
288
|
+
* @returns {{ path: string, action: string, reason?: string } | null}
|
|
289
|
+
*/
|
|
290
|
+
export function ensureStrictVModel(root) {
|
|
291
|
+
if (nuxtConfig(root)) return null;
|
|
292
|
+
const target = ['tsconfig.app.json', 'tsconfig.json']
|
|
293
|
+
.map((name) => join(root, name))
|
|
294
|
+
.find((path) => existsSync(path));
|
|
295
|
+
if (!target) return null;
|
|
296
|
+
const path = `${relative(root, target)} [vueCompilerOptions.strictVModel]`;
|
|
297
|
+
if (flagSet(root, STRICT_V_MODEL_CHOSEN))
|
|
298
|
+
return { path, action: 'unchanged' };
|
|
299
|
+
try {
|
|
300
|
+
refuseLinkedTarget(target);
|
|
301
|
+
} catch (error) {
|
|
302
|
+
return { path, action: 'skipped', reason: error.message };
|
|
303
|
+
}
|
|
304
|
+
return insertVueCompilerFlag(target, path, 'strictVModel');
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const NOT_SOURCE = new Set([
|
|
308
|
+
'node_modules',
|
|
309
|
+
'dist',
|
|
310
|
+
'build',
|
|
311
|
+
'vendor',
|
|
312
|
+
'.git',
|
|
313
|
+
'.nuxt',
|
|
314
|
+
'.output',
|
|
315
|
+
'storage',
|
|
316
|
+
'public',
|
|
317
|
+
]);
|
|
318
|
+
/** Above any scaffold's own count (create-vue with examples has about 11). */
|
|
319
|
+
const NEW_PROJECT_MAX_SFCS = 15;
|
|
320
|
+
|
|
321
|
+
/** `true` while the count stays within the limit; an unreadable folder counts as over it. */
|
|
322
|
+
function sfcsWithin(dir, limit) {
|
|
323
|
+
let count = 0;
|
|
324
|
+
const walk = (at) => {
|
|
325
|
+
for (const entry of readdirSync(at, { withFileTypes: true })) {
|
|
326
|
+
if (entry.isDirectory()) {
|
|
327
|
+
if (!NOT_SOURCE.has(entry.name)) walk(join(at, entry.name));
|
|
328
|
+
} else if (entry.name.endsWith('.vue')) count++;
|
|
329
|
+
if (count > limit) return;
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
try {
|
|
333
|
+
walk(dir);
|
|
334
|
+
} catch {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
return count <= limit;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Commits reachable from HEAD: 0 outside a repository or before the first commit, `undefined` when git cannot say. */
|
|
341
|
+
function commitCount(root) {
|
|
342
|
+
const result = spawnSync('git', ['rev-list', '--count', 'HEAD'], {
|
|
343
|
+
cwd: root,
|
|
344
|
+
encoding: 'utf-8',
|
|
345
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
346
|
+
});
|
|
347
|
+
if (result.error) return undefined;
|
|
348
|
+
if (result.status === 0) return Number(result.stdout.trim());
|
|
349
|
+
return /not a git repository|bad revision 'HEAD'|ambiguous argument 'HEAD'/i.test(
|
|
350
|
+
result.stderr
|
|
351
|
+
)
|
|
352
|
+
? 0
|
|
353
|
+
: undefined;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Is this demonstrably a project that has just been scaffolded? Every signal
|
|
358
|
+
* must say so; any doubt means running.
|
|
359
|
+
*
|
|
360
|
+
* @param {string} root
|
|
361
|
+
* @param {{ alreadyWired: boolean }} options
|
|
362
|
+
*/
|
|
363
|
+
export function isNewProject(root, { alreadyWired }) {
|
|
364
|
+
if (alreadyWired) return false;
|
|
365
|
+
const commits = commitCount(root);
|
|
366
|
+
if (commits === undefined || commits > 1) return false;
|
|
367
|
+
return sfcsWithin(root, NEW_PROJECT_MAX_SFCS);
|
|
368
|
+
}
|