basalt-ui 2.11.1 → 2.13.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/AGENTS.md +1 -1
- package/CHANGELOG.md +39 -0
- package/MIGRATING.md +51 -12
- package/README.md +2 -0
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/rules/basalt-state.md +1 -1
- package/agent/skills/basalt-app/SKILL.md +2 -2
- package/agent/templates/main.tpl +1 -0
- package/dist/cli/basalt-install.d.ts +10 -0
- package/dist/cli/basalt-install.d.ts.map +1 -0
- package/dist/cli/basalt-install.js +0 -0
- package/dist/cli/check-theme.js +1 -1
- package/dist/cli/doctor-upgrade.d.ts +5 -6
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +85 -56
- package/dist/cli/doctor.js +3 -3
- package/dist/cli/index.d.ts +5 -27
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +12 -49
- package/dist/cli/provider-tags.d.ts +12 -0
- package/dist/cli/provider-tags.d.ts.map +1 -0
- package/dist/cli/provider-tags.js +28 -0
- package/dist/cli/render-imports.d.ts +24 -0
- package/dist/cli/render-imports.d.ts.map +1 -0
- package/dist/cli/render-imports.js +74 -0
- package/dist/cli/router-wiring.d.ts +12 -0
- package/dist/cli/router-wiring.d.ts.map +1 -1
- package/dist/cli/router-wiring.js +18 -0
- package/dist/cli/source-text.d.ts +7 -0
- package/dist/cli/source-text.d.ts.map +1 -1
- package/dist/cli/source-text.js +34 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +19 -13
- package/dist/commands/command-stash.d.ts +15 -0
- package/dist/commands/command-stash.d.ts.map +1 -0
- package/dist/commands/command-stash.js +31 -0
- package/dist/commands/define-commands.d.ts +2 -3
- package/dist/commands/define-commands.d.ts.map +1 -1
- package/dist/commands/define-commands.js +9 -7
- package/dist/commands/define-overlays.d.ts +6 -12
- package/dist/commands/define-overlays.d.ts.map +1 -1
- package/dist/commands/define-overlays.js +28 -34
- package/dist/commands/projectors.js +1 -1
- package/dist/guard/fonts-hint.d.ts +3 -0
- package/dist/guard/fonts-hint.d.ts.map +1 -0
- package/dist/guard/fonts-hint.js +4 -0
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +2 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/provider/create-router.d.ts +57 -10
- package/dist/provider/create-router.d.ts.map +1 -1
- package/dist/provider/create-router.js +28 -17
- package/dist/provider/hotkeys.d.ts +2 -6
- package/dist/provider/hotkeys.d.ts.map +1 -1
- package/dist/provider/hotkeys.js +10 -15
- package/dist/provider/index.d.ts +7 -5
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +35 -42
- package/dist/provider/modals-mount.d.ts +16 -0
- package/dist/provider/modals-mount.d.ts.map +1 -0
- package/dist/provider/modals-mount.js +42 -0
- package/dist/provider/notifier.d.ts +22 -0
- package/dist/provider/notifier.d.ts.map +1 -0
- package/dist/provider/notifier.js +36 -0
- package/dist/provider/route-transition.d.ts +1 -1
- package/dist/provider/route-transition.d.ts.map +1 -1
- package/dist/provider/route-transition.js +1 -1
- package/dist/provider/slots.d.ts +25 -0
- package/dist/provider/slots.d.ts.map +1 -0
- package/dist/provider/slots.js +29 -0
- package/dist/provider/spotlight-actions.d.ts +1 -1
- package/dist/provider/spotlight-actions.d.ts.map +1 -1
- package/dist/provider/spotlight-actions.js +2 -3
- package/dist/provider/spotlight-mount.d.ts +3 -0
- package/dist/provider/spotlight-mount.d.ts.map +1 -0
- package/dist/provider/spotlight-mount.js +26 -0
- package/dist/query-client.d.ts +2 -62
- package/dist/query-client.d.ts.map +1 -1
- package/dist/query-client.js +13 -18
- package/dist/router-tanstack/nav-stash.d.ts +24 -0
- package/dist/router-tanstack/nav-stash.d.ts.map +1 -0
- package/dist/router-tanstack/nav-stash.js +23 -0
- package/dist/router-tanstack/nav.d.ts +5 -15
- package/dist/router-tanstack/nav.d.ts.map +1 -1
- package/dist/router-tanstack/nav.js +6 -16
- package/dist/router-tanstack/search-store-warnings.d.ts +33 -0
- package/dist/router-tanstack/search-store-warnings.d.ts.map +1 -0
- package/dist/router-tanstack/search-store-warnings.js +77 -0
- package/dist/router-tanstack/search-store.d.ts +2 -5
- package/dist/router-tanstack/search-store.d.ts.map +1 -1
- package/dist/router-tanstack/search-store.js +111 -110
- package/dist/router-tanstack/use-nav.js +1 -1
- package/dist/surfaces.d.ts +1 -1
- package/dist/surfaces.js +1 -1
- package/dist/telemetry.d.ts +31 -2
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +32 -12
- package/dist/theme/ctl-theme.d.ts.map +1 -1
- package/dist/theme/ctl-theme.js +17 -30
- package/dist/theme/extend.d.ts +18 -0
- package/dist/theme/extend.d.ts.map +1 -0
- package/dist/theme/extend.js +6 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +44 -84
- package/dist/unwrap.d.ts +29 -0
- package/dist/unwrap.d.ts.map +1 -0
- package/dist/unwrap.js +18 -0
- package/llms.txt +11 -7
- package/package.json +2 -2
- package/src/cli/basalt-install.ts +9 -0
- package/src/cli/check-theme.ts +1 -1
- package/src/cli/doctor-upgrade.ts +117 -72
- package/src/cli/doctor.ts +3 -3
- package/src/cli/index.ts +15 -70
- package/src/cli/provider-tags.ts +38 -0
- package/src/cli/render-imports.ts +104 -0
- package/src/cli/router-wiring.ts +23 -0
- package/src/cli/source-text.ts +39 -0
- package/src/cli/sync.ts +28 -22
- package/src/commands/command-stash.ts +44 -0
- package/src/commands/define-commands.ts +10 -17
- package/src/commands/define-overlays.ts +40 -68
- package/src/commands/projectors.ts +1 -1
- package/src/guard/fonts-hint.ts +2 -0
- package/src/guard/index.ts +2 -2
- package/src/index.ts +4 -2
- package/src/provider/create-router.tsx +103 -39
- package/src/provider/hotkeys.ts +14 -22
- package/src/provider/index.tsx +55 -61
- package/src/provider/modals-mount.tsx +66 -0
- package/src/provider/notifier.ts +52 -0
- package/src/provider/route-transition.ts +1 -1
- package/src/provider/slots.ts +59 -0
- package/src/provider/spotlight-actions.tsx +3 -4
- package/src/provider/spotlight-mount.tsx +33 -0
- package/src/query-client.ts +20 -78
- package/src/router-tanstack/nav-stash.ts +41 -0
- package/src/router-tanstack/nav.ts +11 -31
- package/src/router-tanstack/search-store-warnings.ts +120 -0
- package/src/router-tanstack/search-store.ts +200 -206
- package/src/router-tanstack/use-nav.ts +1 -1
- package/src/surfaces.ts +1 -1
- package/src/telemetry.ts +71 -13
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +2354 -0
- package/src/theme/ctl-theme.tsx +20 -19
- package/src/theme/extend.ts +18 -0
- package/src/theme/index.ts +50 -49
- package/src/unwrap.ts +44 -0
package/dist/unwrap.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `unwrap` — the transport-agnostic `{ data, error }` envelope (Eden Treaty, a raw fetch wrapper)
|
|
3
|
+
* to data. Throws the `error` branch (any value that is not `null`/`undefined`) and, when there is
|
|
4
|
+
* no error, on `null`/`undefined` data: a 204 or a silent transport failure must not resolve.
|
|
5
|
+
*
|
|
6
|
+
* One generic signature with a conditional return, so a bare `.then(unwrap)` callback keeps its
|
|
7
|
+
* type (an overload pair resolves to `unknown` there). Pinned by `unwrap.type-guard.test.ts`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* queryFn: () => unwrap(api.users.get({ query: params }))
|
|
11
|
+
* const rows = unwrap(await api.users.get())
|
|
12
|
+
* const rows2 = await api.users.get().then(unwrap)
|
|
13
|
+
*/
|
|
14
|
+
export declare function unwrap<R extends Envelope | PromiseLike<Envelope>>(response: R): UnwrapResult<R>;
|
|
15
|
+
type Envelope<TData = unknown> = {
|
|
16
|
+
data: TData | null | undefined;
|
|
17
|
+
error: unknown;
|
|
18
|
+
};
|
|
19
|
+
/** A `Promise<TData>` for a promised envelope, `TData` for a resolved one; `NonNullable` is applied
|
|
20
|
+
* to the inferred `data` so it distributes over Eden's union of envelope shapes. */
|
|
21
|
+
type UnwrapResult<R> = R extends PromiseLike<{
|
|
22
|
+
data: infer TData;
|
|
23
|
+
error: unknown;
|
|
24
|
+
}> ? Promise<NonNullable<TData>> : R extends {
|
|
25
|
+
data: infer TData;
|
|
26
|
+
error: unknown;
|
|
27
|
+
} ? NonNullable<TData> : never;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=unwrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unwrap.d.ts","sourceRoot":"","sources":["../src/unwrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAM/F;AAMD,KAAK,QAAQ,CAAC,KAAK,GAAG,OAAO,IAAI;IAAE,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAA;AAEnF;oFACoF;AACpF,KAAK,YAAY,CAAC,CAAC,IACjB,CAAC,SAAS,WAAW,CAAC;IAAE,IAAI,EAAE,MAAM,KAAK,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,GACxD,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,GAC3B,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,KAAK,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC7C,WAAW,CAAC,KAAK,CAAC,GAClB,KAAK,CAAA"}
|
package/dist/unwrap.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function unwrap(response) {
|
|
2
|
+
const result = isThenable(response) ? Promise.resolve(response).then(unwrapEnvelope) : unwrapEnvelope(response);
|
|
3
|
+
return result;
|
|
4
|
+
}
|
|
5
|
+
function isThenable(value) {
|
|
6
|
+
return typeof value.then === "function";
|
|
7
|
+
}
|
|
8
|
+
function unwrapEnvelope({ data, error }) {
|
|
9
|
+
if (error !== null && error !== void 0) throw error;
|
|
10
|
+
if (data === null || data === void 0)
|
|
11
|
+
throw new Error(
|
|
12
|
+
"unwrap: null/undefined data with no error \u2014 check for a 204 response or a transport failure"
|
|
13
|
+
);
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
unwrap
|
|
18
|
+
};
|
package/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# basalt-ui v2.
|
|
1
|
+
# basalt-ui v2.13.0
|
|
2
2
|
# Opinionated framework for Mantine-based React apps — theme, app shell, TanStack Charts, toolchain presets
|
|
3
3
|
#
|
|
4
4
|
# Entry points: use the exact import specifier below; do not guess.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# A subpath's `Install:` line is its required peers; `OptionalPeers:` are import()-only, install on use.
|
|
14
14
|
|
|
15
15
|
Package: basalt-ui
|
|
16
|
-
Version: 2.
|
|
16
|
+
Version: 2.13.0
|
|
17
17
|
|
|
18
18
|
## basalt-ui
|
|
19
19
|
Import: import { ... } from 'basalt-ui'
|
|
@@ -202,11 +202,15 @@ Signature: WidgetHeader(props: WidgetHeaderProps): JSX.Element
|
|
|
202
202
|
sparkline?: ReactNode
|
|
203
203
|
count?: number
|
|
204
204
|
actions?: ReactNode
|
|
205
|
-
Signature:
|
|
205
|
+
Signature: basaltRouterOptions(options: RouterOptionsInput<NoContext> | undefined): BasaltRouterOptions<NoContext>
|
|
206
|
+
context?: (NoContext & ExtraContext)
|
|
207
|
+
query?: QueryClientConfig
|
|
208
|
+
Signature: createBasaltRouter(options: { routeTree: TRouteTree; history?: RouterHistory; basepath?: string; …): BasaltRouter<TRouteTree>
|
|
206
209
|
routeTree: TRouteTree
|
|
207
|
-
|
|
210
|
+
history?: RouterHistory
|
|
211
|
+
basepath?: string
|
|
212
|
+
context?: (NoContext & ExtraContext)
|
|
208
213
|
query?: QueryClientConfig
|
|
209
|
-
defaultViewTransition?: never
|
|
210
214
|
Signature: createBasaltTheme(overrides: Omit<PartialObjectDeep<MantineTheme, { recurseIntoArrays: false; allo…, options: CreateBasaltThemeOptions | undefined): PartialObjectDeep<Ma…
|
|
211
215
|
Signature: defineNav(config: "basalt: declare Register { router }"): NavConfig<G, T>
|
|
212
216
|
Signature: flattenNav(config: { groups: ReadonlyArray<AnyNavGroup>; }): FlatNavItem[]
|
|
@@ -535,7 +539,7 @@ Install: bun add @mantine/form@^9.7.0
|
|
|
535
539
|
|
|
536
540
|
## basalt-ui/commands
|
|
537
541
|
Import: import { ... } from 'basalt-ui/commands'
|
|
538
|
-
Description: defineCommands (typed command bus), defineOverlays/overlays (a form dialog is a registered overlay opened with overlays.open), setColorScheme, toggleSidebar, ShortcutsHelp, defineNotifications/emit/NotificationBell (emit only accepts kinds registered in defineNotifications; folded in from ./notifications); BasaltProvider mounts Spotlight, Modals
|
|
542
|
+
Description: defineCommands (typed command bus), defineOverlays/overlays (a form dialog is a registered overlay opened with overlays.open), setColorScheme, toggleSidebar, ShortcutsHelp, defineNotifications/emit/NotificationBell (emit only accepts kinds registered in defineNotifications; folded in from ./notifications); BasaltProvider mounts Notifications; Spotlight mounts once defineNav/defineCommands ran, Modals once defineOverlays/overlays.confirm ran
|
|
539
543
|
Layer: mantine-coupled
|
|
540
544
|
Rule: basalt-batteries
|
|
541
545
|
Signature: NotificationBell(props: NotificationBellProps): JSX.Element
|
|
@@ -688,7 +692,7 @@ Signature: useAgentThreadRuns(props: UseAgentThreadRunsArgs<TPart>): UseAgentThr
|
|
|
688
692
|
onError?: ((info: { readonly threadId: string; readonly error: unknow…
|
|
689
693
|
throttle?: number
|
|
690
694
|
telemetry?: Telemetry
|
|
691
|
-
Install: bun add ai@^7.0.137 @ai-sdk/provider@^4.0.26 motion
|
|
695
|
+
Install: bun add ai@^7.0.137 @ai-sdk/provider@^4.0.26 motion@^14.1.0
|
|
692
696
|
OptionalPeers: use-stick-to-bottom@^1.1.6, @tanstack/react-virtual@>=3.14.0 <4
|
|
693
697
|
|
|
694
698
|
## basalt-ui/content
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basalt-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "Opinionated framework for Mantine-based React apps — theme, app shell, TanStack Charts, toolchain presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"charts",
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
"beautiful-mermaid": "^1.1.0",
|
|
190
190
|
"d3-scale": "4.0.2",
|
|
191
191
|
"dayjs": "^1.11.0",
|
|
192
|
-
"motion": "14.1.0",
|
|
192
|
+
"motion": "^14.1.0",
|
|
193
193
|
"react": "^19.3.0",
|
|
194
194
|
"react-dom": "^19.3.0",
|
|
195
195
|
"react-markdown": "^10.1.0",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The resolved `node_modules/basalt-ui` a command acts on — a type-only leaf shared by `index` and `doctor-upgrade`. */
|
|
2
|
+
export type BasaltInstall = {
|
|
3
|
+
/** Absolute path of the resolved `node_modules/basalt-ui` directory, or null when unresolvable. */
|
|
4
|
+
dir: string | null
|
|
5
|
+
/** The resolved copy's own version, or null. */
|
|
6
|
+
version: string | null
|
|
7
|
+
/** How it was found — `null` when unresolved. `'workspace'` is the isolated-linker case. */
|
|
8
|
+
how: 'cwd' | 'ancestor' | 'workspace' | null
|
|
9
|
+
}
|
package/src/cli/check-theme.ts
CHANGED
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
OXLINT_NO_BIN,
|
|
29
29
|
oxlintBinResolves,
|
|
30
30
|
packageRoot,
|
|
31
|
-
parseJsonc,
|
|
32
31
|
readBasaltConfig,
|
|
33
32
|
readIfExists,
|
|
34
33
|
readSource,
|
|
@@ -38,6 +37,7 @@ import {
|
|
|
38
37
|
SERIES_MODULE_HINT_RE,
|
|
39
38
|
waiverHintFor,
|
|
40
39
|
} from './index'
|
|
40
|
+
import { parseJsonc } from './source-text'
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* What the `.oxlintrc.json` in `dir` does for the AST lane. A plugin load alone enables no rule, so
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* `doctor`'s 2.0 strictness and upgrade checks. Each returns null (pass), `{ fail }` (the problem
|
|
3
3
|
* plus its fix) or `{ skip }` (the check could not run: a check that cannot run is not a pass).
|
|
4
4
|
*/
|
|
5
|
-
import { writeFileSync } from 'node:fs'
|
|
5
|
+
import { readdirSync, writeFileSync } from 'node:fs'
|
|
6
|
+
import type { Dirent } from 'node:fs'
|
|
6
7
|
import { createRequire } from 'node:module'
|
|
7
8
|
import { dirname, relative, resolve } from 'node:path'
|
|
8
9
|
|
|
9
10
|
import { BASALT_CONFIG_KEYS, RETIRED_CONFIG_KEYS, shellConfigError } from './config'
|
|
10
11
|
import type { BasaltConfig } from './config'
|
|
11
|
-
import {
|
|
12
|
-
import type { BasaltInstall } from './index'
|
|
12
|
+
import type { BasaltInstall } from './basalt-install'
|
|
13
13
|
import {
|
|
14
14
|
appEntry,
|
|
15
15
|
callsIn,
|
|
@@ -18,8 +18,14 @@ import {
|
|
|
18
18
|
isCodeRoutedApp,
|
|
19
19
|
isStartApp,
|
|
20
20
|
routeTreeDirs,
|
|
21
|
+
routerSeedDest,
|
|
22
|
+
START_PROVIDER_HINT,
|
|
21
23
|
} from './router-wiring'
|
|
22
|
-
import {
|
|
24
|
+
import { FONTS_CSS_HINT } from '../guard/fonts-hint'
|
|
25
|
+
import { carriesRouter } from './provider-tags'
|
|
26
|
+
import { followProviderHops, loadModule } from './render-imports'
|
|
27
|
+
import type { ModuleFile } from './render-imports'
|
|
28
|
+
import { parseJsonc, readIfExists, readPackageJson, tokenize } from './source-text'
|
|
23
29
|
|
|
24
30
|
export type Check = { fail: string } | { skip: string } | null
|
|
25
31
|
|
|
@@ -228,8 +234,8 @@ function cssImports(src: string): [string, number][] {
|
|
|
228
234
|
}
|
|
229
235
|
|
|
230
236
|
/** `[subpath, file, line]` per `basalt-ui/<subpath>` import in the app's source and style files. */
|
|
231
|
-
const appImports = (cwd: string,
|
|
232
|
-
|
|
237
|
+
const appImports = (cwd: string, scanned: string[]): [string, string, number][] =>
|
|
238
|
+
scanned.flatMap((rel) => {
|
|
233
239
|
const isCode = /\.(?:[cm]?[jt]sx?|vue|astro)$/.test(rel)
|
|
234
240
|
if (!isCode && !rel.endsWith('.css')) return []
|
|
235
241
|
const src = readIfExists(resolve(cwd, rel)) ?? ''
|
|
@@ -242,7 +248,7 @@ const appImports = (cwd: string, cfg: BasaltConfig): [string, string, number][]
|
|
|
242
248
|
const DROPPED_FIXES = new Map([
|
|
243
249
|
[
|
|
244
250
|
'tokens.css',
|
|
245
|
-
|
|
251
|
+
`commit the emit instead: \`basalt-ui tokens:css --out src/tokens.css\` and import that file (${FONTS_CSS_HINT})`,
|
|
246
252
|
],
|
|
247
253
|
[
|
|
248
254
|
'router-tanstack',
|
|
@@ -253,7 +259,7 @@ const DROPPED_FIXES = new Map([
|
|
|
253
259
|
/** `dropped-subpaths`: `basalt-ui/<subpath>` imports the installed `exports` map does not have. */
|
|
254
260
|
export function droppedSubpathsCheck(
|
|
255
261
|
cwd: string,
|
|
256
|
-
|
|
262
|
+
scanned: string[],
|
|
257
263
|
install: BasaltInstall,
|
|
258
264
|
): Check {
|
|
259
265
|
const id = 'dropped-subpaths'
|
|
@@ -269,7 +275,7 @@ export function droppedSubpathsCheck(
|
|
|
269
275
|
(k) => k === `./${sub}` || (k.endsWith('*') && `./${sub}`.startsWith(k.slice(0, -1))),
|
|
270
276
|
)
|
|
271
277
|
const isDropped = (sub: string): boolean => DROPPED_FIXES.has(sub) || !hasExport(sub)
|
|
272
|
-
const found = appImports(cwd,
|
|
278
|
+
const found = appImports(cwd, scanned).filter(([sub]) => isDropped(sub))
|
|
273
279
|
if (found.length === 0) return null
|
|
274
280
|
const hits = found.map(([sub, rel, line]) => `${rel}:${line} imports basalt-ui/${sub}`)
|
|
275
281
|
const more = hits.length > 10 ? ` (+${hits.length - 10} more)` : ''
|
|
@@ -369,87 +375,126 @@ const ROUTER_PLUGIN_FIX =
|
|
|
369
375
|
"from '@tanstack/router-plugin/vite' to `plugins` in vite.config.ts (before react()), then run vite once " +
|
|
370
376
|
'to generate src/routeTree.gen.ts — or define the tree in code (`createRootRoute` + `createRoute`), drop the routeTree.gen import and pass the tree to createBasaltRouter.'
|
|
371
377
|
|
|
372
|
-
/**
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
378
|
+
/** `_app.tsx` or `_app/route.tsx` at any depth: a pathless layout (`_app.map.tsx` is a child, `__root` is the root). */
|
|
379
|
+
const PATHLESS_LAYOUT = /(^|\/)(_[^_./][^./]*\.[jt]sx|_[^_./][^./]*\/route\.[jt]sx)$/
|
|
380
|
+
|
|
381
|
+
/** Every file under `rel`, recursively; an unreadable directory has no files. */
|
|
382
|
+
function filesUnder(cwd: string, rel: string): string[] {
|
|
383
|
+
let entries: Dirent[]
|
|
384
|
+
try {
|
|
385
|
+
entries = readdirSync(resolve(cwd, rel), { withFileTypes: true })
|
|
386
|
+
} catch {
|
|
387
|
+
return []
|
|
388
|
+
}
|
|
389
|
+
return entries.flatMap((e) =>
|
|
390
|
+
e.isDirectory() ? filesUnder(cwd, `${rel}/${e.name}`) : [`${rel}/${e.name}`],
|
|
391
|
+
)
|
|
377
392
|
}
|
|
378
393
|
|
|
379
|
-
|
|
394
|
+
/** The root route and every pathless layout, then the modules they render a provider from (`hops`, one import hop). */
|
|
395
|
+
function startProviderFiles(cwd: string): {
|
|
396
|
+
root: ModuleFile
|
|
397
|
+
layouts: ModuleFile[]
|
|
398
|
+
hops: ModuleFile[]
|
|
399
|
+
far: string[]
|
|
400
|
+
} {
|
|
401
|
+
const rootFile = routerSeedDest('', 'root')
|
|
402
|
+
const routesDir = dirname(rootFile)
|
|
403
|
+
const root = loadModule(cwd, rootFile)
|
|
404
|
+
const layouts = filesUnder(cwd, routesDir)
|
|
405
|
+
.filter((f) => PATHLESS_LAYOUT.test(f.slice(routesDir.length + 1)))
|
|
406
|
+
.toSorted()
|
|
407
|
+
.map((f) => loadModule(cwd, f))
|
|
408
|
+
return { root, layouts, ...followProviderHops(cwd, [root, ...layouts]) }
|
|
409
|
+
}
|
|
380
410
|
|
|
381
411
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
* and
|
|
412
|
+
* How the exported root route is created: `createRootRouteWithContext` is typed (TypeScript gates the
|
|
413
|
+
* context at `createRouter`), `createRootRoute` is not. Anything else (a re-export, a wrapper, no
|
|
414
|
+
* `export const Route`) is null and never fails. A type annotation on `Route` is allowed.
|
|
385
415
|
*/
|
|
386
|
-
function
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
for (let i = m.index + m[0].length; i < code.length; i++) {
|
|
394
|
-
const ch = code[i]!
|
|
395
|
-
if (inLiteral(i)) continue
|
|
396
|
-
if (ch === '{') {
|
|
397
|
-
if (depth++ === 0 && isSpreadAt(code, i)) tag.spread = true
|
|
398
|
-
} else if (ch === '}') depth--
|
|
399
|
-
else if (ch === '>' && depth === 0) break
|
|
400
|
-
else if (depth === 0) tag.attrs += ch
|
|
401
|
-
}
|
|
402
|
-
return tag
|
|
403
|
-
})
|
|
416
|
+
function rootRouteKind(src: string): 'typed' | 'untyped' | null {
|
|
417
|
+
const kind =
|
|
418
|
+
/\bexport\s+const\s+Route\s*(?::[^=]+)?=\s*(createRootRouteWithContext|createRootRoute)\b/.exec(
|
|
419
|
+
tokenize(src).code,
|
|
420
|
+
)?.[1]
|
|
421
|
+
if (kind === undefined) return null
|
|
422
|
+
return kind === 'createRootRoute' ? 'untyped' : 'typed'
|
|
404
423
|
}
|
|
405
424
|
|
|
406
|
-
const
|
|
425
|
+
const fail = (problem: string, fix: string): { fail: string } => ({
|
|
426
|
+
fail: `app-wiring: ${problem} (TanStack Start app). Fix: ${fix}.`,
|
|
427
|
+
})
|
|
407
428
|
|
|
408
429
|
/**
|
|
409
|
-
* A Start app owns its router and entry: the wiring is
|
|
410
|
-
* in
|
|
411
|
-
* inside Start's, so it
|
|
430
|
+
* A Start app owns its router and entry: the wiring is ONE embedded `<BasaltProvider>` tag (no
|
|
431
|
+
* `router=`) around `<Outlet />`, in the root route or a pathless layout (a landing kept at 0 JS
|
|
432
|
+
* mounts it in the layout). ANY tag with `router=` mounts a second router inside Start's, so it
|
|
433
|
+
* fails even beside an embedded one. The exported root route must not be a bare `createRootRoute(`:
|
|
434
|
+
* the provider reads `context.queryClient`. Only that untyped form fails — a re-export, wrapper or
|
|
435
|
+
* missing `Route` export is skipped silently, and the context's type argument is left to TypeScript.
|
|
412
436
|
*/
|
|
413
437
|
function startWiring(cwd: string): { fail: string } | null {
|
|
414
|
-
const root =
|
|
415
|
-
const
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
: mounting
|
|
423
|
-
? 'passes router= to BasaltProvider, which mounts a second router inside Start'
|
|
424
|
-
: 'does not render <BasaltProvider>'
|
|
425
|
-
return {
|
|
426
|
-
fail: `app-wiring: ${root} ${problem} (TanStack Start app). Fix: render <BasaltProvider><Outlet /></BasaltProvider> in the root route component.`,
|
|
438
|
+
const { root, layouts, hops, far } = startProviderFiles(cwd)
|
|
439
|
+
const withTags = [root, ...layouts, ...hops].filter((f) => f.tags.length > 0)
|
|
440
|
+
const mounting = withTags.find((f) => f.tags.some(carriesRouter))
|
|
441
|
+
if (mounting) {
|
|
442
|
+
return fail(
|
|
443
|
+
`${mounting.file} passes router= to BasaltProvider, which mounts a second router inside Start`,
|
|
444
|
+
START_PROVIDER_HINT,
|
|
445
|
+
)
|
|
427
446
|
}
|
|
447
|
+
const [first] = withTags
|
|
448
|
+
if (first === undefined) {
|
|
449
|
+
const problem =
|
|
450
|
+
root.text === null
|
|
451
|
+
? `${root.file} does not exist and no pathless layout renders <BasaltProvider>`
|
|
452
|
+
: `neither ${root.file} nor a pathless layout (src/routes/_<name>.tsx, _<name>/route.tsx) renders <BasaltProvider>` +
|
|
453
|
+
(far.length > 0
|
|
454
|
+
? `, and the provider in ${far.join(', ')} is two imports away (doctor follows one import hop from a route file)`
|
|
455
|
+
: '')
|
|
456
|
+
return fail(problem, START_PROVIDER_HINT)
|
|
457
|
+
}
|
|
458
|
+
if (far.length > 0) {
|
|
459
|
+
return fail(
|
|
460
|
+
`${first.file} renders a <BasaltProvider> and so does ${far.join(', ')}, two imports away (doctor follows one import hop from a route file); the extra one nests a duplicate Query/Mantine tree`,
|
|
461
|
+
'keep one',
|
|
462
|
+
)
|
|
463
|
+
}
|
|
464
|
+
const tagCount = withTags.reduce((n, f) => n + f.tags.length, 0)
|
|
465
|
+
if (tagCount > 1) {
|
|
466
|
+
return fail(
|
|
467
|
+
`${[...new Set(withTags.map((f) => f.file))].join(' and ')} render ${tagCount} <BasaltProvider> tags; the extra ones nest a duplicate Query/Mantine tree`,
|
|
468
|
+
'keep one',
|
|
469
|
+
)
|
|
470
|
+
}
|
|
471
|
+
if (root.text === null) {
|
|
472
|
+
return fail(
|
|
473
|
+
`${root.file} does not exist, so the provider in ${first.file} has no root route context`,
|
|
474
|
+
'create it with `export const Route = createRootRouteWithContext<BasaltRouterContext>()({ … })`',
|
|
475
|
+
)
|
|
476
|
+
}
|
|
477
|
+
if (rootRouteKind(root.text) !== 'untyped') return null
|
|
478
|
+
return fail(
|
|
479
|
+
`${root.file} exports a Route built with createRootRoute(), so its router context has no queryClient, which the embedded BasaltProvider reads from context.queryClient`,
|
|
480
|
+
"`createRootRouteWithContext<BasaltRouterContext>()({ … })` (import type { BasaltRouterContext } from 'basalt-ui') and pass the QueryClient in createRouter({ context })",
|
|
481
|
+
)
|
|
428
482
|
}
|
|
429
483
|
|
|
430
484
|
/**
|
|
431
|
-
* Warnings for a Start app's embedded provider; heuristics, not proofs. A `{...spread}` on
|
|
432
|
-
* could carry a `router
|
|
433
|
-
* provider will find no `context.queryClient`. Empty when there is nothing to judge.
|
|
485
|
+
* Warnings for a Start app's embedded provider; heuristics, not proofs. A `{...spread}` on a tag
|
|
486
|
+
* could carry a `router`. Empty when there is nothing to judge.
|
|
434
487
|
*/
|
|
435
488
|
export function startWiringWarnings(cwd: string): string[] {
|
|
436
489
|
if (!isStartApp(cwd, '')) return []
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
490
|
+
const { root, layouts, hops } = startProviderFiles(cwd)
|
|
491
|
+
return [...new Set([root, ...layouts, ...hops])]
|
|
492
|
+
.filter((f) => f.tags.some((t) => t.spread))
|
|
493
|
+
.map(
|
|
494
|
+
(f) =>
|
|
495
|
+
`app-wiring: <BasaltProvider {...spread}> in ${f.file} could pass router=, which mounts ` +
|
|
442
496
|
'a second router inside Start (heuristic: the spread is not followed).',
|
|
443
497
|
)
|
|
444
|
-
}
|
|
445
|
-
const router = readIfExists(resolve(cwd, 'src/router.tsx'))
|
|
446
|
-
if (router !== null && !/queryClient/.test(router)) {
|
|
447
|
-
out.push(
|
|
448
|
-
'app-wiring: src/router.tsx never mentions queryClient — embedded BasaltProvider needs ' +
|
|
449
|
-
'context.queryClient on the Start router (heuristic text check; ignore if you build it elsewhere).',
|
|
450
|
-
)
|
|
451
|
-
}
|
|
452
|
-
return out
|
|
453
498
|
}
|
|
454
499
|
|
|
455
500
|
const BASALT_SHELL_TAG = /<BasaltShell\b/g
|
|
@@ -592,12 +637,12 @@ export const SUBPATH_REQUIRED_PEERS: Readonly<Record<string, readonly string[]>>
|
|
|
592
637
|
* `subpath-peers`: every `basalt-ui/<subpath>` the app imports has its required peers installed. A
|
|
593
638
|
* missing one still builds, then throws "Could not resolve" when the chunk loads.
|
|
594
639
|
*/
|
|
595
|
-
export function subpathPeersCheck(cwd: string,
|
|
640
|
+
export function subpathPeersCheck(cwd: string, scanned: string[], install: BasaltInstall): Check {
|
|
596
641
|
const id = 'subpath-peers'
|
|
597
642
|
return withInstall(id, install, 'peers', (dir) => {
|
|
598
643
|
const missing = new Map<string, string[]>()
|
|
599
644
|
for (const [sub, file] of new Map(
|
|
600
|
-
appImports(cwd,
|
|
645
|
+
appImports(cwd, scanned)
|
|
601
646
|
.toReversed()
|
|
602
647
|
.map(([s, f]) => [s, f]),
|
|
603
648
|
)) {
|
package/src/cli/doctor.ts
CHANGED
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
OXLINT_FILES,
|
|
23
23
|
OXLINT_NO_BIN,
|
|
24
24
|
oxlintBinResolves,
|
|
25
|
-
parseJsonc,
|
|
26
25
|
readBasaltConfig,
|
|
27
26
|
readIfExists,
|
|
28
27
|
readManifest,
|
|
@@ -34,6 +33,7 @@ import {
|
|
|
34
33
|
scannableFiles,
|
|
35
34
|
shippedAssetPath,
|
|
36
35
|
} from './index'
|
|
36
|
+
import { parseJsonc } from './source-text'
|
|
37
37
|
import { resolveRoots } from './config'
|
|
38
38
|
import {
|
|
39
39
|
appWiringCheck,
|
|
@@ -377,7 +377,7 @@ export function doctor(invocationCwd: string = process.cwd(), flags: string[] =
|
|
|
377
377
|
// ── Hard checks 8-13: strictness and the 1.x → 2.0 upgrade path (./doctor-upgrade) ──────────
|
|
378
378
|
const droppedCheck: [string, Check] = [
|
|
379
379
|
'dropped-subpaths: no import of a basalt-ui subpath the install lacks',
|
|
380
|
-
droppedSubpathsCheck(appDir, cfg, install),
|
|
380
|
+
droppedSubpathsCheck(appDir, scannableFiles(appDir, cfg), install),
|
|
381
381
|
]
|
|
382
382
|
const runChecks = (checks: [string, Check][]): void => {
|
|
383
383
|
for (const [ok, check] of checks) {
|
|
@@ -407,7 +407,7 @@ export function doctor(invocationCwd: string = process.cwd(), flags: string[] =
|
|
|
407
407
|
['exact-peers: installed exact-pinned peers match basalt-ui', exactPeersCheck(cwd, install)],
|
|
408
408
|
[
|
|
409
409
|
'subpath-peers: every imported basalt-ui subpath has its required peers installed',
|
|
410
|
-
subpathPeersCheck(appDir, cfg, install),
|
|
410
|
+
subpathPeersCheck(appDir, scannableFiles(appDir, cfg), install),
|
|
411
411
|
],
|
|
412
412
|
[
|
|
413
413
|
'config-keys: the basalt config block sets only keys basalt-ui reads',
|
package/src/cli/index.ts
CHANGED
|
@@ -29,9 +29,20 @@ import { guardHook } from './guard-hook'
|
|
|
29
29
|
import { COMMAND_OPTIONS, USAGE, unknownFlag } from './help'
|
|
30
30
|
import { init } from './init'
|
|
31
31
|
import { sync } from './sync'
|
|
32
|
-
import {
|
|
32
|
+
import type { BasaltInstall } from './basalt-install'
|
|
33
|
+
import {
|
|
34
|
+
CODE_ROUTED_NOTE,
|
|
35
|
+
ROUTER_SEED_DESTS,
|
|
36
|
+
SHELL_LESS_NOTE,
|
|
37
|
+
START_PROVIDER_HINT,
|
|
38
|
+
routerSeedDest,
|
|
39
|
+
routerSeedDests,
|
|
40
|
+
routerSeedSkip,
|
|
41
|
+
} from './router-wiring'
|
|
33
42
|
import type { RouterSeedSkip } from './router-wiring'
|
|
34
|
-
|
|
43
|
+
|
|
44
|
+
export type { BasaltInstall }
|
|
45
|
+
import { hasDependency, parseJsonc, readIfExists, readPackageJson, stripJsonc } from './source-text'
|
|
35
46
|
import { fontsCss, normalizeColorFunctions, tokensCss } from './tokens-css'
|
|
36
47
|
import { DEFAULT_ROOT, exemptRulePaths, resolveRoots } from './config'
|
|
37
48
|
import type { BasaltConfig } from './config'
|
|
@@ -213,14 +224,6 @@ export function relativePosix(fromDir: string, toPath: string): string {
|
|
|
213
224
|
* resolution walks OUTWARD from the consumer dir, then across workspace packages, and every caller
|
|
214
225
|
* renders its paths from the answer rather than assuming the root.
|
|
215
226
|
*/
|
|
216
|
-
export type BasaltInstall = {
|
|
217
|
-
/** Absolute path of the resolved `node_modules/basalt-ui` directory, or null when unresolvable. */
|
|
218
|
-
dir: string | null
|
|
219
|
-
/** The resolved copy's own version, or null. */
|
|
220
|
-
version: string | null
|
|
221
|
-
/** How it was found — `null` when unresolved. `'workspace'` is the isolated-linker case. */
|
|
222
|
-
how: 'cwd' | 'ancestor' | 'workspace' | null
|
|
223
|
-
}
|
|
224
227
|
|
|
225
228
|
const UNRESOLVED_INSTALL: BasaltInstall = { dir: null, version: null, how: null }
|
|
226
229
|
|
|
@@ -642,28 +645,9 @@ export function importsAgentsMd(text: string): boolean {
|
|
|
642
645
|
/** Scaffold options. `noMergeLint`: `--no-merge-lint` leaves an existing `.oxlintrc.json` untouched. */
|
|
643
646
|
export type ScaffoldFlags = { noMergeLint?: boolean }
|
|
644
647
|
|
|
645
|
-
|
|
646
|
-
export const ROUTER_SEED_DESTS = {
|
|
647
|
-
nav: 'src/lib/nav.tsx',
|
|
648
|
-
root: 'src/routes/__root.tsx',
|
|
649
|
-
main: 'src/main.tsx',
|
|
650
|
-
} as const
|
|
651
|
-
|
|
652
|
-
/** A router seed's dest, relative to the install root: under the app dir when it is not the root. */
|
|
653
|
-
export function routerSeedDest(appRel: string, seed: keyof typeof ROUTER_SEED_DESTS): string {
|
|
654
|
-
return appRel === '' ? ROUTER_SEED_DESTS[seed] : `${appRel}/${ROUTER_SEED_DESTS[seed]}`
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
/** The router seeds' dests for an app dir (`main.tsx`, `nav.tsx`, `__root.tsx`). */
|
|
658
|
-
export function routerSeedDests(appRel: string): string[] {
|
|
659
|
-
return (Object.keys(ROUTER_SEED_DESTS) as (keyof typeof ROUTER_SEED_DESTS)[]).map((seed) =>
|
|
660
|
-
routerSeedDest(appRel, seed),
|
|
661
|
-
)
|
|
662
|
-
}
|
|
648
|
+
export { ROUTER_SEED_DESTS, START_PROVIDER_HINT, routerSeedDest, routerSeedDests }
|
|
663
649
|
|
|
664
|
-
export const START_APP_NOTE =
|
|
665
|
-
'TanStack Start app — no main.tsx/nav.tsx/__root.tsx seeded (Start owns the router); render ' +
|
|
666
|
-
'<BasaltProvider><Outlet /></BasaltProvider> in your root route component.'
|
|
650
|
+
export const START_APP_NOTE = `TanStack Start app — no main.tsx/nav.tsx/__root.tsx seeded (Start owns the router); ${START_PROVIDER_HINT}.`
|
|
667
651
|
|
|
668
652
|
/**
|
|
669
653
|
* The router seeds an app does not get, for `init` and `sync`: why (`start` | `code-routed` |
|
|
@@ -1369,45 +1353,6 @@ export function rootsNotices(state: RootsState): { log: string[]; error: string[
|
|
|
1369
1353
|
}
|
|
1370
1354
|
}
|
|
1371
1355
|
|
|
1372
|
-
/**
|
|
1373
|
-
* Strip JSONC comments and trailing commas so oxlint/tsconfig files can be READ (string-aware). A
|
|
1374
|
-
* mangled string fails as a parse error, which callers treat as "cannot tell", never as a pass.
|
|
1375
|
-
*/
|
|
1376
|
-
function stripJsonc(text: string): string {
|
|
1377
|
-
let out = ''
|
|
1378
|
-
let inString = false
|
|
1379
|
-
for (let i = 0; i < text.length; i++) {
|
|
1380
|
-
const ch = text[i] as string
|
|
1381
|
-
if (inString) {
|
|
1382
|
-
out += ch
|
|
1383
|
-
if (ch === '\\') out += text[++i] ?? ''
|
|
1384
|
-
else if (ch === '"') inString = false
|
|
1385
|
-
continue
|
|
1386
|
-
}
|
|
1387
|
-
if (ch === '"') inString = true
|
|
1388
|
-
else if (ch === '/' && text[i + 1] === '/') {
|
|
1389
|
-
while (i < text.length && text[i] !== '\n') i++
|
|
1390
|
-
continue
|
|
1391
|
-
} else if (ch === '/' && text[i + 1] === '*') {
|
|
1392
|
-
i += 2
|
|
1393
|
-
while (i < text.length && !(text[i] === '*' && text[i + 1] === '/')) i++
|
|
1394
|
-
i++
|
|
1395
|
-
continue
|
|
1396
|
-
}
|
|
1397
|
-
out += ch
|
|
1398
|
-
}
|
|
1399
|
-
return out.replace(/,(\s*[}\]])/g, '$1')
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
/** Parse a JSONC document, or null when it does not parse at all. */
|
|
1403
|
-
export function parseJsonc(text: string): Record<string, unknown> | null {
|
|
1404
|
-
try {
|
|
1405
|
-
return JSON.parse(stripJsonc(text.replace(/^\uFEFF/, ''))) as Record<string, unknown>
|
|
1406
|
-
} catch {
|
|
1407
|
-
return null
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
1356
|
/** Outcome of splicing the shipped preset into an `.oxlintrc.json` the consumer already had. */
|
|
1412
1357
|
export type MergeLintResult = 'added' | 'already' | 'absent' | 'unreadable' | 'has-comments'
|
|
1413
1358
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** `<BasaltProvider>` tag reading — a leaf: the CLI's doctor and sync share it without importing each other. */
|
|
2
|
+
import { tokenize } from './source-text'
|
|
3
|
+
|
|
4
|
+
/** True when `{` at `i` opens a `{...spread}`: sticky, so any whitespace width is read. */
|
|
5
|
+
function isSpreadAt(code: string, i: number): boolean {
|
|
6
|
+
const spread = /\{\s*\.\.\./y
|
|
7
|
+
spread.lastIndex = i
|
|
8
|
+
return spread.test(code)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type ProviderTag = { attrs: string; spread: boolean }
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Every `<BasaltProvider …>` opening tag in a root route: its attribute text at JSX brace depth 0,
|
|
15
|
+
* with string literals skipped (so `className="a > b"` cannot end the tag, nor `"router="` count),
|
|
16
|
+
* and whether a `{...spread}` could carry a `router`.
|
|
17
|
+
*/
|
|
18
|
+
export function providerTags(src: string): ProviderTag[] {
|
|
19
|
+
const { code, inLiteral } = tokenize(src)
|
|
20
|
+
return [...code.matchAll(/<BasaltProvider\b/g)]
|
|
21
|
+
.filter((m) => !inLiteral(m.index))
|
|
22
|
+
.map((m) => {
|
|
23
|
+
const tag: ProviderTag = { attrs: '', spread: false }
|
|
24
|
+
let depth = 0
|
|
25
|
+
for (let i = m.index + m[0].length; i < code.length; i++) {
|
|
26
|
+
const ch = code[i]!
|
|
27
|
+
if (inLiteral(i)) continue
|
|
28
|
+
if (ch === '{') {
|
|
29
|
+
if (depth++ === 0 && isSpreadAt(code, i)) tag.spread = true
|
|
30
|
+
} else if (ch === '}') depth--
|
|
31
|
+
else if (ch === '>' && depth === 0) break
|
|
32
|
+
else if (depth === 0) tag.attrs += ch
|
|
33
|
+
}
|
|
34
|
+
return tag
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const carriesRouter = (tag: ProviderTag): boolean => /(^|\s)router\s*=/.test(tag.attrs)
|