@_linked/cli 1.46.2 → 1.47.1
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/CHANGELOG.md +113 -0
- package/README.md +44 -36
- package/hooks/drift.cjs +169 -0
- package/hooks/git-hook.cjs +170 -0
- package/hooks/hook-shim.cjs +63 -0
- package/hooks/lock-at-rest.cjs +268 -0
- package/hooks/manifests.cjs +216 -0
- package/hooks/platform.cjs +25 -0
- package/lib/esm/app-release/build-backend.d.ts.map +1 -1
- package/lib/esm/app-release/build-backend.js +2 -1
- package/lib/esm/app-release/build-backend.js.map +1 -1
- package/lib/esm/cli-methods.d.ts.map +1 -1
- package/lib/esm/cli-methods.js +166 -150
- package/lib/esm/cli-methods.js.map +1 -1
- package/lib/esm/cli.js +20 -22
- package/lib/esm/cli.js.map +1 -1
- package/lib/esm/commands/build-app.d.ts.map +1 -1
- package/lib/esm/commands/build-app.js +2 -1
- package/lib/esm/commands/build-app.js.map +1 -1
- package/lib/esm/commands/build-package.d.ts.map +1 -1
- package/lib/esm/commands/build-package.js +6 -2
- package/lib/esm/commands/build-package.js.map +1 -1
- package/lib/esm/commands/localize.d.ts +9 -15
- package/lib/esm/commands/localize.d.ts.map +1 -1
- package/lib/esm/commands/localize.js +43 -74
- package/lib/esm/commands/localize.js.map +1 -1
- package/lib/esm/commands/setup-publish.d.ts.map +1 -1
- package/lib/esm/commands/setup-publish.js +22 -15
- package/lib/esm/commands/setup-publish.js.map +1 -1
- package/lib/esm/commands/start.d.ts +8 -0
- package/lib/esm/commands/start.d.ts.map +1 -1
- package/lib/esm/commands/start.js +20 -8
- package/lib/esm/commands/start.js.map +1 -1
- package/lib/esm/installed-packages.d.ts +5 -13
- package/lib/esm/installed-packages.d.ts.map +1 -1
- package/lib/esm/installed-packages.js +5 -38
- package/lib/esm/installed-packages.js.map +1 -1
- package/lib/esm/lifecycle.d.ts +35 -22
- package/lib/esm/lifecycle.d.ts.map +1 -1
- package/lib/esm/lifecycle.js +62 -36
- package/lib/esm/lifecycle.js.map +1 -1
- package/lib/esm/localize/adopt.d.ts +5 -5
- package/lib/esm/localize/adopt.d.ts.map +1 -1
- package/lib/esm/localize/adopt.js +46 -55
- package/lib/esm/localize/adopt.js.map +1 -1
- package/lib/esm/localize/app-root.d.ts +16 -0
- package/lib/esm/localize/app-root.d.ts.map +1 -0
- package/lib/esm/localize/app-root.js +94 -0
- package/lib/esm/localize/app-root.js.map +1 -0
- package/lib/esm/localize/app-setup.d.ts +21 -0
- package/lib/esm/localize/app-setup.d.ts.map +1 -0
- package/lib/esm/localize/app-setup.js +178 -0
- package/lib/esm/localize/app-setup.js.map +1 -0
- package/lib/esm/localize/delocalize.d.ts.map +1 -1
- package/lib/esm/localize/delocalize.js +168 -104
- package/lib/esm/localize/delocalize.js.map +1 -1
- package/lib/esm/localize/drift-hook.d.ts +18 -0
- package/lib/esm/localize/drift-hook.d.ts.map +1 -0
- package/lib/esm/localize/drift-hook.js +37 -0
- package/lib/esm/localize/drift-hook.js.map +1 -0
- package/lib/esm/localize/drift.d.ts +36 -0
- package/lib/esm/localize/drift.d.ts.map +1 -0
- package/lib/esm/localize/drift.js +34 -0
- package/lib/esm/localize/drift.js.map +1 -0
- package/lib/esm/localize/errors.d.ts +14 -8
- package/lib/esm/localize/errors.d.ts.map +1 -1
- package/lib/esm/localize/errors.js +14 -8
- package/lib/esm/localize/errors.js.map +1 -1
- package/lib/esm/localize/fsops.d.ts +11 -27
- package/lib/esm/localize/fsops.d.ts.map +1 -1
- package/lib/esm/localize/fsops.js +40 -115
- package/lib/esm/localize/fsops.js.map +1 -1
- package/lib/esm/localize/git-hooks.d.ts +33 -0
- package/lib/esm/localize/git-hooks.d.ts.map +1 -0
- package/lib/esm/localize/git-hooks.js +146 -0
- package/lib/esm/localize/git-hooks.js.map +1 -0
- package/lib/esm/localize/hook-module.d.ts +6 -0
- package/lib/esm/localize/hook-module.d.ts.map +1 -0
- package/lib/esm/localize/hook-module.js +37 -0
- package/lib/esm/localize/hook-module.js.map +1 -0
- package/lib/esm/localize/index.d.ts +14 -15
- package/lib/esm/localize/index.d.ts.map +1 -1
- package/lib/esm/localize/index.js +8 -9
- package/lib/esm/localize/index.js.map +1 -1
- package/lib/esm/localize/list.d.ts +6 -10
- package/lib/esm/localize/list.d.ts.map +1 -1
- package/lib/esm/localize/list.js +48 -189
- package/lib/esm/localize/list.js.map +1 -1
- package/lib/esm/localize/localize.d.ts +41 -62
- package/lib/esm/localize/localize.d.ts.map +1 -1
- package/lib/esm/localize/localize.js +398 -285
- package/lib/esm/localize/localize.js.map +1 -1
- package/lib/esm/localize/members.d.ts +13 -0
- package/lib/esm/localize/members.d.ts.map +1 -0
- package/lib/esm/localize/members.js +46 -0
- package/lib/esm/localize/members.js.map +1 -0
- package/lib/esm/localize/resolve.d.ts +1 -2
- package/lib/esm/localize/resolve.d.ts.map +1 -1
- package/lib/esm/localize/resolve.js +3 -5
- package/lib/esm/localize/resolve.js.map +1 -1
- package/lib/esm/localize/run.d.ts +1 -0
- package/lib/esm/localize/run.d.ts.map +1 -1
- package/lib/esm/localize/run.js +11 -6
- package/lib/esm/localize/run.js.map +1 -1
- package/lib/esm/localize/setup-lockfile.d.ts +13 -0
- package/lib/esm/localize/setup-lockfile.d.ts.map +1 -0
- package/lib/esm/localize/setup-lockfile.js +80 -0
- package/lib/esm/localize/setup-lockfile.js.map +1 -0
- package/lib/esm/utils/createPackageLocation.d.ts +4 -13
- package/lib/esm/utils/createPackageLocation.d.ts.map +1 -1
- package/lib/esm/utils/createPackageLocation.js +12 -21
- package/lib/esm/utils/createPackageLocation.js.map +1 -1
- package/lib/esm/utils/packageSetup.d.ts +5 -2
- package/lib/esm/utils/packageSetup.d.ts.map +1 -1
- package/lib/esm/utils/packageSetup.js +9 -3
- package/lib/esm/utils/packageSetup.js.map +1 -1
- package/lib/esm/utils/platform.d.ts +24 -0
- package/lib/esm/utils/platform.d.ts.map +1 -0
- package/lib/esm/utils/platform.js +62 -0
- package/lib/esm/utils/platform.js.map +1 -0
- package/lib/esm/utils/shapeReferences.d.ts.map +1 -1
- package/lib/esm/utils/shapeReferences.js +3 -2
- package/lib/esm/utils/shapeReferences.js.map +1 -1
- package/lib/esm/utils/spawn.d.ts +65 -0
- package/lib/esm/utils/spawn.d.ts.map +1 -0
- package/lib/esm/utils/spawn.js +181 -0
- package/lib/esm/utils/spawn.js.map +1 -0
- package/lib/esm/utils.d.ts.map +1 -1
- package/lib/esm/utils.js +19 -5
- package/lib/esm/utils.js.map +1 -1
- package/lib/esm/vite-config.d.ts +5 -12
- package/lib/esm/vite-config.d.ts.map +1 -1
- package/lib/esm/vite-config.js +41 -33
- package/lib/esm/vite-config.js.map +1 -1
- package/package.json +4 -3
- package/lib/esm/localize/ensure.d.ts +0 -44
- package/lib/esm/localize/ensure.d.ts.map +0 -1
- package/lib/esm/localize/ensure.js +0 -151
- package/lib/esm/localize/ensure.js.map +0 -1
- package/lib/esm/localize/manifest.d.ts +0 -63
- package/lib/esm/localize/manifest.d.ts.map +0 -1
- package/lib/esm/localize/manifest.js +0 -133
- package/lib/esm/localize/manifest.js.map +0 -1
- package/lib/esm/localize/one-copy-hook.d.ts +0 -16
- package/lib/esm/localize/one-copy-hook.d.ts.map +0 -1
- package/lib/esm/localize/one-copy-hook.js +0 -20
- package/lib/esm/localize/one-copy-hook.js.map +0 -1
- package/lib/esm/localize/provided.d.ts +0 -28
- package/lib/esm/localize/provided.d.ts.map +0 -1
- package/lib/esm/localize/provided.js +0 -89
- package/lib/esm/localize/provided.js.map +0 -1
- package/lib/esm/localize/prune.d.ts +0 -182
- package/lib/esm/localize/prune.d.ts.map +0 -1
- package/lib/esm/localize/prune.js +0 -703
- package/lib/esm/localize/prune.js.map +0 -1
- package/lib/esm/localize/relink.d.ts +0 -13
- package/lib/esm/localize/relink.d.ts.map +0 -1
- package/lib/esm/localize/relink.js +0 -181
- package/lib/esm/localize/relink.js.map +0 -1
- package/lib/esm/localized-dedupe.d.ts +0 -26
- package/lib/esm/localized-dedupe.d.ts.map +0 -1
- package/lib/esm/localized-dedupe.js +0 -139
- package/lib/esm/localized-dedupe.js.map +0 -1
- package/lib/esm/utils/relinkHooks.d.ts +0 -19
- package/lib/esm/utils/relinkHooks.d.ts.map +0 -1
- package/lib/esm/utils/relinkHooks.js +0 -74
- package/lib/esm/utils/relinkHooks.js.map +0 -1
package/lib/esm/vite-config.js
CHANGED
|
@@ -29,7 +29,6 @@ import { generateScopedName } from './utils.js';
|
|
|
29
29
|
import { generateScopedNameProduction } from './css-module-names.js';
|
|
30
30
|
import { parseWorkspacePatterns, isWorkspacePathNegated } from './workspace-globs.js';
|
|
31
31
|
import { pinCompiledClassNames } from './plugins/pin-compiled-class-names.js';
|
|
32
|
-
import { describeSkipped, localizedDedupe } from './localized-dedupe.js';
|
|
33
32
|
import { discoverInstalledLinkedPackages, isLinkedPackageJson, readInstalledPkg, } from './installed-packages.js';
|
|
34
33
|
import { linkedClientDepIncludesPlugin, resolveExportsSubpath, } from './client-dep-includes.js';
|
|
35
34
|
/** Default dev server port, and Vite's default HMR websocket port. */
|
|
@@ -310,10 +309,11 @@ function readSourcePackage(root) {
|
|
|
310
309
|
* ones that ship `src/`.
|
|
311
310
|
*
|
|
312
311
|
* A dep ships `src/` when it is a symlinked workspace clone, a `link:`/`portal:`
|
|
313
|
-
* dev install, or a LOCALIZED checkout (`packages-local/<pkg>`, in
|
|
314
|
-
*
|
|
315
|
-
* per-branch clone under /apps) resolve a
|
|
316
|
-
* extension probing, instead of falling
|
|
312
|
+
* dev install, or a LOCALIZED checkout (`packages-local/<pkg>`, in an app
|
|
313
|
+
* not set up for localizing yet). That's what lets a STANDALONE app (not
|
|
314
|
+
* itself a workspace root — e.g. a per-branch clone under /apps) resolve a
|
|
315
|
+
* linked package's `.tsx` sources with extension probing, instead of falling
|
|
316
|
+
* through to the package's
|
|
317
317
|
* `development → ./src/*.ts` export (which misses `.tsx` like LinkedServer). A
|
|
318
318
|
* prod/ejected app installs PUBLISHED packages (no `src/`) → not registered,
|
|
319
319
|
* resolved via each package's `lib`.
|
|
@@ -335,8 +335,8 @@ export function discoverLinkedSourceDependencies() {
|
|
|
335
335
|
return __awaiter(this, arguments, void 0, function* (cwd = process.cwd()) {
|
|
336
336
|
const out = [];
|
|
337
337
|
const seen = new Set();
|
|
338
|
-
// The walk
|
|
339
|
-
//
|
|
338
|
+
// The walk is breadth-first and keyed on the installed directory; see
|
|
339
|
+
// discoverInstalledLinkedPackages.
|
|
340
340
|
for (const pkg of yield discoverInstalledLinkedPackages(cwd)) {
|
|
341
341
|
const entry = yield readSourcePackage(pkg.realRoot);
|
|
342
342
|
if (entry && !seen.has(entry.name)) {
|
|
@@ -408,9 +408,10 @@ export function discoverWorkspaces() {
|
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
|
-
// 2. Linked deps installed as source — including a localized checkout
|
|
412
|
-
//
|
|
413
|
-
//
|
|
411
|
+
// 2. Linked deps installed as source — including a localized checkout in an
|
|
412
|
+
// app whose globs do not cover `packages-local/*` yet. Shared with the
|
|
413
|
+
// `linked start` watch set; see discoverLinkedSourceDependencies above.
|
|
414
|
+
// Glob entries win on a name clash.
|
|
414
415
|
for (const entry of yield discoverLinkedSourceDependencies(cwd)) {
|
|
415
416
|
if (seen.has(entry.name))
|
|
416
417
|
continue;
|
|
@@ -553,13 +554,23 @@ export function ssrNoExternal(workspaces, dependents = []) {
|
|
|
553
554
|
*/
|
|
554
555
|
const STANDALONE_DEDUPE = ['@_linked/server-utils', '@_linked/react'];
|
|
555
556
|
/**
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
* dedupes only React.
|
|
557
|
+
* Deduped in every mode when the app has them installed: one React for the
|
|
558
|
+
* whole tree, whoever imports it. A workspace member's own `react` (an older
|
|
559
|
+
* checkout, a package with a stale lockfile) would otherwise give hooks a
|
|
560
|
+
* second dispatcher.
|
|
561
561
|
*/
|
|
562
|
-
|
|
562
|
+
const REACT_DEDUPE = ['react', 'react-dom'];
|
|
563
|
+
/** `resolve.dedupe`: the standalone pair when standalone, then React where the app has it. */
|
|
564
|
+
function dedupeFor(appRoot, isStandalone) {
|
|
565
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
566
|
+
const react = [];
|
|
567
|
+
for (const name of REACT_DEDUPE) {
|
|
568
|
+
if (yield readInstalledPkg(name, appRoot))
|
|
569
|
+
react.push(name);
|
|
570
|
+
}
|
|
571
|
+
return [...(isStandalone ? STANDALONE_DEDUPE : []), ...react];
|
|
572
|
+
});
|
|
573
|
+
}
|
|
563
574
|
/**
|
|
564
575
|
* The `process.env.*` values inlined into the browser bundle — and only there.
|
|
565
576
|
* See the `environments.client.define` note in `createViteConfig` for why the
|
|
@@ -587,12 +598,6 @@ export function createViteConfig(opts = {}) {
|
|
|
587
598
|
// (CN monorepo or its workspace-member clones) this is false and none
|
|
588
599
|
// of the standalone-gated branches below apply.
|
|
589
600
|
const isStandalone = isDev && workspaces.length === 0;
|
|
590
|
-
const dedupe = yield localizedDedupe(process.cwd());
|
|
591
|
-
if (isDev) {
|
|
592
|
-
const skippedLine = describeSkipped(dedupe.skipped);
|
|
593
|
-
if (skippedLine)
|
|
594
|
-
console.warn(skippedLine);
|
|
595
|
-
}
|
|
596
601
|
// The app's published framework deps — excluded from Vite's dep-optimizer below
|
|
597
602
|
// (`optimizeDeps.exclude`) so the browser's native ESM graph loads ONE copy of each.
|
|
598
603
|
// Without the exclude, esbuild inlines a duplicate `@_linked/core` into each
|
|
@@ -670,9 +675,10 @@ export function createViteConfig(opts = {}) {
|
|
|
670
675
|
return null;
|
|
671
676
|
// Workspace-internal `./Sibling.js` → `.tsx` / `.ts` rewrite.
|
|
672
677
|
if (importer &&
|
|
673
|
-
|
|
678
|
+
// Vite's ids use `/`, on Windows too.
|
|
679
|
+
/[\\/]packages[\\/]/.test(importer) &&
|
|
674
680
|
/\.(jsx?)$/.test(id) &&
|
|
675
|
-
(id.startsWith('.') ||
|
|
681
|
+
(id.startsWith('.') || path.isAbsolute(id))) {
|
|
676
682
|
const importerDir = path.dirname(importer);
|
|
677
683
|
const base = path.resolve(importerDir, id);
|
|
678
684
|
for (const ext of ['.tsx', '.ts']) {
|
|
@@ -683,7 +689,7 @@ export function createViteConfig(opts = {}) {
|
|
|
683
689
|
}
|
|
684
690
|
// Bare workspace specifier — resolve directly to src/.
|
|
685
691
|
if (!id.startsWith('.') &&
|
|
686
|
-
!
|
|
692
|
+
!path.isAbsolute(id) &&
|
|
687
693
|
workspaces.length > 0) {
|
|
688
694
|
const resolved = yield resolveWorkspaceSpecifier(id, workspaces);
|
|
689
695
|
if (resolved)
|
|
@@ -786,14 +792,16 @@ export function createViteConfig(opts = {}) {
|
|
|
786
792
|
// conditions at Vite's defaults there (undefined = untouched), keeping
|
|
787
793
|
// CN dev byte-for-byte unchanged.
|
|
788
794
|
//
|
|
789
|
-
// DEDUPE,
|
|
790
|
-
//
|
|
791
|
-
//
|
|
792
|
-
//
|
|
793
|
-
//
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
795
|
+
// DEDUPE, standalone only: its two context-holding packages, even when
|
|
796
|
+
// they are not found on disk, so the two `ssrLoadModule` loads
|
|
797
|
+
// (LinkedServer + the app graph) resolve to ONE `server-utils`/`react`
|
|
798
|
+
// instance — otherwise their `AppContext` objects differ and
|
|
799
|
+
// `useAppContext()` returns null. Pairs with `ssr.noExternal` below.
|
|
800
|
+
// Every mode also dedupes `react` and `react-dom` when the app has them
|
|
801
|
+
// (`dedupeFor`). Localized checkouts need nothing more: they are
|
|
802
|
+
// workspace members (`packages-local/*`), so npm links and dedupes them
|
|
803
|
+
// like any other.
|
|
804
|
+
resolve: Object.assign(Object.assign({}, (isStandalone ? { conditions: ['module', 'node'] } : {})), { dedupe: yield dedupeFor(process.cwd(), isStandalone) }),
|
|
797
805
|
// `ssr.external` is a minimal allowlist of
|
|
798
806
|
// npm deps that genuinely can't (or shouldn't) go through Vite's
|
|
799
807
|
// SSR transform. Workspace packages (`@_linked/*`, `lincd-*`) are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-config.js","sourceRoot":"","sources":["../../src/vite-config.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,oEAAoE;AACpE,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,wDAAwD;AACxD,wEAAwE;AACxE,EAAE;AACF,mEAAmE;AACnE,qEAAqE;AACrE,uEAAuE;AACvE,+EAA+E;AAC/E,kEAAkE;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,4BAA4B,EAAC,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAC,qBAAqB,EAAC,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAC,eAAe,EAAE,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAGlC,sEAAsE;AACtE,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,iFAAiF;AACjF,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B;;;;;;;;;;;;;;;GAeG;AACH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAU,EAAsB,EAAE;IACjE,IAAI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AAC,EAAC;YAC1D,CAAC,CAAC,YAAY,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;gBACrC,CAAC,CAAC,EAAC,YAAY,EAAE,EAAC,OAAO,EAAE,UAAU,EAAC,EAAC;gBACvC,CAAC,CAAC,EAAE,CAAC,CACV,CAAC;QAEF,sEAAsE;QACtE,IAAI,IAAI,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YAChC,gEAAgE;YAChE,iEAAiE;YACjE,gEAAgE;YAChE,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAQ,MAAM,MAAM,CAAC,mBAA0B,CAAC,CAAC;gBAC/D,MAAM,cAAc,GAAG,MAAA,QAAQ,CAAC,OAAO,mCAAI,QAAQ,CAAC;gBACnD,MAAM,CAAC,OAAoB,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;YACtD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,CAAC,IAAI,CACV,4DAA4D;oBAC1D,gEAAgE;oBAChE,sDAAsD,CACzD,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAA,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Vite config helper for linked apps. The one dev + build pipeline.\n//\n// Apps use this from their own vite.config.ts:\n//\n// import {createViteConfig} from '@_linked/cli/vite';\n// export default createViteConfig({port: 4040, cssMode: 'tailwind'});\n//\n// The helper preserves the dev-mode `generateScopedName` (readable\n// `_packageName_filename_className`) so CSS module class names match\n// what the previous bundler chain produced for trace/debug. Production\n// uses `generateScopedNameProduction`, which the Node CSS loader shares so the\n// server renders the class names the client's stylesheet defines.\nimport {defineConfig} from 'vite';\nimport react from '@vitejs/plugin-react';\nimport fsExtra from 'fs-extra';\nimport path from 'node:path';\nimport {generateScopedName} from './utils.js';\nimport {generateScopedNameProduction} from './css-module-names.js';\nimport {parseWorkspacePatterns, isWorkspacePathNegated} from './workspace-globs.js';\nimport {pinCompiledClassNames} from './plugins/pin-compiled-class-names.js';\nimport {describeSkipped, localizedDedupe} from './localized-dedupe.js';\nimport {\n discoverInstalledLinkedPackages,\n isLinkedPackageJson,\n readInstalledPkg,\n} from './installed-packages.js';\nimport {\n linkedClientDepIncludesPlugin,\n resolveExportsSubpath,\n} from './client-dep-includes.js';\nimport type {Plugin, UserConfig} from 'vite';\n\n/** Default dev server port, and Vite's default HMR websocket port. */\nconst DEFAULT_DEV_PORT = 4040;\nconst DEFAULT_HMR_PORT = 24678;\n/** Vite may not bind below 1024 without privileges; 65535 is the TCP ceiling. */\nconst MIN_HMR_PORT = 1024;\nconst MAX_HMR_PORT = 65535;\n\n/**\n * Derive an app's HMR websocket port from its dev port.\n *\n * Every `createViteConfig` app used to fall back to Vite's shared default\n * 24678, so any two dev servers running at once collided (\"Port 24678 is\n * already in use\") and HMR silently broke for the loser. Offsetting the HMR\n * port by the same amount the dev port is offset from its default keeps the\n * derivation trivial and means apps that already run on distinct dev ports get\n * distinct HMR ports for free.\n *\n * The input is untrusted (`process.env.PORT` is an arbitrary string), so\n * anything that is not a whole port number — `PORT=abc` yielding `NaN`, a\n * negative or out-of-range value — falls back to the dev port default. The\n * result is then clamped into the bindable range, since a far-out dev port\n * would otherwise derive an HMR port past 65535.\n */\n/**\n * Which manual chunk a module belongs in.\n *\n * Split large/common deps so route chunks don't all carry their own copy AND\n * the main entry doesn't end up at 5MB+. Each chunk becomes its own\n * `assets/<name>-<hash>.js` the browser caches independently — incremental\n * dev builds and cache wins on prod deploys both improve.\n *\n * Exported so the grouping can be asserted directly: getting it wrong does not\n * fail the build, it produces a bundle that throws on load in the browser.\n */\nexport const chunkForModuleId = (id: string): string | undefined => {\n if (!id.includes('node_modules')) {\n // Linked workspaces ship as @_linked/* / lincd-* — group all\n // linked-framework code into a single chunk.\n if (\n id.includes('/packages/core/') ||\n id.includes('/packages/react/') ||\n id.includes('/packages/server-utils/') ||\n id.includes('/packages/primitives/') ||\n id.includes('/packages/css/') ||\n /\\/packages\\/(auth|org|schema|fuseki|owl|xsd|dcat|dcmi|s3|sentry|ui)\\//.test(id)\n ) {\n return 'linked';\n }\n return undefined;\n }\n // Framework code installed from the registry rather than resolved to a\n // workspace. An app can hold both at once — a published `@_linked/server`\n // in node_modules next to workspace `@_linked/core` — and the two import\n // each other. Split across `linked` and `vendor` that is a cycle, and\n // Rollup's chosen order left a binding in its temporal dead zone:\n // `Cannot access 'Wo' before initialization` before the app rendered.\n // Same chunk, no cycle.\n if (/[\\\\/]node_modules[\\\\/](@_linked[\\\\/]|lincd-)/.test(id)) {\n return 'linked';\n }\n // React + React-DOM in their own chunk — every route uses them.\n //\n // react-router and @remix-run/router belong here too. Left in `vendor` they\n // made the two chunks import each other: react-router-dom re-exports\n // react-router, so react-vendor imported vendor, while vendor's own\n // top-level `React.createContext(...)` calls imported react-vendor. Rollup\n // has to pick an order for a cycle, and it ran vendor first — every\n // production build died on load with \"Cannot read properties of undefined\n // (reading 'createContext')\".\n if (\n /[\\\\/]node_modules[\\\\/](react|react-dom|react-router-dom|react-router|@remix-run[\\\\/]router|scheduler)[\\\\/]/.test(\n id\n )\n ) {\n return 'react-vendor';\n }\n // Heavy editor deps — only loaded on pages that need them, but worth\n // isolating so they don't get pulled into main.\n if (/[\\\\/]node_modules[\\\\/]@monaco-editor[\\\\/]/.test(id)) {\n return 'monaco';\n }\n // Charting/visualization\n if (/[\\\\/]node_modules[\\\\/](recharts|react-flow|@xyflow|d3-)[\\\\/]/.test(id)) {\n return 'viz';\n }\n // Animation\n if (/[\\\\/]node_modules[\\\\/]framer-motion[\\\\/]/.test(id)) {\n return 'motion';\n }\n // Catch-all for other node_modules in a vendor chunk\n return 'vendor';\n};\n\nexport function hmrPortFor(devPort: unknown): number {\n const parsed = Number(devPort);\n const validDevPort =\n Number.isFinite(parsed) && Number.isInteger(parsed) && parsed >= 1 && parsed <= 65535\n ? parsed\n : DEFAULT_DEV_PORT;\n const derived = DEFAULT_HMR_PORT + (validDevPort - DEFAULT_DEV_PORT);\n return Math.min(MAX_HMR_PORT, Math.max(MIN_HMR_PORT, derived));\n}\n\n/** How far past the derived port `resolveHmrPort` looks for a free one. */\nconst HMR_PORT_SEARCH_RANGE = 100;\n\n/**\n * Whether `port` can be listened on the way Vite's HMR websocket server\n * listens: every interface, since `createViteConfig` sets no `hmr.host`.\n */\nexport function isPortFree(port: number, host?: string): Promise<boolean> {\n return import('node:net').then(\n (net) =>\n new Promise<boolean>((resolve) => {\n const probe = net.createServer();\n probe.unref();\n probe.once('error', () => resolve(false));\n probe.listen({port, host, exclusive: true}, () => probe.close(() => resolve(true)));\n }),\n );\n}\n\n/**\n * Ports this process already chose, by derived port. Vite re-evaluates the\n * config when it restarts the server (a vite.config edit), and it does so while\n * the old server still holds the port — probing again would see our own socket\n * and move to the next port on every restart.\n */\nconst chosenHmrPorts: Map<number, number> = ((globalThis as any)[Symbol.for('@_linked/cli.hmrPorts')] ??=\n new Map<number, number>());\n\nexport interface ResolveHmrPortOptions {\n /** The dev port the HMR port is derived from (`process.env.PORT ?? opts.port`). */\n devPort: unknown;\n env?: NodeJS.ProcessEnv;\n isFree?: (port: number) => Promise<boolean>;\n log?: (message: string) => void;\n}\n\n/**\n * The HMR websocket port for this dev server.\n *\n * `LINKED_HMR_PORT` wins outright. Otherwise the port derived from the dev port\n * (`hmrPortFor`) is used if it is free, and the next free port above it if it\n * is not: the derivation keeps apps on distinct dev ports apart, but not an app\n * from an unrelated process (or a second checkout of the same app) that already\n * holds the derived port. Vite injects the configured `hmr.port` into the\n * client it serves, so the browser connects to whichever port was chosen.\n *\n * If nothing in range is free the derived port is returned and Vite reports the\n * conflict, as it did before.\n */\nexport async function resolveHmrPort({\n devPort,\n env = process.env,\n isFree = isPortFree,\n log = (m) => console.log(m),\n}: ResolveHmrPortOptions): Promise<number> {\n const override = env.LINKED_HMR_PORT;\n if (override !== undefined && override.trim() !== '') {\n const port = Number(override);\n if (Number.isInteger(port) && port >= 1 && port <= MAX_HMR_PORT) return port;\n log(`[linked] ignoring LINKED_HMR_PORT=${override}: not a port number`);\n }\n const derived = hmrPortFor(devPort);\n const remembered = chosenHmrPorts.get(derived);\n if (remembered !== undefined) return remembered;\n for (let port = derived; port <= Math.min(MAX_HMR_PORT, derived + HMR_PORT_SEARCH_RANGE); port++) {\n if (await isFree(port)) {\n chosenHmrPorts.set(derived, port);\n if (port !== derived) {\n log(`[linked] HMR port ${derived} is in use; using ${port} (set LINKED_HMR_PORT to choose one)`);\n }\n return port;\n }\n }\n return derived;\n}\n\nexport interface LinkedViteConfigOptions {\n /** Dev server port. Default 4040. */\n port?: number;\n /** Output dir for `vite build`. Default `public/bundles`. */\n outDir?: string;\n /** CSS pipeline mode. */\n cssMode?: 'tailwind' | 'css-modules-only';\n /** Entry file for the client bundle. Default `src/index.tsx`. */\n entry?: string;\n /** Extra Vite plugins. */\n plugins?: Plugin[];\n /** Extra PostCSS plugins (e.g. `postcss-media-to-container`). */\n postcssPlugins?: unknown[];\n /**\n * Extra `define` entries for the CLIENT environment only (used to bridge\n * `process.env.X` refs into the browser). Never applied server-side.\n */\n define?: Record<string, string>;\n /**\n * Extra workspace globs (trailing `/*`, or a direct package dir) resolved\n * RELATIVE TO the app's cwd, in ADDITION to the app's own `workspaces` field.\n *\n * For apps whose linked-package sources live OUTSIDE their own workspace tree\n * — e.g. an app consumes `packages/lincd.org/modules/*`, which sit one level\n * up (`../lincd.org/modules/*`) when the app runs inside the CN monorepo, and under\n * `packages/lincd.org/modules/*` when the app runs from its own root. Pass BOTH\n * candidate layouts; only globs whose parent dir actually exists are scanned,\n * so the same config works in either checkout. Each glob's packages are\n * registered as source workspaces (resolved to `src/` for HMR + single-instance),\n * exactly like the app's own `workspaces` field.\n */\n workspaceGlobs?: string[];\n /**\n * Add the third-party client dependencies of the excluded framework packages\n * to `optimizeDeps.include` in dev (see ./client-dep-includes.ts). Default on;\n * `false` (or `LINKED_CLIENT_DEP_INCLUDES=0`) turns it off, and `deny` keeps\n * entries out — matched against the entry (`'@_linked/primitives > vaul'`),\n * the specifier (`'vaul'`) or the package name. Run with `DEBUG=linked` to see\n * what was added.\n */\n clientDepIncludes?: boolean | {deny?: (string | RegExp)[]};\n}\n\nexport interface WorkspaceEntry {\n name: string;\n srcDir: string;\n}\n\n/**\n * Names of installed packages that depend, directly or transitively (via\n * `dependencies` / `peerDependencies`), on a discovered source workspace. Such a\n * package must also go through Vite SSR: if Node loaded it natively, it would\n * import its own Node-loaded copy of the workspace (e.g. published\n * `@_linked/fuseki` importing a workspace `@_linked/core`), splitting module\n * state. Vite rewrites the dynamic `import()` in code it transforms, so bundling\n * the dependents keeps one instance.\n *\n * Only the dependency closure of the app's `package.json` (dependencies +\n * devDependencies) and of the workspaces themselves is scanned. Packages are\n * resolved Node-style, keyed by real path, and unresolvable ones are ignored.\n * Workspace names are not included in the result.\n */\nexport async function workspaceDependents(\n workspaces: {name: string; srcDir?: string}[],\n cwd: string = process.cwd(),\n): Promise<string[]> {\n if (workspaces.length === 0) return [];\n const fs = await import('node:fs/promises');\n const wsNames = new Set(workspaces.map((w) => w.name));\n // realRoot -> {name, deps (realRoots)}\n const nodes = new Map<string, {name: string; deps: Set<string>}>();\n const realpath = async (p: string): Promise<string> => {\n try {\n return await fs.realpath(p);\n } catch {\n return path.resolve(p);\n }\n };\n\n const visit = async (root: string, json: any): Promise<string> => {\n const real = await realpath(root);\n if (nodes.has(real)) return real;\n const node = {name: json.name as string, deps: new Set<string>()};\n nodes.set(real, node);\n const names = new Set([\n ...Object.keys(json.dependencies ?? {}),\n ...Object.keys(json.peerDependencies ?? {}),\n ]);\n for (const dep of names) {\n const resolved = await readInstalledPkg(dep, real);\n if (resolved) node.deps.add(await visit(resolved.root, resolved.json));\n }\n return real;\n };\n\n // Seed: the app's direct deps, plus each workspace package's own deps.\n try {\n const appPkg = await fsExtra.readJson(path.join(cwd, 'package.json'));\n for (const dep of Object.keys({...appPkg.dependencies, ...appPkg.devDependencies})) {\n const resolved = await readInstalledPkg(dep, cwd);\n if (resolved) await visit(resolved.root, resolved.json);\n }\n } catch {}\n for (const ws of workspaces) {\n if (!ws.srcDir) continue;\n const root = path.dirname(ws.srcDir);\n try {\n await visit(root, await fsExtra.readJson(path.join(root, 'package.json')));\n } catch {}\n }\n\n // Walk reverse edges from every workspace node: everything reached depends on one.\n const dependentsOf = new Map<string, string[]>();\n for (const [key, node] of nodes) {\n for (const dep of node.deps) {\n if (!dependentsOf.has(dep)) dependentsOf.set(dep, []);\n dependentsOf.get(dep)!.push(key);\n }\n }\n const queue = [...nodes].filter(([, n]) => wsNames.has(n.name)).map(([k]) => k);\n const marked = new Set(queue);\n while (queue.length) {\n for (const parent of dependentsOf.get(queue.pop()!) ?? []) {\n if (!marked.has(parent)) {\n marked.add(parent);\n queue.push(parent);\n }\n }\n }\n const out = new Set<string>();\n for (const key of marked) {\n const name = nodes.get(key)!.name;\n if (name && !wsNames.has(name)) out.add(name);\n }\n return [...out].sort();\n}\n\n/**\n * Read a package root as a SOURCE install: `{name, srcDir}` iff it has a\n * package.json with a name and ships a `src/` dir. Published packages have only\n * `lib/` and are skipped — they resolve via their exports.\n */\nasync function readSourcePackage(root: string): Promise<WorkspaceEntry | null> {\n const pkgPath = path.join(root, 'package.json');\n if (!(await fsExtra.pathExists(pkgPath))) return null;\n const srcDir = path.join(root, 'src');\n if (!(await fsExtra.pathExists(srcDir))) return null;\n try {\n const json = await fsExtra.readJson(pkgPath);\n return json.name ? {name: json.name, srcDir} : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Linked packages installed as SOURCE, found by walking the app's\n * `dependencies` + `devDependencies` (and recursing through the `dependencies`\n * of each linked package found), keeping those marked `\"linkedPackage\": true`\n * — the same marker the CLI keys on (see cli-methods.ts) — and registering the\n * ones that ship `src/`.\n *\n * A dep ships `src/` when it is a symlinked workspace clone, a `link:`/`portal:`\n * dev install, or a LOCALIZED checkout (`packages-local/<pkg>`, in no workspace\n * glob). That's what lets a STANDALONE app (not itself a workspace root — e.g. a\n * per-branch clone under /apps) resolve a linked package's `.tsx` sources with\n * extension probing, instead of falling through to the package's\n * `development → ./src/*.ts` export (which misses `.tsx` like LinkedServer). A\n * prod/ejected app installs PUBLISHED packages (no `src/`) → not registered,\n * resolved via each package's `lib`.\n *\n * The marker — NOT the npm scope — drives discovery, so a user's own\n * custom-scope published linked package (e.g. `@acme/foo` with\n * `linkedPackage:true`) is picked up too, and linked packages present in\n * node_modules but not depended upon are ignored.\n *\n * Every root is REALPATHED before it is registered: `readInstalledPkg` returns\n * the `node_modules/<name>` symlink spelling, and Vite's resolver realpaths\n * every id it produces, so registering the symlink would give one file two\n * module ids — two instances of the same module.\n *\n * Shared by the Vite resolver table (`discoverWorkspaces`) and the `linked start`\n * HMR watch set, so the two cannot disagree about what is source.\n */\nexport async function discoverLinkedSourceDependencies(\n cwd: string = process.cwd(),\n): Promise<WorkspaceEntry[]> {\n const out: WorkspaceEntry[] = [];\n const seen = new Set<string>();\n // The walk (breadth-first, keyed on the installed directory) is shared with\n // `resolve.dedupe` and `linked localize`; see discoverInstalledLinkedPackages.\n for (const pkg of await discoverInstalledLinkedPackages(cwd)) {\n const entry = await readSourcePackage(pkg.realRoot);\n if (entry && !seen.has(entry.name)) {\n seen.add(entry.name);\n out.push(entry);\n }\n }\n return out;\n}\n\n/**\n * Walk the app's package.json `workspaces` field to build a lookup table\n * from npm name → absolute src/ directory. Used by the resolver plugin\n * to map bare specifiers like `@_linked/foo/bar` directly to source.\n *\n * Positive patterns are expanded by directory listing, so only a trailing `/*`\n * is honoured. NEGATED patterns (`\"!packages/core\"`) are honoured in full, with\n * npm's semantics — see ./workspace-globs.js. Skipping them would resolve a\n * package to an excluded directory that the package manager never installed\n * dependencies for.\n */\nexport async function discoverWorkspaces(\n extraGlobs: string[] = [],\n cwd: string = process.cwd(),\n): Promise<WorkspaceEntry[]> {\n const fs = await import('node:fs/promises');\n const out: WorkspaceEntry[] = [];\n const seen = new Set<string>();\n // Register a package root iff it ships a `src/` dir (source install).\n const addFromRoot = async (root: string): Promise<void> => {\n const entry = await readSourcePackage(root);\n if (!entry || seen.has(entry.name)) return;\n seen.add(entry.name);\n out.push(entry);\n };\n\n // 1. The app's own `workspaces` globs — the monorepo-root case (CN, or any app\n // that is itself a workspace root). Only trailing `/*` patterns.\n const pkgPath = path.join(cwd, 'package.json');\n if (await fsExtra.pathExists(pkgPath)) {\n const pkg = await fsExtra.readJson(pkgPath);\n // Merge the app's own `workspaces` globs with any caller-supplied\n // `workspaceGlobs` (e.g. `../lincd.org/modules/*`). Non-existent parents\n // are skipped below, so passing both nested + standalone layouts is safe.\n // Either list may carry negations, so they are parsed together.\n const {patterns, negatedPatterns} = parseWorkspacePatterns([\n ...(Array.isArray(pkg.workspaces) ? pkg.workspaces : pkg.workspaces?.packages ?? []),\n ...extraGlobs,\n ]);\n const addUnlessNegated = async (root: string): Promise<void> => {\n const rel = path.relative(cwd, root).split(path.sep).join('/');\n if (isWorkspacePathNegated(rel, negatedPatterns)) return;\n await addFromRoot(root);\n };\n for (const pattern of patterns) {\n const m = pattern.match(/^(.+?)\\/\\*$/);\n if (m) {\n const parent = path.join(cwd, m[1]);\n if (await fsExtra.pathExists(parent)) {\n for (const ent of await fs.readdir(parent, {withFileTypes: true})) {\n if (ent.isDirectory() || ent.isSymbolicLink()) {\n await addUnlessNegated(path.join(parent, ent.name));\n }\n }\n }\n } else {\n await addUnlessNegated(path.join(cwd, pattern));\n }\n }\n }\n\n // 2. Linked deps installed as source — including a localized checkout that is\n // in no workspace glob. Shared with the `linked start` watch set; see\n // discoverLinkedSourceDependencies above. Glob entries win on a name clash.\n for (const entry of await discoverLinkedSourceDependencies(cwd)) {\n if (seen.has(entry.name)) continue;\n seen.add(entry.name);\n out.push(entry);\n }\n\n return out;\n}\n\nconst isFile = async (p: string): Promise<boolean> =>\n fsExtra\n .stat(p)\n .then((st) => st.isFile())\n .catch(() => false);\n\n/**\n * Map a `lib/esm` file back to its source under `srcDir`: `.js`/`.jsx` probe\n * `.tsx` then `.ts`, anything else (css, json, ...) is taken literally.\n */\nasync function libTargetToSource(\n srcDir: string,\n rel: string,\n): Promise<string | null> {\n if (/\\.jsx?$/.test(rel)) {\n const base = path.join(srcDir, rel.replace(/\\.jsx?$/, ''));\n for (const ext of ['.tsx', '.ts']) {\n if (await isFile(base + ext)) return base + ext;\n }\n return null;\n }\n const literal = path.join(srcDir, rel);\n return (await isFile(literal)) ? literal : null;\n}\n\n/**\n * The name-based lookup's fallback: resolve `subpath` (`.` or `./x/y`) through\n * the workspace's own `exports` under `import`/`default`, and map a\n * `./lib/esm/...` target to the same path under src. This is what reaches\n * source for a subpath whose export key does not match a file name\n * (`@_linked/translation/key-sync/node` -> `lib/esm/key-sync-node.js` ->\n * `src/key-sync-node.ts`), a directory subpath (`./conformance` ->\n * `lib/esm/conformance/index.js`), or a bare name whose src has no index.\n * Without it such a specifier falls through to Vite, which picks the package's\n * `lib/esm` copy while the rest of the package comes from src: two instances of\n * every module-level registry. It must not depend on a `development` -> src\n * condition, because src/ is not published and packages do not declare one.\n */\nasync function resolveViaWorkspaceExports(\n ws: WorkspaceEntry,\n subpath: string,\n): Promise<string | null> {\n let json: any;\n try {\n json = await fsExtra.readJson(path.join(path.dirname(ws.srcDir), 'package.json'));\n } catch {\n return null;\n }\n const target = resolveExportsSubpath(json, subpath, ['import', 'default']);\n if (!target || !target.startsWith('./lib/esm/')) return null;\n return libTargetToSource(ws.srcDir, target.slice('./lib/esm/'.length));\n}\n\n/**\n * Resolve a bare specifier like `@_linked/foo/bar`, `lincd-rdfs/Foo`, or\n * `pkg/utils/Bar.js` against the workspace lookup. Tries the file name first:\n * .tsx, .ts, then the literal file (for files that already include an\n * extension or for non-TS assets). When the name matches no file, falls back to\n * the workspace's `exports` map (see `resolveViaWorkspaceExports`). Returns null\n * when the specifier doesn't match any workspace package or no candidate exists\n * on disk.\n */\nexport async function resolveWorkspaceSpecifier(\n specifier: string,\n workspaces: WorkspaceEntry[],\n): Promise<string | null> {\n for (const ws of workspaces) {\n if (specifier === ws.name) {\n for (const ext of ['index.ts', 'index.tsx']) {\n const p = path.join(ws.srcDir, ext);\n if (await fsExtra.pathExists(p)) return p;\n }\n return resolveViaWorkspaceExports(ws, '.');\n }\n if (specifier.startsWith(ws.name + '/')) {\n const subpath = specifier.slice(ws.name.length + 1);\n // Strip .js/.jsx suffix — workspace src uses TS published-output\n // convention (./Sibling.js) but we want the TS source.\n const base = subpath.replace(/\\.jsx?$/, '');\n for (const ext of ['.tsx', '.ts']) {\n const p = path.join(ws.srcDir, base + ext);\n if (await fsExtra.pathExists(p)) return p;\n }\n // Files that already include an extension Vite handles (.css, .json,\n // .svg, etc.) — return the literal path under src. A FILE only: a\n // directory of the same name is a directory subpath, left to `exports`.\n const literal = path.join(ws.srcDir, subpath);\n if (await isFile(literal)) return literal;\n return resolveViaWorkspaceExports(ws, './' + subpath);\n }\n }\n return null;\n}\n\n/**\n * Packages whose entry `linked start` hands to `vite.ssrLoadModule` by name\n * (`@_linked/server/shapes/LinkedServer`, see `commands/start.ts`).\n *\n * Vite transforms an explicitly requested entry, and every file it reaches by\n * RELATIVE import, whether or not the package is external. The same package's\n * bare-specifier imports from anywhere else (the app's `src`, the storage\n * config) are externalized to Node. Left external, the package is split across\n * two loaders, and which copy a file ends up in depends on import order: a file\n * the module runner has already evaluated is reused, one it has not is loaded\n * by Node, and Node then loads that file's relative imports itself. Measured in\n * CN: `package.js` and `ontologies/lincd-server.js` evaluated once by each\n * loader, and `LocalFileStore.js` too once the package's `backend` was loaded.\n * Bundling the package makes Vite the only loader for it.\n */\nexport const SSR_ENTRY_PACKAGES = ['@_linked/server'];\n\n/**\n * `ssr.noExternal` for the dev SSR runner. With source workspaces, only those\n * package names are bundled by Vite; everything else in node_modules (including\n * published `@_linked/*`) is externalized to Node. Vite matches these entries\n * against the bare package name, so subpath imports (`pkg/shapes/Foo`) match too.\n * Installed packages that depend on a workspace (`dependents`, from\n * `workspaceDependents`) are bundled too, so they share the Vite-loaded workspace.\n * Standalone (no workspaces): the context-holding framework packages are bundled.\n * In both modes, `SSR_ENTRY_PACKAGES` are bundled.\n */\nexport function ssrNoExternal(\n workspaces: {name: string}[],\n dependents: string[] = [],\n): (string | RegExp)[] {\n if (workspaces.length === 0) {\n return [/^@_linked\\/server-utils$/, /^@_linked\\/react$/, ...SSR_ENTRY_PACKAGES];\n }\n return [...new Set([...workspaces.map((w) => w.name), ...dependents, ...SSR_ENTRY_PACKAGES])];\n}\n\n/**\n * Packages a STANDALONE app has always deduped, installed or not: the two that\n * hold React context the SSR tree must agree on. See the standalone `resolve`\n * block in `createViteConfig`.\n */\nconst STANDALONE_DEDUPE = ['@_linked/server-utils', '@_linked/react'];\n\n/**\n * `resolve.dedupe` for every mode: the localized packages, what their checkouts\n * import that the app has at a version they accept, and React — see\n * `localizedDedupe`. Duplicates come from localization (a checkout's own\n * `node_modules`), so that is what is detected; an app with nothing localized\n * dedupes only React.\n */\nexport {localizedDedupe} from './localized-dedupe.js';\n\n/**\n * The `process.env.*` values inlined into the browser bundle — and only there.\n * See the `environments.client.define` note in `createViteConfig` for why the\n * server environment must not receive them.\n */\nexport function clientDefine(\n opts: Pick<LinkedViteConfigOptions, 'define' | 'port'> = {},\n): Record<string, string> {\n return {\n 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'production'),\n 'process.env.SITE_ROOT': JSON.stringify(\n process.env.SITE_ROOT ?? `http://localhost:${process.env.PORT ?? opts.port ?? 4040}`,\n ),\n // The app's display name, so client components (e.g. the header) can read it\n // like the SSR <title> does (server-utils Html reads process.env.APP_NAME). The\n // browser has no `process`, so inline it; falls back to a generic label when\n // unset so a bare checkout never renders `undefined`.\n 'process.env.APP_NAME': JSON.stringify(process.env.APP_NAME ?? 'Linked App'),\n ...(opts.define ?? {}),\n };\n}\n\nexport function createViteConfig(opts: LinkedViteConfigOptions = {}): ReturnType<typeof defineConfig> {\n return defineConfig(async ({mode}) => {\n const isDev = mode === 'development';\n const workspaces = isDev ? await discoverWorkspaces(opts.workspaceGlobs) : [];\n // STANDALONE = dev mode with no source-shipping workspaces discovered\n // (an app installed from npm outside the monorepo — its `@_linked/*` /\n // `lincd-*` deps are lib-only). discoverWorkspaces() only registers\n // packages that ship `src/` on disk, so `length === 0` is the exact\n // standalone signal used elsewhere in this file. In WORKSPACE mode\n // (CN monorepo or its workspace-member clones) this is false and none\n // of the standalone-gated branches below apply.\n const isStandalone = isDev && workspaces.length === 0;\n const dedupe = await localizedDedupe(process.cwd());\n if (isDev) {\n const skippedLine = describeSkipped(dedupe.skipped);\n if (skippedLine) console.warn(skippedLine);\n }\n\n // The app's published framework deps — excluded from Vite's dep-optimizer below\n // (`optimizeDeps.exclude`) so the browser's native ESM graph loads ONE copy of each.\n // Without the exclude, esbuild inlines a duplicate `@_linked/core` into each\n // per-subpath chunk (`@_linked_schema_shapes_Person.js`,\n // `@_linked_core_utils_LinkedStorage.js`, …), duplicating framework classes\n // (`Person` → `Person2`/`3`), so their shapes register under mangled URIs that no\n // longer match the backend's (one clean copy via Node). These packages are ESM with\n // no bare CJS runtime deps (e.g. `classnames` is inlined in `@_linked/react`), so\n // native-ESM serving needs no interop shim.\n const linkedDeps: string[] = [];\n if (isStandalone) {\n try {\n const appPkg = await fsExtra.readJson(path.join(process.cwd(), 'package.json'));\n const allDeps = {...appPkg.dependencies, ...appPkg.devDependencies};\n // A linked package by its own `linkedPackage` flag, not its scope.\n for (const name of Object.keys(allDeps)) {\n const installed = await readInstalledPkg(name, process.cwd());\n if (installed && isLinkedPackageJson(installed.json)) linkedDeps.push(name);\n }\n } catch {\n /* best-effort — no package.json is fine */\n }\n }\n const devPort = process.env.PORT ?? opts.port;\n const clientDepIncludes =\n isDev && opts.clientDepIncludes !== false && process.env.LINKED_CLIENT_DEP_INCLUDES !== '0';\n const config: UserConfig = {\n server: {\n port: opts.port ?? 4040,\n middlewareMode: true,\n // Unique HMR websocket port per app/worktree, derived from the dev port\n // and moved to a free one when taken — see `resolveHmrPort`. Apps can\n // still override this with their own `server.hmr` in mergeConfig.\n hmr: {port: isDev ? await resolveHmrPort({devPort}) : hmrPortFor(devPort)},\n },\n build: {\n outDir: opts.outDir ?? 'public/bundles',\n manifest: true,\n // Bump chunk-size warning so it doesn't fire on every build for\n // the linked vendor bundle. Real chunking happens via\n // manualChunks below.\n chunkSizeWarningLimit: 1000,\n rollupOptions: {\n input: opts.entry ?? 'src/index.tsx',\n output: {\n entryFileNames: 'assets/[name]-[hash].js',\n chunkFileNames: 'assets/[name]-[hash].js',\n assetFileNames: 'assets/[name]-[hash][extname]',\n manualChunks: chunkForModuleId,\n },\n },\n sourcemap: true,\n },\n plugins: [\n // Direct workspace specifier resolver.\n //\n // The package.json `\"./*\": { \"development\": \"./src/*.ts\" }` wildcard\n // can't express \"try .ts, fall back to .tsx\" (Node's exports spec\n // resolves to a single literal path). For React-heavy packages like\n // @_linked/primitives, @_linked/server-utils, and @_linked/auth,\n // most files are .tsx — the wildcard fails before any Vite plugin\n // gets a chance to fix it up.\n //\n // This plugin intercepts BARE workspace specifiers like\n // `@_linked/foo/bar` and `pkg-name/utils/Baz.js` BEFORE Vite's\n // package.json resolver runs, mapping them straight to source with\n // proper extension fallback (.tsx → .ts → literal). It also covers\n // the `./Sibling.js` published-output convention for imports made\n // from within workspace `src/` trees.\n isDev\n ? ({\n name: 'linked:resolve-workspace-ts',\n enforce: 'pre',\n async resolveId(id, importer) {\n if (id.startsWith('\\0')) return null;\n\n // Workspace-internal `./Sibling.js` → `.tsx` / `.ts` rewrite.\n if (\n importer &&\n importer.includes(`${path.sep}packages${path.sep}`) &&\n /\\.(jsx?)$/.test(id) &&\n (id.startsWith('.') || id.startsWith('/'))\n ) {\n const importerDir = path.dirname(importer);\n const base = path.resolve(importerDir, id);\n for (const ext of ['.tsx', '.ts']) {\n const candidate = base.replace(/\\.jsx?$/, ext);\n if (await fsExtra.pathExists(candidate)) return candidate;\n }\n }\n\n // Bare workspace specifier — resolve directly to src/.\n if (\n !id.startsWith('.') &&\n !id.startsWith('/') &&\n workspaces.length > 0\n ) {\n const resolved = await resolveWorkspaceSpecifier(id, workspaces);\n if (resolved) return resolved;\n }\n\n // STANDALONE (no workspaces): the linked packages are installed\n // from npm as lib-only (no `src`). We DON'T intercept them here —\n // instead the standalone `resolve.conditions` / `ssr.resolve.conditions`\n // (set on the config below, dropping Vite's `development` token)\n // let Vite's normal resolver pick each package's `import → lib/esm`\n // export. Bundling those lib files through the SSR runner works\n // (they're plain ESM); marking them external instead would leave a\n // bare specifier that `vite.ssrLoadModule` can't load\n // (\"Failed to load url @_linked/server/shapes/LinkedServer\").\n\n return null;\n },\n } as Plugin)\n : null,\n // Published lib JS: keep decorated shape classes named `Foo`, not the\n // `Foo2` Vite's esbuild re-prints would give them — see the plugin.\n pinCompiledClassNames(),\n react({\n babel: {\n parserOpts: {\n plugins: ['decorators-legacy', 'classProperties'],\n },\n },\n }),\n // Dev-only: log every file the watcher sees change. Without this,\n // backend edits look silent (no JS rebuild step, no Node restart)\n // and it's hard to tell whether\n // Vite picked up the change at all.\n isDev\n ? ({\n name: 'linked:reload-log',\n configureServer(server) {\n server.watcher.on('change', (file) => {\n const rel = file.replace(process.cwd() + '/', '');\n console.log(`[linked] reloaded ${rel}`);\n });\n },\n } as Plugin)\n : null,\n clientDepIncludes\n ? linkedClientDepIncludesPlugin({\n sourceWorkspaces: workspaces,\n deny: typeof opts.clientDepIncludes === 'object' ? opts.clientDepIncludes.deny : undefined,\n })\n : null,\n ...(opts.plugins ?? []),\n ].filter(Boolean) as Plugin[],\n css: {\n modules: {\n generateScopedName: isDev ? generateScopedName : generateScopedNameProduction,\n },\n postcss: opts.postcssPlugins\n ? {plugins: opts.postcssPlugins as any}\n : undefined,\n },\n esbuild: {\n tsconfigRaw: {\n compilerOptions: {\n experimentalDecorators: true,\n },\n },\n jsx: 'automatic',\n // A shape's IRI is built from its class name —\n // `getNodeShapeUri(packageName, constructor.name)` — so a minifier that\n // renames the class changes the shape's identity. In a production build\n // the client would ask the server for\n // `https://linked.cm/shape/server/za` while the server had registered\n // `.../BackendAPIStore`, and every Server.call on that shape 501'd.\n // The same mangling made registration report `Shape undefined does not\n // extend base class`.\n //\n // Vite honours this in the minifier only: its per-file TypeScript\n // transform and its define pass both run esbuild with keepNames off.\n // `pinCompiledClassNames` above covers what those passes rename.\n keepNames: true,\n },\n // STANDALONE resolve conditions.\n //\n // The published `@_linked/*` / `lincd-*` packages export\n // \"development\": \"./src/*.ts\", \"import\": \"./lib/esm/*.js\"\n // In dev, Vite expands its special `development|production` condition\n // token to `development`, so it resolves these to `./src/*.ts` — which\n // doesn't exist in a lib-only npm install → boot crash\n // (\"Failed to load @_linked/server/shapes/LinkedServer\").\n //\n // Dropping the dev/prod token from the condition list means Vite never\n // adds `development`; `import` (always appended last by Vite) wins, so\n // these packages resolve to `./lib/esm/*.js`. We start from Vite's\n // default SERVER conditions (`module`, `node`, `development|production`)\n // minus the dev/prod token. This governs BOTH the plugin pipeline\n // (`resolve.conditions`) and the SSR module runner used by\n // `ssrLoadModule('@_linked/server/shapes/LinkedServer')` in\n // commands/start.ts (`ssr.resolve.conditions`).\n //\n // WORKSPACE-GATED: only applied standalone. In monorepo dev the packages\n // ship `src`, and we WANT `development → src` for HMR — so we leave\n // conditions at Vite's defaults there (undefined = untouched), keeping\n // CN dev byte-for-byte unchanged.\n //\n // DEDUPE, every mode: see `localizedDedupe`. Standalone also keeps its two\n // context-holding packages even when they are not found on disk, so the two\n // `ssrLoadModule` loads (LinkedServer + the app graph) resolve to ONE\n // `server-utils`/`react` instance — otherwise their `AppContext` objects\n // differ and `useAppContext()` returns null. Pairs with `ssr.noExternal` below.\n resolve: {\n ...(isStandalone ? {conditions: ['module', 'node']} : {}),\n dedupe: [\n ...new Set([...(isStandalone ? STANDALONE_DEDUPE : []), ...dedupe.names]),\n ],\n },\n // `ssr.external` is a minimal allowlist of\n // npm deps that genuinely can't (or shouldn't) go through Vite's\n // SSR transform. Workspace packages (`@_linked/*`, `lincd-*`) are\n // DELIBERATELY removed so Vite resolves them via each package's\n // `development → ./src/*.ts` conditional export and HMR works on\n // source changes.\n //\n // \"Multiple LINCD\" warnings may resurface during the interim until\n // LINCD eradication completes (accepted).\n ssr: {\n // NOTE: Vite's `ssr.external` only accepts exact package-name strings\n // (not regex). Standalone `@_linked/*` / `lincd-*` are NOT force-listed\n // here — they auto-externalize (or bundle) and resolve via the\n // standalone `import → lib/esm` conditions set below.\n external: [\n 'react',\n 'react-dom',\n 'react-dom/server',\n 'react-router-dom',\n 'scheduler',\n 'express',\n ],\n // Vite 7 auto-externalizes node_modules packages for SSR (loading them\n // via Node → the `import`→`lib/esm` condition), which would bypass the\n // `linked:resolve-workspace-ts` resolver and create a SECOND module\n // instance of each workspace package (breaking the single-`src`-instance\n // invariant — `LinkedStorage` state set on one instance, read on the\n // other → \"No query dispatch configured\"). Force the workspace packages\n // to be BUNDLED so they resolve via each package's `development → src`.\n //\n // WORKSPACE-GATED: only force-bundle when workspaces are actually\n // present (the monorepo / CN + CN's workspace-member clones, where the\n // `@_linked/*` packages have `src` on disk). A STANDALONE app (CLI-\n // created, no workspaces) installs `@_linked/*` from npm as lib-only —\n // those have NO `src`, so bundling them via the `development → src`\n // condition fails (\"Failed to load @_linked/server/shapes/LinkedServer\").\n // Leaving them EXTERNAL lets Node resolve `import → lib/esm`. Single-\n // instance is not a concern standalone (one node_modules copy each) and\n // core's query dispatch is global-backed regardless.\n // STANDALONE: force-bundle the framework packages that hold React context /\n // shared singletons the SSR tree must agree on — `server-utils` (`AppContext`,\n // read by `AppRoot`) and `react`. If left external, LinkedServer's\n // `AppContextProvider` and the app's `AppRoot` (`useAppContext`) can resolve to\n // DIFFERENT module instances → two `AppContext` objects → `useAppContext()` sees\n // no provider (null) → \"Cannot destructure 'isNativeApp'\" and a blank \"SSR timed\n // out\". Bundling makes them one instance in Vite's SSR module graph (matching how\n // workspace mode bundles everything). `fuseki` stays external; `server` is bundled\n // because `start` loads its entry through Vite (`SSR_ENTRY_PACKAGES`). Their native\n // dependencies (e.g. `sharp`) are separate packages and stay external either way.\n //\n // WORKSPACE: bundle ONLY the discovered source workspaces (they resolve to `src/`\n // for HMR). Published framework packages installed under node_modules (lib-only)\n // stay EXTERNAL, so Vite-loaded source and Node-native `import()` share Node's\n // single instance of them. Force-bundling every `@_linked/*` here made Vite\n // evaluate its own `@_linked/core` while `loadStores` (core) loaded a store such\n // as `@_linked/fuseki/shapes/FusekiStore` through native `import()`, which pulled\n // a SECOND Node-loaded core and split the shape registry. Installed packages\n // that depend on a workspace (e.g. published fuseki when core itself is a\n // workspace) are bundled too, so they import the Vite-loaded workspace. The one\n // published exception is `SSR_ENTRY_PACKAGES`, which Vite loads regardless.\n //\n // NOT DEV (a release build of the backend): nothing is force-bundled. The\n // compiled backend is loaded by Node next to the installed\n // `@_linked/server`, so every framework package has to stay a bare import\n // that resolves to that same node_modules copy. `workspaces` is always\n // empty here, and handing that to `ssrNoExternal` used to select the\n // standalone list — which compiled a private `server-utils` into `lib/`,\n // so no app provider was `instanceof` the server's `ShapeProvider` and\n // `LinkedServer` dropped them all (\"exports two generic backend providers\").\n noExternal: isDev ? ssrNoExternal(workspaces, await workspaceDependents(workspaces)) : [],\n // STANDALONE: the SSR module runner (`vite.ssrLoadModule`, used to\n // load LinkedServer + the app graph in commands/start.ts) has its OWN\n // condition list, defaulting to `resolve.conditions`. Set it\n // explicitly so `development` is excluded there too and the lib-only\n // packages resolve via `import → lib/esm`. Omitted (defaults kept) in\n // workspace mode so monorepo SSR still resolves `development → src`.\n ...(isStandalone\n ? {resolve: {conditions: ['module', 'node']}}\n : {}),\n },\n // Client-only, deliberately: these go on the `client` environment, not the\n // top-level `define`, because a top-level `define` is inherited by the SSR\n // environment too.\n //\n // The browser needs them. `@_linked/server-utils`'s `Server.ts` reads\n // `process.env.SITE_ROOT` to target the backend; the browser has no\n // `process`, and Vite (unlike a bundler's EnvironmentPlugin) doesn't\n // auto-inline `process.env.X`, so SITE_ROOT is defined here — always the\n // app's own origin, defaulted to `http://localhost:<port>` (an explicit\n // `SITE_ROOT` env, e.g. from `.env-cmdrc`, still wins). NODE_ENV is a\n // common client guard, so it is defined too.\n //\n // The server must NOT get them, for two reasons:\n // - it reads `process.env` at runtime, so an inlined build-time value is\n // wrong there (a release backend would carry the build machine's\n // SITE_ROOT rather than the deployment's);\n // - worse, every `define` key is a trigger. Vite's `vite:define` plugin\n // runs `esbuild.transform` — without `keepNames` — over any SSR module\n // whose text contains a key. esbuild renames the inner binding of a\n // tsc-emitted decorated class (`let LinkedServer = class LinkedServer`\n // becomes `class LinkedServer2`), and a shape's IRI is built from its\n // class name, so `@_linked/server`'s `LinkedServer` and `LincdAPI`\n // registered as `LinkedServer2` / `LincdAPI2` in dev. Without user keys\n // the SSR environment has none of its own (`keepProcessEnv` is on for\n // it), so nothing server-side is rewritten.\n //\n // Only these SPECIFIC tokens, never a whole-object `process.env`\n // replacement: in a client build Vite already maps any other\n // `process.env.X` to `{}.X` (undefined), which is what client code expects.\n //\n // Apps expose their OWN frontend env vars through the `define` option,\n // which lands here too:\n // createViteConfig({ define: {\n // 'process.env.MY_PUBLIC_KEY': JSON.stringify(process.env.MY_PUBLIC_KEY),\n // }})\n // (only reference PUBLIC vars in client code — a defined secret would be\n // inlined into the browser bundle). An app that puts a top-level `define`\n // in its own config reintroduces both problems for the server; use\n // `environments.client.define` there as well.\n environments: {\n client: {\n define: clientDefine(opts),\n },\n },\n // WORKSPACE mode: exclude the source-shipping workspace packages (@_linked/*,\n // lincd-*) from esbuild's dep pre-bundler. They resolve to `src/` via the\n // `linked:resolve-workspace-ts` plugin; in a workspace-member CLONE they'd\n // otherwise resolve via `node_modules` SYMLINKS and esbuild fails on their\n // subpath `exports` (\"No known conditions for ./shapes/SHACL …\").\n // STANDALONE mode: exclude the app's published linked deps (by their\n // `linkedPackage` flag; see `linkedDeps` above) from\n // esbuild's pre-bundler so the browser's native ESM graph loads ONE copy of\n // `@_linked/core` (no per-subpath duplication → stable class names → shape URIs\n // match the backend — see `linkedDeps` above). These packages are ESM with no\n // bare CJS runtime deps (e.g. `classnames` is inlined in `@_linked/react`), so\n // serving them as native ESM needs no interop shim.\n // An excluded package is not crawled, so its OWN third-party imports (Radix,\n // vaul, js-cookie…) are listed in `optimizeDeps.include` by the\n // `linked:client-dep-includes` plugin above, once the app's excludes are final.\n ...(workspaces.length > 0\n ? {optimizeDeps: {exclude: workspaces.map((w) => w.name)}}\n : isStandalone && linkedDeps.length > 0\n ? {optimizeDeps: {exclude: linkedDeps}}\n : {}),\n };\n\n // Tailwind plugin (only if explicitly enabled — adds a heavy plugin).\n if (opts.cssMode === 'tailwind') {\n // Try ESM dynamic import first (works when @tailwindcss/vite is\n // installed in the app or hoisted). Surface a CLEAR warning when\n // it's not — the app needs the dep for theme variables to load.\n try {\n const tailwind: any = await import('@tailwindcss/vite' as any);\n const tailwindPlugin = tailwind.default ?? tailwind;\n (config.plugins as Plugin[]).push(tailwindPlugin());\n } catch (err) {\n console.warn(\n '[createViteConfig] cssMode=tailwind but @tailwindcss/vite ' +\n 'could not be loaded. Theme variables won\\'t apply at runtime. ' +\n 'Add `@tailwindcss/vite` to your app\\'s package.json.',\n );\n }\n }\n\n return config;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"vite-config.js","sourceRoot":"","sources":["../../src/vite-config.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,oEAAoE;AACpE,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,wDAAwD;AACxD,wEAAwE;AACxE,EAAE;AACF,mEAAmE;AACnE,qEAAqE;AACrE,uEAAuE;AACvE,+EAA+E;AAC/E,kEAAkE;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,4BAA4B,EAAC,MAAM,uBAAuB,CAAC;AACnE,OAAO,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gBACb,OAAO,CAAC,IAAI,CACV,4DAA4D;oBAC1D,gEAAgE;oBAChE,sDAAsD,CACzD,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAA,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Vite config helper for linked apps. The one dev + build pipeline.\n//\n// Apps use this from their own vite.config.ts:\n//\n// import {createViteConfig} from '@_linked/cli/vite';\n// export default createViteConfig({port: 4040, cssMode: 'tailwind'});\n//\n// The helper preserves the dev-mode `generateScopedName` (readable\n// `_packageName_filename_className`) so CSS module class names match\n// what the previous bundler chain produced for trace/debug. Production\n// uses `generateScopedNameProduction`, which the Node CSS loader shares so the\n// server renders the class names the client's stylesheet defines.\nimport {defineConfig} from 'vite';\nimport react from '@vitejs/plugin-react';\nimport fsExtra from 'fs-extra';\nimport path from 'node:path';\nimport {generateScopedName} from './utils.js';\nimport {generateScopedNameProduction} from './css-module-names.js';\nimport {parseWorkspacePatterns, isWorkspacePathNegated} from './workspace-globs.js';\nimport {pinCompiledClassNames} from './plugins/pin-compiled-class-names.js';\nimport {\n discoverInstalledLinkedPackages,\n isLinkedPackageJson,\n readInstalledPkg,\n} from './installed-packages.js';\nimport {\n linkedClientDepIncludesPlugin,\n resolveExportsSubpath,\n} from './client-dep-includes.js';\nimport type {Plugin, UserConfig} from 'vite';\n\n/** Default dev server port, and Vite's default HMR websocket port. */\nconst DEFAULT_DEV_PORT = 4040;\nconst DEFAULT_HMR_PORT = 24678;\n/** Vite may not bind below 1024 without privileges; 65535 is the TCP ceiling. */\nconst MIN_HMR_PORT = 1024;\nconst MAX_HMR_PORT = 65535;\n\n/**\n * Derive an app's HMR websocket port from its dev port.\n *\n * Every `createViteConfig` app used to fall back to Vite's shared default\n * 24678, so any two dev servers running at once collided (\"Port 24678 is\n * already in use\") and HMR silently broke for the loser. Offsetting the HMR\n * port by the same amount the dev port is offset from its default keeps the\n * derivation trivial and means apps that already run on distinct dev ports get\n * distinct HMR ports for free.\n *\n * The input is untrusted (`process.env.PORT` is an arbitrary string), so\n * anything that is not a whole port number — `PORT=abc` yielding `NaN`, a\n * negative or out-of-range value — falls back to the dev port default. The\n * result is then clamped into the bindable range, since a far-out dev port\n * would otherwise derive an HMR port past 65535.\n */\n/**\n * Which manual chunk a module belongs in.\n *\n * Split large/common deps so route chunks don't all carry their own copy AND\n * the main entry doesn't end up at 5MB+. Each chunk becomes its own\n * `assets/<name>-<hash>.js` the browser caches independently — incremental\n * dev builds and cache wins on prod deploys both improve.\n *\n * Exported so the grouping can be asserted directly: getting it wrong does not\n * fail the build, it produces a bundle that throws on load in the browser.\n */\nexport const chunkForModuleId = (id: string): string | undefined => {\n if (!id.includes('node_modules')) {\n // Linked workspaces ship as @_linked/* / lincd-* — group all\n // linked-framework code into a single chunk.\n if (\n id.includes('/packages/core/') ||\n id.includes('/packages/react/') ||\n id.includes('/packages/server-utils/') ||\n id.includes('/packages/primitives/') ||\n id.includes('/packages/css/') ||\n /\\/packages\\/(auth|org|schema|fuseki|owl|xsd|dcat|dcmi|s3|sentry|ui)\\//.test(id)\n ) {\n return 'linked';\n }\n return undefined;\n }\n // Framework code installed from the registry rather than resolved to a\n // workspace. An app can hold both at once — a published `@_linked/server`\n // in node_modules next to workspace `@_linked/core` — and the two import\n // each other. Split across `linked` and `vendor` that is a cycle, and\n // Rollup's chosen order left a binding in its temporal dead zone:\n // `Cannot access 'Wo' before initialization` before the app rendered.\n // Same chunk, no cycle.\n if (/[\\\\/]node_modules[\\\\/](@_linked[\\\\/]|lincd-)/.test(id)) {\n return 'linked';\n }\n // React + React-DOM in their own chunk — every route uses them.\n //\n // react-router and @remix-run/router belong here too. Left in `vendor` they\n // made the two chunks import each other: react-router-dom re-exports\n // react-router, so react-vendor imported vendor, while vendor's own\n // top-level `React.createContext(...)` calls imported react-vendor. Rollup\n // has to pick an order for a cycle, and it ran vendor first — every\n // production build died on load with \"Cannot read properties of undefined\n // (reading 'createContext')\".\n if (\n /[\\\\/]node_modules[\\\\/](react|react-dom|react-router-dom|react-router|@remix-run[\\\\/]router|scheduler)[\\\\/]/.test(\n id\n )\n ) {\n return 'react-vendor';\n }\n // Heavy editor deps — only loaded on pages that need them, but worth\n // isolating so they don't get pulled into main.\n if (/[\\\\/]node_modules[\\\\/]@monaco-editor[\\\\/]/.test(id)) {\n return 'monaco';\n }\n // Charting/visualization\n if (/[\\\\/]node_modules[\\\\/](recharts|react-flow|@xyflow|d3-)[\\\\/]/.test(id)) {\n return 'viz';\n }\n // Animation\n if (/[\\\\/]node_modules[\\\\/]framer-motion[\\\\/]/.test(id)) {\n return 'motion';\n }\n // Catch-all for other node_modules in a vendor chunk\n return 'vendor';\n};\n\nexport function hmrPortFor(devPort: unknown): number {\n const parsed = Number(devPort);\n const validDevPort =\n Number.isFinite(parsed) && Number.isInteger(parsed) && parsed >= 1 && parsed <= 65535\n ? parsed\n : DEFAULT_DEV_PORT;\n const derived = DEFAULT_HMR_PORT + (validDevPort - DEFAULT_DEV_PORT);\n return Math.min(MAX_HMR_PORT, Math.max(MIN_HMR_PORT, derived));\n}\n\n/** How far past the derived port `resolveHmrPort` looks for a free one. */\nconst HMR_PORT_SEARCH_RANGE = 100;\n\n/**\n * Whether `port` can be listened on the way Vite's HMR websocket server\n * listens: every interface, since `createViteConfig` sets no `hmr.host`.\n */\nexport function isPortFree(port: number, host?: string): Promise<boolean> {\n return import('node:net').then(\n (net) =>\n new Promise<boolean>((resolve) => {\n const probe = net.createServer();\n probe.unref();\n probe.once('error', () => resolve(false));\n probe.listen({port, host, exclusive: true}, () => probe.close(() => resolve(true)));\n }),\n );\n}\n\n/**\n * Ports this process already chose, by derived port. Vite re-evaluates the\n * config when it restarts the server (a vite.config edit), and it does so while\n * the old server still holds the port — probing again would see our own socket\n * and move to the next port on every restart.\n */\nconst chosenHmrPorts: Map<number, number> = ((globalThis as any)[Symbol.for('@_linked/cli.hmrPorts')] ??=\n new Map<number, number>());\n\nexport interface ResolveHmrPortOptions {\n /** The dev port the HMR port is derived from (`process.env.PORT ?? opts.port`). */\n devPort: unknown;\n env?: NodeJS.ProcessEnv;\n isFree?: (port: number) => Promise<boolean>;\n log?: (message: string) => void;\n}\n\n/**\n * The HMR websocket port for this dev server.\n *\n * `LINKED_HMR_PORT` wins outright. Otherwise the port derived from the dev port\n * (`hmrPortFor`) is used if it is free, and the next free port above it if it\n * is not: the derivation keeps apps on distinct dev ports apart, but not an app\n * from an unrelated process (or a second checkout of the same app) that already\n * holds the derived port. Vite injects the configured `hmr.port` into the\n * client it serves, so the browser connects to whichever port was chosen.\n *\n * If nothing in range is free the derived port is returned and Vite reports the\n * conflict, as it did before.\n */\nexport async function resolveHmrPort({\n devPort,\n env = process.env,\n isFree = isPortFree,\n log = (m) => console.log(m),\n}: ResolveHmrPortOptions): Promise<number> {\n const override = env.LINKED_HMR_PORT;\n if (override !== undefined && override.trim() !== '') {\n const port = Number(override);\n if (Number.isInteger(port) && port >= 1 && port <= MAX_HMR_PORT) return port;\n log(`[linked] ignoring LINKED_HMR_PORT=${override}: not a port number`);\n }\n const derived = hmrPortFor(devPort);\n const remembered = chosenHmrPorts.get(derived);\n if (remembered !== undefined) return remembered;\n for (let port = derived; port <= Math.min(MAX_HMR_PORT, derived + HMR_PORT_SEARCH_RANGE); port++) {\n if (await isFree(port)) {\n chosenHmrPorts.set(derived, port);\n if (port !== derived) {\n log(`[linked] HMR port ${derived} is in use; using ${port} (set LINKED_HMR_PORT to choose one)`);\n }\n return port;\n }\n }\n return derived;\n}\n\nexport interface LinkedViteConfigOptions {\n /** Dev server port. Default 4040. */\n port?: number;\n /** Output dir for `vite build`. Default `public/bundles`. */\n outDir?: string;\n /** CSS pipeline mode. */\n cssMode?: 'tailwind' | 'css-modules-only';\n /** Entry file for the client bundle. Default `src/index.tsx`. */\n entry?: string;\n /** Extra Vite plugins. */\n plugins?: Plugin[];\n /** Extra PostCSS plugins (e.g. `postcss-media-to-container`). */\n postcssPlugins?: unknown[];\n /**\n * Extra `define` entries for the CLIENT environment only (used to bridge\n * `process.env.X` refs into the browser). Never applied server-side.\n */\n define?: Record<string, string>;\n /**\n * Extra workspace globs (trailing `/*`, or a direct package dir) resolved\n * RELATIVE TO the app's cwd, in ADDITION to the app's own `workspaces` field.\n *\n * For apps whose linked-package sources live OUTSIDE their own workspace tree\n * — e.g. an app consumes `packages/lincd.org/modules/*`, which sit one level\n * up (`../lincd.org/modules/*`) when the app runs inside the CN monorepo, and under\n * `packages/lincd.org/modules/*` when the app runs from its own root. Pass BOTH\n * candidate layouts; only globs whose parent dir actually exists are scanned,\n * so the same config works in either checkout. Each glob's packages are\n * registered as source workspaces (resolved to `src/` for HMR + single-instance),\n * exactly like the app's own `workspaces` field.\n */\n workspaceGlobs?: string[];\n /**\n * Add the third-party client dependencies of the excluded framework packages\n * to `optimizeDeps.include` in dev (see ./client-dep-includes.ts). Default on;\n * `false` (or `LINKED_CLIENT_DEP_INCLUDES=0`) turns it off, and `deny` keeps\n * entries out — matched against the entry (`'@_linked/primitives > vaul'`),\n * the specifier (`'vaul'`) or the package name. Run with `DEBUG=linked` to see\n * what was added.\n */\n clientDepIncludes?: boolean | {deny?: (string | RegExp)[]};\n}\n\nexport interface WorkspaceEntry {\n name: string;\n srcDir: string;\n}\n\n/**\n * Names of installed packages that depend, directly or transitively (via\n * `dependencies` / `peerDependencies`), on a discovered source workspace. Such a\n * package must also go through Vite SSR: if Node loaded it natively, it would\n * import its own Node-loaded copy of the workspace (e.g. published\n * `@_linked/fuseki` importing a workspace `@_linked/core`), splitting module\n * state. Vite rewrites the dynamic `import()` in code it transforms, so bundling\n * the dependents keeps one instance.\n *\n * Only the dependency closure of the app's `package.json` (dependencies +\n * devDependencies) and of the workspaces themselves is scanned. Packages are\n * resolved Node-style, keyed by real path, and unresolvable ones are ignored.\n * Workspace names are not included in the result.\n */\nexport async function workspaceDependents(\n workspaces: {name: string; srcDir?: string}[],\n cwd: string = process.cwd(),\n): Promise<string[]> {\n if (workspaces.length === 0) return [];\n const fs = await import('node:fs/promises');\n const wsNames = new Set(workspaces.map((w) => w.name));\n // realRoot -> {name, deps (realRoots)}\n const nodes = new Map<string, {name: string; deps: Set<string>}>();\n const realpath = async (p: string): Promise<string> => {\n try {\n return await fs.realpath(p);\n } catch {\n return path.resolve(p);\n }\n };\n\n const visit = async (root: string, json: any): Promise<string> => {\n const real = await realpath(root);\n if (nodes.has(real)) return real;\n const node = {name: json.name as string, deps: new Set<string>()};\n nodes.set(real, node);\n const names = new Set([\n ...Object.keys(json.dependencies ?? {}),\n ...Object.keys(json.peerDependencies ?? {}),\n ]);\n for (const dep of names) {\n const resolved = await readInstalledPkg(dep, real);\n if (resolved) node.deps.add(await visit(resolved.root, resolved.json));\n }\n return real;\n };\n\n // Seed: the app's direct deps, plus each workspace package's own deps.\n try {\n const appPkg = await fsExtra.readJson(path.join(cwd, 'package.json'));\n for (const dep of Object.keys({...appPkg.dependencies, ...appPkg.devDependencies})) {\n const resolved = await readInstalledPkg(dep, cwd);\n if (resolved) await visit(resolved.root, resolved.json);\n }\n } catch {}\n for (const ws of workspaces) {\n if (!ws.srcDir) continue;\n const root = path.dirname(ws.srcDir);\n try {\n await visit(root, await fsExtra.readJson(path.join(root, 'package.json')));\n } catch {}\n }\n\n // Walk reverse edges from every workspace node: everything reached depends on one.\n const dependentsOf = new Map<string, string[]>();\n for (const [key, node] of nodes) {\n for (const dep of node.deps) {\n if (!dependentsOf.has(dep)) dependentsOf.set(dep, []);\n dependentsOf.get(dep)!.push(key);\n }\n }\n const queue = [...nodes].filter(([, n]) => wsNames.has(n.name)).map(([k]) => k);\n const marked = new Set(queue);\n while (queue.length) {\n for (const parent of dependentsOf.get(queue.pop()!) ?? []) {\n if (!marked.has(parent)) {\n marked.add(parent);\n queue.push(parent);\n }\n }\n }\n const out = new Set<string>();\n for (const key of marked) {\n const name = nodes.get(key)!.name;\n if (name && !wsNames.has(name)) out.add(name);\n }\n return [...out].sort();\n}\n\n/**\n * Read a package root as a SOURCE install: `{name, srcDir}` iff it has a\n * package.json with a name and ships a `src/` dir. Published packages have only\n * `lib/` and are skipped — they resolve via their exports.\n */\nasync function readSourcePackage(root: string): Promise<WorkspaceEntry | null> {\n const pkgPath = path.join(root, 'package.json');\n if (!(await fsExtra.pathExists(pkgPath))) return null;\n const srcDir = path.join(root, 'src');\n if (!(await fsExtra.pathExists(srcDir))) return null;\n try {\n const json = await fsExtra.readJson(pkgPath);\n return json.name ? {name: json.name, srcDir} : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Linked packages installed as SOURCE, found by walking the app's\n * `dependencies` + `devDependencies` (and recursing through the `dependencies`\n * of each linked package found), keeping those marked `\"linkedPackage\": true`\n * — the same marker the CLI keys on (see cli-methods.ts) — and registering the\n * ones that ship `src/`.\n *\n * A dep ships `src/` when it is a symlinked workspace clone, a `link:`/`portal:`\n * dev install, or a LOCALIZED checkout (`packages-local/<pkg>`, in an app\n * not set up for localizing yet). That's what lets a STANDALONE app (not\n * itself a workspace root — e.g. a per-branch clone under /apps) resolve a\n * linked package's `.tsx` sources with extension probing, instead of falling\n * through to the package's\n * `development → ./src/*.ts` export (which misses `.tsx` like LinkedServer). A\n * prod/ejected app installs PUBLISHED packages (no `src/`) → not registered,\n * resolved via each package's `lib`.\n *\n * The marker — NOT the npm scope — drives discovery, so a user's own\n * custom-scope published linked package (e.g. `@acme/foo` with\n * `linkedPackage:true`) is picked up too, and linked packages present in\n * node_modules but not depended upon are ignored.\n *\n * Every root is REALPATHED before it is registered: `readInstalledPkg` returns\n * the `node_modules/<name>` symlink spelling, and Vite's resolver realpaths\n * every id it produces, so registering the symlink would give one file two\n * module ids — two instances of the same module.\n *\n * Shared by the Vite resolver table (`discoverWorkspaces`) and the `linked start`\n * HMR watch set, so the two cannot disagree about what is source.\n */\nexport async function discoverLinkedSourceDependencies(\n cwd: string = process.cwd(),\n): Promise<WorkspaceEntry[]> {\n const out: WorkspaceEntry[] = [];\n const seen = new Set<string>();\n // The walk is breadth-first and keyed on the installed directory; see\n // discoverInstalledLinkedPackages.\n for (const pkg of await discoverInstalledLinkedPackages(cwd)) {\n const entry = await readSourcePackage(pkg.realRoot);\n if (entry && !seen.has(entry.name)) {\n seen.add(entry.name);\n out.push(entry);\n }\n }\n return out;\n}\n\n/**\n * Walk the app's package.json `workspaces` field to build a lookup table\n * from npm name → absolute src/ directory. Used by the resolver plugin\n * to map bare specifiers like `@_linked/foo/bar` directly to source.\n *\n * Positive patterns are expanded by directory listing, so only a trailing `/*`\n * is honoured. NEGATED patterns (`\"!packages/core\"`) are honoured in full, with\n * npm's semantics — see ./workspace-globs.js. Skipping them would resolve a\n * package to an excluded directory that the package manager never installed\n * dependencies for.\n */\nexport async function discoverWorkspaces(\n extraGlobs: string[] = [],\n cwd: string = process.cwd(),\n): Promise<WorkspaceEntry[]> {\n const fs = await import('node:fs/promises');\n const out: WorkspaceEntry[] = [];\n const seen = new Set<string>();\n // Register a package root iff it ships a `src/` dir (source install).\n const addFromRoot = async (root: string): Promise<void> => {\n const entry = await readSourcePackage(root);\n if (!entry || seen.has(entry.name)) return;\n seen.add(entry.name);\n out.push(entry);\n };\n\n // 1. The app's own `workspaces` globs — the monorepo-root case (CN, or any app\n // that is itself a workspace root). Only trailing `/*` patterns.\n const pkgPath = path.join(cwd, 'package.json');\n if (await fsExtra.pathExists(pkgPath)) {\n const pkg = await fsExtra.readJson(pkgPath);\n // Merge the app's own `workspaces` globs with any caller-supplied\n // `workspaceGlobs` (e.g. `../lincd.org/modules/*`). Non-existent parents\n // are skipped below, so passing both nested + standalone layouts is safe.\n // Either list may carry negations, so they are parsed together.\n const {patterns, negatedPatterns} = parseWorkspacePatterns([\n ...(Array.isArray(pkg.workspaces) ? pkg.workspaces : pkg.workspaces?.packages ?? []),\n ...extraGlobs,\n ]);\n const addUnlessNegated = async (root: string): Promise<void> => {\n const rel = path.relative(cwd, root).split(path.sep).join('/');\n if (isWorkspacePathNegated(rel, negatedPatterns)) return;\n await addFromRoot(root);\n };\n for (const pattern of patterns) {\n const m = pattern.match(/^(.+?)\\/\\*$/);\n if (m) {\n const parent = path.join(cwd, m[1]);\n if (await fsExtra.pathExists(parent)) {\n for (const ent of await fs.readdir(parent, {withFileTypes: true})) {\n if (ent.isDirectory() || ent.isSymbolicLink()) {\n await addUnlessNegated(path.join(parent, ent.name));\n }\n }\n }\n } else {\n await addUnlessNegated(path.join(cwd, pattern));\n }\n }\n }\n\n // 2. Linked deps installed as source — including a localized checkout in an\n // app whose globs do not cover `packages-local/*` yet. Shared with the\n // `linked start` watch set; see discoverLinkedSourceDependencies above.\n // Glob entries win on a name clash.\n for (const entry of await discoverLinkedSourceDependencies(cwd)) {\n if (seen.has(entry.name)) continue;\n seen.add(entry.name);\n out.push(entry);\n }\n\n return out;\n}\n\nconst isFile = async (p: string): Promise<boolean> =>\n fsExtra\n .stat(p)\n .then((st) => st.isFile())\n .catch(() => false);\n\n/**\n * Map a `lib/esm` file back to its source under `srcDir`: `.js`/`.jsx` probe\n * `.tsx` then `.ts`, anything else (css, json, ...) is taken literally.\n */\nasync function libTargetToSource(\n srcDir: string,\n rel: string,\n): Promise<string | null> {\n if (/\\.jsx?$/.test(rel)) {\n const base = path.join(srcDir, rel.replace(/\\.jsx?$/, ''));\n for (const ext of ['.tsx', '.ts']) {\n if (await isFile(base + ext)) return base + ext;\n }\n return null;\n }\n const literal = path.join(srcDir, rel);\n return (await isFile(literal)) ? literal : null;\n}\n\n/**\n * The name-based lookup's fallback: resolve `subpath` (`.` or `./x/y`) through\n * the workspace's own `exports` under `import`/`default`, and map a\n * `./lib/esm/...` target to the same path under src. This is what reaches\n * source for a subpath whose export key does not match a file name\n * (`@_linked/translation/key-sync/node` -> `lib/esm/key-sync-node.js` ->\n * `src/key-sync-node.ts`), a directory subpath (`./conformance` ->\n * `lib/esm/conformance/index.js`), or a bare name whose src has no index.\n * Without it such a specifier falls through to Vite, which picks the package's\n * `lib/esm` copy while the rest of the package comes from src: two instances of\n * every module-level registry. It must not depend on a `development` -> src\n * condition, because src/ is not published and packages do not declare one.\n */\nasync function resolveViaWorkspaceExports(\n ws: WorkspaceEntry,\n subpath: string,\n): Promise<string | null> {\n let json: any;\n try {\n json = await fsExtra.readJson(path.join(path.dirname(ws.srcDir), 'package.json'));\n } catch {\n return null;\n }\n const target = resolveExportsSubpath(json, subpath, ['import', 'default']);\n if (!target || !target.startsWith('./lib/esm/')) return null;\n return libTargetToSource(ws.srcDir, target.slice('./lib/esm/'.length));\n}\n\n/**\n * Resolve a bare specifier like `@_linked/foo/bar`, `lincd-rdfs/Foo`, or\n * `pkg/utils/Bar.js` against the workspace lookup. Tries the file name first:\n * .tsx, .ts, then the literal file (for files that already include an\n * extension or for non-TS assets). When the name matches no file, falls back to\n * the workspace's `exports` map (see `resolveViaWorkspaceExports`). Returns null\n * when the specifier doesn't match any workspace package or no candidate exists\n * on disk.\n */\nexport async function resolveWorkspaceSpecifier(\n specifier: string,\n workspaces: WorkspaceEntry[],\n): Promise<string | null> {\n for (const ws of workspaces) {\n if (specifier === ws.name) {\n for (const ext of ['index.ts', 'index.tsx']) {\n const p = path.join(ws.srcDir, ext);\n if (await fsExtra.pathExists(p)) return p;\n }\n return resolveViaWorkspaceExports(ws, '.');\n }\n if (specifier.startsWith(ws.name + '/')) {\n const subpath = specifier.slice(ws.name.length + 1);\n // Strip .js/.jsx suffix — workspace src uses TS published-output\n // convention (./Sibling.js) but we want the TS source.\n const base = subpath.replace(/\\.jsx?$/, '');\n for (const ext of ['.tsx', '.ts']) {\n const p = path.join(ws.srcDir, base + ext);\n if (await fsExtra.pathExists(p)) return p;\n }\n // Files that already include an extension Vite handles (.css, .json,\n // .svg, etc.) — return the literal path under src. A FILE only: a\n // directory of the same name is a directory subpath, left to `exports`.\n const literal = path.join(ws.srcDir, subpath);\n if (await isFile(literal)) return literal;\n return resolveViaWorkspaceExports(ws, './' + subpath);\n }\n }\n return null;\n}\n\n/**\n * Packages whose entry `linked start` hands to `vite.ssrLoadModule` by name\n * (`@_linked/server/shapes/LinkedServer`, see `commands/start.ts`).\n *\n * Vite transforms an explicitly requested entry, and every file it reaches by\n * RELATIVE import, whether or not the package is external. The same package's\n * bare-specifier imports from anywhere else (the app's `src`, the storage\n * config) are externalized to Node. Left external, the package is split across\n * two loaders, and which copy a file ends up in depends on import order: a file\n * the module runner has already evaluated is reused, one it has not is loaded\n * by Node, and Node then loads that file's relative imports itself. Measured in\n * CN: `package.js` and `ontologies/lincd-server.js` evaluated once by each\n * loader, and `LocalFileStore.js` too once the package's `backend` was loaded.\n * Bundling the package makes Vite the only loader for it.\n */\nexport const SSR_ENTRY_PACKAGES = ['@_linked/server'];\n\n/**\n * `ssr.noExternal` for the dev SSR runner. With source workspaces, only those\n * package names are bundled by Vite; everything else in node_modules (including\n * published `@_linked/*`) is externalized to Node. Vite matches these entries\n * against the bare package name, so subpath imports (`pkg/shapes/Foo`) match too.\n * Installed packages that depend on a workspace (`dependents`, from\n * `workspaceDependents`) are bundled too, so they share the Vite-loaded workspace.\n * Standalone (no workspaces): the context-holding framework packages are bundled.\n * In both modes, `SSR_ENTRY_PACKAGES` are bundled.\n */\nexport function ssrNoExternal(\n workspaces: {name: string}[],\n dependents: string[] = [],\n): (string | RegExp)[] {\n if (workspaces.length === 0) {\n return [/^@_linked\\/server-utils$/, /^@_linked\\/react$/, ...SSR_ENTRY_PACKAGES];\n }\n return [...new Set([...workspaces.map((w) => w.name), ...dependents, ...SSR_ENTRY_PACKAGES])];\n}\n\n/**\n * Packages a STANDALONE app has always deduped, installed or not: the two that\n * hold React context the SSR tree must agree on. See the standalone `resolve`\n * block in `createViteConfig`.\n */\nconst STANDALONE_DEDUPE = ['@_linked/server-utils', '@_linked/react'];\n\n/**\n * Deduped in every mode when the app has them installed: one React for the\n * whole tree, whoever imports it. A workspace member's own `react` (an older\n * checkout, a package with a stale lockfile) would otherwise give hooks a\n * second dispatcher.\n */\nconst REACT_DEDUPE = ['react', 'react-dom'];\n\n/** `resolve.dedupe`: the standalone pair when standalone, then React where the app has it. */\nasync function dedupeFor(\n appRoot: string,\n isStandalone: boolean,\n): Promise<string[]> {\n const react: string[] = [];\n for (const name of REACT_DEDUPE) {\n if (await readInstalledPkg(name, appRoot)) react.push(name);\n }\n return [...(isStandalone ? STANDALONE_DEDUPE : []), ...react];\n}\n\n/**\n * The `process.env.*` values inlined into the browser bundle — and only there.\n * See the `environments.client.define` note in `createViteConfig` for why the\n * server environment must not receive them.\n */\nexport function clientDefine(\n opts: Pick<LinkedViteConfigOptions, 'define' | 'port'> = {},\n): Record<string, string> {\n return {\n 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'production'),\n 'process.env.SITE_ROOT': JSON.stringify(\n process.env.SITE_ROOT ?? `http://localhost:${process.env.PORT ?? opts.port ?? 4040}`,\n ),\n // The app's display name, so client components (e.g. the header) can read it\n // like the SSR <title> does (server-utils Html reads process.env.APP_NAME). The\n // browser has no `process`, so inline it; falls back to a generic label when\n // unset so a bare checkout never renders `undefined`.\n 'process.env.APP_NAME': JSON.stringify(process.env.APP_NAME ?? 'Linked App'),\n ...(opts.define ?? {}),\n };\n}\n\nexport function createViteConfig(opts: LinkedViteConfigOptions = {}): ReturnType<typeof defineConfig> {\n return defineConfig(async ({mode}) => {\n const isDev = mode === 'development';\n const workspaces = isDev ? await discoverWorkspaces(opts.workspaceGlobs) : [];\n // STANDALONE = dev mode with no source-shipping workspaces discovered\n // (an app installed from npm outside the monorepo — its `@_linked/*` /\n // `lincd-*` deps are lib-only). discoverWorkspaces() only registers\n // packages that ship `src/` on disk, so `length === 0` is the exact\n // standalone signal used elsewhere in this file. In WORKSPACE mode\n // (CN monorepo or its workspace-member clones) this is false and none\n // of the standalone-gated branches below apply.\n const isStandalone = isDev && workspaces.length === 0;\n\n // The app's published framework deps — excluded from Vite's dep-optimizer below\n // (`optimizeDeps.exclude`) so the browser's native ESM graph loads ONE copy of each.\n // Without the exclude, esbuild inlines a duplicate `@_linked/core` into each\n // per-subpath chunk (`@_linked_schema_shapes_Person.js`,\n // `@_linked_core_utils_LinkedStorage.js`, …), duplicating framework classes\n // (`Person` → `Person2`/`3`), so their shapes register under mangled URIs that no\n // longer match the backend's (one clean copy via Node). These packages are ESM with\n // no bare CJS runtime deps (e.g. `classnames` is inlined in `@_linked/react`), so\n // native-ESM serving needs no interop shim.\n const linkedDeps: string[] = [];\n if (isStandalone) {\n try {\n const appPkg = await fsExtra.readJson(path.join(process.cwd(), 'package.json'));\n const allDeps = {...appPkg.dependencies, ...appPkg.devDependencies};\n // A linked package by its own `linkedPackage` flag, not its scope.\n for (const name of Object.keys(allDeps)) {\n const installed = await readInstalledPkg(name, process.cwd());\n if (installed && isLinkedPackageJson(installed.json)) linkedDeps.push(name);\n }\n } catch {\n /* best-effort — no package.json is fine */\n }\n }\n const devPort = process.env.PORT ?? opts.port;\n const clientDepIncludes =\n isDev && opts.clientDepIncludes !== false && process.env.LINKED_CLIENT_DEP_INCLUDES !== '0';\n const config: UserConfig = {\n server: {\n port: opts.port ?? 4040,\n middlewareMode: true,\n // Unique HMR websocket port per app/worktree, derived from the dev port\n // and moved to a free one when taken — see `resolveHmrPort`. Apps can\n // still override this with their own `server.hmr` in mergeConfig.\n hmr: {port: isDev ? await resolveHmrPort({devPort}) : hmrPortFor(devPort)},\n },\n build: {\n outDir: opts.outDir ?? 'public/bundles',\n manifest: true,\n // Bump chunk-size warning so it doesn't fire on every build for\n // the linked vendor bundle. Real chunking happens via\n // manualChunks below.\n chunkSizeWarningLimit: 1000,\n rollupOptions: {\n input: opts.entry ?? 'src/index.tsx',\n output: {\n entryFileNames: 'assets/[name]-[hash].js',\n chunkFileNames: 'assets/[name]-[hash].js',\n assetFileNames: 'assets/[name]-[hash][extname]',\n manualChunks: chunkForModuleId,\n },\n },\n sourcemap: true,\n },\n plugins: [\n // Direct workspace specifier resolver.\n //\n // The package.json `\"./*\": { \"development\": \"./src/*.ts\" }` wildcard\n // can't express \"try .ts, fall back to .tsx\" (Node's exports spec\n // resolves to a single literal path). For React-heavy packages like\n // @_linked/primitives, @_linked/server-utils, and @_linked/auth,\n // most files are .tsx — the wildcard fails before any Vite plugin\n // gets a chance to fix it up.\n //\n // This plugin intercepts BARE workspace specifiers like\n // `@_linked/foo/bar` and `pkg-name/utils/Baz.js` BEFORE Vite's\n // package.json resolver runs, mapping them straight to source with\n // proper extension fallback (.tsx → .ts → literal). It also covers\n // the `./Sibling.js` published-output convention for imports made\n // from within workspace `src/` trees.\n isDev\n ? ({\n name: 'linked:resolve-workspace-ts',\n enforce: 'pre',\n async resolveId(id, importer) {\n if (id.startsWith('\\0')) return null;\n\n // Workspace-internal `./Sibling.js` → `.tsx` / `.ts` rewrite.\n if (\n importer &&\n // Vite's ids use `/`, on Windows too.\n /[\\\\/]packages[\\\\/]/.test(importer) &&\n /\\.(jsx?)$/.test(id) &&\n (id.startsWith('.') || path.isAbsolute(id))\n ) {\n const importerDir = path.dirname(importer);\n const base = path.resolve(importerDir, id);\n for (const ext of ['.tsx', '.ts']) {\n const candidate = base.replace(/\\.jsx?$/, ext);\n if (await fsExtra.pathExists(candidate)) return candidate;\n }\n }\n\n // Bare workspace specifier — resolve directly to src/.\n if (\n !id.startsWith('.') &&\n !path.isAbsolute(id) &&\n workspaces.length > 0\n ) {\n const resolved = await resolveWorkspaceSpecifier(id, workspaces);\n if (resolved) return resolved;\n }\n\n // STANDALONE (no workspaces): the linked packages are installed\n // from npm as lib-only (no `src`). We DON'T intercept them here —\n // instead the standalone `resolve.conditions` / `ssr.resolve.conditions`\n // (set on the config below, dropping Vite's `development` token)\n // let Vite's normal resolver pick each package's `import → lib/esm`\n // export. Bundling those lib files through the SSR runner works\n // (they're plain ESM); marking them external instead would leave a\n // bare specifier that `vite.ssrLoadModule` can't load\n // (\"Failed to load url @_linked/server/shapes/LinkedServer\").\n\n return null;\n },\n } as Plugin)\n : null,\n // Published lib JS: keep decorated shape classes named `Foo`, not the\n // `Foo2` Vite's esbuild re-prints would give them — see the plugin.\n pinCompiledClassNames(),\n react({\n babel: {\n parserOpts: {\n plugins: ['decorators-legacy', 'classProperties'],\n },\n },\n }),\n // Dev-only: log every file the watcher sees change. Without this,\n // backend edits look silent (no JS rebuild step, no Node restart)\n // and it's hard to tell whether\n // Vite picked up the change at all.\n isDev\n ? ({\n name: 'linked:reload-log',\n configureServer(server) {\n server.watcher.on('change', (file) => {\n const rel = file.replace(process.cwd() + '/', '');\n console.log(`[linked] reloaded ${rel}`);\n });\n },\n } as Plugin)\n : null,\n clientDepIncludes\n ? linkedClientDepIncludesPlugin({\n sourceWorkspaces: workspaces,\n deny: typeof opts.clientDepIncludes === 'object' ? opts.clientDepIncludes.deny : undefined,\n })\n : null,\n ...(opts.plugins ?? []),\n ].filter(Boolean) as Plugin[],\n css: {\n modules: {\n generateScopedName: isDev ? generateScopedName : generateScopedNameProduction,\n },\n postcss: opts.postcssPlugins\n ? {plugins: opts.postcssPlugins as any}\n : undefined,\n },\n esbuild: {\n tsconfigRaw: {\n compilerOptions: {\n experimentalDecorators: true,\n },\n },\n jsx: 'automatic',\n // A shape's IRI is built from its class name —\n // `getNodeShapeUri(packageName, constructor.name)` — so a minifier that\n // renames the class changes the shape's identity. In a production build\n // the client would ask the server for\n // `https://linked.cm/shape/server/za` while the server had registered\n // `.../BackendAPIStore`, and every Server.call on that shape 501'd.\n // The same mangling made registration report `Shape undefined does not\n // extend base class`.\n //\n // Vite honours this in the minifier only: its per-file TypeScript\n // transform and its define pass both run esbuild with keepNames off.\n // `pinCompiledClassNames` above covers what those passes rename.\n keepNames: true,\n },\n // STANDALONE resolve conditions.\n //\n // The published `@_linked/*` / `lincd-*` packages export\n // \"development\": \"./src/*.ts\", \"import\": \"./lib/esm/*.js\"\n // In dev, Vite expands its special `development|production` condition\n // token to `development`, so it resolves these to `./src/*.ts` — which\n // doesn't exist in a lib-only npm install → boot crash\n // (\"Failed to load @_linked/server/shapes/LinkedServer\").\n //\n // Dropping the dev/prod token from the condition list means Vite never\n // adds `development`; `import` (always appended last by Vite) wins, so\n // these packages resolve to `./lib/esm/*.js`. We start from Vite's\n // default SERVER conditions (`module`, `node`, `development|production`)\n // minus the dev/prod token. This governs BOTH the plugin pipeline\n // (`resolve.conditions`) and the SSR module runner used by\n // `ssrLoadModule('@_linked/server/shapes/LinkedServer')` in\n // commands/start.ts (`ssr.resolve.conditions`).\n //\n // WORKSPACE-GATED: only applied standalone. In monorepo dev the packages\n // ship `src`, and we WANT `development → src` for HMR — so we leave\n // conditions at Vite's defaults there (undefined = untouched), keeping\n // CN dev byte-for-byte unchanged.\n //\n // DEDUPE, standalone only: its two context-holding packages, even when\n // they are not found on disk, so the two `ssrLoadModule` loads\n // (LinkedServer + the app graph) resolve to ONE `server-utils`/`react`\n // instance — otherwise their `AppContext` objects differ and\n // `useAppContext()` returns null. Pairs with `ssr.noExternal` below.\n // Every mode also dedupes `react` and `react-dom` when the app has them\n // (`dedupeFor`). Localized checkouts need nothing more: they are\n // workspace members (`packages-local/*`), so npm links and dedupes them\n // like any other.\n resolve: {\n ...(isStandalone ? {conditions: ['module', 'node']} : {}),\n dedupe: await dedupeFor(process.cwd(), isStandalone),\n },\n // `ssr.external` is a minimal allowlist of\n // npm deps that genuinely can't (or shouldn't) go through Vite's\n // SSR transform. Workspace packages (`@_linked/*`, `lincd-*`) are\n // DELIBERATELY removed so Vite resolves them via each package's\n // `development → ./src/*.ts` conditional export and HMR works on\n // source changes.\n //\n // \"Multiple LINCD\" warnings may resurface during the interim until\n // LINCD eradication completes (accepted).\n ssr: {\n // NOTE: Vite's `ssr.external` only accepts exact package-name strings\n // (not regex). Standalone `@_linked/*` / `lincd-*` are NOT force-listed\n // here — they auto-externalize (or bundle) and resolve via the\n // standalone `import → lib/esm` conditions set below.\n external: [\n 'react',\n 'react-dom',\n 'react-dom/server',\n 'react-router-dom',\n 'scheduler',\n 'express',\n ],\n // Vite 7 auto-externalizes node_modules packages for SSR (loading them\n // via Node → the `import`→`lib/esm` condition), which would bypass the\n // `linked:resolve-workspace-ts` resolver and create a SECOND module\n // instance of each workspace package (breaking the single-`src`-instance\n // invariant — `LinkedStorage` state set on one instance, read on the\n // other → \"No query dispatch configured\"). Force the workspace packages\n // to be BUNDLED so they resolve via each package's `development → src`.\n //\n // WORKSPACE-GATED: only force-bundle when workspaces are actually\n // present (the monorepo / CN + CN's workspace-member clones, where the\n // `@_linked/*` packages have `src` on disk). A STANDALONE app (CLI-\n // created, no workspaces) installs `@_linked/*` from npm as lib-only —\n // those have NO `src`, so bundling them via the `development → src`\n // condition fails (\"Failed to load @_linked/server/shapes/LinkedServer\").\n // Leaving them EXTERNAL lets Node resolve `import → lib/esm`. Single-\n // instance is not a concern standalone (one node_modules copy each) and\n // core's query dispatch is global-backed regardless.\n // STANDALONE: force-bundle the framework packages that hold React context /\n // shared singletons the SSR tree must agree on — `server-utils` (`AppContext`,\n // read by `AppRoot`) and `react`. If left external, LinkedServer's\n // `AppContextProvider` and the app's `AppRoot` (`useAppContext`) can resolve to\n // DIFFERENT module instances → two `AppContext` objects → `useAppContext()` sees\n // no provider (null) → \"Cannot destructure 'isNativeApp'\" and a blank \"SSR timed\n // out\". Bundling makes them one instance in Vite's SSR module graph (matching how\n // workspace mode bundles everything). `fuseki` stays external; `server` is bundled\n // because `start` loads its entry through Vite (`SSR_ENTRY_PACKAGES`). Their native\n // dependencies (e.g. `sharp`) are separate packages and stay external either way.\n //\n // WORKSPACE: bundle ONLY the discovered source workspaces (they resolve to `src/`\n // for HMR). Published framework packages installed under node_modules (lib-only)\n // stay EXTERNAL, so Vite-loaded source and Node-native `import()` share Node's\n // single instance of them. Force-bundling every `@_linked/*` here made Vite\n // evaluate its own `@_linked/core` while `loadStores` (core) loaded a store such\n // as `@_linked/fuseki/shapes/FusekiStore` through native `import()`, which pulled\n // a SECOND Node-loaded core and split the shape registry. Installed packages\n // that depend on a workspace (e.g. published fuseki when core itself is a\n // workspace) are bundled too, so they import the Vite-loaded workspace. The one\n // published exception is `SSR_ENTRY_PACKAGES`, which Vite loads regardless.\n //\n // NOT DEV (a release build of the backend): nothing is force-bundled. The\n // compiled backend is loaded by Node next to the installed\n // `@_linked/server`, so every framework package has to stay a bare import\n // that resolves to that same node_modules copy. `workspaces` is always\n // empty here, and handing that to `ssrNoExternal` used to select the\n // standalone list — which compiled a private `server-utils` into `lib/`,\n // so no app provider was `instanceof` the server's `ShapeProvider` and\n // `LinkedServer` dropped them all (\"exports two generic backend providers\").\n noExternal: isDev ? ssrNoExternal(workspaces, await workspaceDependents(workspaces)) : [],\n // STANDALONE: the SSR module runner (`vite.ssrLoadModule`, used to\n // load LinkedServer + the app graph in commands/start.ts) has its OWN\n // condition list, defaulting to `resolve.conditions`. Set it\n // explicitly so `development` is excluded there too and the lib-only\n // packages resolve via `import → lib/esm`. Omitted (defaults kept) in\n // workspace mode so monorepo SSR still resolves `development → src`.\n ...(isStandalone\n ? {resolve: {conditions: ['module', 'node']}}\n : {}),\n },\n // Client-only, deliberately: these go on the `client` environment, not the\n // top-level `define`, because a top-level `define` is inherited by the SSR\n // environment too.\n //\n // The browser needs them. `@_linked/server-utils`'s `Server.ts` reads\n // `process.env.SITE_ROOT` to target the backend; the browser has no\n // `process`, and Vite (unlike a bundler's EnvironmentPlugin) doesn't\n // auto-inline `process.env.X`, so SITE_ROOT is defined here — always the\n // app's own origin, defaulted to `http://localhost:<port>` (an explicit\n // `SITE_ROOT` env, e.g. from `.env-cmdrc`, still wins). NODE_ENV is a\n // common client guard, so it is defined too.\n //\n // The server must NOT get them, for two reasons:\n // - it reads `process.env` at runtime, so an inlined build-time value is\n // wrong there (a release backend would carry the build machine's\n // SITE_ROOT rather than the deployment's);\n // - worse, every `define` key is a trigger. Vite's `vite:define` plugin\n // runs `esbuild.transform` — without `keepNames` — over any SSR module\n // whose text contains a key. esbuild renames the inner binding of a\n // tsc-emitted decorated class (`let LinkedServer = class LinkedServer`\n // becomes `class LinkedServer2`), and a shape's IRI is built from its\n // class name, so `@_linked/server`'s `LinkedServer` and `LincdAPI`\n // registered as `LinkedServer2` / `LincdAPI2` in dev. Without user keys\n // the SSR environment has none of its own (`keepProcessEnv` is on for\n // it), so nothing server-side is rewritten.\n //\n // Only these SPECIFIC tokens, never a whole-object `process.env`\n // replacement: in a client build Vite already maps any other\n // `process.env.X` to `{}.X` (undefined), which is what client code expects.\n //\n // Apps expose their OWN frontend env vars through the `define` option,\n // which lands here too:\n // createViteConfig({ define: {\n // 'process.env.MY_PUBLIC_KEY': JSON.stringify(process.env.MY_PUBLIC_KEY),\n // }})\n // (only reference PUBLIC vars in client code — a defined secret would be\n // inlined into the browser bundle). An app that puts a top-level `define`\n // in its own config reintroduces both problems for the server; use\n // `environments.client.define` there as well.\n environments: {\n client: {\n define: clientDefine(opts),\n },\n },\n // WORKSPACE mode: exclude the source-shipping workspace packages (@_linked/*,\n // lincd-*) from esbuild's dep pre-bundler. They resolve to `src/` via the\n // `linked:resolve-workspace-ts` plugin; in a workspace-member CLONE they'd\n // otherwise resolve via `node_modules` SYMLINKS and esbuild fails on their\n // subpath `exports` (\"No known conditions for ./shapes/SHACL …\").\n // STANDALONE mode: exclude the app's published linked deps (by their\n // `linkedPackage` flag; see `linkedDeps` above) from\n // esbuild's pre-bundler so the browser's native ESM graph loads ONE copy of\n // `@_linked/core` (no per-subpath duplication → stable class names → shape URIs\n // match the backend — see `linkedDeps` above). These packages are ESM with no\n // bare CJS runtime deps (e.g. `classnames` is inlined in `@_linked/react`), so\n // serving them as native ESM needs no interop shim.\n // An excluded package is not crawled, so its OWN third-party imports (Radix,\n // vaul, js-cookie…) are listed in `optimizeDeps.include` by the\n // `linked:client-dep-includes` plugin above, once the app's excludes are final.\n ...(workspaces.length > 0\n ? {optimizeDeps: {exclude: workspaces.map((w) => w.name)}}\n : isStandalone && linkedDeps.length > 0\n ? {optimizeDeps: {exclude: linkedDeps}}\n : {}),\n };\n\n // Tailwind plugin (only if explicitly enabled — adds a heavy plugin).\n if (opts.cssMode === 'tailwind') {\n // Try ESM dynamic import first (works when @tailwindcss/vite is\n // installed in the app or hoisted). Surface a CLEAR warning when\n // it's not — the app needs the dep for theme variables to load.\n try {\n const tailwind: any = await import('@tailwindcss/vite' as any);\n const tailwindPlugin = tailwind.default ?? tailwind;\n (config.plugins as Plugin[]).push(tailwindPlugin());\n } catch (err) {\n console.warn(\n '[createViteConfig] cssMode=tailwind but @tailwindcss/vite ' +\n 'could not be loaded. Theme variables won\\'t apply at runtime. ' +\n 'Add `@tailwindcss/vite` to your app\\'s package.json.',\n );\n }\n }\n\n return config;\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@_linked/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.1",
|
|
4
4
|
"packageManager": "npm@12.2.0",
|
|
5
5
|
"description": "Command line tools for the @_linked/* packages and apps",
|
|
6
6
|
"main": "lib/esm/index.js",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "rimraf ./lib && npm run build-esm && npm run copy-to-lib && npm run chmod-bin",
|
|
33
|
-
"chmod-bin": "
|
|
33
|
+
"chmod-bin": "node -e \"require('fs').chmodSync('lib/esm/launch.js', 0o755)\"",
|
|
34
34
|
"build-esm": "echo \"compiling ESM\" && rimraf ./lib/esm && tsc -p tsconfig-esm.json",
|
|
35
|
-
"copy-to-lib": "echo
|
|
35
|
+
"copy-to-lib": "echo Copying CSS assets to lib folder && copyfiles -u 1 \"src/**/*.css\" lib/esm",
|
|
36
36
|
"dev": "tsc -p tsconfig-esm.json -w",
|
|
37
37
|
"test": "npm run test:unit && npm run test:e2e",
|
|
38
38
|
"test:unit": "jest --config jest.config.cjs",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"files": [
|
|
66
66
|
"lib",
|
|
67
67
|
"defaults",
|
|
68
|
+
"hooks",
|
|
68
69
|
"README.md",
|
|
69
70
|
"CHANGELOG.md",
|
|
70
71
|
"LICENSE"
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { ManifestEntry } from './manifest.js';
|
|
2
|
-
import type { PruneOptions } from './prune.js';
|
|
3
|
-
import type { Deps } from './run.js';
|
|
4
|
-
/**
|
|
5
|
-
* `npm install --no-save` inside the checkout at `entry.path`, then prune it.
|
|
6
|
-
*
|
|
7
|
-
* `--no-save` keeps the checkout's tracked files out of it: npm installs what
|
|
8
|
-
* the committed lockfile says and writes neither `package.json` nor
|
|
9
|
-
* `package-lock.json` (only the gitignored hidden lockfile). Without it every
|
|
10
|
-
* relink left a lockfile diff in each checkout it reinstalled, written in the
|
|
11
|
-
* dialect of whichever npm was first on PATH -- measured: Node 22's bundled
|
|
12
|
-
* npm 10.9.9 drops every `"libc"` field an npm 12 lockfile records, and any
|
|
13
|
-
* npm syncs a lockfile header the release workflow bumped. Changing a
|
|
14
|
-
* checkout's dependencies is a deliberate `npm install <dep>` inside it.
|
|
15
|
-
*
|
|
16
|
-
* `--include=dev` because this runs from the app's npm lifecycle hooks, and
|
|
17
|
-
* npm exports the outer command's config to them as `npm_config_*`: measured,
|
|
18
|
-
* `npm install --omit=dev` at the app root arrives as `npm_config_omit=dev`,
|
|
19
|
-
* and an inner install that inherits it skips the checkout's
|
|
20
|
-
* devDependencies, so the checkout no longer builds. A checkout is a
|
|
21
|
-
* development copy; it always needs them.
|
|
22
|
-
*
|
|
23
|
-
* The package's name is read from the checkout's own `package.json`; the
|
|
24
|
-
* other localized packages (siblings) from the manifest, so a checkout being
|
|
25
|
-
* localized right now prunes before the manifest records it.
|
|
26
|
-
*
|
|
27
|
-
* @returns 0, or `EXIT_WARNED` when the prune failed (the install stands).
|
|
28
|
-
* @throws {LocalizeError} `EXIT_INSTALL_FAILED` when `npm install` fails.
|
|
29
|
-
*/
|
|
30
|
-
export declare function ensure(entry: Pick<ManifestEntry, 'path' | 'subdir' | 'prune'>, deps: Deps, opts?: PruneOptions): number;
|
|
31
|
-
/** `linked localize --reinstall <pkg>`: `ensure` for one recorded package. */
|
|
32
|
-
export declare function reinstall(name: string, opts: PruneOptions, deps: Deps): number;
|
|
33
|
-
/**
|
|
34
|
-
* The run-time check: remove every recorded checkout's own copy of what the
|
|
35
|
-
* app provides -- exactly what `pruneProvided` would remove, decided first
|
|
36
|
-
* without it, so the common case (nothing to remove, some copies kept) never
|
|
37
|
-
* reaches the prune.
|
|
38
|
-
*
|
|
39
|
-
* @returns what was removed, as `<checkout>/node_modules/<name>@<version>`.
|
|
40
|
-
*/
|
|
41
|
-
export declare function checkOneCopy(appRoot?: string, deps?: Pick<Deps, 'log' | 'warn'>): {
|
|
42
|
-
pruned: string[];
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=ensure.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ensure.d.ts","sourceRoot":"","sources":["../../../src/localize/ensure.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AASjD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,UAAU,CAAC;AAGnC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,EACvD,IAAI,EAAE,IAAI,EACV,IAAI,GAAE,YAAiB,GACtB,MAAM,CA4BR;AAED,8EAA8E;AAC9E,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,IAAI,GACT,MAAM,CAoBR;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,OAAO,GAAE,MAAsB,EAC/B,IAAI,GAAE,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,CAAwB,GACtD;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CAwCpB"}
|