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/cli/index.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ import { doctor } from './doctor.js';
|
|
|
5
5
|
import { guardHook } from './guard-hook.js';
|
|
6
6
|
import { init } from './init.js';
|
|
7
7
|
import { sync } from './sync.js';
|
|
8
|
+
import type { BasaltInstall } from './basalt-install.js';
|
|
9
|
+
import { ROUTER_SEED_DESTS, START_PROVIDER_HINT, routerSeedDest, routerSeedDests } from './router-wiring.js';
|
|
8
10
|
import type { RouterSeedSkip } from './router-wiring.js';
|
|
11
|
+
export type { BasaltInstall };
|
|
9
12
|
import { fontsCss, normalizeColorFunctions, tokensCss } from './tokens-css.js';
|
|
10
13
|
import type { BasaltConfig } from './config.js';
|
|
11
14
|
export declare function resolveGuardConfig(cfg: BasaltConfig, profile: DoctorProfile): GuardConfig;
|
|
@@ -24,20 +27,6 @@ export declare function hasBasaltKey(cwd: string): boolean;
|
|
|
24
27
|
export declare function readBasaltConfig(cwd: string): BasaltConfig;
|
|
25
28
|
/** A path relative to `fromDir`, POSIX-separated and always explicitly relative (`./` / `../`). */
|
|
26
29
|
export declare function relativePosix(fromDir: string, toPath: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* Where `basalt-ui` actually resolves from, seen from a consumer directory. Under bun's isolated
|
|
29
|
-
* linker a package that declares basalt gets it at `<pkg>/node_modules` and nothing at the root, so
|
|
30
|
-
* resolution walks OUTWARD from the consumer dir, then across workspace packages, and every caller
|
|
31
|
-
* renders its paths from the answer rather than assuming the root.
|
|
32
|
-
*/
|
|
33
|
-
export type BasaltInstall = {
|
|
34
|
-
/** Absolute path of the resolved `node_modules/basalt-ui` directory, or null when unresolvable. */
|
|
35
|
-
dir: string | null;
|
|
36
|
-
/** The resolved copy's own version, or null. */
|
|
37
|
-
version: string | null;
|
|
38
|
-
/** How it was found — `null` when unresolved. `'workspace'` is the isolated-linker case. */
|
|
39
|
-
how: 'cwd' | 'ancestor' | 'workspace' | null;
|
|
40
|
-
};
|
|
41
30
|
/** Resolve the installed basalt-ui: cwd, then every ancestor, then the workspace packages. */
|
|
42
31
|
export declare function findBasaltInstall(cwd: string): BasaltInstall;
|
|
43
32
|
/**
|
|
@@ -201,17 +190,8 @@ export declare function importsAgentsMd(text: string): boolean;
|
|
|
201
190
|
export type ScaffoldFlags = {
|
|
202
191
|
noMergeLint?: boolean;
|
|
203
192
|
};
|
|
204
|
-
|
|
205
|
-
export declare const
|
|
206
|
-
readonly nav: "src/lib/nav.tsx";
|
|
207
|
-
readonly root: "src/routes/__root.tsx";
|
|
208
|
-
readonly main: "src/main.tsx";
|
|
209
|
-
};
|
|
210
|
-
/** A router seed's dest, relative to the install root: under the app dir when it is not the root. */
|
|
211
|
-
export declare function routerSeedDest(appRel: string, seed: keyof typeof ROUTER_SEED_DESTS): string;
|
|
212
|
-
/** The router seeds' dests for an app dir (`main.tsx`, `nav.tsx`, `__root.tsx`). */
|
|
213
|
-
export declare function routerSeedDests(appRel: string): string[];
|
|
214
|
-
export declare const START_APP_NOTE: string;
|
|
193
|
+
export { ROUTER_SEED_DESTS, START_PROVIDER_HINT, routerSeedDest, routerSeedDests };
|
|
194
|
+
export declare const START_APP_NOTE = "TanStack Start app \u2014 no main.tsx/nav.tsx/__root.tsx seeded (Start owns the router); render <BasaltProvider><Outlet /></BasaltProvider> in the root route component or a pathless layout.";
|
|
215
195
|
/**
|
|
216
196
|
* The router seeds an app does not get, for `init` and `sync`: why (`start` | `code-routed` |
|
|
217
197
|
* `shell-less` | null) and which dests. A tokens-only consumer gets none of them either; so does an
|
|
@@ -400,8 +380,6 @@ export declare function rootsNotices(state: RootsState): {
|
|
|
400
380
|
log: string[];
|
|
401
381
|
error: string[];
|
|
402
382
|
};
|
|
403
|
-
/** Parse a JSONC document, or null when it does not parse at all. */
|
|
404
|
-
export declare function parseJsonc(text: string): Record<string, unknown> | null;
|
|
405
383
|
/** Outcome of splicing the shipped preset into an `.oxlintrc.json` the consumer already had. */
|
|
406
384
|
export type MergeLintResult = 'added' | 'already' | 'absent' | 'unreadable' | 'has-comments';
|
|
407
385
|
/** The shipped oxlint files, package-relative — the one spelling every reader of them uses. */
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,WAAW,EAA4B,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,WAAW,EAA4B,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,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D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;AAClC,YAAY,EAAE,WAAW,EAAE,CAAA;AAI3B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,uBAAuB,EAAE,SAAS,EAAE,CAAA;AAClG,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/cli/index.js
CHANGED
|
@@ -20,8 +20,16 @@ import { guardHook } from "./guard-hook.js";
|
|
|
20
20
|
import { COMMAND_OPTIONS, USAGE, unknownFlag } from "./help.js";
|
|
21
21
|
import { init } from "./init.js";
|
|
22
22
|
import { sync } from "./sync.js";
|
|
23
|
-
import {
|
|
24
|
-
|
|
23
|
+
import {
|
|
24
|
+
CODE_ROUTED_NOTE,
|
|
25
|
+
ROUTER_SEED_DESTS,
|
|
26
|
+
SHELL_LESS_NOTE,
|
|
27
|
+
START_PROVIDER_HINT,
|
|
28
|
+
routerSeedDest,
|
|
29
|
+
routerSeedDests,
|
|
30
|
+
routerSeedSkip
|
|
31
|
+
} from "./router-wiring.js";
|
|
32
|
+
import { hasDependency, parseJsonc, readIfExists, readPackageJson, stripJsonc } from "./source-text.js";
|
|
25
33
|
import { fontsCss, normalizeColorFunctions, tokensCss } from "./tokens-css.js";
|
|
26
34
|
import { DEFAULT_ROOT, exemptRulePaths, resolveRoots } from "./config.js";
|
|
27
35
|
const GUARD_PASSTHROUGH = {
|
|
@@ -333,20 +341,7 @@ function isAgentsImportLine(line) {
|
|
|
333
341
|
function importsAgentsMd(text) {
|
|
334
342
|
return text.split(/\r?\n/).some(isAgentsImportLine);
|
|
335
343
|
}
|
|
336
|
-
const
|
|
337
|
-
nav: "src/lib/nav.tsx",
|
|
338
|
-
root: "src/routes/__root.tsx",
|
|
339
|
-
main: "src/main.tsx"
|
|
340
|
-
};
|
|
341
|
-
function routerSeedDest(appRel, seed) {
|
|
342
|
-
return appRel === "" ? ROUTER_SEED_DESTS[seed] : `${appRel}/${ROUTER_SEED_DESTS[seed]}`;
|
|
343
|
-
}
|
|
344
|
-
function routerSeedDests(appRel) {
|
|
345
|
-
return Object.keys(ROUTER_SEED_DESTS).map(
|
|
346
|
-
(seed) => routerSeedDest(appRel, seed)
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
const START_APP_NOTE = "TanStack Start app \u2014 no main.tsx/nav.tsx/__root.tsx seeded (Start owns the router); render <BasaltProvider><Outlet /></BasaltProvider> in your root route component.";
|
|
344
|
+
const START_APP_NOTE = `TanStack Start app \u2014 no main.tsx/nav.tsx/__root.tsx seeded (Start owns the router); ${START_PROVIDER_HINT}.`;
|
|
350
345
|
function routerSeedPlan(cwd, appRel, tokensOnly = false) {
|
|
351
346
|
const detected = tokensOnly ? null : routerSeedSkip(cwd, appRel);
|
|
352
347
|
const skip = detected ?? (!tokensOnly && readBasaltConfig(cwd).shell === false ? "shell-less" : null);
|
|
@@ -745,38 +740,6 @@ function rootsNotices(state) {
|
|
|
745
740
|
error: []
|
|
746
741
|
};
|
|
747
742
|
}
|
|
748
|
-
function stripJsonc(text) {
|
|
749
|
-
let out = "";
|
|
750
|
-
let inString = false;
|
|
751
|
-
for (let i = 0; i < text.length; i++) {
|
|
752
|
-
const ch = text[i];
|
|
753
|
-
if (inString) {
|
|
754
|
-
out += ch;
|
|
755
|
-
if (ch === "\\") out += text[++i] ?? "";
|
|
756
|
-
else if (ch === '"') inString = false;
|
|
757
|
-
continue;
|
|
758
|
-
}
|
|
759
|
-
if (ch === '"') inString = true;
|
|
760
|
-
else if (ch === "/" && text[i + 1] === "/") {
|
|
761
|
-
while (i < text.length && text[i] !== "\n") i++;
|
|
762
|
-
continue;
|
|
763
|
-
} else if (ch === "/" && text[i + 1] === "*") {
|
|
764
|
-
i += 2;
|
|
765
|
-
while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) i++;
|
|
766
|
-
i++;
|
|
767
|
-
continue;
|
|
768
|
-
}
|
|
769
|
-
out += ch;
|
|
770
|
-
}
|
|
771
|
-
return out.replace(/,(\s*[}\]])/g, "$1");
|
|
772
|
-
}
|
|
773
|
-
function parseJsonc(text) {
|
|
774
|
-
try {
|
|
775
|
-
return JSON.parse(stripJsonc(text.replace(/^\uFEFF/, "")));
|
|
776
|
-
} catch {
|
|
777
|
-
return null;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
743
|
const OXLINT_FILES = {
|
|
781
744
|
preset: "configs/oxlint.json",
|
|
782
745
|
guards: "configs/oxlint-basalt.json",
|
|
@@ -981,6 +944,7 @@ export {
|
|
|
981
944
|
SKILL_NAMES,
|
|
982
945
|
SKIP,
|
|
983
946
|
START_APP_NOTE,
|
|
947
|
+
START_PROVIDER_HINT,
|
|
984
948
|
basaltBinCommand,
|
|
985
949
|
basaltPresetEntry,
|
|
986
950
|
checkTheme,
|
|
@@ -1011,7 +975,6 @@ export {
|
|
|
1011
975
|
noteRelocation,
|
|
1012
976
|
oxlintBinResolves,
|
|
1013
977
|
packageRoot,
|
|
1014
|
-
parseJsonc,
|
|
1015
978
|
patchPackageJson,
|
|
1016
979
|
placementNotices,
|
|
1017
980
|
pruneRetiredManagedFiles,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ProviderTag = {
|
|
2
|
+
attrs: string;
|
|
3
|
+
spread: boolean;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Every `<BasaltProvider …>` opening tag in a root route: its attribute text at JSX brace depth 0,
|
|
7
|
+
* with string literals skipped (so `className="a > b"` cannot end the tag, nor `"router="` count),
|
|
8
|
+
* and whether a `{...spread}` could carry a `router`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function providerTags(src: string): ProviderTag[];
|
|
11
|
+
export declare const carriesRouter: (tag: ProviderTag) => boolean;
|
|
12
|
+
//# sourceMappingURL=provider-tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-tags.d.ts","sourceRoot":"","sources":["../../src/cli/provider-tags.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAA;AAE5D;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,EAAE,CAkBvD;AAED,eAAO,MAAM,aAAa,GAAI,KAAK,WAAW,KAAG,OAA6C,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { tokenize } from "./source-text.js";
|
|
2
|
+
function isSpreadAt(code, i) {
|
|
3
|
+
const spread = /\{\s*\.\.\./y;
|
|
4
|
+
spread.lastIndex = i;
|
|
5
|
+
return spread.test(code);
|
|
6
|
+
}
|
|
7
|
+
function providerTags(src) {
|
|
8
|
+
const { code, inLiteral } = tokenize(src);
|
|
9
|
+
return [...code.matchAll(/<BasaltProvider\b/g)].filter((m) => !inLiteral(m.index)).map((m) => {
|
|
10
|
+
const tag = { attrs: "", spread: false };
|
|
11
|
+
let depth = 0;
|
|
12
|
+
for (let i = m.index + m[0].length; i < code.length; i++) {
|
|
13
|
+
const ch = code[i];
|
|
14
|
+
if (inLiteral(i)) continue;
|
|
15
|
+
if (ch === "{") {
|
|
16
|
+
if (depth++ === 0 && isSpreadAt(code, i)) tag.spread = true;
|
|
17
|
+
} else if (ch === "}") depth--;
|
|
18
|
+
else if (ch === ">" && depth === 0) break;
|
|
19
|
+
else if (depth === 0) tag.attrs += ch;
|
|
20
|
+
}
|
|
21
|
+
return tag;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const carriesRouter = (tag) => /(^|\s)router\s*=/.test(tag.attrs);
|
|
25
|
+
export {
|
|
26
|
+
carriesRouter,
|
|
27
|
+
providerTags
|
|
28
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ProviderTag } from './provider-tags.js';
|
|
2
|
+
export type ModuleFile = {
|
|
3
|
+
file: string;
|
|
4
|
+
text: string | null;
|
|
5
|
+
tags: ProviderTag[];
|
|
6
|
+
};
|
|
7
|
+
/** One read path for every module in the walk; `text` is null for a missing file. */
|
|
8
|
+
export declare function loadModule(cwd: string, file: string): ModuleFile;
|
|
9
|
+
type Alias = [prefix: string, dir: string];
|
|
10
|
+
/** tsconfig `compilerOptions.paths` single-wildcard `alias/*` entries; a malformed shape is no alias. */
|
|
11
|
+
export declare function pathAliases(cwd: string): Alias[];
|
|
12
|
+
/** The local modules `file` renders a component from: `<Name` in JSX, name imported from a relative or aliased specifier. */
|
|
13
|
+
export declare function renderedImports(cwd: string, file: string, text: string, aliases: Alias[]): string[];
|
|
14
|
+
/**
|
|
15
|
+
* `hops`: one entry per render EDGE (scanned file -> rendered module holding a provider tag), so the
|
|
16
|
+
* same wrapper rendered from two route files counts twice. `far`: provider-holding modules one more hop out, which doctor does not follow but
|
|
17
|
+
* names (the one-provider invariant and the failure message both need them).
|
|
18
|
+
*/
|
|
19
|
+
export declare function followProviderHops(cwd: string, scanned: ModuleFile[]): {
|
|
20
|
+
hops: ModuleFile[];
|
|
21
|
+
far: string[];
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=render-imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-imports.d.ts","sourceRoot":"","sources":["../../src/cli/render-imports.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,WAAW,EAAE,CAAA;CAAE,CAAA;AAEnF,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAGhE;AAID,KAAK,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;AAE1C,yGAAyG;AACzG,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,CAWhD;AASD,6HAA6H;AAC7H,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,KAAK,EAAE,GACf,MAAM,EAAE,CAqBV;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,UAAU,EAAE,GACpB;IAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAsBvC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { dirname, relative, resolve } from "node:path";
|
|
2
|
+
import { providerTags } from "./provider-tags.js";
|
|
3
|
+
import { parseJsonc, readIfExists, tokenize } from "./source-text.js";
|
|
4
|
+
function loadModule(cwd, file) {
|
|
5
|
+
const text = readIfExists(resolve(cwd, file));
|
|
6
|
+
return { file, text, tags: providerTags(text ?? "") };
|
|
7
|
+
}
|
|
8
|
+
const MODULE_SUFFIXES = [".tsx", ".ts", ".jsx", ".js", "/index.tsx", "/index.ts"];
|
|
9
|
+
function pathAliases(cwd) {
|
|
10
|
+
const opts = parseJsonc(readIfExists(resolve(cwd, "tsconfig.json")) ?? "")?.["compilerOptions"];
|
|
11
|
+
if (typeof opts !== "object" || opts === null) return [];
|
|
12
|
+
const { baseUrl, paths } = opts;
|
|
13
|
+
if (typeof paths !== "object" || paths === null || Array.isArray(paths)) return [];
|
|
14
|
+
const base = typeof baseUrl === "string" ? baseUrl : ".";
|
|
15
|
+
return Object.entries(paths).flatMap(([pattern, targets]) => {
|
|
16
|
+
const target = Array.isArray(targets) ? targets[0] : void 0;
|
|
17
|
+
if (!pattern.endsWith("/*") || typeof target !== "string" || !target.endsWith("/*")) return [];
|
|
18
|
+
return [[pattern.slice(0, -1), `${base}/${target.slice(0, -1)}`]];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const aliasedBase = (cwd, spec, aliases) => {
|
|
22
|
+
const hit = aliases.find(([prefix]) => spec.startsWith(prefix));
|
|
23
|
+
return hit === void 0 ? void 0 : resolve(cwd, hit[1] + spec.slice(hit[0].length));
|
|
24
|
+
};
|
|
25
|
+
const escapeRegex = (name) => name.replaceAll("$", String.raw`\$`);
|
|
26
|
+
function renderedImports(cwd, file, text, aliases) {
|
|
27
|
+
const { code, inLiteral } = tokenize(text);
|
|
28
|
+
const found = /* @__PURE__ */ new Set();
|
|
29
|
+
for (const m of code.matchAll(/\bimport\s+(?!type\b)([^'"]*?)\s*from\s*['"]([^'"]+)['"]/g)) {
|
|
30
|
+
if (inLiteral(m.index)) continue;
|
|
31
|
+
const spec = m[2].replace(/\.[jt]sx?$/, "");
|
|
32
|
+
const base = spec.startsWith(".") ? resolve(cwd, dirname(file), spec) : aliasedBase(cwd, spec, aliases);
|
|
33
|
+
if (base === void 0) continue;
|
|
34
|
+
const names = [...m[1].replace(/\btype\s+/g, "").matchAll(/[A-Za-z_$][\w$]*/g)].map(
|
|
35
|
+
(n) => n[0]
|
|
36
|
+
);
|
|
37
|
+
if (!names.some((n) => new RegExp(`<${escapeRegex(n)}\\b`).test(code))) continue;
|
|
38
|
+
const rel = relative(cwd, base).split("\\").join("/");
|
|
39
|
+
const hit = MODULE_SUFFIXES.map((x) => rel + x).find(
|
|
40
|
+
(c) => readIfExists(resolve(cwd, c)) !== null
|
|
41
|
+
);
|
|
42
|
+
if (hit !== void 0) found.add(hit);
|
|
43
|
+
}
|
|
44
|
+
return [...found];
|
|
45
|
+
}
|
|
46
|
+
function followProviderHops(cwd, scanned) {
|
|
47
|
+
const aliases = pathAliases(cwd);
|
|
48
|
+
const modules = new Map(scanned.map((f) => [f.file, f]));
|
|
49
|
+
const load = (file) => {
|
|
50
|
+
const known = modules.get(file) ?? loadModule(cwd, file);
|
|
51
|
+
modules.set(file, known);
|
|
52
|
+
return known;
|
|
53
|
+
};
|
|
54
|
+
const hops = [];
|
|
55
|
+
const far = /* @__PURE__ */ new Set();
|
|
56
|
+
for (const f of scanned) {
|
|
57
|
+
for (const mod of renderedImports(cwd, f.file, f.text ?? "", aliases)) {
|
|
58
|
+
if (scanned.some((s) => s.file === mod)) continue;
|
|
59
|
+
const hop = load(mod);
|
|
60
|
+
if (hop.tags.length > 0) hops.push(hop);
|
|
61
|
+
for (const next of renderedImports(cwd, mod, hop.text ?? "", aliases)) {
|
|
62
|
+
if (!scanned.some((s) => s.file === next) && load(next).tags.length > 0) far.add(next);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const nearFiles = new Set(hops.map((h) => h.file));
|
|
67
|
+
return { hops, far: [...far].filter((f) => !nearFiles.has(f)) };
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
followProviderHops,
|
|
71
|
+
loadModule,
|
|
72
|
+
pathAliases,
|
|
73
|
+
renderedImports
|
|
74
|
+
};
|
|
@@ -35,5 +35,17 @@ export declare const CODE_ROUTED_NOTE = "code-routed app (createBasaltRouter, no
|
|
|
35
35
|
*/
|
|
36
36
|
export declare function routerSeedSkip(cwd: string, appRel: string): RouterSeedSkip;
|
|
37
37
|
export declare const SHELL_LESS_NOTE = "`basalt.shell: false` \u2014 no main.tsx/nav.tsx/__root.tsx seeded; the app owns its root route (or has none).";
|
|
38
|
+
/** The router seeds (TanStack Router and Query are required peers of `.`, so they are always written). */
|
|
39
|
+
export declare const ROUTER_SEED_DESTS: {
|
|
40
|
+
readonly nav: "src/lib/nav.tsx";
|
|
41
|
+
readonly root: "src/routes/__root.tsx";
|
|
42
|
+
readonly main: "src/main.tsx";
|
|
43
|
+
};
|
|
44
|
+
/** A router seed's dest, relative to the install root: under the app dir when it is not the root. */
|
|
45
|
+
export declare function routerSeedDest(appRel: string, seed: keyof typeof ROUTER_SEED_DESTS): string;
|
|
46
|
+
/** The router seeds' dests for an app dir (`main.tsx`, `nav.tsx`, `__root.tsx`). */
|
|
47
|
+
export declare function routerSeedDests(appRel: string): string[];
|
|
48
|
+
/** Where a Start app's embedded provider goes (doctor, init and sync all say it). */
|
|
49
|
+
export declare const START_PROVIDER_HINT = "render <BasaltProvider><Outlet /></BasaltProvider> in the root route component or a pathless layout";
|
|
38
50
|
export {};
|
|
39
51
|
//# sourceMappingURL=router-wiring.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-wiring.d.ts","sourceRoot":"","sources":["../../src/cli/router-wiring.ts"],"names":[],"mappings":"AAOA,OAAO,EAA+B,QAAQ,EAAE,MAAM,eAAe,CAAA;AAuErE,oGAAoG;AACpG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAA;AAEzC;;;;GAIG;AACH,wBAAgB,OAAO,CACrB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAqBT;AAED,wHAAwH;AACxH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9C;AAID,mGAAmG;AACnG,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAErD;AAED,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAQhE;AAED,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MA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FAAmF;AACnF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAEnF;AAOD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAMpE;AAED,2GAA2G;AAC3G,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,uEAAuE;AACvE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,aAAa,GAAG,YAAY,GAAG,IAAI,CAAA;AAE1E,eAAO,MAAM,gBAAgB,8HAC2F,CAAA;AAExH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAG1E;AAED,eAAO,MAAM,eAAe,mHACiF,CAAA;AAE7G,0GAA0G;AAC1G,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAA;AAEV,qGAAqG;AACrG,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,iBAAiB,GAAG,MAAM,CAE3F;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAIxD;AAED,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,wGACuE,CAAA"}
|
|
@@ -103,9 +103,25 @@ function routerSeedSkip(cwd, appRel) {
|
|
|
103
103
|
return isCodeRoutedApp(cwd, appRel) ? "code-routed" : null;
|
|
104
104
|
}
|
|
105
105
|
const SHELL_LESS_NOTE = "`basalt.shell: false` \u2014 no main.tsx/nav.tsx/__root.tsx seeded; the app owns its root route (or has none).";
|
|
106
|
+
const ROUTER_SEED_DESTS = {
|
|
107
|
+
nav: "src/lib/nav.tsx",
|
|
108
|
+
root: "src/routes/__root.tsx",
|
|
109
|
+
main: "src/main.tsx"
|
|
110
|
+
};
|
|
111
|
+
function routerSeedDest(appRel, seed) {
|
|
112
|
+
return appRel === "" ? ROUTER_SEED_DESTS[seed] : `${appRel}/${ROUTER_SEED_DESTS[seed]}`;
|
|
113
|
+
}
|
|
114
|
+
function routerSeedDests(appRel) {
|
|
115
|
+
return Object.keys(ROUTER_SEED_DESTS).map(
|
|
116
|
+
(seed) => routerSeedDest(appRel, seed)
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
const START_PROVIDER_HINT = "render <BasaltProvider><Outlet /></BasaltProvider> in the root route component or a pathless layout";
|
|
106
120
|
export {
|
|
107
121
|
CODE_ROUTED_NOTE,
|
|
122
|
+
ROUTER_SEED_DESTS,
|
|
108
123
|
SHELL_LESS_NOTE,
|
|
124
|
+
START_PROVIDER_HINT,
|
|
109
125
|
appEntry,
|
|
110
126
|
callOf,
|
|
111
127
|
callsIn,
|
|
@@ -114,5 +130,7 @@ export {
|
|
|
114
130
|
isCodeRoutedApp,
|
|
115
131
|
isStartApp,
|
|
116
132
|
routeTreeDirs,
|
|
133
|
+
routerSeedDest,
|
|
134
|
+
routerSeedDests,
|
|
117
135
|
routerSeedSkip
|
|
118
136
|
};
|
|
@@ -9,4 +9,11 @@ export declare function tokenize(src: string): {
|
|
|
9
9
|
code: string;
|
|
10
10
|
inLiteral: (at: number) => boolean;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Strip JSONC comments and trailing commas so oxlint/tsconfig files can be READ (string-aware). A
|
|
14
|
+
* mangled string fails as a parse error, which callers treat as "cannot tell", never as a pass.
|
|
15
|
+
*/
|
|
16
|
+
export declare function stripJsonc(text: string): string;
|
|
17
|
+
/** Parse a JSONC document, or null when it does not parse at all. */
|
|
18
|
+
export declare function parseJsonc(text: string): Record<string, unknown> | null;
|
|
12
19
|
//# sourceMappingURL=source-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-text.d.ts","sourceRoot":"","sources":["../../src/cli/source-text.ts"],"names":[],"mappings":"AAOA,uGAAuG;AACvG,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMvD;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAOxD;AAID,8GAA8G;AAC9G,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAMnE;AAUD,uGAAuG;AACvG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAA;CAAE,CAe1F"}
|
|
1
|
+
{"version":3,"file":"source-text.d.ts","sourceRoot":"","sources":["../../src/cli/source-text.ts"],"names":[],"mappings":"AAOA,uGAAuG;AACvG,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMvD;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAOxD;AAID,8GAA8G;AAC9G,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAMnE;AAUD,uGAAuG;AACvG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAA;CAAE,CAe1F;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwB/C;AAED,qEAAqE;AACrE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAMvE"}
|
package/dist/cli/source-text.js
CHANGED
|
@@ -38,9 +38,43 @@ function tokenize(src) {
|
|
|
38
38
|
});
|
|
39
39
|
return { code, inLiteral: (at) => literals.some(([from, to]) => at >= from && at < to) };
|
|
40
40
|
}
|
|
41
|
+
function stripJsonc(text) {
|
|
42
|
+
let out = "";
|
|
43
|
+
let inString = false;
|
|
44
|
+
for (let i = 0; i < text.length; i++) {
|
|
45
|
+
const ch = text[i];
|
|
46
|
+
if (inString) {
|
|
47
|
+
out += ch;
|
|
48
|
+
if (ch === "\\") out += text[++i] ?? "";
|
|
49
|
+
else if (ch === '"') inString = false;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (ch === '"') inString = true;
|
|
53
|
+
else if (ch === "/" && text[i + 1] === "/") {
|
|
54
|
+
while (i < text.length && text[i] !== "\n") i++;
|
|
55
|
+
continue;
|
|
56
|
+
} else if (ch === "/" && text[i + 1] === "*") {
|
|
57
|
+
i += 2;
|
|
58
|
+
while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) i++;
|
|
59
|
+
i++;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
out += ch;
|
|
63
|
+
}
|
|
64
|
+
return out.replace(/,(\s*[}\]])/g, "$1");
|
|
65
|
+
}
|
|
66
|
+
function parseJsonc(text) {
|
|
67
|
+
try {
|
|
68
|
+
return JSON.parse(stripJsonc(text.replace(/^\uFEFF/, "")));
|
|
69
|
+
} catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
41
73
|
export {
|
|
42
74
|
hasDependency,
|
|
75
|
+
parseJsonc,
|
|
43
76
|
readIfExists,
|
|
44
77
|
readPackageJson,
|
|
78
|
+
stripJsonc,
|
|
45
79
|
tokenize
|
|
46
80
|
};
|
package/dist/cli/sync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/cli/sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/cli/sync.ts"],"names":[],"mappings":"AA+CA,gGAAgG;AAChG,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAGjE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,mGAAmG;IACnG,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1B,CAAA;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrF;AAQD;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,IAAI,GAAE,WAAgB,EAAE,aAAa,GAAE,MAAsB,GAAG,MAAM,CAiP1F"}
|
package/dist/cli/sync.js
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync } from "node:fs";
|
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { deriveSpacing } from "../tokens/core.js";
|
|
4
4
|
import { shellConfigError } from "./config.js";
|
|
5
|
+
import { carriesRouter, providerTags } from "./provider-tags.js";
|
|
5
6
|
import {
|
|
6
7
|
MANIFEST_PATH,
|
|
7
8
|
basaltPresetEntry,
|
|
@@ -16,7 +17,6 @@ import {
|
|
|
16
17
|
normalizeForLedger,
|
|
17
18
|
noteRelocation,
|
|
18
19
|
OXLINT_FILES,
|
|
19
|
-
parseJsonc,
|
|
20
20
|
placementNotices,
|
|
21
21
|
pruneRetiredManagedFiles,
|
|
22
22
|
readBasaltConfig,
|
|
@@ -34,10 +34,12 @@ import {
|
|
|
34
34
|
sha256,
|
|
35
35
|
shippedAssetPath,
|
|
36
36
|
START_APP_NOTE,
|
|
37
|
+
START_PROVIDER_HINT,
|
|
37
38
|
unitState,
|
|
38
39
|
writeFileEnsuringDir,
|
|
39
40
|
writeUnit
|
|
40
41
|
} from "./index.js";
|
|
42
|
+
import { parseJsonc } from "./source-text.js";
|
|
41
43
|
import { findManifestAbove, installRootAbove } from "./install-root.js";
|
|
42
44
|
function readOxlintPresetPlugins(pkgRoot) {
|
|
43
45
|
const plugins = parseJsonc(readSource(pkgRoot, OXLINT_FILES.preset) ?? "null")?.["plugins"];
|
|
@@ -46,6 +48,11 @@ function readOxlintPresetPlugins(pkgRoot) {
|
|
|
46
48
|
function parentInstallAdvice(cwd, parent, verb) {
|
|
47
49
|
return `This repo's install is at ${relativePosix(cwd, parent)} (${parent}) \u2014 run ${verb} there, or set BASALT_CWD to it.`;
|
|
48
50
|
}
|
|
51
|
+
const RETIRED_BECAUSE = {
|
|
52
|
+
"code-routed": "code-routed app",
|
|
53
|
+
start: "TanStack Start app",
|
|
54
|
+
"shell-less": "basalt.shell: false"
|
|
55
|
+
};
|
|
49
56
|
function sync(opts = {}, invocationCwd = process.cwd()) {
|
|
50
57
|
const syncFlags = opts.flags ?? [];
|
|
51
58
|
if (conflictingProfileFlags("sync", syncFlags)) return 1;
|
|
@@ -136,27 +143,26 @@ function sync(opts = {}, invocationCwd = process.cwd()) {
|
|
|
136
143
|
});
|
|
137
144
|
staleForCheck += pruned.removed.length + pruned.drifted.length;
|
|
138
145
|
const isTracked = (d) => manifest.files[d] !== void 0;
|
|
139
|
-
const retiredBecause = seedSkip ===
|
|
146
|
+
const retiredBecause = seedSkip === null ? null : RETIRED_BECAUSE[seedSkip];
|
|
140
147
|
const retiredSeeds = retiredBecause === null ? [] : [...skipped].filter(isTracked);
|
|
148
|
+
if (opts.check && seedSkip === "start" && retiredSeeds.length > 0) {
|
|
149
|
+
staleForCheck += retiredSeeds.length;
|
|
150
|
+
console.error(
|
|
151
|
+
`basalt-ui sync --check: ${retiredSeeds.join(", ")} still tracked in the manifest of a TanStack Start app. Fix: run \`basalt-ui sync\`.`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
141
154
|
if (retiredSeeds.length > 0 && !opts.check) {
|
|
142
155
|
for (const d of retiredSeeds) delete manifest.files[d];
|
|
143
156
|
console.error(
|
|
144
157
|
`\u26A0 basalt-ui sync: ${retiredBecause} \u2014 dropped ${retiredSeeds.join(", ")} from the manifest (any file is yours).`
|
|
145
158
|
);
|
|
146
159
|
}
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const inert = stale.filter((d) => d.endsWith("nav.tsx"));
|
|
151
|
-
const embedded = "Delete them and render <BasaltProvider><Outlet /></BasaltProvider> in the Start root route (embedded mode).";
|
|
160
|
+
const mounting = seedSkip === "start" ? [...skipped].filter(
|
|
161
|
+
(d) => providerTags(readIfExists(resolve(cwd, d)) ?? "").some(carriesRouter)
|
|
162
|
+
) : [];
|
|
152
163
|
if (mounting.length > 0) {
|
|
153
164
|
console.error(
|
|
154
|
-
`\u26A0 basalt-ui sync: ${mounting.join(", ")} mount a second router inside this TanStack Start app; left untouched. ${embedded
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
if (inert.length > 0) {
|
|
158
|
-
console.error(
|
|
159
|
-
`\u26A0 basalt-ui sync: ${inert.join(", ")} was seeded before this became a Start app; it mounts nothing, so keep or delete it. Left untouched.`
|
|
165
|
+
`\u26A0 basalt-ui sync: ${mounting.join(", ")} mount a second router inside this TanStack Start app; left untouched. Delete them and ${START_PROVIDER_HINT} (embedded mode).`
|
|
160
166
|
);
|
|
161
167
|
}
|
|
162
168
|
if (seedSkip === "start" && (!opts.check || syncFlags.includes("--verbose")))
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Command, CommandMap } from './define-commands.js';
|
|
2
|
+
/** @internal — `defineCommands` only. The last call wins; readers subscribed via {@link subscribeCommands} re-read. */
|
|
3
|
+
export declare function setActiveCommands(spec: CommandMap): void;
|
|
4
|
+
/** @internal — test isolation only. */
|
|
5
|
+
export declare function resetCommandStash(): void;
|
|
6
|
+
/** @internal — exposed to the provider and projectors.ts to iterate the runtime stash. Returns a readonly view. */
|
|
7
|
+
export declare function getActiveCommands(): Readonly<CommandMap>;
|
|
8
|
+
/** @internal — `useSyncExternalStore` subscribe for a late `defineCommands` (a lazily loaded route). */
|
|
9
|
+
export declare const subscribeCommands: (listener: () => void) => () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Runs a command, swallowing a sync throw or async rejection so a failing command never becomes an
|
|
12
|
+
* unhandled rejection (which the provider would report as a `window.error`). Dev logs it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runCommandSafely(cmd: Command): void;
|
|
15
|
+
//# sourceMappingURL=command-stash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-stash.d.ts","sourceRoot":"","sources":["../../src/commands/command-stash.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAK5D,uHAAuH;AACvH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAGxD;AAED,uCAAuC;AACvC,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED,mHAAmH;AACnH,wBAAgB,iBAAiB,IAAI,QAAQ,CAAC,UAAU,CAAC,CAExD;AAED,wGAAwG;AACxG,eAAO,MAAM,iBAAiB,sCAAkB,CAAA;AAEhD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CASnD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createNotifier } from "../provider/notifier.js";
|
|
2
|
+
let activeCommands = {};
|
|
3
|
+
const store = createNotifier();
|
|
4
|
+
function setActiveCommands(spec) {
|
|
5
|
+
activeCommands = spec;
|
|
6
|
+
store.notify();
|
|
7
|
+
}
|
|
8
|
+
function resetCommandStash() {
|
|
9
|
+
setActiveCommands({});
|
|
10
|
+
}
|
|
11
|
+
function getActiveCommands() {
|
|
12
|
+
return activeCommands;
|
|
13
|
+
}
|
|
14
|
+
const subscribeCommands = store.subscribe;
|
|
15
|
+
function runCommandSafely(cmd) {
|
|
16
|
+
const report = (error) => {
|
|
17
|
+
if (process.env.NODE_ENV !== "production") console.error("[basalt] command failed", error);
|
|
18
|
+
};
|
|
19
|
+
try {
|
|
20
|
+
Promise.resolve(cmd.run()).catch(report);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
report(error);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
getActiveCommands,
|
|
27
|
+
resetCommandStash,
|
|
28
|
+
runCommandSafely,
|
|
29
|
+
setActiveCommands,
|
|
30
|
+
subscribeCommands
|
|
31
|
+
};
|
|
@@ -94,7 +94,8 @@ export type CommandId = Extract<keyof Commands, string>;
|
|
|
94
94
|
* keys so the id union is exact after augmenting BasaltRegister.
|
|
95
95
|
*
|
|
96
96
|
* Stashes the runtime map so the provider resolves commands at runtime (type augmentation is
|
|
97
|
-
* erased; the stash is the live source)
|
|
97
|
+
* erased; the stash is the live source), and registers the provider mounts that need it: Spotlight,
|
|
98
|
+
* plus the hotkey binder when any command has a `shortcut`. Nothing else pulls those into a bundle.
|
|
98
99
|
*
|
|
99
100
|
* @example
|
|
100
101
|
* export const COMMANDS = defineCommands({
|
|
@@ -118,7 +119,5 @@ export declare function defineCommands<const T extends CommandMap>(spec: T): T;
|
|
|
118
119
|
* // Then include saveCmd in a defineCommands({ 'file:save': saveCmd }) call to register it.
|
|
119
120
|
*/
|
|
120
121
|
export declare function defineCommand(cmd: Command): Command;
|
|
121
|
-
/** @internal — exposed to the provider and projectors.ts to iterate the runtime stash. Returns a readonly view. */
|
|
122
|
-
export declare function getActiveCommands(): Readonly<CommandMap>;
|
|
123
122
|
export {};
|
|
124
123
|
//# sourceMappingURL=define-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-commands.d.ts","sourceRoot":"","sources":["../../src/commands/define-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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