@trojanbox-vcp-test/site-edit-engine 0.1.0 → 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.
Files changed (163) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.js +127 -2
  3. package/dist/internal/protocol/operation.d.ts +2 -0
  4. package/dist/internal/protocol/render.d.ts +3 -30
  5. package/dist/internal/protocol.d.ts +1 -1
  6. package/dist/next-app-router.js +1 -140
  7. package/dist/preview-runtime.d.ts +249 -303
  8. package/dist/runtime-sync.d.ts +8 -8
  9. package/dist/runtime.d.ts +1 -127
  10. package/dist/site-edit-instrumentation.d.ts +1 -1
  11. package/dist/source-watcher.js +1 -150
  12. package/dist/types.d.ts +12 -14
  13. package/dist/webpack-loader.cjs +50 -588
  14. package/package.json +2 -2
  15. package/dist/execute-integration/execute-fixture-harness.d.ts +0 -25
  16. package/dist/execute-integration/execute-fixture-harness.js +0 -37
  17. package/dist/internal/ast/diagnostics/index.d.ts +0 -5
  18. package/dist/internal/ast/diagnostics/index.js +0 -25
  19. package/dist/internal/ast/history/index.d.ts +0 -15
  20. package/dist/internal/ast/history/index.js +0 -62
  21. package/dist/internal/ast/index.d.ts +0 -8
  22. package/dist/internal/ast/index.js +0 -5
  23. package/dist/internal/ast/locators/index.d.ts +0 -1
  24. package/dist/internal/ast/locators/index.js +0 -1
  25. package/dist/internal/ast/locators/resolve-locator.d.ts +0 -16
  26. package/dist/internal/ast/locators/resolve-locator.js +0 -920
  27. package/dist/internal/ast/parser/SourceParser.d.ts +0 -30
  28. package/dist/internal/ast/parser/SourceParser.js +0 -49
  29. package/dist/internal/ast/parser/index.d.ts +0 -21
  30. package/dist/internal/ast/parser/index.js +0 -64
  31. package/dist/internal/ast/primitives/conditional/conditional-primitives.d.ts +0 -18
  32. package/dist/internal/ast/primitives/conditional/conditional-primitives.js +0 -237
  33. package/dist/internal/ast/primitives/conditional/index.d.ts +0 -1
  34. package/dist/internal/ast/primitives/conditional/index.js +0 -1
  35. package/dist/internal/ast/primitives/imports/add-import.d.ts +0 -18
  36. package/dist/internal/ast/primitives/imports/add-import.js +0 -111
  37. package/dist/internal/ast/primitives/imports/index.d.ts +0 -2
  38. package/dist/internal/ast/primitives/imports/index.js +0 -2
  39. package/dist/internal/ast/primitives/imports/remove-import.d.ts +0 -15
  40. package/dist/internal/ast/primitives/imports/remove-import.js +0 -72
  41. package/dist/internal/ast/primitives/index.d.ts +0 -10
  42. package/dist/internal/ast/primitives/index.js +0 -10
  43. package/dist/internal/ast/primitives/jsx/index.d.ts +0 -4
  44. package/dist/internal/ast/primitives/jsx/index.js +0 -4
  45. package/dist/internal/ast/primitives/jsx/insert-child.d.ts +0 -11
  46. package/dist/internal/ast/primitives/jsx/insert-child.js +0 -69
  47. package/dist/internal/ast/primitives/jsx/move-node.d.ts +0 -9
  48. package/dist/internal/ast/primitives/jsx/move-node.js +0 -76
  49. package/dist/internal/ast/primitives/jsx/remove-node.d.ts +0 -7
  50. package/dist/internal/ast/primitives/jsx/remove-node.js +0 -36
  51. package/dist/internal/ast/primitives/jsx/update-text.d.ts +0 -8
  52. package/dist/internal/ast/primitives/jsx/update-text.js +0 -81
  53. package/dist/internal/ast/primitives/next/index.d.ts +0 -1
  54. package/dist/internal/ast/primitives/next/index.js +0 -1
  55. package/dist/internal/ast/primitives/next/next-primitives.d.ts +0 -43
  56. package/dist/internal/ast/primitives/next/next-primitives.js +0 -211
  57. package/dist/internal/ast/primitives/shared.d.ts +0 -60
  58. package/dist/internal/ast/primitives/shared.js +0 -176
  59. package/dist/internal/ast/primitives/style/class-expression.d.ts +0 -23
  60. package/dist/internal/ast/primitives/style/class-expression.js +0 -174
  61. package/dist/internal/ast/primitives/style/index.d.ts +0 -1
  62. package/dist/internal/ast/primitives/style/index.js +0 -1
  63. package/dist/internal/ast/primitives/style/style-primitives.d.ts +0 -49
  64. package/dist/internal/ast/primitives/style/style-primitives.js +0 -555
  65. package/dist/internal/ast/primitives/values/index.d.ts +0 -1
  66. package/dist/internal/ast/primitives/values/index.js +0 -1
  67. package/dist/internal/ast/primitives/values/value-primitives.d.ts +0 -42
  68. package/dist/internal/ast/primitives/values/value-primitives.js +0 -158
  69. package/dist/internal/ast/printer/SourcePrinter.d.ts +0 -21
  70. package/dist/internal/ast/printer/SourcePrinter.js +0 -76
  71. package/dist/internal/ast/printer/index.d.ts +0 -6
  72. package/dist/internal/ast/printer/index.js +0 -126
  73. package/dist/internal/ast/types.d.ts +0 -190
  74. package/dist/internal/ast/types.js +0 -1
  75. package/dist/internal/capability/capability-resolver.d.ts +0 -16
  76. package/dist/internal/capability/capability-resolver.js +0 -127
  77. package/dist/internal/classname-source.d.ts +0 -24
  78. package/dist/internal/classname-source.js +0 -220
  79. package/dist/internal/contracts/IEditEngineRuntime.d.ts +0 -18
  80. package/dist/internal/contracts/IEditEngineRuntime.js +0 -1
  81. package/dist/internal/domain/EditDiagnostic.d.ts +0 -38
  82. package/dist/internal/domain/EditDiagnostic.js +0 -43
  83. package/dist/internal/events/event-bus.d.ts +0 -14
  84. package/dist/internal/events/event-bus.js +0 -21
  85. package/dist/internal/graph/graph-builder.d.ts +0 -12
  86. package/dist/internal/graph/graph-builder.js +0 -1371
  87. package/dist/internal/graph/import-resolver.d.ts +0 -31
  88. package/dist/internal/graph/import-resolver.js +0 -109
  89. package/dist/internal/graph/project-graph-builder.d.ts +0 -32
  90. package/dist/internal/graph/project-graph-builder.js +0 -133
  91. package/dist/internal/graph/types.d.ts +0 -114
  92. package/dist/internal/graph/types.js +0 -6
  93. package/dist/internal/history/undo-redo.d.ts +0 -28
  94. package/dist/internal/history/undo-redo.js +0 -42
  95. package/dist/internal/index.d.ts +0 -2
  96. package/dist/internal/index.js +0 -1
  97. package/dist/internal/planner/planner.d.ts +0 -104
  98. package/dist/internal/planner/planner.js +0 -2533
  99. package/dist/internal/planner/types.d.ts +0 -275
  100. package/dist/internal/planner/types.js +0 -6
  101. package/dist/internal/protocol/boundary.js +0 -3
  102. package/dist/internal/protocol/capability.js +0 -8
  103. package/dist/internal/protocol/error.js +0 -38
  104. package/dist/internal/protocol/event.js +0 -3
  105. package/dist/internal/protocol/identity.js +0 -30
  106. package/dist/internal/protocol/operation.js +0 -8
  107. package/dist/internal/protocol/render.js +0 -3
  108. package/dist/internal/protocol.js +0 -2
  109. package/dist/internal/provenance/binding-graph.d.ts +0 -39
  110. package/dist/internal/provenance/binding-graph.js +0 -184
  111. package/dist/internal/provenance/capability-policy.d.ts +0 -15
  112. package/dist/internal/provenance/capability-policy.js +0 -96
  113. package/dist/internal/provenance/data-source-classifier.d.ts +0 -14
  114. package/dist/internal/provenance/data-source-classifier.js +0 -281
  115. package/dist/internal/provenance/resolve-text-provenance.d.ts +0 -45
  116. package/dist/internal/provenance/resolve-text-provenance.js +0 -3090
  117. package/dist/internal/provenance/types.d.ts +0 -89
  118. package/dist/internal/provenance/types.js +0 -1
  119. package/dist/internal/render/component-semantic.d.ts +0 -11
  120. package/dist/internal/render/component-semantic.js +0 -141
  121. package/dist/internal/render/content-model.d.ts +0 -3
  122. package/dist/internal/render/content-model.js +0 -89
  123. package/dist/internal/render/media-model.d.ts +0 -3
  124. package/dist/internal/render/media-model.js +0 -45
  125. package/dist/internal/render/provenance-types.d.ts +0 -33
  126. package/dist/internal/render/provenance-types.js +0 -1
  127. package/dist/internal/render/render-projection.d.ts +0 -24
  128. package/dist/internal/render/render-projection.js +0 -281
  129. package/dist/internal/render/tailwind-style-model.d.ts +0 -19
  130. package/dist/internal/render/tailwind-style-model.js +0 -1187
  131. package/dist/internal/runtime/EditEngineRuntime.d.ts +0 -25
  132. package/dist/internal/runtime/EditEngineRuntime.js +0 -89
  133. package/dist/internal/runtime/EditEngineRuntimeSnapshot.d.ts +0 -31
  134. package/dist/internal/runtime/EditEngineRuntimeSnapshot.js +0 -15
  135. package/dist/internal/runtime/InternalEditEngine.d.ts +0 -44
  136. package/dist/internal/runtime/InternalEditEngine.js +0 -1391
  137. package/dist/internal/runtime.d.ts +0 -3
  138. package/dist/internal/runtime.js +0 -1
  139. package/dist/internal/topology/topology.d.ts +0 -6
  140. package/dist/internal/topology/topology.js +0 -98
  141. package/dist/internal/topology/types.d.ts +0 -35
  142. package/dist/internal/topology/types.js +0 -5
  143. package/dist/internal/types.d.ts +0 -1
  144. package/dist/internal/types.js +0 -1
  145. package/dist/internal/writeback/in-memory-fs.d.ts +0 -7
  146. package/dist/internal/writeback/in-memory-fs.js +0 -44
  147. package/dist/internal/writeback/types.d.ts +0 -45
  148. package/dist/internal/writeback/types.js +0 -7
  149. package/dist/internal/writeback/writeback-service.d.ts +0 -7
  150. package/dist/internal/writeback/writeback-service.js +0 -568
  151. package/dist/internal-adapter.d.ts +0 -18
  152. package/dist/internal-adapter.js +0 -350
  153. package/dist/next-app-router-fs.js +0 -64
  154. package/dist/preview-runtime.js +0 -102
  155. package/dist/public-file-system.js +0 -1
  156. package/dist/runtime-sync.js +0 -321
  157. package/dist/runtime.js +0 -134
  158. package/dist/site-edit-instrumentation.js +0 -322
  159. package/dist/snapshot-file-system.d.ts +0 -19
  160. package/dist/snapshot-file-system.js +0 -49
  161. package/dist/source-writeback-test-harness.d.ts +0 -244
  162. package/dist/source-writeback-test-harness.js +0 -119
  163. package/dist/types.js +0 -1
@@ -221,4 +221,6 @@ export interface OperationResult {
221
221
  resultVersion: number;
222
222
  /** 失败时的错误信息 */
223
223
  error?: OperationError;
224
+ /** 本次操作实际影响的文件路径 */
225
+ affectedFiles?: string[];
224
226
  }
@@ -1,6 +1,6 @@
1
1
  import type { NodeCapabilitySnapshot } from "./capability.js";
2
2
  import type { BoundaryKind } from "./boundary.js";
3
- import type { OperationType, StyleBreakpoint, StyleProperty, StyleStateMode } from "./operation.js";
3
+ import type { OperationType } from "./operation.js";
4
4
  export type ExternalSourceKind = "api-field" | "cms-field" | "i18n-message" | "config-entry";
5
5
  export interface ExternalSourceView {
6
6
  sourceType: ExternalSourceKind;
@@ -56,7 +56,6 @@ export interface RenderObjectDetail {
56
56
  contentModel?: ContentModelView;
57
57
  mediaModel?: MediaModelView;
58
58
  styleSource?: StyleSourceView;
59
- styleModel?: StyleModelView;
60
59
  conditional?: ConditionalDetailView;
61
60
  textSegments: TextSegmentView[];
62
61
  boundaryKind: BoundaryKind | null;
@@ -135,7 +134,7 @@ export interface ComponentSemanticDescriptor {
135
134
  }
136
135
  export type ContentModelOperation = Extract<OperationType, "replace-rich-text-content" | "insert-rich-text-block" | "remove-rich-text-block">;
137
136
  export type MediaModelOperation = Extract<OperationType, "set-media-field">;
138
- export type StyleModelOperation = Extract<OperationType, "set-style-property" | "set-style-properties">;
137
+ export type StyleSourceOperation = Extract<OperationType, "set-style-property" | "set-style-properties">;
139
138
  export interface ModelDiagnosticView {
140
139
  code: "unsupported-schema" | "unsupported-field";
141
140
  field?: string;
@@ -158,44 +157,18 @@ export interface MediaModelView {
158
157
  valuePaths?: Record<string, string>;
159
158
  diagnostics?: ModelDiagnosticView[];
160
159
  }
161
- export interface StyleModelView {
162
- kind: "css-style-model";
163
- editable: boolean;
164
- operationBoundary: StyleModelOperation[];
165
- properties: StylePropertyView[];
166
- sourcePath?: string;
167
- diagnostics?: Array<{
168
- code: "missing-class-name" | "dynamic-binding" | "non-string-binding";
169
- message: string;
170
- }>;
171
- }
172
160
  export interface StyleSourceView {
173
161
  kind: "class-name-source";
174
162
  className: string;
175
163
  sourceKind: "missing" | "static-attribute" | "static-expression" | "dynamic-expression";
176
164
  editable: boolean;
177
- operationBoundary: StyleModelOperation[];
165
+ operationBoundary: StyleSourceOperation[];
178
166
  sourcePath?: string;
179
167
  diagnostics?: Array<{
180
168
  code: "missing-class-name" | "dynamic-binding" | "non-string-binding";
181
169
  message: string;
182
170
  }>;
183
171
  }
184
- export interface StylePropertyView {
185
- property: StyleProperty;
186
- value: string | number | boolean | null;
187
- resolvedValue?: string | number | boolean | null;
188
- breakpoint?: StyleBreakpoint;
189
- state?: StyleStateMode;
190
- variants?: string[];
191
- options?: Array<string | number>;
192
- editable: boolean;
193
- operationBoundary?: StyleModelOperation[];
194
- diagnostics?: Array<{
195
- code: "unsupported-value" | "responsive-value";
196
- message: string;
197
- }>;
198
- }
199
172
  export interface ConditionalDetailView {
200
173
  currentBranch: "then" | "else";
201
174
  availableBranches: Array<"then" | "else">;
@@ -6,4 +6,4 @@ export type { DesignerEvent } from "./protocol/event.js";
6
6
  export type { OperationError } from "./protocol/error.js";
7
7
  export type { SourceIdentity } from "./protocol/identity.js";
8
8
  export type { InsertableTag, InsertNodeSpec, MoveTarget, OperationParams, OperationRequest, OperationResult, OperationTarget, OperationType, OperationValue, StyleBreakpoint, StyleProperty, StyleStateMode, } from "./protocol/operation.js";
9
- export type { ComponentSemanticDescriptor, ConditionalDetailView, ContentModelView, EffectiveWriteTargetView, MediaModelView, OperationSummary, ProvenanceChainView, ProvenanceHopView, RenderDocument, RenderEntry, RenderEntryRef, RenderObjectDetail, SemanticSourceView, StyleModelOperation, StyleModelView, StyleSourceView, StylePropertyView, TextSegmentView, TextSourceView, WriteTargetView, } from "./protocol/render.js";
9
+ export type { ComponentSemanticDescriptor, ConditionalDetailView, ContentModelView, EffectiveWriteTargetView, MediaModelView, OperationSummary, ProvenanceChainView, ProvenanceHopView, RenderDocument, RenderEntry, RenderEntryRef, RenderObjectDetail, SemanticSourceView, StyleSourceOperation, StyleSourceView, TextSegmentView, TextSourceView, WriteTargetView, } from "./protocol/render.js";
@@ -1,140 +1 @@
1
- export { scanNextAppRouterRoutes } from "./next-app-router-fs.js";
2
- const pageFilePattern = /^page\.(?:tsx|ts|jsx|js|mjs|cjs)$/;
3
- const dynamicSegmentPattern = /^\[[^\]]+\]$/;
4
- const catchAllSegmentPattern = /^\[\.\.\.[^\]]+\]$/;
5
- const optionalCatchAllSegmentPattern = /^\[\[\.\.\.[^\]]+\]\]$/;
6
- export function scanNextAppRouterRoutesFromFiles(files) {
7
- const normalizedPaths = files.map((file) => toPosixPath(file.path));
8
- const appRoot = resolveAppRoot(normalizedPaths);
9
- if (!appRoot) {
10
- return [];
11
- }
12
- return normalizedPaths
13
- .filter((file) => isAppPageFile(appRoot, file))
14
- .map((file) => ({
15
- routeId: toRouteId(appRoot, file),
16
- entryFile: file,
17
- }))
18
- .sort((left, right) => left.routeId.localeCompare(right.routeId));
19
- }
20
- export function resolveNextAppRouteId(pathname, routes, basePath = "") {
21
- const normalized = normalizeNextRoutePath(pathname, basePath);
22
- if (routes.some((route) => route.routeId === normalized)) {
23
- return normalized;
24
- }
25
- const matchingRoute = [...routes]
26
- .sort((left, right) => getRouteScore(right.routeId) - getRouteScore(left.routeId))
27
- .find((route) => createRouteMatcher(route.routeId).test(normalized));
28
- return matchingRoute?.routeId ?? "/";
29
- }
30
- export function normalizeNextRoutePath(pathname, basePath = "") {
31
- const value = (pathname ?? "/").trim() || "/";
32
- const withoutQuery = value.split(/[?#]/, 1)[0] || "/";
33
- const normalizedPathname = withoutQuery.startsWith("/")
34
- ? withoutQuery
35
- : `/${withoutQuery}`;
36
- const normalizedBasePath = normalizeBasePath(basePath);
37
- const withoutBasePath = normalizedBasePath &&
38
- (normalizedPathname === normalizedBasePath ||
39
- normalizedPathname.startsWith(`${normalizedBasePath}/`))
40
- ? normalizedPathname.slice(normalizedBasePath.length) || "/"
41
- : normalizedPathname;
42
- const withLeadingSlash = withoutBasePath.startsWith("/")
43
- ? withoutBasePath
44
- : `/${withoutBasePath}`;
45
- return withLeadingSlash === "/" ? "/" : withLeadingSlash.replace(/\/+$/, "");
46
- }
47
- function resolveAppRoot(files) {
48
- const hasRootApp = files.some((file) => file.startsWith("app/"));
49
- if (hasRootApp) {
50
- return "app";
51
- }
52
- const hasSrcApp = files.some((file) => file.startsWith("src/app/"));
53
- return hasSrcApp ? "src/app" : null;
54
- }
55
- function isAppPageFile(appRoot, file) {
56
- if (!file.startsWith(`${appRoot}/`)) {
57
- return false;
58
- }
59
- const basename = file.slice(file.lastIndexOf("/") + 1);
60
- if (!pageFilePattern.test(basename)) {
61
- return false;
62
- }
63
- return file
64
- .slice(appRoot.length + 1, -basename.length - 1)
65
- .split("/")
66
- .filter(Boolean)
67
- .every((segment) => !segment.startsWith("@") && !segment.startsWith("_"));
68
- }
69
- function toRouteId(appRoot, pageFile) {
70
- const relativeDirectory = pageFile
71
- .slice(appRoot.length + 1)
72
- .split("/")
73
- .slice(0, -1)
74
- .filter((segment) => isRouteSegment(segment));
75
- return relativeDirectory.length === 0
76
- ? "/"
77
- : `/${relativeDirectory.join("/")}`;
78
- }
79
- function isRouteSegment(segment) {
80
- return (Boolean(segment) &&
81
- !segment.startsWith("@") &&
82
- !segment.startsWith("_") &&
83
- !isRouteGroup(segment));
84
- }
85
- function isRouteGroup(segment) {
86
- return segment.startsWith("(") && segment.endsWith(")");
87
- }
88
- function createRouteMatcher(routeId) {
89
- if (routeId === "/") {
90
- return /^\/$/;
91
- }
92
- const pattern = routeId
93
- .split("/")
94
- .filter(Boolean)
95
- .map((segment) => {
96
- if (optionalCatchAllSegmentPattern.test(segment)) {
97
- return "(?:/.*)?";
98
- }
99
- if (catchAllSegmentPattern.test(segment)) {
100
- return "/.+";
101
- }
102
- if (dynamicSegmentPattern.test(segment)) {
103
- return "/[^/]+";
104
- }
105
- return `/${escapeRegExp(segment)}`;
106
- })
107
- .join("");
108
- return new RegExp(`^${pattern}$`);
109
- }
110
- function getRouteScore(routeId) {
111
- return routeId
112
- .split("/")
113
- .filter(Boolean)
114
- .reduce((score, segment) => {
115
- if (optionalCatchAllSegmentPattern.test(segment)) {
116
- return score + 1;
117
- }
118
- if (catchAllSegmentPattern.test(segment)) {
119
- return score + 2;
120
- }
121
- if (dynamicSegmentPattern.test(segment)) {
122
- return score + 3;
123
- }
124
- return score + 4;
125
- }, 0);
126
- }
127
- function normalizeBasePath(basePath) {
128
- const trimmed = basePath.trim();
129
- if (!trimmed || trimmed === "/") {
130
- return "";
131
- }
132
- const withLeadingSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
133
- return withLeadingSlash.replace(/\/+$/, "");
134
- }
135
- function escapeRegExp(value) {
136
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
137
- }
138
- function toPosixPath(value) {
139
- return value.replace(/\\/g, "/").replace(/^\.\//, "");
140
- }
1
+ import u from"node:fs";import a from"node:path";var R=/^page\.(?:tsx|ts|jsx|js|mjs|cjs)$/;function x(t){let r=W(t);return r?l(r).map(e=>({routeId:$(r,e),entryFile:p(a.relative(t,e))})).sort((e,n)=>e.routeId.localeCompare(n.routeId)):[]}function W(t){for(let r of["app","src/app"]){let e=a.join(t,r);if(u.existsSync(e)&&u.statSync(e).isDirectory())return e}return null}function l(t){let r=[];for(let e of u.readdirSync(t,{withFileTypes:!0})){let n=a.join(t,e.name);if(e.isDirectory()){if(e.name==="node_modules"||e.name.startsWith(".")||e.name.startsWith("_")||e.name.startsWith("@"))continue;r.push(...l(n));continue}e.isFile()&&R.test(e.name)&&r.push(n)}return r}function $(t,r){let e=p(a.relative(t,a.dirname(r))),n=e?e.split("/").filter(s=>P(s)):[];return n.length===0?"/":`/${n.join("/")}`}function P(t){return!!t&&!t.startsWith("@")&&!t.startsWith("_")&&!g(t)}function g(t){return t.startsWith("(")&&t.endsWith(")")}function p(t){return t.replace(/\\/g,"/")}var I=/^page\.(?:tsx|ts|jsx|js|mjs|cjs)$/,f=/^\[[^\]]+\]$/,d=/^\[\.\.\.[^\]]+\]$/,m=/^\[\[\.\.\.[^\]]+\]\]$/;function C(t){let r=t.map(n=>N(n.path)),e=y(r);return e?r.filter(n=>A(e,n)).map(n=>({routeId:j(e,n),entryFile:n})).sort((n,s)=>n.routeId.localeCompare(s.routeId)):[]}function L(t,r,e=""){let n=S(t,e);return r.some(o=>o.routeId===n)?n:[...r].sort((o,i)=>h(i.routeId)-h(o.routeId)).find(o=>B(o.routeId).test(n))?.routeId??"/"}function S(t,r=""){let n=((t??"/").trim()||"/").split(/[?#]/,1)[0]||"/",s=n.startsWith("/")?n:`/${n}`,o=w(r),i=o&&(s===o||s.startsWith(`${o}/`))?s.slice(o.length)||"/":s,c=i.startsWith("/")?i:`/${i}`;return c==="/"?"/":c.replace(/\/+$/,"")}function y(t){return t.some(n=>n.startsWith("app/"))?"app":t.some(n=>n.startsWith("src/app/"))?"src/app":null}function A(t,r){if(!r.startsWith(`${t}/`))return!1;let e=r.slice(r.lastIndexOf("/")+1);return I.test(e)?r.slice(t.length+1,-e.length-1).split("/").filter(Boolean).every(n=>!n.startsWith("@")&&!n.startsWith("_")):!1}function j(t,r){let e=r.slice(t.length+1).split("/").slice(0,-1).filter(n=>v(n));return e.length===0?"/":`/${e.join("/")}`}function v(t){return!!t&&!t.startsWith("@")&&!t.startsWith("_")&&!F(t)}function F(t){return t.startsWith("(")&&t.endsWith(")")}function B(t){if(t==="/")return/^\/$/;let r=t.split("/").filter(Boolean).map(e=>m.test(e)?"(?:/.*)?":d.test(e)?"/.+":f.test(e)?"/[^/]+":`/${z(e)}`).join("");return new RegExp(`^${r}$`)}function h(t){return t.split("/").filter(Boolean).reduce((r,e)=>m.test(e)?r+1:d.test(e)?r+2:f.test(e)?r+3:r+4,0)}function w(t){let r=t.trim();return!r||r==="/"?"":(r.startsWith("/")?r:`/${r}`).replace(/\/+$/,"")}function z(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function N(t){return t.replace(/\\/g,"/").replace(/^\.\//,"")}export{S as normalizeNextRoutePath,L as resolveNextAppRouteId,x as scanNextAppRouterRoutes,C as scanNextAppRouterRoutesFromFiles};