nudge-ui 0.2.0 → 0.2.2
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/bin/nudge-ui.mjs +3 -1
- package/dist/cli/agentCommand.d.ts +8 -0
- package/dist/cli/agentCommand.js +59 -0
- package/dist/client.mjs +878 -11
- package/dist/hosts/astro/astroRuntimeConfig.js +1 -1
- package/dist/hosts/astro/clientTransport.js +63 -11
- package/dist/hosts/astro/integration.d.ts +2 -2
- package/dist/hosts/astro/integration.js +4 -3
- package/dist/hosts/environment.d.ts +15 -0
- package/dist/hosts/environment.js +16 -0
- package/dist/hosts/next/sidecar.d.ts +4 -0
- package/dist/hosts/next/sidecar.js +56 -7
- package/dist/hosts/next/wrapper.d.ts +2 -0
- package/dist/hosts/next/wrapper.js +32 -3
- package/dist/hosts/projectBridge.d.ts +21 -0
- package/dist/hosts/projectBridge.js +98 -0
- package/dist/hosts/static/cli.d.ts +1 -1
- package/dist/hosts/static/cli.js +6 -1
- package/dist/hosts/static/manifest.d.ts +1 -1
- package/dist/hosts/static/manifest.js +3 -1
- package/dist/hosts/static/server.js +45 -3
- package/dist/hosts/vite/vite.d.ts +6 -1
- package/dist/hosts/vite/vite.js +82 -15
- package/dist/inspector/agent/McpConnectionDialog.d.ts +5 -4
- package/dist/inspector/agent/McpConnectionDialog.js +20 -37
- package/dist/inspector/agent/client.d.ts +16 -3
- package/dist/inspector/agent/client.js +114 -11
- package/dist/inspector/agent/connectionStatus.d.ts +3 -3
- package/dist/inspector/agent/connectionStatus.js +11 -4
- package/dist/inspector/agent/httpTransport.d.ts +8 -0
- package/dist/inspector/agent/httpTransport.js +78 -18
- package/dist/inspector/agent/protocol.d.ts +11 -3
- package/dist/inspector/agent/protocol.js +1 -1
- package/dist/inspector/agent/verification.d.ts +1 -1
- package/dist/inspector/agent/verification.js +69 -12
- package/dist/inspector/canvas/CanvasCard.d.ts +5 -3
- package/dist/inspector/canvas/CanvasCard.js +181 -91
- package/dist/inspector/canvas/CanvasElementOverlay.js +288 -52
- package/dist/inspector/canvas/CanvasToolbar.d.ts +12 -0
- package/dist/inspector/canvas/CanvasToolbar.js +24 -0
- package/dist/inspector/canvas/CanvasWorkspace.d.ts +4 -1
- package/dist/inspector/canvas/CanvasWorkspace.js +410 -72
- package/dist/inspector/canvas/activeCanvasDocument.d.ts +5 -0
- package/dist/inspector/canvas/activeCanvasDocument.js +23 -0
- package/dist/inspector/canvas/canvasResize.d.ts +30 -0
- package/dist/inspector/canvas/canvasResize.js +52 -0
- package/dist/inspector/canvas/canvasStore.d.ts +30 -6
- package/dist/inspector/canvas/canvasStore.js +128 -61
- package/dist/inspector/canvas/frameProtocol.d.ts +82 -5
- package/dist/inspector/canvas/frameProtocol.js +63 -2
- package/dist/inspector/canvas/keyboardShortcuts.d.ts +4 -0
- package/dist/inspector/canvas/keyboardShortcuts.js +16 -0
- package/dist/inspector/canvas/linkEligibility.d.ts +0 -5
- package/dist/inspector/canvas/linkEligibility.js +0 -29
- package/dist/inspector/canvas/projection.d.ts +7 -0
- package/dist/inspector/canvas/projection.js +118 -25
- package/dist/inspector/canvas/rendererBootstrap.js +42 -29
- package/dist/inspector/canvas/rendererElementSelector.d.ts +1 -1
- package/dist/inspector/canvas/rendererElementSelector.js +385 -58
- package/dist/inspector/canvas/rendererMessageRouter.d.ts +11 -0
- package/dist/inspector/canvas/rendererMessageRouter.js +43 -0
- package/dist/inspector/canvas/rendererSelectionProxy.js +6 -2
- package/dist/inspector/canvas/sessionStore.d.ts +1 -0
- package/dist/inspector/canvas/sessionStore.js +12 -4
- package/dist/inspector/canvas/staleChangeDetector.js +16 -14
- package/dist/inspector/changes/changesLog.js +31 -1
- package/dist/inspector/changes/managedStyleProjection.d.ts +1 -1
- package/dist/inspector/changes/managedStyleProjection.js +3 -3
- package/dist/inspector/changes/structuralTypes.d.ts +4 -0
- package/dist/inspector/changes/workspaceChanges.d.ts +4 -0
- package/dist/inspector/changes/workspaceChanges.js +29 -3
- package/dist/inspector/clientManifest.d.ts +7 -0
- package/dist/inspector/clientManifest.js +12 -0
- package/dist/inspector/componentSemantics/adapterRegistry.js +4 -3
- package/dist/inspector/componentSemantics/runtimeBridge.d.ts +2 -2
- package/dist/inspector/componentSemantics/runtimeBridge.js +16 -3
- package/dist/inspector/index.d.ts +2 -0
- package/dist/inspector/index.js +80 -32
- package/dist/inspector/inline-text/inlineTextDiagnostics.d.ts +10 -0
- package/dist/inspector/inline-text/inlineTextDiagnostics.js +65 -0
- package/dist/inspector/inline-text/inlineTextEditor.d.ts +3 -5
- package/dist/inspector/inline-text/inlineTextEditor.js +74 -206
- package/dist/inspector/inline-text/inlineTextFeedback.d.ts +5 -0
- package/dist/inspector/inline-text/inlineTextFeedback.js +27 -0
- package/dist/inspector/inline-text/inlineTextLifecycle.js +2 -0
- package/dist/inspector/inline-text/textEditChange.d.ts +14 -0
- package/dist/inspector/inline-text/textEditChange.js +165 -0
- package/dist/inspector/inspection/selectionProperty.d.ts +1 -0
- package/dist/inspector/inspection/selectionProperty.js +1 -0
- package/dist/inspector/overlay/DomNavigator.d.ts +10 -0
- package/dist/inspector/overlay/DomNavigator.js +40 -0
- package/dist/inspector/overlay/InspectorOverlay.js +6 -2
- package/dist/inspector/overlay/clickPolicy.d.ts +18 -2
- package/dist/inspector/overlay/clickPolicy.js +34 -3
- package/dist/inspector/overlay/elementSelector.d.ts +1 -1
- package/dist/inspector/overlay/elementSelector.js +18 -7
- package/dist/inspector/overlay/selectedGeometry.js +21 -2
- package/dist/inspector/overlay/spacingGestures.d.ts +45 -0
- package/dist/inspector/overlay/spacingGestures.js +351 -0
- package/dist/inspector/overlay/structuralGestures.d.ts +2 -2
- package/dist/inspector/overlay/structuralGestures.js +12 -10
- package/dist/inspector/projection/managedStylesheet.js +4 -1
- package/dist/inspector/projection/renderedInstance.d.ts +2 -0
- package/dist/inspector/projection/renderedInstance.js +5 -1
- package/dist/inspector/projection/structuralProjection.d.ts +2 -0
- package/dist/inspector/projection/structuralProjection.js +85 -1
- package/dist/inspector/projection/structuralProjectionBoundary.js +17 -1
- package/dist/inspector/projection/textProjection.d.ts +2 -0
- package/dist/inspector/projection/textProjection.js +10 -4
- package/dist/inspector/prompt/clipboardHandoff.d.ts +1 -1
- package/dist/inspector/prompt/clipboardHandoff.js +3 -3
- package/dist/inspector/prompt/generatePrompt.d.ts +2 -1
- package/dist/inspector/prompt/generatePrompt.js +19 -2
- package/dist/inspector/runtime/editorShell.d.ts +2 -0
- package/dist/inspector/runtime/editorShell.js +4 -0
- package/dist/inspector/runtime/runtimeConfig.d.ts +5 -1
- package/dist/inspector/runtime/runtimeConfig.js +4 -0
- package/dist/inspector/selection/hierarchy.d.ts +6 -0
- package/dist/inspector/selection/hierarchy.js +8 -0
- package/dist/inspector/selection/selectionStore.js +2 -0
- package/dist/inspector/settings/SettingsDialog.d.ts +1 -1
- package/dist/inspector/settings/SettingsDialog.js +12 -2
- package/dist/inspector/shell/AppShell.js +5 -1
- package/dist/inspector/shell/ChangesLog.js +26 -22
- package/dist/inspector/shell/CopyPromptButton.js +102 -19
- package/dist/inspector/shell/EmptyState.js +1 -1
- package/dist/inspector/shell/InspectorShell.d.ts +0 -1
- package/dist/inspector/shell/InspectorShell.js +38 -42
- package/dist/inspector/shell/PeekOriginalButton.d.ts +7 -0
- package/dist/inspector/shell/PeekOriginalButton.js +57 -0
- package/dist/inspector/shell/PeekOriginalIcon.d.ts +7 -0
- package/dist/inspector/shell/PeekOriginalIcon.js +9 -0
- package/dist/inspector/shell/originalPreview.d.ts +9 -0
- package/dist/inspector/shell/originalPreview.js +61 -0
- package/dist/inspector/shell/shortcuts.d.ts +3 -0
- package/dist/inspector/shell/shortcuts.js +15 -0
- package/dist/inspector/sketch/SketchChanges.d.ts +2 -0
- package/dist/inspector/sketch/SketchChanges.js +72 -0
- package/dist/inspector/sketch/SketchEditor.d.ts +21 -0
- package/dist/inspector/sketch/SketchEditor.js +402 -0
- package/dist/inspector/sketch/SketchEntryButton.d.ts +4 -0
- package/dist/inspector/sketch/SketchEntryButton.js +11 -0
- package/dist/inspector/sketch/SketchFrameOverlay.d.ts +11 -0
- package/dist/inspector/sketch/SketchFrameOverlay.js +119 -0
- package/dist/inspector/sketch/SketchLayersPanel.d.ts +2 -0
- package/dist/inspector/sketch/SketchLayersPanel.js +63 -0
- package/dist/inspector/sketch/SketchOverlay.d.ts +19 -0
- package/dist/inspector/sketch/SketchOverlay.js +420 -0
- package/dist/inspector/sketch/SketchPromptPanel.d.ts +15 -0
- package/dist/inspector/sketch/SketchPromptPanel.js +18 -0
- package/dist/inspector/sketch/SketchWorkspace.d.ts +13 -0
- package/dist/inspector/sketch/SketchWorkspace.js +152 -0
- package/dist/inspector/sketch/capture.d.ts +55 -0
- package/dist/inspector/sketch/capture.js +350 -0
- package/dist/inspector/sketch/freehand.d.ts +13 -0
- package/dist/inspector/sketch/freehand.js +64 -0
- package/dist/inspector/sketch/geometry.d.ts +17 -0
- package/dist/inspector/sketch/geometry.js +98 -0
- package/dist/inspector/sketch/handoff.d.ts +21 -0
- package/dist/inspector/sketch/handoff.js +72 -0
- package/dist/inspector/sketch/interaction.d.ts +21 -0
- package/dist/inspector/sketch/interaction.js +98 -0
- package/dist/inspector/sketch/model.d.ts +104 -0
- package/dist/inspector/sketch/model.js +282 -0
- package/dist/inspector/sketch/persistence.d.ts +21 -0
- package/dist/inspector/sketch/persistence.js +205 -0
- package/dist/inspector/sketch/raster.d.ts +22 -0
- package/dist/inspector/sketch/raster.js +203 -0
- package/dist/inspector/sketch/sketchNote.d.ts +10 -0
- package/dist/inspector/sketch/sketchNote.js +30 -0
- package/dist/inspector/sketch/store.d.ts +47 -0
- package/dist/inspector/sketch/store.js +434 -0
- package/dist/inspector/styleEditors/BorderEditor.js +15 -19
- package/dist/inspector/styleEditors/BorderRadiusEditor.js +6 -6
- package/dist/inspector/styleEditors/BoxShadowEditor.js +12 -1
- package/dist/inspector/styleEditors/ColorPicker.js +11 -36
- package/dist/inspector/styleEditors/GapField.d.ts +3 -2
- package/dist/inspector/styleEditors/GapField.js +2 -2
- package/dist/inspector/styleEditors/GridSection.js +1 -1
- package/dist/inspector/styleEditors/LayoutSection.js +11 -8
- package/dist/inspector/styleEditors/SpacingBox.js +31 -33
- package/dist/inspector/styleEditors/layoutPreviewState.d.ts +5 -0
- package/dist/inspector/styleEditors/layoutPreviewState.js +19 -0
- package/dist/inspector/styleEditors/layoutValue.js +3 -0
- package/dist/inspector/styleEditors/nudgeValue.d.ts +11 -0
- package/dist/inspector/styleEditors/nudgeValue.js +93 -5
- package/dist/inspector/styleEditors/stylePresence.d.ts +7 -0
- package/dist/inspector/styleEditors/stylePresence.js +22 -0
- package/dist/inspector/styleEditors/textRelevance.d.ts +3 -0
- package/dist/inspector/styleEditors/textRelevance.js +35 -0
- package/dist/inspector/styleEditors/useFieldVisibility.d.ts +6 -0
- package/dist/inspector/styleEditors/useFieldVisibility.js +26 -0
- package/dist/inspector/tokens/TokenField.js +130 -7
- package/dist/inspector/tokens/TokensPanel.js +2 -1
- package/dist/inspector/tokens/dragPointerLock.d.ts +8 -0
- package/dist/inspector/tokens/dragPointerLock.js +70 -0
- package/dist/inspector/tokens/editActions.d.ts +2 -0
- package/dist/inspector/tokens/editActions.js +2 -2
- package/dist/inspector/tokens/resolution/cssomCollector.d.ts +1 -1
- package/dist/inspector/tokens/resolution/cssomCollector.js +9 -5
- package/dist/inspector/tokens/resolution/ruleMatching.d.ts +40 -0
- package/dist/inspector/tokens/resolution/ruleMatching.js +423 -0
- package/dist/inspector/tokens/resolution/selectorSemantics.d.ts +19 -3
- package/dist/inspector/tokens/resolution/selectorSemantics.js +378 -4
- package/dist/inspector/tokens/resolution.d.ts +3 -26
- package/dist/inspector/tokens/resolution.js +44 -735
- package/dist/inspector/tokens/tokenAvailability.d.ts +18 -0
- package/dist/inspector/tokens/tokenAvailability.js +204 -0
- package/dist/inspector/ui/Button.d.ts +1 -1
- package/dist/inspector/ui/Disclosure.d.ts +22 -0
- package/dist/inspector/ui/Disclosure.js +13 -0
- package/dist/inspector/ui/SideValuesField.js +2 -2
- package/dist/inspector/ui/StatusCallout.d.ts +4 -1
- package/dist/inspector/ui/StatusCallout.js +2 -2
- package/dist/inspector/ui/dragCursor.d.ts +8 -0
- package/dist/inspector/ui/dragCursor.js +21 -0
- package/dist/inspector/ui/styles.js +21 -17
- package/dist/internal/agent-protocol.d.ts +65 -1
- package/dist/internal/agent-protocol.js +183 -3
- package/dist/nudge-ui.mjs +276 -58
- package/dist/transport/editor.d.ts +47 -0
- package/dist/transport/editor.js +163 -0
- package/dist/transport/index.d.ts +1 -0
- package/dist/transport/index.js +1 -0
- package/dist/transport/routes.d.ts +10 -0
- package/dist/transport/routes.js +10 -0
- package/package.json +3 -1
- package/dist/inspector/shell/DomNavigation.d.ts +0 -8
- package/dist/inspector/shell/DomNavigation.js +0 -30
- package/dist/inspector/shell/panelLayout.d.ts +0 -2
- package/dist/inspector/shell/panelLayout.js +0 -29
package/dist/nudge-ui.mjs
CHANGED
|
@@ -1349,7 +1349,7 @@ var require_container = __commonJS({
|
|
|
1349
1349
|
var Node2 = require_node();
|
|
1350
1350
|
var { isClean, my } = require_symbols();
|
|
1351
1351
|
var AtRule2;
|
|
1352
|
-
var
|
|
1352
|
+
var parse4;
|
|
1353
1353
|
var Root2;
|
|
1354
1354
|
var Rule2;
|
|
1355
1355
|
function cleanSource(nodes) {
|
|
@@ -1516,7 +1516,7 @@ var require_container = __commonJS({
|
|
|
1516
1516
|
}
|
|
1517
1517
|
normalize(nodes, sample) {
|
|
1518
1518
|
if (typeof nodes === "string") {
|
|
1519
|
-
nodes = cleanSource(
|
|
1519
|
+
nodes = cleanSource(parse4(nodes).nodes);
|
|
1520
1520
|
} else if (typeof nodes === "undefined") {
|
|
1521
1521
|
nodes = [];
|
|
1522
1522
|
} else if (Array.isArray(nodes)) {
|
|
@@ -1725,7 +1725,7 @@ var require_container = __commonJS({
|
|
|
1725
1725
|
}
|
|
1726
1726
|
};
|
|
1727
1727
|
Container2.registerParse = (dependant) => {
|
|
1728
|
-
|
|
1728
|
+
parse4 = dependant;
|
|
1729
1729
|
};
|
|
1730
1730
|
Container2.registerRule = (dependant) => {
|
|
1731
1731
|
Rule2 = dependant;
|
|
@@ -2064,7 +2064,7 @@ var require_util = __commonJS({
|
|
|
2064
2064
|
return path;
|
|
2065
2065
|
});
|
|
2066
2066
|
exports.normalize = normalize;
|
|
2067
|
-
function
|
|
2067
|
+
function join6(aRoot, aPath) {
|
|
2068
2068
|
if (aRoot === "") {
|
|
2069
2069
|
aRoot = ".";
|
|
2070
2070
|
}
|
|
@@ -2096,7 +2096,7 @@ var require_util = __commonJS({
|
|
|
2096
2096
|
}
|
|
2097
2097
|
return joined;
|
|
2098
2098
|
}
|
|
2099
|
-
exports.join =
|
|
2099
|
+
exports.join = join6;
|
|
2100
2100
|
exports.isAbsolute = function(aPath) {
|
|
2101
2101
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
2102
2102
|
};
|
|
@@ -2310,7 +2310,7 @@ var require_util = __commonJS({
|
|
|
2310
2310
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
2311
2311
|
}
|
|
2312
2312
|
}
|
|
2313
|
-
sourceURL =
|
|
2313
|
+
sourceURL = join6(urlGenerate(parsed), sourceURL);
|
|
2314
2314
|
}
|
|
2315
2315
|
return normalize(sourceURL);
|
|
2316
2316
|
}
|
|
@@ -3750,8 +3750,8 @@ var require_source_map = __commonJS({
|
|
|
3750
3750
|
var require_previous_map = __commonJS({
|
|
3751
3751
|
"../../node_modules/.pnpm/postcss@8.5.26/node_modules/postcss/lib/previous-map.js"(exports, module) {
|
|
3752
3752
|
"use strict";
|
|
3753
|
-
var { existsSync:
|
|
3754
|
-
var { dirname:
|
|
3753
|
+
var { existsSync: existsSync4, readFileSync, realpathSync: realpathSync3 } = __require("fs");
|
|
3754
|
+
var { dirname: dirname5, isAbsolute: isAbsolute4, join: join6, relative: relative4, sep: sep3 } = __require("path");
|
|
3755
3755
|
var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
|
|
3756
3756
|
function realPath(path) {
|
|
3757
3757
|
try {
|
|
@@ -3778,7 +3778,7 @@ var require_previous_map = __commonJS({
|
|
|
3778
3778
|
if (!this.mapFile && opts.from) {
|
|
3779
3779
|
this.mapFile = opts.from;
|
|
3780
3780
|
}
|
|
3781
|
-
if (this.mapFile) this.root =
|
|
3781
|
+
if (this.mapFile) this.root = dirname5(this.mapFile);
|
|
3782
3782
|
if (text) this.text = text;
|
|
3783
3783
|
}
|
|
3784
3784
|
consumer() {
|
|
@@ -3824,13 +3824,13 @@ var require_previous_map = __commonJS({
|
|
|
3824
3824
|
if (!trusted && !this.unsafeMap) {
|
|
3825
3825
|
if (!/\.map$/i.test(path)) return void 0;
|
|
3826
3826
|
if (!cssFile) return void 0;
|
|
3827
|
-
let rel = relative4(realPath(
|
|
3827
|
+
let rel = relative4(realPath(dirname5(cssFile)), realPath(path));
|
|
3828
3828
|
if (rel === ".." || rel.startsWith(".." + sep3) || isAbsolute4(rel)) {
|
|
3829
3829
|
return void 0;
|
|
3830
3830
|
}
|
|
3831
3831
|
}
|
|
3832
|
-
this.root =
|
|
3833
|
-
if (
|
|
3832
|
+
this.root = dirname5(path);
|
|
3833
|
+
if (existsSync4(path)) {
|
|
3834
3834
|
this.mapFile = path;
|
|
3835
3835
|
return readFileSync(path, "utf-8").toString().trim();
|
|
3836
3836
|
}
|
|
@@ -3866,7 +3866,7 @@ var require_previous_map = __commonJS({
|
|
|
3866
3866
|
return this.decodeInline(this.annotation);
|
|
3867
3867
|
} else if (this.annotation) {
|
|
3868
3868
|
let map = this.annotation;
|
|
3869
|
-
if (file) map =
|
|
3869
|
+
if (file) map = join6(dirname5(file), map);
|
|
3870
3870
|
let unknown = this.loadFile(map, file, false);
|
|
3871
3871
|
if (unknown) {
|
|
3872
3872
|
try {
|
|
@@ -3898,7 +3898,7 @@ var require_input = __commonJS({
|
|
|
3898
3898
|
var { nanoid } = require_non_secure();
|
|
3899
3899
|
var { isAbsolute: isAbsolute4, resolve: resolve5 } = __require("path");
|
|
3900
3900
|
var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
|
|
3901
|
-
var { fileURLToPath, pathToFileURL } = __require("url");
|
|
3901
|
+
var { fileURLToPath, pathToFileURL: pathToFileURL2 } = __require("url");
|
|
3902
3902
|
var CssSyntaxError2 = require_css_syntax_error();
|
|
3903
3903
|
var PreviousMap = require_previous_map();
|
|
3904
3904
|
var terminalHighlight = require_terminal_highlight();
|
|
@@ -4017,8 +4017,8 @@ var require_input = __commonJS({
|
|
|
4017
4017
|
source: this.css
|
|
4018
4018
|
};
|
|
4019
4019
|
if (this.file) {
|
|
4020
|
-
if (
|
|
4021
|
-
result.input.url =
|
|
4020
|
+
if (pathToFileURL2) {
|
|
4021
|
+
result.input.url = pathToFileURL2(this.file).toString();
|
|
4022
4022
|
}
|
|
4023
4023
|
result.input.file = this.file;
|
|
4024
4024
|
}
|
|
@@ -4076,11 +4076,11 @@ var require_input = __commonJS({
|
|
|
4076
4076
|
}
|
|
4077
4077
|
let fromUrl;
|
|
4078
4078
|
if (isAbsolute4(from.source)) {
|
|
4079
|
-
fromUrl =
|
|
4079
|
+
fromUrl = pathToFileURL2(from.source);
|
|
4080
4080
|
} else {
|
|
4081
4081
|
fromUrl = new URL(
|
|
4082
4082
|
from.source,
|
|
4083
|
-
this.map.consumer().sourceRoot ||
|
|
4083
|
+
this.map.consumer().sourceRoot || pathToFileURL2(this.map.mapFile)
|
|
4084
4084
|
);
|
|
4085
4085
|
}
|
|
4086
4086
|
let result = {
|
|
@@ -4369,12 +4369,12 @@ var require_fromJSON = __commonJS({
|
|
|
4369
4369
|
var require_map_generator = __commonJS({
|
|
4370
4370
|
"../../node_modules/.pnpm/postcss@8.5.26/node_modules/postcss/lib/map-generator.js"(exports, module) {
|
|
4371
4371
|
"use strict";
|
|
4372
|
-
var { dirname:
|
|
4372
|
+
var { dirname: dirname5, relative: relative4, resolve: resolve5, sep: sep3 } = __require("path");
|
|
4373
4373
|
var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
|
|
4374
|
-
var { pathToFileURL } = __require("url");
|
|
4374
|
+
var { pathToFileURL: pathToFileURL2 } = __require("url");
|
|
4375
4375
|
var Input2 = require_input();
|
|
4376
4376
|
var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
4377
|
-
var pathAvailable = Boolean(
|
|
4377
|
+
var pathAvailable = Boolean(dirname5 && resolve5 && relative4 && sep3);
|
|
4378
4378
|
var MapGenerator = class {
|
|
4379
4379
|
constructor(stringify2, root2, opts, cssString) {
|
|
4380
4380
|
this.stringify = stringify2;
|
|
@@ -4406,7 +4406,7 @@ var require_map_generator = __commonJS({
|
|
|
4406
4406
|
applyPrevMaps() {
|
|
4407
4407
|
for (let prev of this.previous()) {
|
|
4408
4408
|
let from = this.toUrl(this.path(prev.file));
|
|
4409
|
-
let root2 = prev.root ||
|
|
4409
|
+
let root2 = prev.root || dirname5(prev.file);
|
|
4410
4410
|
let map;
|
|
4411
4411
|
if (this.mapOpts.sourcesContent === false) {
|
|
4412
4412
|
map = new SourceMapConsumer(prev.text);
|
|
@@ -4601,9 +4601,9 @@ var require_map_generator = __commonJS({
|
|
|
4601
4601
|
if (/^\w+:\/\//.test(file)) return file;
|
|
4602
4602
|
let cached = this.memoizedPaths.get(file);
|
|
4603
4603
|
if (cached) return cached;
|
|
4604
|
-
let from = this.opts.to ?
|
|
4604
|
+
let from = this.opts.to ? dirname5(this.opts.to) : ".";
|
|
4605
4605
|
if (typeof this.mapOpts.annotation === "string") {
|
|
4606
|
-
from =
|
|
4606
|
+
from = dirname5(resolve5(from, this.mapOpts.annotation));
|
|
4607
4607
|
}
|
|
4608
4608
|
let path = relative4(from, file);
|
|
4609
4609
|
this.memoizedPaths.set(file, path);
|
|
@@ -4665,8 +4665,8 @@ var require_map_generator = __commonJS({
|
|
|
4665
4665
|
toFileUrl(path) {
|
|
4666
4666
|
let cached = this.memoizedFileURLs.get(path);
|
|
4667
4667
|
if (cached) return cached;
|
|
4668
|
-
if (
|
|
4669
|
-
let fileURL =
|
|
4668
|
+
if (pathToFileURL2) {
|
|
4669
|
+
let fileURL = pathToFileURL2(path).toString();
|
|
4670
4670
|
this.memoizedFileURLs.set(path, fileURL);
|
|
4671
4671
|
return fileURL;
|
|
4672
4672
|
} else {
|
|
@@ -5237,7 +5237,7 @@ var require_parse = __commonJS({
|
|
|
5237
5237
|
var Container2 = require_container();
|
|
5238
5238
|
var Input2 = require_input();
|
|
5239
5239
|
var Parser2 = require_parser();
|
|
5240
|
-
function
|
|
5240
|
+
function parse4(css, opts) {
|
|
5241
5241
|
let input = new Input2(css, opts);
|
|
5242
5242
|
let parser = new Parser2(input);
|
|
5243
5243
|
try {
|
|
@@ -5258,9 +5258,9 @@ var require_parse = __commonJS({
|
|
|
5258
5258
|
}
|
|
5259
5259
|
return parser.root;
|
|
5260
5260
|
}
|
|
5261
|
-
module.exports =
|
|
5262
|
-
|
|
5263
|
-
Container2.registerParse(
|
|
5261
|
+
module.exports = parse4;
|
|
5262
|
+
parse4.default = parse4;
|
|
5263
|
+
Container2.registerParse(parse4);
|
|
5264
5264
|
}
|
|
5265
5265
|
});
|
|
5266
5266
|
|
|
@@ -5366,7 +5366,7 @@ var require_lazy_result = __commonJS({
|
|
|
5366
5366
|
var Container2 = require_container();
|
|
5367
5367
|
var Document2 = require_document();
|
|
5368
5368
|
var MapGenerator = require_map_generator();
|
|
5369
|
-
var
|
|
5369
|
+
var parse4 = require_parse();
|
|
5370
5370
|
var Result2 = require_result();
|
|
5371
5371
|
var Root2 = require_root();
|
|
5372
5372
|
var stringify2 = require_stringify();
|
|
@@ -5500,7 +5500,7 @@ var require_lazy_result = __commonJS({
|
|
|
5500
5500
|
opts.map.prev = css.map;
|
|
5501
5501
|
}
|
|
5502
5502
|
} else {
|
|
5503
|
-
let parser =
|
|
5503
|
+
let parser = parse4;
|
|
5504
5504
|
if (opts.syntax) parser = opts.syntax.parse;
|
|
5505
5505
|
if (opts.parser) parser = opts.parser;
|
|
5506
5506
|
if (parser.parse) parser = parser.parse;
|
|
@@ -5891,7 +5891,7 @@ var require_no_work_result = __commonJS({
|
|
|
5891
5891
|
"../../node_modules/.pnpm/postcss@8.5.26/node_modules/postcss/lib/no-work-result.js"(exports, module) {
|
|
5892
5892
|
"use strict";
|
|
5893
5893
|
var MapGenerator = require_map_generator();
|
|
5894
|
-
var
|
|
5894
|
+
var parse4 = require_parse();
|
|
5895
5895
|
var Result2 = require_result();
|
|
5896
5896
|
var stringify2 = require_stringify();
|
|
5897
5897
|
var warnOnce = require_warn_once();
|
|
@@ -5919,7 +5919,7 @@ var require_no_work_result = __commonJS({
|
|
|
5919
5919
|
return this._root;
|
|
5920
5920
|
}
|
|
5921
5921
|
let root2;
|
|
5922
|
-
let parser =
|
|
5922
|
+
let parser = parse4;
|
|
5923
5923
|
try {
|
|
5924
5924
|
root2 = parser(this._css, this._opts);
|
|
5925
5925
|
} catch (error) {
|
|
@@ -6074,7 +6074,7 @@ var require_postcss = __commonJS({
|
|
|
6074
6074
|
var LazyResult = require_lazy_result();
|
|
6075
6075
|
var list2 = require_list();
|
|
6076
6076
|
var Node2 = require_node();
|
|
6077
|
-
var
|
|
6077
|
+
var parse4 = require_parse();
|
|
6078
6078
|
var Processor2 = require_processor();
|
|
6079
6079
|
var Result2 = require_result();
|
|
6080
6080
|
var Root2 = require_root();
|
|
@@ -6119,7 +6119,7 @@ var require_postcss = __commonJS({
|
|
|
6119
6119
|
return creator;
|
|
6120
6120
|
};
|
|
6121
6121
|
postcss2.stringify = stringify2;
|
|
6122
|
-
postcss2.parse =
|
|
6122
|
+
postcss2.parse = parse4;
|
|
6123
6123
|
postcss2.fromJSON = fromJSON2;
|
|
6124
6124
|
postcss2.list = list2;
|
|
6125
6125
|
postcss2.comment = (defaults) => new Comment2(defaults);
|
|
@@ -6150,6 +6150,60 @@ var require_postcss = __commonJS({
|
|
|
6150
6150
|
// src/hosts/static/cli.ts
|
|
6151
6151
|
import { resolve as resolve4 } from "node:path";
|
|
6152
6152
|
|
|
6153
|
+
// src/cli/agentCommand.ts
|
|
6154
|
+
import { spawnSync } from "node:child_process";
|
|
6155
|
+
import { existsSync } from "node:fs";
|
|
6156
|
+
import { createRequire } from "node:module";
|
|
6157
|
+
import { dirname, join } from "node:path";
|
|
6158
|
+
function planAgentCommand(args, projectRoot, packageVersion) {
|
|
6159
|
+
const projectRequire = createRequire(join(projectRoot, "package.json"));
|
|
6160
|
+
if (args[0] === "setup") {
|
|
6161
|
+
if (!packageVersion || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(packageVersion)) {
|
|
6162
|
+
throw new Error("Run agent setup through the installed nudge-ui executable.");
|
|
6163
|
+
}
|
|
6164
|
+
return {
|
|
6165
|
+
executable: process.platform === "win32" ? "npx.cmd" : "npx",
|
|
6166
|
+
args: ["--yes", `create-nudge-ui@${packageVersion}`, "--agent-only", ...args.slice(1)]
|
|
6167
|
+
};
|
|
6168
|
+
}
|
|
6169
|
+
if (args[0] === "doctor") {
|
|
6170
|
+
let entry;
|
|
6171
|
+
try {
|
|
6172
|
+
const packageEntry = projectRequire.resolve(findLocalMcp(projectRoot, projectRequire));
|
|
6173
|
+
entry = join(dirname(packageEntry), "cli.mjs");
|
|
6174
|
+
} catch {
|
|
6175
|
+
throw new Error("Nudge agent integration is not installed. Run nudge-ui agent setup.");
|
|
6176
|
+
}
|
|
6177
|
+
return {
|
|
6178
|
+
executable: process.execPath,
|
|
6179
|
+
args: [entry, "doctor", "--workspace-root", projectRoot, ...args.slice(1)]
|
|
6180
|
+
};
|
|
6181
|
+
}
|
|
6182
|
+
throw new Error("Usage: nudge-ui agent <setup|doctor> [options]");
|
|
6183
|
+
}
|
|
6184
|
+
function findLocalMcp(projectRoot, projectRequire) {
|
|
6185
|
+
let directory = projectRoot;
|
|
6186
|
+
while (true) {
|
|
6187
|
+
const candidate = join(directory, "node_modules", "@nudge-ui", "mcp");
|
|
6188
|
+
if (existsSync(join(candidate, "package.json"))) return candidate;
|
|
6189
|
+
const parent = dirname(directory);
|
|
6190
|
+
if (parent === directory) break;
|
|
6191
|
+
directory = parent;
|
|
6192
|
+
}
|
|
6193
|
+
if (process.versions.pnp) {
|
|
6194
|
+
return projectRequire.resolve("@nudge-ui/mcp");
|
|
6195
|
+
}
|
|
6196
|
+
throw new Error("MCP is not installed in this project.");
|
|
6197
|
+
}
|
|
6198
|
+
function runAgentCommand(args, packageVersion) {
|
|
6199
|
+
const command = planAgentCommand(args, process.cwd(), packageVersion);
|
|
6200
|
+
const result = spawnSync(command.executable, command.args, { cwd: process.cwd(), stdio: "inherit" });
|
|
6201
|
+
if (result.error) throw result.error;
|
|
6202
|
+
if (result.status !== 0) {
|
|
6203
|
+
throw new Error(`Nudge agent command exited with status ${result.status ?? "unknown"}.`);
|
|
6204
|
+
}
|
|
6205
|
+
}
|
|
6206
|
+
|
|
6153
6207
|
// src/hosts/static/server.ts
|
|
6154
6208
|
import { createHash as createHash2 } from "node:crypto";
|
|
6155
6209
|
import {
|
|
@@ -6157,13 +6211,13 @@ import {
|
|
|
6157
6211
|
} from "node:http";
|
|
6158
6212
|
import {
|
|
6159
6213
|
constants,
|
|
6160
|
-
existsSync,
|
|
6214
|
+
existsSync as existsSync3,
|
|
6161
6215
|
realpathSync as realpathSync2,
|
|
6162
6216
|
statSync as statSync2
|
|
6163
6217
|
} from "node:fs";
|
|
6164
6218
|
import { open, stat as stat2 } from "node:fs/promises";
|
|
6165
|
-
import { dirname as
|
|
6166
|
-
import { createRequire } from "node:module";
|
|
6219
|
+
import { dirname as dirname4, extname as extname2, isAbsolute as isAbsolute3, join as join5, relative as relative3, resolve as resolve3 } from "node:path";
|
|
6220
|
+
import { createRequire as createRequire3 } from "node:module";
|
|
6167
6221
|
|
|
6168
6222
|
// ../../node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/unicode.js
|
|
6169
6223
|
var UNDEFINED_CODE_POINTS = /* @__PURE__ */ new Set([
|
|
@@ -14110,8 +14164,14 @@ function positionAt(positions, offset) {
|
|
|
14110
14164
|
var NUDGE_UI_ROUTE_PREFIX = "/__nudge_ui__/";
|
|
14111
14165
|
var NUDGE_UI_MANIFEST_PATH = `${NUDGE_UI_ROUTE_PREFIX}manifest`;
|
|
14112
14166
|
var NUDGE_UI_CLIENT_PATH = `${NUDGE_UI_ROUTE_PREFIX}client.mjs`;
|
|
14167
|
+
var NUDGE_UI_EDITOR_PATH = `${NUDGE_UI_ROUTE_PREFIX}editor`;
|
|
14113
14168
|
var NUDGE_UI_RELOAD_PATH = `${NUDGE_UI_ROUTE_PREFIX}reload`;
|
|
14114
14169
|
var NUDGE_UI_MOUNT_ID = "nudge-ui-root";
|
|
14170
|
+
var NUDGE_UI_EDITOR_QUERY_PARAM = "nudge-ui";
|
|
14171
|
+
var NUDGE_UI_EDITOR_QUERY_VALUE = "editor";
|
|
14172
|
+
function isReservedNudgeUiRoute(pathname) {
|
|
14173
|
+
return pathname === NUDGE_UI_ROUTE_PREFIX.slice(0, -1) || pathname.startsWith(NUDGE_UI_ROUTE_PREFIX);
|
|
14174
|
+
}
|
|
14115
14175
|
|
|
14116
14176
|
// src/html/identity.ts
|
|
14117
14177
|
function runIdentityPass(source, pass) {
|
|
@@ -14212,9 +14272,53 @@ function instrumentSourceHtml(source, file) {
|
|
|
14212
14272
|
});
|
|
14213
14273
|
}
|
|
14214
14274
|
|
|
14275
|
+
// src/transport/editor.ts
|
|
14276
|
+
function isNudgeUiEditorDocumentRequest(requestHref, method, headers) {
|
|
14277
|
+
const normalizedMethod = (method ?? "GET").toUpperCase();
|
|
14278
|
+
if (normalizedMethod !== "GET" && normalizedMethod !== "HEAD") return false;
|
|
14279
|
+
const url = new URL(requestHref, "http://nudge-ui.local");
|
|
14280
|
+
if (url.pathname === NUDGE_UI_EDITOR_PATH) return true;
|
|
14281
|
+
if (!isApplicationUrl(url)) return false;
|
|
14282
|
+
if (!url.searchParams.getAll(NUDGE_UI_EDITOR_QUERY_PARAM).includes(NUDGE_UI_EDITOR_QUERY_VALUE)) return false;
|
|
14283
|
+
const header = (name) => {
|
|
14284
|
+
const value = headers?.[name] ?? headers?.[name.toLowerCase()];
|
|
14285
|
+
return typeof value === "string" ? value : value?.join(",") ?? "";
|
|
14286
|
+
};
|
|
14287
|
+
return header("sec-fetch-dest").toLowerCase() === "document" || header("accept").toLowerCase().includes("text/html");
|
|
14288
|
+
}
|
|
14289
|
+
function isApplicationUrl(url) {
|
|
14290
|
+
return (url.protocol === "http:" || url.protocol === "https:") && url.username === "" && url.password === "" && !isReservedNudgeUiRoute(url.pathname);
|
|
14291
|
+
}
|
|
14292
|
+
function createNudgeUiEditorDocument() {
|
|
14293
|
+
return `<!doctype html>
|
|
14294
|
+
<html lang="en" data-nudge-ui-editor>
|
|
14295
|
+
<head>
|
|
14296
|
+
<meta charset="utf-8">
|
|
14297
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
14298
|
+
<title>Nudge UI</title>
|
|
14299
|
+
<style>html,body,#${NUDGE_UI_MOUNT_ID}{width:100%;height:100%;margin:0}body{overflow:hidden}</style>
|
|
14300
|
+
</head>
|
|
14301
|
+
<body>
|
|
14302
|
+
<div id="${NUDGE_UI_MOUNT_ID}"></div>
|
|
14303
|
+
<script type="module" src="${NUDGE_UI_CLIENT_PATH}" data-nudge-ui-client data-nudge-ui-manifest="${NUDGE_UI_MANIFEST_PATH}"></script>
|
|
14304
|
+
</body>
|
|
14305
|
+
</html>`;
|
|
14306
|
+
}
|
|
14307
|
+
|
|
14215
14308
|
// src/transport/index.ts
|
|
14216
14309
|
var NUDGE_UI_MANIFEST_VERSION = 1;
|
|
14217
14310
|
|
|
14311
|
+
// src/hosts/environment.ts
|
|
14312
|
+
function readNudgeUiEnvironmentSwitch(env = process.env) {
|
|
14313
|
+
const value = env.NUDGE_UI?.trim().toLowerCase();
|
|
14314
|
+
if (value === "0" || value === "false" || value === "off") return "off";
|
|
14315
|
+
if (value === "1" || value === "true" || value === "on") return "on";
|
|
14316
|
+
return null;
|
|
14317
|
+
}
|
|
14318
|
+
function automationManifestFields(env = process.env) {
|
|
14319
|
+
return readNudgeUiEnvironmentSwitch(env) === "on" ? { inspectAutomatedBrowsers: true } : {};
|
|
14320
|
+
}
|
|
14321
|
+
|
|
14218
14322
|
// src/hosts/static/manifest.ts
|
|
14219
14323
|
function createStandaloneRuntimeManifest(projectId, tokenSnapshot = emptyTokenSnapshot(), revision = 0) {
|
|
14220
14324
|
return {
|
|
@@ -14243,7 +14347,8 @@ function createStandaloneRuntimeManifest(projectId, tokenSnapshot = emptyTokenSn
|
|
|
14243
14347
|
endpoint: NUDGE_UI_RELOAD_PATH,
|
|
14244
14348
|
strategy: "reload-document",
|
|
14245
14349
|
events: ["ready", "reload"]
|
|
14246
|
-
}
|
|
14350
|
+
},
|
|
14351
|
+
...automationManifestFields()
|
|
14247
14352
|
};
|
|
14248
14353
|
}
|
|
14249
14354
|
function emptyTokenSnapshot() {
|
|
@@ -14327,6 +14432,81 @@ function escapeAttributeValue2(value) {
|
|
|
14327
14432
|
return value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">");
|
|
14328
14433
|
}
|
|
14329
14434
|
|
|
14435
|
+
// src/hosts/projectBridge.ts
|
|
14436
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
14437
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
14438
|
+
import { dirname as dirname2, join as join2, parse as parse2 } from "node:path";
|
|
14439
|
+
import { pathToFileURL } from "node:url";
|
|
14440
|
+
var runningBridges = /* @__PURE__ */ new Map();
|
|
14441
|
+
async function startOptionalProjectBridge(input) {
|
|
14442
|
+
const key = `${input.appRoot}\0${input.origin}`;
|
|
14443
|
+
const running = runningBridges.get(key);
|
|
14444
|
+
if (running) return running;
|
|
14445
|
+
const starting = launchOptionalProjectBridge(input, key);
|
|
14446
|
+
runningBridges.set(key, starting);
|
|
14447
|
+
void starting.then((bridge) => {
|
|
14448
|
+
if (bridge === null && runningBridges.get(key) === starting) runningBridges.delete(key);
|
|
14449
|
+
});
|
|
14450
|
+
return starting;
|
|
14451
|
+
}
|
|
14452
|
+
async function launchOptionalProjectBridge(input, key) {
|
|
14453
|
+
let modulePath;
|
|
14454
|
+
try {
|
|
14455
|
+
if (!isPnpRuntime() && !hasProjectInstalledMcp(input.appRoot)) {
|
|
14456
|
+
runningBridges.delete(key);
|
|
14457
|
+
return null;
|
|
14458
|
+
}
|
|
14459
|
+
modulePath = createRequire2(join2(input.appRoot, "package.json")).resolve("@nudge-ui/mcp/project");
|
|
14460
|
+
} catch {
|
|
14461
|
+
runningBridges.delete(key);
|
|
14462
|
+
return null;
|
|
14463
|
+
}
|
|
14464
|
+
try {
|
|
14465
|
+
const loaded = await import(pathToFileURL(modulePath).href);
|
|
14466
|
+
if (typeof loaded.startProjectBridge !== "function") {
|
|
14467
|
+
throw new Error("the project bridge export is unavailable");
|
|
14468
|
+
}
|
|
14469
|
+
const runtime = await loaded.startProjectBridge({
|
|
14470
|
+
appRoot: input.appRoot,
|
|
14471
|
+
projectId: input.projectId,
|
|
14472
|
+
origin: input.origin,
|
|
14473
|
+
...input.allowedOrigins ? { allowedOrigins: input.allowedOrigins } : {}
|
|
14474
|
+
});
|
|
14475
|
+
if (runtime.browser.projectId !== input.projectId || runtime.browser.origin !== input.origin) {
|
|
14476
|
+
await runtime.close().catch(() => void 0);
|
|
14477
|
+
throw new Error("the project bridge returned a different project or origin");
|
|
14478
|
+
}
|
|
14479
|
+
input.info?.(`[nudge-ui] project bridge ready for ${input.projectId}`);
|
|
14480
|
+
let closed = false;
|
|
14481
|
+
return {
|
|
14482
|
+
browser: { baseUrl: runtime.browser.bridgeUrl, autoConnect: true },
|
|
14483
|
+
close: async () => {
|
|
14484
|
+
if (closed) return;
|
|
14485
|
+
closed = true;
|
|
14486
|
+
runningBridges.delete(key);
|
|
14487
|
+
await runtime.close();
|
|
14488
|
+
}
|
|
14489
|
+
};
|
|
14490
|
+
} catch (error) {
|
|
14491
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
14492
|
+
input.warn?.(`[nudge-ui] MCP project bridge failed to start: ${detail}`);
|
|
14493
|
+
runningBridges.delete(key);
|
|
14494
|
+
return null;
|
|
14495
|
+
}
|
|
14496
|
+
}
|
|
14497
|
+
function isPnpRuntime() {
|
|
14498
|
+
return typeof process.versions.pnp === "string";
|
|
14499
|
+
}
|
|
14500
|
+
function hasProjectInstalledMcp(appRoot) {
|
|
14501
|
+
let directory = appRoot;
|
|
14502
|
+
const root2 = parse2(directory).root;
|
|
14503
|
+
for (; ; ) {
|
|
14504
|
+
if (existsSync2(join2(directory, "node_modules", "@nudge-ui", "mcp", "package.json"))) return true;
|
|
14505
|
+
if (directory === root2) return false;
|
|
14506
|
+
directory = dirname2(directory);
|
|
14507
|
+
}
|
|
14508
|
+
}
|
|
14509
|
+
|
|
14330
14510
|
// src/project/tokens.ts
|
|
14331
14511
|
import { createHash } from "node:crypto";
|
|
14332
14512
|
import {
|
|
@@ -14335,7 +14515,7 @@ import {
|
|
|
14335
14515
|
realpath,
|
|
14336
14516
|
stat
|
|
14337
14517
|
} from "node:fs/promises";
|
|
14338
|
-
import { extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
14518
|
+
import { extname, isAbsolute, join as join3, relative, resolve, sep } from "node:path";
|
|
14339
14519
|
|
|
14340
14520
|
// ../../node_modules/.pnpm/postcss@8.5.26/node_modules/postcss/lib/postcss.mjs
|
|
14341
14521
|
var import_postcss = __toESM(require_postcss(), 1);
|
|
@@ -14343,7 +14523,7 @@ var postcss_default = import_postcss.default;
|
|
|
14343
14523
|
var stringify = import_postcss.default.stringify;
|
|
14344
14524
|
var fromJSON = import_postcss.default.fromJSON;
|
|
14345
14525
|
var plugin = import_postcss.default.plugin;
|
|
14346
|
-
var
|
|
14526
|
+
var parse3 = import_postcss.default.parse;
|
|
14347
14527
|
var list = import_postcss.default.list;
|
|
14348
14528
|
var document = import_postcss.default.document;
|
|
14349
14529
|
var comment = import_postcss.default.comment;
|
|
@@ -14932,7 +15112,7 @@ async function walkDirectory(rootDirectory, directory, visitedDirectories, visit
|
|
|
14932
15112
|
entries.sort((a, b) => comparePosixStrings(a.name, b.name));
|
|
14933
15113
|
for (const entry of entries) {
|
|
14934
15114
|
if (entry.isDirectory() && isExcludedDirectoryName(entry.name)) continue;
|
|
14935
|
-
const absolutePath =
|
|
15115
|
+
const absolutePath = join3(directory, entry.name);
|
|
14936
15116
|
const canonicalPath = await canonicalWithinRoot(rootDirectory, absolutePath);
|
|
14937
15117
|
if (!canonicalPath) continue;
|
|
14938
15118
|
let stats;
|
|
@@ -15031,7 +15211,7 @@ function comparePosixStrings(a, b) {
|
|
|
15031
15211
|
import { watch } from "node:fs";
|
|
15032
15212
|
import { readdir as readdir2 } from "node:fs/promises";
|
|
15033
15213
|
import { realpathSync, statSync } from "node:fs";
|
|
15034
|
-
import { dirname, isAbsolute as isAbsolute2, join as
|
|
15214
|
+
import { dirname as dirname3, isAbsolute as isAbsolute2, join as join4, relative as relative2, resolve as resolve2, sep as sep2 } from "node:path";
|
|
15035
15215
|
function createProjectFileWatcher(options) {
|
|
15036
15216
|
const rootDirectory = realpathSync(resolve2(options.rootDirectory));
|
|
15037
15217
|
const debounceMs = Math.max(0, options.debounceMs ?? 60);
|
|
@@ -15084,7 +15264,7 @@ function createProjectFileWatcher(options) {
|
|
|
15084
15264
|
try {
|
|
15085
15265
|
directoryWatcher = watch(directory, { persistent: true }, (eventType, filename) => {
|
|
15086
15266
|
const changedName = filename?.toString();
|
|
15087
|
-
const changedPath = changedName ?
|
|
15267
|
+
const changedPath = changedName ? join4(directory, changedName) : directory;
|
|
15088
15268
|
if (!isProjectPath(rootDirectory, changedPath)) return;
|
|
15089
15269
|
if (isProjectDirectory(rootDirectory, changedPath)) watchDirectory(changedPath);
|
|
15090
15270
|
else if (!exists(changedPath)) closeDescendants(changedPath);
|
|
@@ -15113,7 +15293,7 @@ function createProjectFileWatcher(options) {
|
|
|
15113
15293
|
for (const entry of entries) {
|
|
15114
15294
|
if (closed) return;
|
|
15115
15295
|
if (!entry.isDirectory() || isExcludedDirectoryName(entry.name)) continue;
|
|
15116
|
-
const child =
|
|
15296
|
+
const child = join4(directory, entry.name);
|
|
15117
15297
|
if (!isProjectPath(rootDirectory, child)) continue;
|
|
15118
15298
|
watchDirectory(child);
|
|
15119
15299
|
}
|
|
@@ -15177,7 +15357,7 @@ function canonicalProjectPath(rootDirectory, path) {
|
|
|
15177
15357
|
const canonical = realpathSync(path);
|
|
15178
15358
|
return isWithin(rootDirectory, canonical) && !isSensitiveProjectPath(relative2(rootDirectory, canonical).split(sep2).join("/")) ? canonical : null;
|
|
15179
15359
|
} catch {
|
|
15180
|
-
const parent =
|
|
15360
|
+
const parent = dirname3(path);
|
|
15181
15361
|
if (parent === path) return null;
|
|
15182
15362
|
try {
|
|
15183
15363
|
const canonicalParent = realpathSync(parent);
|
|
@@ -15202,7 +15382,7 @@ function comparePosixStrings2(a, b) {
|
|
|
15202
15382
|
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "localhost"]);
|
|
15203
15383
|
var HTML_EXTENSIONS = /* @__PURE__ */ new Set([".html", ".htm"]);
|
|
15204
15384
|
var DEFAULT_PORT = 4173;
|
|
15205
|
-
var packageRequire =
|
|
15385
|
+
var packageRequire = createRequire3(import.meta.url);
|
|
15206
15386
|
function createStandaloneServer(options) {
|
|
15207
15387
|
const rootDirectory = canonicalDirectory(options.rootDirectory);
|
|
15208
15388
|
const host = options.host ?? "127.0.0.1";
|
|
@@ -15219,6 +15399,7 @@ function createStandaloneServer(options) {
|
|
|
15219
15399
|
EMPTY_PROJECT_TOKEN_SNAPSHOT,
|
|
15220
15400
|
revision
|
|
15221
15401
|
);
|
|
15402
|
+
let projectBridge = null;
|
|
15222
15403
|
const initialTokens = createProjectTokenSnapshot({ rootDirectory, generationLabel: "static-html" }).then((tokens) => {
|
|
15223
15404
|
manifest = createStandaloneRuntimeManifest(projectId, tokens, revision);
|
|
15224
15405
|
return tokens;
|
|
@@ -15255,7 +15436,10 @@ data: ${JSON.stringify({ revision })}
|
|
|
15255
15436
|
const processSettledChanges = (_changes) => {
|
|
15256
15437
|
changeQueue = changeQueue.then(async () => {
|
|
15257
15438
|
const tokens = await createProjectTokenSnapshot({ rootDirectory, generationLabel: "static-html" });
|
|
15258
|
-
manifest =
|
|
15439
|
+
manifest = {
|
|
15440
|
+
...createStandaloneRuntimeManifest(projectId, tokens, revision + 1),
|
|
15441
|
+
...projectBridge ? { agentBridge: projectBridge.browser } : {}
|
|
15442
|
+
};
|
|
15259
15443
|
revision += 1;
|
|
15260
15444
|
notifyReload();
|
|
15261
15445
|
}).catch((error) => {
|
|
@@ -15322,7 +15506,22 @@ data: ${JSON.stringify({ revision })}
|
|
|
15322
15506
|
rejectStart(new Error("Standalone server closed during startup."));
|
|
15323
15507
|
return;
|
|
15324
15508
|
}
|
|
15325
|
-
|
|
15509
|
+
const address = readAddress(httpServer, host);
|
|
15510
|
+
void startOptionalProjectBridge({
|
|
15511
|
+
appRoot: rootDirectory,
|
|
15512
|
+
projectId,
|
|
15513
|
+
origin: address.url.replace(/\/$/, ""),
|
|
15514
|
+
info: (message) => console.info(message),
|
|
15515
|
+
warn: (message) => console.warn(message)
|
|
15516
|
+
}).then((bridge) => {
|
|
15517
|
+
projectBridge = bridge;
|
|
15518
|
+
if (bridge) manifest = { ...manifest, agentBridge: bridge.browser };
|
|
15519
|
+
if (closeRequested) {
|
|
15520
|
+
rejectStart(new Error("Standalone server closed during startup."));
|
|
15521
|
+
return;
|
|
15522
|
+
}
|
|
15523
|
+
resolveStart(address);
|
|
15524
|
+
});
|
|
15326
15525
|
});
|
|
15327
15526
|
};
|
|
15328
15527
|
httpServer.once("error", onError);
|
|
@@ -15339,7 +15538,10 @@ data: ${JSON.stringify({ revision })}
|
|
|
15339
15538
|
const closeWatcher = fileWatcher?.close() ?? Promise.resolve();
|
|
15340
15539
|
fileWatcher = null;
|
|
15341
15540
|
closeReloadClients();
|
|
15342
|
-
const closing = closeWatcher.then(() => pendingStart?.catch(() => void 0)).then(
|
|
15541
|
+
const closing = closeWatcher.then(() => pendingStart?.catch(() => void 0)).then(async () => {
|
|
15542
|
+
await projectBridge?.close();
|
|
15543
|
+
projectBridge = null;
|
|
15544
|
+
}).then(() => changeQueue).then(() => {
|
|
15343
15545
|
if (!httpServer.listening) return;
|
|
15344
15546
|
return new Promise((resolveClose, rejectClose) => {
|
|
15345
15547
|
httpServer.close((error) => {
|
|
@@ -15369,13 +15571,13 @@ function resolveDecodedStaticFile(root2, decodedPath) {
|
|
|
15369
15571
|
if (!isWithin2(root2, candidate)) return null;
|
|
15370
15572
|
const canonicalCandidate = canonicalExistingAncestor(candidate);
|
|
15371
15573
|
if (!canonicalCandidate || !isWithin2(root2, canonicalCandidate)) return null;
|
|
15372
|
-
if (!
|
|
15574
|
+
if (!existsSync3(candidate)) return null;
|
|
15373
15575
|
let filePath = canonicalCandidate;
|
|
15374
15576
|
const stats = statSync2(filePath);
|
|
15375
15577
|
if (stats.isDirectory()) {
|
|
15376
|
-
const indexCandidate =
|
|
15578
|
+
const indexCandidate = join5(filePath, "index.html");
|
|
15377
15579
|
const canonicalIndex = canonicalExistingAncestor(indexCandidate);
|
|
15378
|
-
if (!canonicalIndex || !isWithin2(root2, canonicalIndex) || !
|
|
15580
|
+
if (!canonicalIndex || !isWithin2(root2, canonicalIndex) || !existsSync3(indexCandidate)) {
|
|
15379
15581
|
return null;
|
|
15380
15582
|
}
|
|
15381
15583
|
if (!statSync2(canonicalIndex).isFile()) return null;
|
|
@@ -15396,7 +15598,7 @@ function contentTypeForPath(filePath) {
|
|
|
15396
15598
|
const extension = extname2(filePath).toLowerCase();
|
|
15397
15599
|
return MIME_TYPES2[extension] ?? "application/octet-stream";
|
|
15398
15600
|
}
|
|
15399
|
-
function
|
|
15601
|
+
function isReservedNudgeUiRoute2(pathname) {
|
|
15400
15602
|
return pathname === NUDGE_UI_ROUTE_PREFIX.slice(0, -1) || pathname.startsWith(NUDGE_UI_ROUTE_PREFIX);
|
|
15401
15603
|
}
|
|
15402
15604
|
function canonicalDirectory(directory) {
|
|
@@ -15455,7 +15657,7 @@ function canonicalExistingAncestor(candidate) {
|
|
|
15455
15657
|
return realpathSync2(current);
|
|
15456
15658
|
} catch (error) {
|
|
15457
15659
|
if (!isMissingPathError(error)) return null;
|
|
15458
|
-
const parent =
|
|
15660
|
+
const parent = dirname4(current);
|
|
15459
15661
|
if (parent === current) return null;
|
|
15460
15662
|
current = parent;
|
|
15461
15663
|
}
|
|
@@ -15479,10 +15681,15 @@ async function handleRequest(input) {
|
|
|
15479
15681
|
sendText(response, 400, "Bad Request");
|
|
15480
15682
|
return;
|
|
15481
15683
|
}
|
|
15482
|
-
if (
|
|
15684
|
+
if (isReservedNudgeUiRoute2(decodedPath)) {
|
|
15483
15685
|
await handleNudgeUiRoute(input, decodedPath);
|
|
15484
15686
|
return;
|
|
15485
15687
|
}
|
|
15688
|
+
if (isNudgeUiEditorDocumentRequest(request.url ?? "/", request.method, request.headers)) {
|
|
15689
|
+
const body2 = request.method === "HEAD" ? Buffer.alloc(0) : Buffer.from(createNudgeUiEditorDocument(), "utf8");
|
|
15690
|
+
sendBody(response, 200, body2, "text/html; charset=utf-8", { "Cache-Control": "no-store" });
|
|
15691
|
+
return;
|
|
15692
|
+
}
|
|
15486
15693
|
const resolution = resolveDecodedStaticFile(input.rootDirectory, decodedPath);
|
|
15487
15694
|
if (!resolution) {
|
|
15488
15695
|
sendText(response, 404, "Not Found");
|
|
@@ -15533,6 +15740,13 @@ async function handleNudgeUiRoute(input, pathname) {
|
|
|
15533
15740
|
});
|
|
15534
15741
|
return;
|
|
15535
15742
|
}
|
|
15743
|
+
if (pathname === NUDGE_UI_EDITOR_PATH) {
|
|
15744
|
+
const body = input.request.method === "HEAD" ? Buffer.alloc(0) : Buffer.from(createNudgeUiEditorDocument(), "utf8");
|
|
15745
|
+
sendBody(input.response, 200, body, "text/html; charset=utf-8", {
|
|
15746
|
+
"Cache-Control": "no-store"
|
|
15747
|
+
});
|
|
15748
|
+
return;
|
|
15749
|
+
}
|
|
15536
15750
|
if (pathname === NUDGE_UI_CLIENT_PATH) {
|
|
15537
15751
|
try {
|
|
15538
15752
|
const body = await readFileFromDescriptor(input.clientPath ?? resolveDefaultClientPath());
|
|
@@ -15687,7 +15901,11 @@ async function runServeCommand(options) {
|
|
|
15687
15901
|
console.log(`Nudge UI serving ${server.rootDirectory} at ${address.url}`);
|
|
15688
15902
|
await waitForTermination(server);
|
|
15689
15903
|
}
|
|
15690
|
-
async function main(args = process.argv.slice(2)) {
|
|
15904
|
+
async function main(args = process.argv.slice(2), packageVersion) {
|
|
15905
|
+
if (args[0] === "agent") {
|
|
15906
|
+
runAgentCommand(args.slice(1), packageVersion);
|
|
15907
|
+
return;
|
|
15908
|
+
}
|
|
15691
15909
|
const options = parseServeArguments(args);
|
|
15692
15910
|
await runServeCommand(options);
|
|
15693
15911
|
}
|