nudge-ui 0.2.0
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 +66 -0
- package/bin/nudge-ui.mjs +7 -0
- package/dist/LICENSE +21 -0
- package/dist/client.mjs +261 -0
- package/dist/compiler/ast.d.ts +18 -0
- package/dist/compiler/ast.js +75 -0
- package/dist/compiler/componentContractTypes.d.ts +19 -0
- package/dist/compiler/componentContractTypes.js +1 -0
- package/dist/compiler/componentContracts.d.ts +2 -0
- package/dist/compiler/componentContracts.js +260 -0
- package/dist/compiler/componentInstrumentation.d.ts +32 -0
- package/dist/compiler/componentInstrumentation.js +140 -0
- package/dist/compiler/componentPolicyResolution.d.ts +71 -0
- package/dist/compiler/componentPolicyResolution.js +388 -0
- package/dist/compiler/index.d.ts +9 -0
- package/dist/compiler/index.js +9 -0
- package/dist/compiler/packageComponentContracts.d.ts +32 -0
- package/dist/compiler/packageComponentContracts.js +308 -0
- package/dist/compiler/reactComponentProtocols.d.ts +145 -0
- package/dist/compiler/reactComponentProtocols.js +47 -0
- package/dist/compiler/reactIdentity.d.ts +15 -0
- package/dist/compiler/reactIdentity.js +339 -0
- package/dist/compiler/sourcePaths.d.ts +12 -0
- package/dist/compiler/sourcePaths.js +27 -0
- package/dist/css/dialects/index.d.ts +62 -0
- package/dist/css/dialects/index.js +103 -0
- package/dist/css/dialects/tailwind.d.ts +46 -0
- package/dist/css/dialects/tailwind.js +119 -0
- package/dist/css/dialects/vanillaExtract.d.ts +20 -0
- package/dist/css/dialects/vanillaExtract.js +32 -0
- package/dist/css/index.d.ts +10 -0
- package/dist/css/index.js +10 -0
- package/dist/css/model/index.d.ts +190 -0
- package/dist/css/model/index.js +10 -0
- package/dist/css/token-inventory/index.d.ts +26 -0
- package/dist/css/token-inventory/index.js +24 -0
- package/dist/css/token-inventory/inventory.d.ts +8 -0
- package/dist/css/token-inventory/inventory.js +421 -0
- package/dist/css/token-inventory/parseStylesheet.d.ts +16 -0
- package/dist/css/token-inventory/parseStylesheet.js +155 -0
- package/dist/css/token-inventory/policy.d.ts +47 -0
- package/dist/css/token-inventory/policy.js +50 -0
- package/dist/css/token-inventory/types.d.ts +97 -0
- package/dist/css/token-inventory/types.js +1 -0
- package/dist/css/value-semantics/borderSemantics.d.ts +28 -0
- package/dist/css/value-semantics/borderSemantics.js +91 -0
- package/dist/css/value-semantics/boxSemantics.d.ts +37 -0
- package/dist/css/value-semantics/boxSemantics.js +71 -0
- package/dist/css/value-semantics/colorSemantics.d.ts +99 -0
- package/dist/css/value-semantics/colorSemantics.js +526 -0
- package/dist/css/value-semantics/cssSyntax.d.ts +19 -0
- package/dist/css/value-semantics/cssSyntax.js +111 -0
- package/dist/css/value-semantics/fontSemantics.d.ts +35 -0
- package/dist/css/value-semantics/fontSemantics.js +131 -0
- package/dist/css/value-semantics/index.d.ts +20 -0
- package/dist/css/value-semantics/index.js +15 -0
- package/dist/css/value-semantics/propertyPolicy.d.ts +118 -0
- package/dist/css/value-semantics/propertyPolicy.js +356 -0
- package/dist/css/value-semantics/stringMaps.d.ts +2 -0
- package/dist/css/value-semantics/stringMaps.js +1 -0
- package/dist/css/value-semantics/structuredValues.d.ts +64 -0
- package/dist/css/value-semantics/structuredValues.js +250 -0
- package/dist/css/value-semantics/tokenInterpretation.d.ts +90 -0
- package/dist/css/value-semantics/tokenInterpretation.js +193 -0
- package/dist/css/virtual-design-tokens.d.ts +17 -0
- package/dist/hosts/astro/astroRuntimeConfig.d.ts +12 -0
- package/dist/hosts/astro/astroRuntimeConfig.js +26 -0
- package/dist/hosts/astro/clientAsset.d.ts +12 -0
- package/dist/hosts/astro/clientAsset.js +51 -0
- package/dist/hosts/astro/clientTransport.d.ts +3 -0
- package/dist/hosts/astro/clientTransport.js +57 -0
- package/dist/hosts/astro/index.d.ts +3 -0
- package/dist/hosts/astro/index.js +2 -0
- package/dist/hosts/astro/integration.d.ts +35 -0
- package/dist/hosts/astro/integration.js +96 -0
- package/dist/hosts/astro/middleware.d.ts +13 -0
- package/dist/hosts/astro/middleware.js +22 -0
- package/dist/hosts/astro/projectContext.d.ts +11 -0
- package/dist/hosts/astro/projectContext.js +34 -0
- package/dist/hosts/astro/responseInstrumentation.d.ts +41 -0
- package/dist/hosts/astro/responseInstrumentation.js +80 -0
- package/dist/hosts/next/index.d.ts +4 -0
- package/dist/hosts/next/index.js +7 -0
- package/dist/hosts/next/loader.d.ts +66 -0
- package/dist/hosts/next/loader.js +346 -0
- package/dist/hosts/next/loaders/identity-loader.cjs +228257 -0
- package/dist/hosts/next/loaders/loader-plugin.cjs +228257 -0
- package/dist/hosts/next/manifest.d.ts +38 -0
- package/dist/hosts/next/manifest.js +30 -0
- package/dist/hosts/next/mount.d.ts +12 -0
- package/dist/hosts/next/mount.js +23 -0
- package/dist/hosts/next/repositoryScope.d.ts +20 -0
- package/dist/hosts/next/repositoryScope.js +33 -0
- package/dist/hosts/next/sidecar.d.ts +27 -0
- package/dist/hosts/next/sidecar.js +526 -0
- package/dist/hosts/next/wrapper.d.ts +67 -0
- package/dist/hosts/next/wrapper.js +310 -0
- package/dist/hosts/static/cli.d.ts +12 -0
- package/dist/hosts/static/cli.js +77 -0
- package/dist/hosts/static/html/bootstrap.d.ts +27 -0
- package/dist/hosts/static/html/bootstrap.js +93 -0
- package/dist/hosts/static/index.d.ts +4 -0
- package/dist/hosts/static/index.js +4 -0
- package/dist/hosts/static/manifest.d.ts +18 -0
- package/dist/hosts/static/manifest.js +51 -0
- package/dist/hosts/static/server.d.ts +72 -0
- package/dist/hosts/static/server.js +554 -0
- package/dist/hosts/vite/index.d.ts +20 -0
- package/dist/hosts/vite/index.js +48 -0
- package/dist/hosts/vite/react.d.ts +67 -0
- package/dist/hosts/vite/react.js +231 -0
- package/dist/hosts/vite/tokens/activeStylesheets.d.ts +28 -0
- package/dist/hosts/vite/tokens/activeStylesheets.js +70 -0
- package/dist/hosts/vite/tokens/fileMap.d.ts +2 -0
- package/dist/hosts/vite/tokens/fileMap.js +1 -0
- package/dist/hosts/vite/tokens/viteStylesheetArtifacts.d.ts +46 -0
- package/dist/hosts/vite/tokens/viteStylesheetArtifacts.js +104 -0
- package/dist/hosts/vite/virtual/design-tokens.d.ts +9 -0
- package/dist/hosts/vite/virtual/design-tokens.js +7 -0
- package/dist/hosts/vite/virtual-design-tokens.d.ts +1 -0
- package/dist/hosts/vite/vite.d.ts +62 -0
- package/dist/hosts/vite/vite.js +854 -0
- package/dist/html/dom.d.ts +13 -0
- package/dist/html/dom.js +46 -0
- package/dist/html/identity.d.ts +40 -0
- package/dist/html/identity.js +196 -0
- package/dist/html/insertions.d.ts +26 -0
- package/dist/html/insertions.js +59 -0
- package/dist/inspector/agent/McpConnectionDialog.d.ts +26 -0
- package/dist/inspector/agent/McpConnectionDialog.js +135 -0
- package/dist/inspector/agent/client.d.ts +98 -0
- package/dist/inspector/agent/client.js +728 -0
- package/dist/inspector/agent/connectionStatus.d.ts +13 -0
- package/dist/inspector/agent/connectionStatus.js +35 -0
- package/dist/inspector/agent/httpTransport.d.ts +21 -0
- package/dist/inspector/agent/httpTransport.js +347 -0
- package/dist/inspector/agent/protocol.d.ts +95 -0
- package/dist/inspector/agent/protocol.js +9 -0
- package/dist/inspector/agent/verification.d.ts +39 -0
- package/dist/inspector/agent/verification.js +207 -0
- package/dist/inspector/canvas/CanvasCard.d.ts +10 -0
- package/dist/inspector/canvas/CanvasCard.js +275 -0
- package/dist/inspector/canvas/CanvasElementOverlay.d.ts +2 -0
- package/dist/inspector/canvas/CanvasElementOverlay.js +301 -0
- package/dist/inspector/canvas/CanvasWorkspace.d.ts +2 -0
- package/dist/inspector/canvas/CanvasWorkspace.js +301 -0
- package/dist/inspector/canvas/LockedWorkspaceNotice.d.ts +6 -0
- package/dist/inspector/canvas/LockedWorkspaceNotice.js +17 -0
- package/dist/inspector/canvas/StaleChangeIndicator.d.ts +7 -0
- package/dist/inspector/canvas/StaleChangeIndicator.js +43 -0
- package/dist/inspector/canvas/agentPresentation.d.ts +87 -0
- package/dist/inspector/canvas/agentPresentation.js +421 -0
- package/dist/inspector/canvas/canvasGestures.d.ts +12 -0
- package/dist/inspector/canvas/canvasGestures.js +21 -0
- package/dist/inspector/canvas/canvasStore.d.ts +108 -0
- package/dist/inspector/canvas/canvasStore.js +448 -0
- package/dist/inspector/canvas/frameProtocol.d.ts +231 -0
- package/dist/inspector/canvas/frameProtocol.js +165 -0
- package/dist/inspector/canvas/linkEligibility.d.ts +8 -0
- package/dist/inspector/canvas/linkEligibility.js +68 -0
- package/dist/inspector/canvas/measurementProjection.d.ts +8 -0
- package/dist/inspector/canvas/measurementProjection.js +16 -0
- package/dist/inspector/canvas/normalizeUrl.d.ts +7 -0
- package/dist/inspector/canvas/normalizeUrl.js +27 -0
- package/dist/inspector/canvas/projection.d.ts +41 -0
- package/dist/inspector/canvas/projection.js +232 -0
- package/dist/inspector/canvas/rendererBootstrap.d.ts +4 -0
- package/dist/inspector/canvas/rendererBootstrap.js +410 -0
- package/dist/inspector/canvas/rendererCidIndex.d.ts +11 -0
- package/dist/inspector/canvas/rendererCidIndex.js +21 -0
- package/dist/inspector/canvas/rendererElementSelector.d.ts +2 -0
- package/dist/inspector/canvas/rendererElementSelector.js +378 -0
- package/dist/inspector/canvas/rendererSelectionProxy.d.ts +2 -0
- package/dist/inspector/canvas/rendererSelectionProxy.js +61 -0
- package/dist/inspector/canvas/rendererStylesheet.d.ts +16 -0
- package/dist/inspector/canvas/rendererStylesheet.js +221 -0
- package/dist/inspector/canvas/resizeHandleScale.d.ts +13 -0
- package/dist/inspector/canvas/resizeHandleScale.js +20 -0
- package/dist/inspector/canvas/roleDetection.d.ts +5 -0
- package/dist/inspector/canvas/roleDetection.js +21 -0
- package/dist/inspector/canvas/sessionStore.d.ts +71 -0
- package/dist/inspector/canvas/sessionStore.js +453 -0
- package/dist/inspector/canvas/staleChangeDetector.d.ts +11 -0
- package/dist/inspector/canvas/staleChangeDetector.js +217 -0
- package/dist/inspector/canvas/toolbarScale.d.ts +7 -0
- package/dist/inspector/canvas/toolbarScale.js +11 -0
- package/dist/inspector/canvas/workspaceLease.d.ts +26 -0
- package/dist/inspector/canvas/workspaceLease.js +214 -0
- package/dist/inspector/changes/changesLog.d.ts +46 -0
- package/dist/inspector/changes/changesLog.js +209 -0
- package/dist/inspector/changes/codecs.d.ts +98 -0
- package/dist/inspector/changes/codecs.js +389 -0
- package/dist/inspector/changes/editModel.d.ts +74 -0
- package/dist/inspector/changes/editModel.js +120 -0
- package/dist/inspector/changes/managedStyleProjection.d.ts +6 -0
- package/dist/inspector/changes/managedStyleProjection.js +109 -0
- package/dist/inspector/changes/model.d.ts +13 -0
- package/dist/inspector/changes/model.js +163 -0
- package/dist/inspector/changes/presentation.d.ts +14 -0
- package/dist/inspector/changes/presentation.js +81 -0
- package/dist/inspector/changes/previewDiagnostics.d.ts +39 -0
- package/dist/inspector/changes/previewDiagnostics.js +172 -0
- package/dist/inspector/changes/structuralTypes.d.ts +35 -0
- package/dist/inspector/changes/structuralTypes.js +1 -0
- package/dist/inspector/changes/types.d.ts +76 -0
- package/dist/inspector/changes/types.js +16 -0
- package/dist/inspector/changes/workspaceChanges.d.ts +43 -0
- package/dist/inspector/changes/workspaceChanges.js +239 -0
- package/dist/inspector/clientManifest.d.ts +24 -0
- package/dist/inspector/clientManifest.js +69 -0
- package/dist/inspector/componentSemantics/ComponentPropsSection.d.ts +5 -0
- package/dist/inspector/componentSemantics/ComponentPropsSection.js +44 -0
- package/dist/inspector/componentSemantics/adapterRegistry.d.ts +11 -0
- package/dist/inspector/componentSemantics/adapterRegistry.js +75 -0
- package/dist/inspector/componentSemantics/boundaries.d.ts +2 -0
- package/dist/inspector/componentSemantics/boundaries.js +10 -0
- package/dist/inspector/componentSemantics/changeAction.d.ts +3 -0
- package/dist/inspector/componentSemantics/changeAction.js +6 -0
- package/dist/inspector/componentSemantics/changeModel.d.ts +8 -0
- package/dist/inspector/componentSemantics/changeModel.js +60 -0
- package/dist/inspector/componentSemantics/index.d.ts +4 -0
- package/dist/inspector/componentSemantics/index.js +2 -0
- package/dist/inspector/componentSemantics/reactRuntime.d.ts +10 -0
- package/dist/inspector/componentSemantics/reactRuntime.js +186 -0
- package/dist/inspector/componentSemantics/runtimeBridge.d.ts +25 -0
- package/dist/inspector/componentSemantics/runtimeBridge.js +161 -0
- package/dist/inspector/componentSemantics/runtimeTypes.d.ts +2 -0
- package/dist/inspector/componentSemantics/runtimeTypes.js +1 -0
- package/dist/inspector/componentSemantics/textBinding.d.ts +69 -0
- package/dist/inspector/componentSemantics/textBinding.js +514 -0
- package/dist/inspector/componentSemantics/types.d.ts +96 -0
- package/dist/inspector/componentSemantics/types.js +5 -0
- package/dist/inspector/conformance/borderCases.d.ts +7 -0
- package/dist/inspector/conformance/borderCases.js +428 -0
- package/dist/inspector/conformance/colorCases.d.ts +8 -0
- package/dist/inspector/conformance/colorCases.js +470 -0
- package/dist/inspector/conformance/fixture.d.ts +68 -0
- package/dist/inspector/conformance/fixture.js +153 -0
- package/dist/inspector/conformance/projection.d.ts +2 -0
- package/dist/inspector/conformance/projection.js +3 -0
- package/dist/inspector/conformance/spacingCases.d.ts +6 -0
- package/dist/inspector/conformance/spacingCases.js +417 -0
- package/dist/inspector/conformance/typographyCases.d.ts +7 -0
- package/dist/inspector/conformance/typographyCases.js +174 -0
- package/dist/inspector/editScope.d.ts +4 -0
- package/dist/inspector/editScope.js +5 -0
- package/dist/inspector/index.d.ts +20 -0
- package/dist/inspector/index.js +236 -0
- package/dist/inspector/inline-text/inlineTextEditor.d.ts +74 -0
- package/dist/inspector/inline-text/inlineTextEditor.js +1207 -0
- package/dist/inspector/inline-text/inlineTextLifecycle.d.ts +2 -0
- package/dist/inspector/inline-text/inlineTextLifecycle.js +17 -0
- package/dist/inspector/inline-text/textChangeBoundary.d.ts +6 -0
- package/dist/inspector/inline-text/textChangeBoundary.js +1 -0
- package/dist/inspector/inspection/bridge.d.ts +72 -0
- package/dist/inspector/inspection/bridge.js +134 -0
- package/dist/inspector/inspection/browserCssInspection.d.ts +74 -0
- package/dist/inspector/inspection/browserCssInspection.js +317 -0
- package/dist/inspector/inspection/browserCssInspectionRegistry.d.ts +12 -0
- package/dist/inspector/inspection/browserCssInspectionRegistry.js +66 -0
- package/dist/inspector/inspection/selectionProperty.d.ts +32 -0
- package/dist/inspector/inspection/selectionProperty.js +33 -0
- package/dist/inspector/inspection/useBrowserCssInspection.d.ts +20 -0
- package/dist/inspector/inspection/useBrowserCssInspection.js +159 -0
- package/dist/inspector/overlay/DropGuideOverlay.d.ts +17 -0
- package/dist/inspector/overlay/DropGuideOverlay.js +17 -0
- package/dist/inspector/overlay/InspectorOverlay.d.ts +5 -0
- package/dist/inspector/overlay/InspectorOverlay.js +328 -0
- package/dist/inspector/overlay/MeasurementGuideOverlay.d.ts +19 -0
- package/dist/inspector/overlay/MeasurementGuideOverlay.js +40 -0
- package/dist/inspector/overlay/clickPolicy.d.ts +7 -0
- package/dist/inspector/overlay/clickPolicy.js +13 -0
- package/dist/inspector/overlay/dropGuide.d.ts +22 -0
- package/dist/inspector/overlay/dropGuide.js +48 -0
- package/dist/inspector/overlay/elementSelector.d.ts +1 -0
- package/dist/inspector/overlay/elementSelector.js +100 -0
- package/dist/inspector/overlay/frameThrottle.d.ts +10 -0
- package/dist/inspector/overlay/frameThrottle.js +38 -0
- package/dist/inspector/overlay/interactionStyles.d.ts +3 -0
- package/dist/inspector/overlay/interactionStyles.js +70 -0
- package/dist/inspector/overlay/measurementGeometry.d.ts +25 -0
- package/dist/inspector/overlay/measurementGeometry.js +104 -0
- package/dist/inspector/overlay/overlayGeometry.d.ts +40 -0
- package/dist/inspector/overlay/overlayGeometry.js +59 -0
- package/dist/inspector/overlay/selectedGeometry.d.ts +7 -0
- package/dist/inspector/overlay/selectedGeometry.js +51 -0
- package/dist/inspector/overlay/structuralGestures.d.ts +28 -0
- package/dist/inspector/overlay/structuralGestures.js +180 -0
- package/dist/inspector/projection/cssEscapes.d.ts +3 -0
- package/dist/inspector/projection/cssEscapes.js +20 -0
- package/dist/inspector/projection/managedStylesheet.d.ts +33 -0
- package/dist/inspector/projection/managedStylesheet.js +240 -0
- package/dist/inspector/projection/renderedInstance.d.ts +56 -0
- package/dist/inspector/projection/renderedInstance.js +306 -0
- package/dist/inspector/projection/structuralProjection.d.ts +93 -0
- package/dist/inspector/projection/structuralProjection.js +560 -0
- package/dist/inspector/projection/structuralProjectionBoundary.d.ts +5 -0
- package/dist/inspector/projection/structuralProjectionBoundary.js +65 -0
- package/dist/inspector/projection/textProjection.d.ts +53 -0
- package/dist/inspector/projection/textProjection.js +705 -0
- package/dist/inspector/projection/workspaceProjection.d.ts +43 -0
- package/dist/inspector/projection/workspaceProjection.js +58 -0
- package/dist/inspector/prompt/PromptSettingsDialog.d.ts +15 -0
- package/dist/inspector/prompt/PromptSettingsDialog.js +17 -0
- package/dist/inspector/prompt/clipboardHandoff.d.ts +34 -0
- package/dist/inspector/prompt/clipboardHandoff.js +212 -0
- package/dist/inspector/prompt/copyToClipboard.d.ts +1 -0
- package/dist/inspector/prompt/copyToClipboard.js +34 -0
- package/dist/inspector/prompt/detectFramework.d.ts +6 -0
- package/dist/inspector/prompt/detectFramework.js +4 -0
- package/dist/inspector/prompt/generatePrompt.d.ts +7 -0
- package/dist/inspector/prompt/generatePrompt.js +391 -0
- package/dist/inspector/prompt/promptSettings.d.ts +8 -0
- package/dist/inspector/prompt/promptSettings.js +28 -0
- package/dist/inspector/runtime/devFlag.d.ts +28 -0
- package/dist/inspector/runtime/devFlag.js +50 -0
- package/dist/inspector/runtime/documentStylesheetOrder.d.ts +19 -0
- package/dist/inspector/runtime/documentStylesheetOrder.js +89 -0
- package/dist/inspector/runtime/domRealm.d.ts +4 -0
- package/dist/inspector/runtime/domRealm.js +11 -0
- package/dist/inspector/runtime/runtimeConfig.d.ts +119 -0
- package/dist/inspector/runtime/runtimeConfig.js +276 -0
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.d.ts +32 -0
- package/dist/inspector/runtime/staticHtmlRuntimeIdentity.js +149 -0
- package/dist/inspector/runtime/useRuntimeConfig.d.ts +10 -0
- package/dist/inspector/runtime/useRuntimeConfig.js +13 -0
- package/dist/inspector/selection/editScope.d.ts +32 -0
- package/dist/inspector/selection/editScope.js +140 -0
- package/dist/inspector/selection/editTarget.d.ts +8 -0
- package/dist/inspector/selection/editTarget.js +11 -0
- package/dist/inspector/selection/hierarchy.d.ts +7 -0
- package/dist/inspector/selection/hierarchy.js +42 -0
- package/dist/inspector/selection/resolveSelection.d.ts +10 -0
- package/dist/inspector/selection/resolveSelection.js +60 -0
- package/dist/inspector/selection/selectionStore.d.ts +41 -0
- package/dist/inspector/selection/selectionStore.js +262 -0
- package/dist/inspector/selection/selectionTarget.d.ts +5 -0
- package/dist/inspector/selection/selectionTarget.js +50 -0
- package/dist/inspector/selection/sourceSite.d.ts +2 -0
- package/dist/inspector/selection/sourceSite.js +12 -0
- package/dist/inspector/selection/styleSelection.d.ts +22 -0
- package/dist/inspector/selection/styleSelection.js +104 -0
- package/dist/inspector/session/index.d.ts +3 -0
- package/dist/inspector/session/index.js +2 -0
- package/dist/inspector/session/lifecycle.d.ts +22 -0
- package/dist/inspector/session/lifecycle.js +63 -0
- package/dist/inspector/session/sessionContext.d.ts +21 -0
- package/dist/inspector/session/sessionContext.js +28 -0
- package/dist/inspector/session/sessionFactory.d.ts +29 -0
- package/dist/inspector/session/sessionFactory.js +73 -0
- package/dist/inspector/settings/SettingsDialog.d.ts +12 -0
- package/dist/inspector/settings/SettingsDialog.js +46 -0
- package/dist/inspector/shell/AppShell.d.ts +2 -0
- package/dist/inspector/shell/AppShell.js +9 -0
- package/dist/inspector/shell/ChangesLog.d.ts +6 -0
- package/dist/inspector/shell/ChangesLog.js +92 -0
- package/dist/inspector/shell/CopyPromptButton.d.ts +9 -0
- package/dist/inspector/shell/CopyPromptButton.js +159 -0
- package/dist/inspector/shell/DomNavigation.d.ts +8 -0
- package/dist/inspector/shell/DomNavigation.js +30 -0
- package/dist/inspector/shell/EmptyState.d.ts +2 -0
- package/dist/inspector/shell/EmptyState.js +15 -0
- package/dist/inspector/shell/InspectorShell.d.ts +11 -0
- package/dist/inspector/shell/InspectorShell.js +268 -0
- package/dist/inspector/shell/openStore.d.ts +6 -0
- package/dist/inspector/shell/openStore.js +29 -0
- package/dist/inspector/shell/panelLayout.d.ts +2 -0
- package/dist/inspector/shell/panelLayout.js +29 -0
- package/dist/inspector/shell/shortcuts.d.ts +3 -0
- package/dist/inspector/shell/shortcuts.js +25 -0
- package/dist/inspector/shell/stateValue.d.ts +3 -0
- package/dist/inspector/shell/stateValue.js +34 -0
- package/dist/inspector/shell/styleState.d.ts +7 -0
- package/dist/inspector/shell/styleState.js +13 -0
- package/dist/inspector/spacing/projection.d.ts +43 -0
- package/dist/inspector/spacing/projection.js +136 -0
- package/dist/inspector/styleEditors/AppearanceSection.d.ts +13 -0
- package/dist/inspector/styleEditors/AppearanceSection.js +6 -0
- package/dist/inspector/styleEditors/AspectRatioField.d.ts +17 -0
- package/dist/inspector/styleEditors/AspectRatioField.js +10 -0
- package/dist/inspector/styleEditors/BorderEditor.d.ts +13 -0
- package/dist/inspector/styleEditors/BorderEditor.js +295 -0
- package/dist/inspector/styleEditors/BorderRadiusEditor.d.ts +14 -0
- package/dist/inspector/styleEditors/BorderRadiusEditor.js +108 -0
- package/dist/inspector/styleEditors/BoxShadowEditor.d.ts +13 -0
- package/dist/inspector/styleEditors/BoxShadowEditor.js +13 -0
- package/dist/inspector/styleEditors/ColorPicker.d.ts +15 -0
- package/dist/inspector/styleEditors/ColorPicker.js +73 -0
- package/dist/inspector/styleEditors/GapField.d.ts +17 -0
- package/dist/inspector/styleEditors/GapField.js +12 -0
- package/dist/inspector/styleEditors/GridChildSection.d.ts +14 -0
- package/dist/inspector/styleEditors/GridChildSection.js +91 -0
- package/dist/inspector/styleEditors/GridPicker.d.ts +13 -0
- package/dist/inspector/styleEditors/GridPicker.js +179 -0
- package/dist/inspector/styleEditors/GridSection.d.ts +17 -0
- package/dist/inspector/styleEditors/GridSection.js +27 -0
- package/dist/inspector/styleEditors/GridValueField.d.ts +17 -0
- package/dist/inspector/styleEditors/GridValueField.js +70 -0
- package/dist/inspector/styleEditors/InsetSection.d.ts +15 -0
- package/dist/inspector/styleEditors/InsetSection.js +15 -0
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.d.ts +6 -0
- package/dist/inspector/styleEditors/LayoutBlockedIndicator.js +6 -0
- package/dist/inspector/styleEditors/LayoutComboField.d.ts +18 -0
- package/dist/inspector/styleEditors/LayoutComboField.js +138 -0
- package/dist/inspector/styleEditors/LayoutDropdown.d.ts +14 -0
- package/dist/inspector/styleEditors/LayoutDropdown.js +34 -0
- package/dist/inspector/styleEditors/LayoutSection.d.ts +13 -0
- package/dist/inspector/styleEditors/LayoutSection.js +342 -0
- package/dist/inspector/styleEditors/OpacityEditor.d.ts +13 -0
- package/dist/inspector/styleEditors/OpacityEditor.js +34 -0
- package/dist/inspector/styleEditors/PositionInsets.d.ts +15 -0
- package/dist/inspector/styleEditors/PositionInsets.js +12 -0
- package/dist/inspector/styleEditors/SpacingBox.d.ts +29 -0
- package/dist/inspector/styleEditors/SpacingBox.js +189 -0
- package/dist/inspector/styleEditors/Typography.d.ts +13 -0
- package/dist/inspector/styleEditors/Typography.js +137 -0
- package/dist/inspector/styleEditors/completeCssValue.d.ts +8 -0
- package/dist/inspector/styleEditors/completeCssValue.js +34 -0
- package/dist/inspector/styleEditors/gridChildModel.d.ts +74 -0
- package/dist/inspector/styleEditors/gridChildModel.js +138 -0
- package/dist/inspector/styleEditors/layoutValue.d.ts +24 -0
- package/dist/inspector/styleEditors/layoutValue.js +103 -0
- package/dist/inspector/styleEditors/nudgeValue.d.ts +8 -0
- package/dist/inspector/styleEditors/nudgeValue.js +71 -0
- package/dist/inspector/styleEditors/rowLookup.d.ts +11 -0
- package/dist/inspector/styleEditors/rowLookup.js +13 -0
- package/dist/inspector/styleEditors/stringRecord.d.ts +4 -0
- package/dist/inspector/styleEditors/stringRecord.js +1 -0
- package/dist/inspector/styleEditors/valuePolicy.d.ts +20 -0
- package/dist/inspector/styleEditors/valuePolicy.js +82 -0
- package/dist/inspector/testing.d.ts +10 -0
- package/dist/inspector/testing.js +9 -0
- package/dist/inspector/tokens/TokenChip.d.ts +24 -0
- package/dist/inspector/tokens/TokenChip.js +23 -0
- package/dist/inspector/tokens/TokenDropdown.d.ts +13 -0
- package/dist/inspector/tokens/TokenDropdown.js +59 -0
- package/dist/inspector/tokens/TokenField.d.ts +68 -0
- package/dist/inspector/tokens/TokenField.js +485 -0
- package/dist/inspector/tokens/TokenLabel.d.ts +7 -0
- package/dist/inspector/tokens/TokenLabel.js +23 -0
- package/dist/inspector/tokens/TokensPanel.d.ts +5 -0
- package/dist/inspector/tokens/TokensPanel.js +47 -0
- package/dist/inspector/tokens/catalog.d.ts +51 -0
- package/dist/inspector/tokens/catalog.js +184 -0
- package/dist/inspector/tokens/editActions.d.ts +35 -0
- package/dist/inspector/tokens/editActions.js +164 -0
- package/dist/inspector/tokens/resolution/cascade.d.ts +14 -0
- package/dist/inspector/tokens/resolution/cascade.js +31 -0
- package/dist/inspector/tokens/resolution/cssomCollector.d.ts +43 -0
- package/dist/inspector/tokens/resolution/cssomCollector.js +528 -0
- package/dist/inspector/tokens/resolution/selectorSemantics.d.ts +12 -0
- package/dist/inspector/tokens/resolution/selectorSemantics.js +106 -0
- package/dist/inspector/tokens/resolution.d.ts +56 -0
- package/dist/inspector/tokens/resolution.js +1401 -0
- package/dist/inspector/tokens/tokenEdits.d.ts +3 -0
- package/dist/inspector/tokens/tokenEdits.js +22 -0
- package/dist/inspector/tokens/valueSemanticsAdapter.d.ts +6 -0
- package/dist/inspector/tokens/valueSemanticsAdapter.js +68 -0
- package/dist/inspector/ui/AtRuleContext.d.ts +18 -0
- package/dist/inspector/ui/AtRuleContext.js +54 -0
- package/dist/inspector/ui/Button.d.ts +9 -0
- package/dist/inspector/ui/Button.js +4 -0
- package/dist/inspector/ui/ColorSwatch.d.ts +7 -0
- package/dist/inspector/ui/ColorSwatch.js +6 -0
- package/dist/inspector/ui/ControlSurface.d.ts +14 -0
- package/dist/inspector/ui/ControlSurface.js +10 -0
- package/dist/inspector/ui/FieldRow.d.ts +14 -0
- package/dist/inspector/ui/FieldRow.js +15 -0
- package/dist/inspector/ui/IconButton.d.ts +14 -0
- package/dist/inspector/ui/IconButton.js +5 -0
- package/dist/inspector/ui/InspectorPopover.d.ts +17 -0
- package/dist/inspector/ui/InspectorPopover.js +13 -0
- package/dist/inspector/ui/PopoverListbox.d.ts +37 -0
- package/dist/inspector/ui/PopoverListbox.js +21 -0
- package/dist/inspector/ui/SegmentedControl.d.ts +24 -0
- package/dist/inspector/ui/SegmentedControl.js +16 -0
- package/dist/inspector/ui/Select.d.ts +25 -0
- package/dist/inspector/ui/Select.js +56 -0
- package/dist/inspector/ui/SideValuesField.d.ts +44 -0
- package/dist/inspector/ui/SideValuesField.js +76 -0
- package/dist/inspector/ui/StatusCallout.d.ts +9 -0
- package/dist/inspector/ui/StatusCallout.js +4 -0
- package/dist/inspector/ui/TextInput.d.ts +12 -0
- package/dist/inspector/ui/TextInput.js +5 -0
- package/dist/inspector/ui/ToggleButton.d.ts +11 -0
- package/dist/inspector/ui/ToggleButton.js +6 -0
- package/dist/inspector/ui/assets/grid.svg +14 -0
- package/dist/inspector/ui/css.d.ts +9 -0
- package/dist/inspector/ui/labels.d.ts +1 -0
- package/dist/inspector/ui/labels.js +7 -0
- package/dist/inspector/ui/styles.d.ts +1 -0
- package/dist/inspector/ui/styles.js +68 -0
- package/dist/inspector/virtual-modules.d.ts +7 -0
- package/dist/inspector/vite-env.d.ts +10 -0
- package/dist/internal/agent-protocol.d.ts +232 -0
- package/dist/internal/agent-protocol.js +237 -0
- package/dist/nudge-ui.mjs +15722 -0
- package/dist/project/files.d.ts +19 -0
- package/dist/project/files.js +226 -0
- package/dist/project/identity.d.ts +6 -0
- package/dist/project/identity.js +19 -0
- package/dist/project/pathPolicy.d.ts +8 -0
- package/dist/project/pathPolicy.js +12 -0
- package/dist/project/tokens.d.ts +36 -0
- package/dist/project/tokens.js +223 -0
- package/dist/transport/index.d.ts +8 -0
- package/dist/transport/index.js +8 -0
- package/dist/transport/routes.d.ts +13 -0
- package/dist/transport/routes.js +16 -0
- package/package.json +137 -0
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createServer, } from "node:http";
|
|
3
|
+
import { constants, existsSync, realpathSync, statSync, } from "node:fs";
|
|
4
|
+
import { open, stat } from "node:fs/promises";
|
|
5
|
+
import { dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
6
|
+
import { createRequire } from "node:module";
|
|
7
|
+
import { instrumentSourceHtml } from "../../html/identity.js";
|
|
8
|
+
import { injectStandaloneBootstrap } from "./html/bootstrap.js";
|
|
9
|
+
import { createStandaloneRuntimeManifest, NUDGE_UI_CLIENT_PATH, NUDGE_UI_MANIFEST_PATH, NUDGE_UI_RELOAD_PATH, NUDGE_UI_ROUTE_PREFIX, } from "./manifest.js";
|
|
10
|
+
import { createProjectTokenSnapshot, EMPTY_PROJECT_TOKEN_SNAPSHOT } from "../../project/tokens.js";
|
|
11
|
+
import { createProjectFileWatcher, isSensitiveProjectPath, } from "../../project/files.js";
|
|
12
|
+
const LOOPBACK_HOSTS = new Set(["127.0.0.1", "::1", "localhost"]);
|
|
13
|
+
const HTML_EXTENSIONS = new Set([".html", ".htm"]);
|
|
14
|
+
const DEFAULT_PORT = 4173;
|
|
15
|
+
const packageRequire = createRequire(import.meta.url);
|
|
16
|
+
/**
|
|
17
|
+
* Creates a Nudge UI-owned static server for one explicit project root.
|
|
18
|
+
*
|
|
19
|
+
* The server binds to loopback, reserves its own route namespace, and only
|
|
20
|
+
* reads prototype files. HTML instrumentation and bootstrap nodes exist in
|
|
21
|
+
* response memory; the configured source directory is never rewritten.
|
|
22
|
+
*
|
|
23
|
+
* @param options Server root, address, port, and client artifact options.
|
|
24
|
+
* @returns A server that has not started listening yet.
|
|
25
|
+
* @throws If the root is missing, not a directory, or the host is not loopback.
|
|
26
|
+
*/
|
|
27
|
+
export function createStandaloneServer(options) {
|
|
28
|
+
const rootDirectory = canonicalDirectory(options.rootDirectory);
|
|
29
|
+
const host = options.host ?? "127.0.0.1";
|
|
30
|
+
if (!LOOPBACK_HOSTS.has(host)) {
|
|
31
|
+
throw new Error(`Standalone server host must be loopback; received ${host}.`);
|
|
32
|
+
}
|
|
33
|
+
const port = options.port ?? DEFAULT_PORT;
|
|
34
|
+
validatePort(port);
|
|
35
|
+
const clientPath = options.clientPath;
|
|
36
|
+
const projectId = options.projectId ?? createStandaloneProjectId(rootDirectory);
|
|
37
|
+
let revision = 0;
|
|
38
|
+
let manifest = createStandaloneRuntimeManifest(projectId, EMPTY_PROJECT_TOKEN_SNAPSHOT, revision);
|
|
39
|
+
// The initial scan runs asynchronously; start() awaits it so the first
|
|
40
|
+
// request and manifest always observe the complete project token knowledge.
|
|
41
|
+
const initialTokens = createProjectTokenSnapshot({ rootDirectory, generationLabel: "static-html" }).then((tokens) => {
|
|
42
|
+
manifest = createStandaloneRuntimeManifest(projectId, tokens, revision);
|
|
43
|
+
return tokens;
|
|
44
|
+
});
|
|
45
|
+
// start() awaits and surfaces scan failures; this second handler only
|
|
46
|
+
// prevents an unhandled rejection when a server is created but never started.
|
|
47
|
+
void initialTokens.catch(() => undefined);
|
|
48
|
+
const reloadClients = new Set();
|
|
49
|
+
let fileWatcher = null;
|
|
50
|
+
let changeQueue = Promise.resolve();
|
|
51
|
+
const getManifest = () => manifest;
|
|
52
|
+
const closeReloadClients = () => {
|
|
53
|
+
for (const client of reloadClients) {
|
|
54
|
+
client.end();
|
|
55
|
+
}
|
|
56
|
+
reloadClients.clear();
|
|
57
|
+
};
|
|
58
|
+
const notifyReload = () => {
|
|
59
|
+
const payload = `event: reload\ndata: ${JSON.stringify({ revision })}\n\n`;
|
|
60
|
+
for (const client of [...reloadClients]) {
|
|
61
|
+
if (client.destroyed) {
|
|
62
|
+
reloadClients.delete(client);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
client.write(payload);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
reloadClients.delete(client);
|
|
70
|
+
client.destroy();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const processSettledChanges = (_changes) => {
|
|
75
|
+
changeQueue = changeQueue.then(async () => {
|
|
76
|
+
// Rebuild every settled batch. fs.watch can report a directory or omit a
|
|
77
|
+
// filename, so an extension check cannot reliably identify CSS changes.
|
|
78
|
+
// The scan is asynchronous and bounded to the project root; rebuilding
|
|
79
|
+
// once per settled batch keeps the manifest coherent before reload.
|
|
80
|
+
const tokens = await createProjectTokenSnapshot({ rootDirectory, generationLabel: "static-html" });
|
|
81
|
+
manifest = createStandaloneRuntimeManifest(projectId, tokens, revision + 1);
|
|
82
|
+
revision += 1;
|
|
83
|
+
notifyReload();
|
|
84
|
+
}).catch((error) => {
|
|
85
|
+
// A later settled batch can still rebuild the snapshot after a failed
|
|
86
|
+
// callback. Source edits must not terminate the static server, but a
|
|
87
|
+
// skipped reload must be visible to the developer.
|
|
88
|
+
console.warn("Nudge UI standalone reload was skipped because rebuilding token knowledge failed:", error);
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
const httpServer = createServer((request, response) => {
|
|
92
|
+
void handleRequest({
|
|
93
|
+
request,
|
|
94
|
+
response,
|
|
95
|
+
rootDirectory,
|
|
96
|
+
clientPath,
|
|
97
|
+
getManifest,
|
|
98
|
+
reloadClients,
|
|
99
|
+
}).catch(() => {
|
|
100
|
+
if (response.headersSent) {
|
|
101
|
+
response.destroy();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
sendText(response, 500, "Internal Server Error");
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
let started = false;
|
|
108
|
+
let startPromise = null;
|
|
109
|
+
let closePromise = null;
|
|
110
|
+
let closeRequested = false;
|
|
111
|
+
const server = {
|
|
112
|
+
httpServer,
|
|
113
|
+
rootDirectory,
|
|
114
|
+
projectId,
|
|
115
|
+
get manifest() {
|
|
116
|
+
return manifest;
|
|
117
|
+
},
|
|
118
|
+
start: () => {
|
|
119
|
+
if (closeRequested) {
|
|
120
|
+
return Promise.reject(new Error("Standalone server is closing."));
|
|
121
|
+
}
|
|
122
|
+
if (started)
|
|
123
|
+
return Promise.resolve(readAddress(httpServer, host));
|
|
124
|
+
if (startPromise)
|
|
125
|
+
return startPromise;
|
|
126
|
+
startPromise = initialTokens.then(() => new Promise((resolveStart, rejectStart) => {
|
|
127
|
+
const onError = (error) => {
|
|
128
|
+
httpServer.off("listening", onListening);
|
|
129
|
+
startPromise = null;
|
|
130
|
+
rejectStart(error);
|
|
131
|
+
};
|
|
132
|
+
const onListening = () => {
|
|
133
|
+
httpServer.off("error", onError);
|
|
134
|
+
started = true;
|
|
135
|
+
if (closeRequested) {
|
|
136
|
+
rejectStart(new Error("Standalone server closed during startup."));
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
fileWatcher = createProjectFileWatcher({
|
|
140
|
+
rootDirectory,
|
|
141
|
+
debounceMs: options.watchDebounceMs,
|
|
142
|
+
onSettled: processSettledChanges,
|
|
143
|
+
});
|
|
144
|
+
void fileWatcher.start().then(() => {
|
|
145
|
+
if (closeRequested) {
|
|
146
|
+
rejectStart(new Error("Standalone server closed during startup."));
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
resolveStart(readAddress(httpServer, host));
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
httpServer.once("error", onError);
|
|
153
|
+
httpServer.once("listening", onListening);
|
|
154
|
+
httpServer.listen(port, host);
|
|
155
|
+
}));
|
|
156
|
+
return startPromise;
|
|
157
|
+
},
|
|
158
|
+
close: () => {
|
|
159
|
+
if (closePromise)
|
|
160
|
+
return closePromise;
|
|
161
|
+
closeRequested = true;
|
|
162
|
+
const pendingStart = startPromise;
|
|
163
|
+
const closeWatcher = fileWatcher?.close() ?? Promise.resolve();
|
|
164
|
+
fileWatcher = null;
|
|
165
|
+
closeReloadClients();
|
|
166
|
+
const closing = closeWatcher
|
|
167
|
+
.then(() => pendingStart?.catch(() => undefined))
|
|
168
|
+
.then(() => changeQueue)
|
|
169
|
+
.then(() => {
|
|
170
|
+
if (!httpServer.listening)
|
|
171
|
+
return;
|
|
172
|
+
return new Promise((resolveClose, rejectClose) => {
|
|
173
|
+
httpServer.close((error) => {
|
|
174
|
+
if (error)
|
|
175
|
+
rejectClose(error);
|
|
176
|
+
else
|
|
177
|
+
resolveClose();
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
})
|
|
181
|
+
.finally(() => {
|
|
182
|
+
started = false;
|
|
183
|
+
startPromise = null;
|
|
184
|
+
fileWatcher = null;
|
|
185
|
+
closeRequested = false;
|
|
186
|
+
closePromise = null;
|
|
187
|
+
});
|
|
188
|
+
closePromise = closing;
|
|
189
|
+
return closing;
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
return server;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Resolves one URL pathname to a canonical file under the project root.
|
|
196
|
+
*
|
|
197
|
+
* URL decoding occurs before path normalization, which makes encoded dot
|
|
198
|
+
* segments subject to the same confinement check as ordinary traversal. The
|
|
199
|
+
* canonical existing ancestor check also rejects a symlink that escapes the
|
|
200
|
+
* root when the requested leaf does not yet exist. Hidden path segments are
|
|
201
|
+
* refused, including encoded and multiply encoded forms, and a visible
|
|
202
|
+
* symlink cannot be used to reach a hidden target.
|
|
203
|
+
*
|
|
204
|
+
* @param rootDirectory The configured project root.
|
|
205
|
+
* @param requestPath A request target or URL pathname.
|
|
206
|
+
* @returns A file resolution, or `null` for malformed, missing, or unsafe paths.
|
|
207
|
+
*/
|
|
208
|
+
export function resolveStaticFile(rootDirectory, requestPath) {
|
|
209
|
+
const root = canonicalDirectoryOrNull(rootDirectory);
|
|
210
|
+
if (!root)
|
|
211
|
+
return null;
|
|
212
|
+
const decodedPath = decodeRequestPath(requestPath);
|
|
213
|
+
if (!decodedPath)
|
|
214
|
+
return null;
|
|
215
|
+
return resolveDecodedStaticFile(root, decodedPath);
|
|
216
|
+
}
|
|
217
|
+
function resolveDecodedStaticFile(root, decodedPath) {
|
|
218
|
+
const projectPath = decodedPath.replace(/^\/+/, "") || "index.html";
|
|
219
|
+
if (isSensitiveProjectPath(projectPath) || hasNestedUnsafePathEncoding(decodedPath)) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
const candidate = resolve(root, projectPath);
|
|
223
|
+
if (!isWithin(root, candidate))
|
|
224
|
+
return null;
|
|
225
|
+
const canonicalCandidate = canonicalExistingAncestor(candidate);
|
|
226
|
+
if (!canonicalCandidate || !isWithin(root, canonicalCandidate))
|
|
227
|
+
return null;
|
|
228
|
+
if (!existsSync(candidate))
|
|
229
|
+
return null;
|
|
230
|
+
let filePath = canonicalCandidate;
|
|
231
|
+
const stats = statSync(filePath);
|
|
232
|
+
if (stats.isDirectory()) {
|
|
233
|
+
const indexCandidate = join(filePath, "index.html");
|
|
234
|
+
const canonicalIndex = canonicalExistingAncestor(indexCandidate);
|
|
235
|
+
if (!canonicalIndex || !isWithin(root, canonicalIndex) || !existsSync(indexCandidate)) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
if (!statSync(canonicalIndex).isFile())
|
|
239
|
+
return null;
|
|
240
|
+
filePath = canonicalIndex;
|
|
241
|
+
}
|
|
242
|
+
else if (!stats.isFile()) {
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
const relativePath = relative(root, filePath).split("\\").join("/");
|
|
246
|
+
if (isSensitiveProjectPath(relativePath))
|
|
247
|
+
return null;
|
|
248
|
+
return { absolutePath: filePath, projectPath: relativePath };
|
|
249
|
+
}
|
|
250
|
+
/** Returns the deterministic project identity used for session persistence. */
|
|
251
|
+
export function createStandaloneProjectId(rootDirectory) {
|
|
252
|
+
const canonicalRoot = canonicalDirectory(rootDirectory);
|
|
253
|
+
const digest = createHash("sha256").update(canonicalRoot).digest("hex").slice(0, 24);
|
|
254
|
+
return `static-html:${digest}`;
|
|
255
|
+
}
|
|
256
|
+
/** Returns a common response content type for a project-relative file. */
|
|
257
|
+
export function contentTypeForPath(filePath) {
|
|
258
|
+
const extension = extname(filePath).toLowerCase();
|
|
259
|
+
return MIME_TYPES[extension] ?? "application/octet-stream";
|
|
260
|
+
}
|
|
261
|
+
/** Returns whether a decoded pathname belongs to the server-owned route space. */
|
|
262
|
+
export function isReservedNudgeUiRoute(pathname) {
|
|
263
|
+
return pathname === NUDGE_UI_ROUTE_PREFIX.slice(0, -1)
|
|
264
|
+
|| pathname.startsWith(NUDGE_UI_ROUTE_PREFIX);
|
|
265
|
+
}
|
|
266
|
+
function canonicalDirectory(directory) {
|
|
267
|
+
const canonical = canonicalDirectoryOrNull(directory);
|
|
268
|
+
if (!canonical)
|
|
269
|
+
throw new Error(`Standalone root is not a readable directory: ${directory}`);
|
|
270
|
+
return canonical;
|
|
271
|
+
}
|
|
272
|
+
function canonicalDirectoryOrNull(directory) {
|
|
273
|
+
if (!isAbsolute(directory))
|
|
274
|
+
return null;
|
|
275
|
+
try {
|
|
276
|
+
const canonical = realpathSync(directory);
|
|
277
|
+
return statSync(canonical).isDirectory() ? canonical : null;
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function decodeRequestPath(requestPath) {
|
|
284
|
+
const separator = requestPath.search(/[?#]/);
|
|
285
|
+
const rawPath = separator >= 0 ? requestPath.slice(0, separator) : requestPath;
|
|
286
|
+
if (!rawPath.startsWith("/") || rawPath.startsWith("//") || rawPath.includes("\\")) {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
let pathname;
|
|
290
|
+
try {
|
|
291
|
+
pathname = decodeURIComponent(rawPath);
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
if (!pathname.startsWith("/") || pathname.includes("\0") || pathname.includes("\\")) {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
if (pathname.split("/").some((segment) => segment === ".."))
|
|
300
|
+
return null;
|
|
301
|
+
return pathname;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Detects suspicious paths that become hidden or traversal paths after a
|
|
305
|
+
* second URL decode. The server resolves request URLs exactly once so literal
|
|
306
|
+
* percent-containing filenames continue to work, but nested encodings must
|
|
307
|
+
* not provide an alternate spelling for a sensitive path.
|
|
308
|
+
*/
|
|
309
|
+
function hasNestedUnsafePathEncoding(pathname) {
|
|
310
|
+
let candidate = pathname;
|
|
311
|
+
for (let depth = 0; depth < 5; depth += 1) {
|
|
312
|
+
let decoded;
|
|
313
|
+
try {
|
|
314
|
+
decoded = decodeURIComponent(candidate);
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
if (decoded === candidate)
|
|
320
|
+
return false;
|
|
321
|
+
if (decoded.includes("\0")
|
|
322
|
+
|| decoded.includes("\\")
|
|
323
|
+
|| decoded.split("/").some((segment) => segment === "..")
|
|
324
|
+
|| isSensitiveProjectPath(decoded.replace(/^\/+/, ""))) {
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
327
|
+
candidate = decoded;
|
|
328
|
+
}
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
function canonicalExistingAncestor(candidate) {
|
|
332
|
+
let current = candidate;
|
|
333
|
+
while (true) {
|
|
334
|
+
try {
|
|
335
|
+
return realpathSync(current);
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
if (!isMissingPathError(error))
|
|
339
|
+
return null;
|
|
340
|
+
const parent = dirname(current);
|
|
341
|
+
if (parent === current)
|
|
342
|
+
return null;
|
|
343
|
+
current = parent;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function isMissingPathError(error) {
|
|
348
|
+
// SAFETY: The `in` guard below proves the node error object has a code field.
|
|
349
|
+
return typeof error === "object"
|
|
350
|
+
&& error !== null
|
|
351
|
+
&& "code" in error
|
|
352
|
+
&& error.code === "ENOENT";
|
|
353
|
+
}
|
|
354
|
+
function isWithin(root, candidate) {
|
|
355
|
+
const pathFromRoot = relative(root, candidate);
|
|
356
|
+
return pathFromRoot === "" || (!pathFromRoot.startsWith("..") && !isAbsolute(pathFromRoot));
|
|
357
|
+
}
|
|
358
|
+
async function handleRequest(input) {
|
|
359
|
+
const { request, response } = input;
|
|
360
|
+
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
361
|
+
sendText(response, 405, "Method Not Allowed", { Allow: "GET, HEAD" });
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const decodedPath = decodeRequestPath(request.url ?? "/");
|
|
365
|
+
if (!decodedPath) {
|
|
366
|
+
sendText(response, 400, "Bad Request");
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
if (isReservedNudgeUiRoute(decodedPath)) {
|
|
370
|
+
await handleNudgeUiRoute(input, decodedPath);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const resolution = resolveDecodedStaticFile(input.rootDirectory, decodedPath);
|
|
374
|
+
if (!resolution) {
|
|
375
|
+
sendText(response, 404, "Not Found");
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
const isHtml = HTML_EXTENSIONS.has(extname(resolution.projectPath).toLowerCase());
|
|
379
|
+
const contentType = contentTypeForPath(resolution.projectPath);
|
|
380
|
+
if (request.method === "HEAD") {
|
|
381
|
+
// HEAD answers headers without running the response transform: the body
|
|
382
|
+
// would be discarded anyway, and the instrumented GET length cannot be
|
|
383
|
+
// known without performing it. Content-Length is omitted for HTML so the
|
|
384
|
+
// header cannot disagree with a subsequent GET body; untransformed files
|
|
385
|
+
// report their exact length.
|
|
386
|
+
const body = await readProjectFile(resolution.absolutePath);
|
|
387
|
+
if (isHtml) {
|
|
388
|
+
response.writeHead(200, {
|
|
389
|
+
"Content-Type": contentType,
|
|
390
|
+
"X-Content-Type-Options": "nosniff",
|
|
391
|
+
"Cache-Control": "no-cache",
|
|
392
|
+
});
|
|
393
|
+
response.end();
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
sendBody(response, 200, body, contentType);
|
|
397
|
+
}
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
let body = await readProjectFile(resolution.absolutePath);
|
|
401
|
+
if (isHtml) {
|
|
402
|
+
body = instrumentHtmlResponse(body, resolution.projectPath);
|
|
403
|
+
}
|
|
404
|
+
sendBody(response, 200, body, contentType, isHtml ? { "Cache-Control": "no-cache" } : {});
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Instruments one HTML response while guaranteeing byte preservation.
|
|
408
|
+
*
|
|
409
|
+
* The identity inserter only edits the decoded string at parser offsets, so
|
|
410
|
+
* the decode itself must be lossless. A non-UTF-8 document cannot round-trip
|
|
411
|
+
* through `toString("utf8")` without replacing every invalid sequence with
|
|
412
|
+
* U+FFFD, so such documents are served untouched with a warning instead of
|
|
413
|
+
* being silently corrupted.
|
|
414
|
+
*/
|
|
415
|
+
function instrumentHtmlResponse(body, projectPath) {
|
|
416
|
+
let source;
|
|
417
|
+
try {
|
|
418
|
+
source = strictUtf8Decoder.decode(body);
|
|
419
|
+
}
|
|
420
|
+
catch {
|
|
421
|
+
console.warn(`Nudge UI served ${projectPath} without instrumentation because it is not valid UTF-8.`);
|
|
422
|
+
return body;
|
|
423
|
+
}
|
|
424
|
+
const identified = instrumentSourceHtml(source, projectPath);
|
|
425
|
+
const bootstrapped = injectStandaloneBootstrap(identified.html);
|
|
426
|
+
return Buffer.from(bootstrapped.html, "utf8");
|
|
427
|
+
}
|
|
428
|
+
const strictUtf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
429
|
+
async function handleNudgeUiRoute(input, pathname) {
|
|
430
|
+
if (pathname === NUDGE_UI_MANIFEST_PATH) {
|
|
431
|
+
const body = Buffer.from(JSON.stringify(input.getManifest()), "utf8");
|
|
432
|
+
sendBody(input.response, 200, body, "application/json; charset=utf-8", {
|
|
433
|
+
"Cache-Control": "no-store",
|
|
434
|
+
});
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
if (pathname === NUDGE_UI_CLIENT_PATH) {
|
|
438
|
+
try {
|
|
439
|
+
const body = await readFileFromDescriptor(input.clientPath ?? resolveDefaultClientPath());
|
|
440
|
+
sendBody(input.response, 200, body, "text/javascript; charset=utf-8", {
|
|
441
|
+
"Cache-Control": "no-cache",
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
catch {
|
|
445
|
+
sendText(input.response, 503, "Nudge UI client has not been built.");
|
|
446
|
+
}
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (pathname === NUDGE_UI_RELOAD_PATH) {
|
|
450
|
+
if (input.request.method === "HEAD") {
|
|
451
|
+
sendBody(input.response, 200, Buffer.alloc(0), "text/event-stream; charset=utf-8", {
|
|
452
|
+
"Cache-Control": "no-cache",
|
|
453
|
+
Connection: "keep-alive",
|
|
454
|
+
});
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
input.response.writeHead(200, {
|
|
458
|
+
"Content-Type": "text/event-stream; charset=utf-8",
|
|
459
|
+
"Cache-Control": "no-cache",
|
|
460
|
+
Connection: "keep-alive",
|
|
461
|
+
"X-Accel-Buffering": "no",
|
|
462
|
+
});
|
|
463
|
+
input.response.write(`event: ready\ndata: ${JSON.stringify({ revision: input.getManifest().revision })}\n\n`);
|
|
464
|
+
input.reloadClients.add(input.response);
|
|
465
|
+
input.request.on("close", () => input.reloadClients.delete(input.response));
|
|
466
|
+
input.response.on("close", () => input.reloadClients.delete(input.response));
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
sendText(input.response, 404, "Not Found");
|
|
470
|
+
}
|
|
471
|
+
const READ_ONLY_NOFOLLOW_FLAGS = constants.O_RDONLY | constants.O_NOFOLLOW;
|
|
472
|
+
async function readProjectFile(filePath) {
|
|
473
|
+
const expectedStats = await stat(filePath);
|
|
474
|
+
return readFileFromDescriptor(filePath, {
|
|
475
|
+
flags: READ_ONLY_NOFOLLOW_FLAGS,
|
|
476
|
+
expectedStats,
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
async function readFileFromDescriptor(filePath, options = {}) {
|
|
480
|
+
const fileHandle = await open(filePath, options.flags ?? constants.O_RDONLY);
|
|
481
|
+
try {
|
|
482
|
+
const actualStats = await fileHandle.stat();
|
|
483
|
+
if (!actualStats.isFile()) {
|
|
484
|
+
throw new Error(`Expected a regular file: ${filePath}`);
|
|
485
|
+
}
|
|
486
|
+
if (options.expectedStats
|
|
487
|
+
&& (actualStats.dev !== options.expectedStats.dev
|
|
488
|
+
|| actualStats.ino !== options.expectedStats.ino)) {
|
|
489
|
+
throw new Error(`File changed while it was being resolved: ${filePath}`);
|
|
490
|
+
}
|
|
491
|
+
return await fileHandle.readFile();
|
|
492
|
+
}
|
|
493
|
+
finally {
|
|
494
|
+
await fileHandle.close();
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
function resolveDefaultClientPath() {
|
|
498
|
+
return packageRequire.resolve("nudge-ui/internal/client");
|
|
499
|
+
}
|
|
500
|
+
function readAddress(server, host) {
|
|
501
|
+
const address = server.address();
|
|
502
|
+
if (!address || typeof address === "string") {
|
|
503
|
+
throw new Error("Standalone server did not expose a TCP address after listening.");
|
|
504
|
+
}
|
|
505
|
+
const displayHost = host === "::1" ? `[${host}]` : host;
|
|
506
|
+
return { host, port: address.port, url: `http://${displayHost}:${address.port}/` };
|
|
507
|
+
}
|
|
508
|
+
function validatePort(port) {
|
|
509
|
+
if (!Number.isInteger(port) || port < 0 || port > 65_535) {
|
|
510
|
+
throw new Error(`Standalone server port must be an integer from 0 to 65535; received ${port}.`);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
function sendText(response, status, text, headers = {}) {
|
|
514
|
+
sendBody(response, status, Buffer.from(text, "utf8"), "text/plain; charset=utf-8", headers);
|
|
515
|
+
}
|
|
516
|
+
function sendBody(response, status, body, contentType, headers = {}) {
|
|
517
|
+
response.writeHead(status, {
|
|
518
|
+
"Content-Type": contentType,
|
|
519
|
+
"Content-Length": body.byteLength,
|
|
520
|
+
"X-Content-Type-Options": "nosniff",
|
|
521
|
+
...headers,
|
|
522
|
+
});
|
|
523
|
+
if (response.req?.method !== "HEAD")
|
|
524
|
+
response.end(body);
|
|
525
|
+
else
|
|
526
|
+
response.end();
|
|
527
|
+
}
|
|
528
|
+
const MIME_TYPES = {
|
|
529
|
+
".avif": "image/avif",
|
|
530
|
+
".css": "text/css; charset=utf-8",
|
|
531
|
+
".csv": "text/csv; charset=utf-8",
|
|
532
|
+
".gif": "image/gif",
|
|
533
|
+
".html": "text/html; charset=utf-8",
|
|
534
|
+
".htm": "text/html; charset=utf-8",
|
|
535
|
+
".ico": "image/x-icon",
|
|
536
|
+
".jpeg": "image/jpeg",
|
|
537
|
+
".jpg": "image/jpeg",
|
|
538
|
+
".js": "text/javascript; charset=utf-8",
|
|
539
|
+
".json": "application/json; charset=utf-8",
|
|
540
|
+
".map": "application/json; charset=utf-8",
|
|
541
|
+
".md": "text/markdown; charset=utf-8",
|
|
542
|
+
".mjs": "text/javascript; charset=utf-8",
|
|
543
|
+
".mp4": "video/mp4",
|
|
544
|
+
".pdf": "application/pdf",
|
|
545
|
+
".png": "image/png",
|
|
546
|
+
".svg": "image/svg+xml",
|
|
547
|
+
".txt": "text/plain; charset=utf-8",
|
|
548
|
+
".wasm": "application/wasm",
|
|
549
|
+
".webmanifest": "application/manifest+json",
|
|
550
|
+
".webp": "image/webp",
|
|
551
|
+
".woff": "font/woff",
|
|
552
|
+
".woff2": "font/woff2",
|
|
553
|
+
".xml": "application/xml; charset=utf-8",
|
|
554
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Plugin, UserConfigExport } from "vite";
|
|
2
|
+
import { type NudgeUiOptions } from "./vite.js";
|
|
3
|
+
/**
|
|
4
|
+
* Composes two independent halves: `./vite.ts` owns the build tool and knows
|
|
5
|
+
* nothing about JSX, `./react.ts` owns React and knows nothing about Vite.
|
|
6
|
+
* This is deliberately the only file that names both.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nudgeUi(options?: NudgeUiOptions): Plugin[];
|
|
9
|
+
/**
|
|
10
|
+
* Adds this host to an existing Vite configuration export. Object, promise,
|
|
11
|
+
* and function forms are resolved at the same boundary Vite uses, so the host
|
|
12
|
+
* keeps ownership of its runtime root and dependency graph.
|
|
13
|
+
*/
|
|
14
|
+
export declare function withNudgeUi(config: UserConfigExport, options?: NudgeUiOptions): UserConfigExport;
|
|
15
|
+
export type { NudgeUiOptions, VanillaExtractOptions } from "./vite.js";
|
|
16
|
+
export { extractViteModuleCss, transformIndexHtmlHtml } from "./vite.js";
|
|
17
|
+
export type { TransformIndexHtmlOptions } from "./vite.js";
|
|
18
|
+
export { isHostApplicationSource } from "./tokens/viteStylesheetArtifacts.js";
|
|
19
|
+
export type { TokenCatalogDiagnostic, TokenContext, TokenDeclaration, TokenDefinition, TokenEntry, } from "./virtual/design-tokens.js";
|
|
20
|
+
export type { TailwindV3Config, ThemeContract } from "../../css/dialects/index.js";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createVitePlugins } from "./vite.js";
|
|
2
|
+
import { createReactSupport } from "./react.js";
|
|
3
|
+
/**
|
|
4
|
+
* Composes two independent halves: `./vite.ts` owns the build tool and knows
|
|
5
|
+
* nothing about JSX, `./react.ts` owns React and knows nothing about Vite.
|
|
6
|
+
* This is deliberately the only file that names both.
|
|
7
|
+
*/
|
|
8
|
+
export function nudgeUi(options = {}) {
|
|
9
|
+
return createVitePlugins(options, createReactSupport);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Adds this host to an existing Vite configuration export. Object, promise,
|
|
13
|
+
* and function forms are resolved at the same boundary Vite uses, so the host
|
|
14
|
+
* keeps ownership of its runtime root and dependency graph.
|
|
15
|
+
*/
|
|
16
|
+
export function withNudgeUi(config, options = {}) {
|
|
17
|
+
if (typeof config === "function") {
|
|
18
|
+
// SAFETY: The typeof guard selects the function form of UserConfigExport, whose signature this cast states.
|
|
19
|
+
const resolveConfig = config;
|
|
20
|
+
return (env) => appendNudgeUi(resolveConfig(env), options);
|
|
21
|
+
}
|
|
22
|
+
return appendNudgeUi(config, options);
|
|
23
|
+
}
|
|
24
|
+
function appendNudgeUi(config, options) {
|
|
25
|
+
if (isPromiseLike(config)) {
|
|
26
|
+
return Promise.resolve(config).then((resolved) => appendNudgeUi(resolved, options));
|
|
27
|
+
}
|
|
28
|
+
if (hasNudgeUiPlugin(config.plugins))
|
|
29
|
+
return config;
|
|
30
|
+
return { ...config, plugins: [...(config.plugins ?? []), ...nudgeUi(options)] };
|
|
31
|
+
}
|
|
32
|
+
function hasNudgeUiPlugin(value) {
|
|
33
|
+
if (Array.isArray(value))
|
|
34
|
+
return value.some((entry) => hasNudgeUiPlugin(entry));
|
|
35
|
+
return typeof value === "object"
|
|
36
|
+
&& value !== null
|
|
37
|
+
&& "name" in value
|
|
38
|
+
&& typeof value.name === "string"
|
|
39
|
+
&& value.name.startsWith("nudge-ui");
|
|
40
|
+
}
|
|
41
|
+
function isPromiseLike(value) {
|
|
42
|
+
return typeof value === "object"
|
|
43
|
+
&& value !== null
|
|
44
|
+
&& "then" in value
|
|
45
|
+
&& typeof value.then === "function";
|
|
46
|
+
}
|
|
47
|
+
export { extractViteModuleCss, transformIndexHtmlHtml } from "./vite.js";
|
|
48
|
+
export { isHostApplicationSource } from "./tokens/viteStylesheetArtifacts.js";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Alias } from "vite";
|
|
2
|
+
import { injectIdentity } from "../../compiler/reactIdentity.js";
|
|
3
|
+
import type { ComponentContract } from "../../compiler/index.js";
|
|
4
|
+
import { type ComponentInstrumentationOptions, type ComponentModuleProtocols } from "../../compiler/index.js";
|
|
5
|
+
export interface ReactOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Skip the React aliases used only by the legacy bundled landing demo.
|
|
8
|
+
* @deprecated Normal development clients no longer add React aliases.
|
|
9
|
+
*/
|
|
10
|
+
skipReactAliases?: boolean;
|
|
11
|
+
/** Fills gaps for packages whose public type graph cannot describe an editable prop. */
|
|
12
|
+
componentMetadata?: ComponentContract[];
|
|
13
|
+
/** Package imports are fail-closed unless listed here or described by a component protocol. */
|
|
14
|
+
compatibleComponentImports?: ComponentInstrumentationOptions["compatibleComponentImports"];
|
|
15
|
+
/** Additional package or project component protocols resolved by the host. */
|
|
16
|
+
componentProtocols?: ComponentModuleProtocols;
|
|
17
|
+
}
|
|
18
|
+
/** Everything React needs from whichever host is driving it. */
|
|
19
|
+
export interface FrameworkHost {
|
|
20
|
+
root(): string | undefined;
|
|
21
|
+
/** True when a module belongs to the application rather than a dependency. */
|
|
22
|
+
isHostSource(id: string): boolean;
|
|
23
|
+
/** The project-relative path recorded in contracts and diagnostics. */
|
|
24
|
+
catalogPath(id: string): string;
|
|
25
|
+
}
|
|
26
|
+
/** The parts of a transform hook React uses, named without the build tool. */
|
|
27
|
+
export interface FrameworkTransformContext {
|
|
28
|
+
resolve(specifier: string, importer: string): Promise<string | null>;
|
|
29
|
+
warn(message: string): void;
|
|
30
|
+
}
|
|
31
|
+
export declare function createReactSupport(options: ReactOptions, host: FrameworkHost): {
|
|
32
|
+
/** Manifest labels for a host composing React. */
|
|
33
|
+
hostLabel: "vite-react";
|
|
34
|
+
framework: "React";
|
|
35
|
+
virtualModuleId: string;
|
|
36
|
+
owns(id: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Dedupe is the load-bearing part: instrumented callsites must use the
|
|
39
|
+
* application's own React, and a linked or nested copy would create a
|
|
40
|
+
* second runtime.
|
|
41
|
+
*/
|
|
42
|
+
viteConfig(context: {
|
|
43
|
+
projectRoot: string;
|
|
44
|
+
demo: boolean;
|
|
45
|
+
existingDedupe: readonly string[];
|
|
46
|
+
}): {
|
|
47
|
+
resolve: {
|
|
48
|
+
dedupe: string[];
|
|
49
|
+
alias?: Alias[] | undefined;
|
|
50
|
+
};
|
|
51
|
+
optimizeDeps?: {
|
|
52
|
+
include: string[];
|
|
53
|
+
} | undefined;
|
|
54
|
+
};
|
|
55
|
+
/** Not fatal, but a packed install that cannot resolve it fails later at the importing module. */
|
|
56
|
+
unresolvedRuntimeWarning(): string | null;
|
|
57
|
+
/** Cold-start scan, so the first manifest is not missing every contract. */
|
|
58
|
+
warmUp(): void;
|
|
59
|
+
observe(id: string, code: string, refreshPackages?: boolean): void;
|
|
60
|
+
/** Drops a module whose source could not be read after a change. */
|
|
61
|
+
forget(id: string): void;
|
|
62
|
+
transform(context: FrameworkTransformContext, code: string, id: string): Promise<ReturnType<typeof injectIdentity>>;
|
|
63
|
+
contracts(): ComponentContract[];
|
|
64
|
+
serializeVirtualModule(contracts: readonly ComponentContract[]): string;
|
|
65
|
+
};
|
|
66
|
+
/** The framework support a host composes, or `null` for no framework at all. */
|
|
67
|
+
export type FrameworkSupport = ReturnType<typeof createReactSupport>;
|