@_linked/cli 1.35.0 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -2
- package/lib/esm/cli.js +4 -13
- package/lib/esm/cli.js.map +1 -1
- package/lib/esm/client-dep-includes.d.ts +1 -1
- package/lib/esm/client-dep-includes.js +2 -2
- package/lib/esm/client-dep-includes.js.map +1 -1
- package/lib/esm/commands/{doctor.d.ts → app-doctor.d.ts} +11 -5
- package/lib/esm/commands/app-doctor.d.ts.map +1 -0
- package/lib/esm/commands/{doctor.js → app-doctor.js} +26 -4
- package/lib/esm/commands/app-doctor.js.map +1 -0
- package/lib/esm/index.d.ts +0 -1
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/installed-packages.js +1 -1
- package/lib/esm/installed-packages.js.map +1 -1
- package/package.json +1 -1
- package/lib/esm/commands/doctor.d.ts.map +0 -1
- package/lib/esm/commands/doctor.js.map +0 -1
- package/lib/esm/commands/safe-yarn.d.ts +0 -13
- package/lib/esm/commands/safe-yarn.d.ts.map +0 -1
- package/lib/esm/commands/safe-yarn.js +0 -34
- package/lib/esm/commands/safe-yarn.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.36.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#196](https://github.com/linked-fw/cli/pull/196) [`dc311f2`](https://github.com/linked-fw/cli/commit/dc311f202784e93cf9357ec51e0c4497fa9cb521) Thanks [@flyon](https://github.com/flyon)! - **Renamed:** `linked doctor` is now `linked app-doctor` (no alias). It checks how an app uses
|
|
8
|
+
linked packages, so run outside an app (no `vite.config.{ts,js,mjs}`) it now says so and exits 1,
|
|
9
|
+
instead of reporting "0 warnings" for a directory it never checked.
|
|
10
|
+
|
|
11
|
+
**Removed:** the `linked yarn` command and the `safeYarn` export — the workspace is npm-only.
|
|
12
|
+
|
|
3
13
|
## 1.35.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -185,11 +185,10 @@ linked setup-publish --scope community # use NPM_AUTH_TOKEN_CM instead of N
|
|
|
185
185
|
linked start # run the dev server (app)
|
|
186
186
|
linked start --api-only # run only the backend API (no page rendering, no vite.config needed)
|
|
187
187
|
linked dev # file-watch rebuild (package)
|
|
188
|
-
linked yarn <args> # safe-yarn: run yarn at the workspace root, forwarding all args
|
|
189
188
|
```
|
|
190
189
|
|
|
191
190
|
```bash
|
|
192
|
-
linked doctor
|
|
191
|
+
linked app-doctor # in an app: check optimizeDeps.include and React peer ranges of linked packages' deps
|
|
193
192
|
```
|
|
194
193
|
|
|
195
194
|
`createViteConfig()` takes care of two things apps used to configure by hand:
|
package/lib/esm/cli.js
CHANGED
|
@@ -314,20 +314,11 @@ program
|
|
|
314
314
|
return runDelocalize(packages, options);
|
|
315
315
|
}));
|
|
316
316
|
program
|
|
317
|
-
.command('doctor')
|
|
318
|
-
.description("
|
|
317
|
+
.command('app-doctor')
|
|
318
|
+
.description("Run in an app. Checks how the app uses linked packages: Vite pre-bundle entries that don't resolve (and the fix), linked packages whose dependencies don't support the app's React version (and which to bump), and hand-written entries that are now generated and can be removed. Exits 1 if anything needs fixing.")
|
|
319
319
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
320
|
-
const {
|
|
321
|
-
return
|
|
322
|
-
}));
|
|
323
|
-
program
|
|
324
|
-
.command('yarn')
|
|
325
|
-
.description('Run yarn at the workspace root. Forwards all extra args to yarn.')
|
|
326
|
-
.allowUnknownOption(true)
|
|
327
|
-
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
328
|
-
const yarnArgs = program.args.slice(1); // drop 'yarn' itself
|
|
329
|
-
const { safeYarn } = yield import('./commands/safe-yarn.js');
|
|
330
|
-
return safeYarn(yarnArgs);
|
|
320
|
+
const { runAppDoctor } = yield import('./commands/app-doctor.js');
|
|
321
|
+
return runAppDoctor();
|
|
331
322
|
}));
|
|
332
323
|
program
|
|
333
324
|
.command('setup-publish')
|
package/lib/esm/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA,oHAAoH;AACpH,yCAAyC;;;;;;;;;;AAEzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,SAAS,EACT,eAAe,EACf,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,cAAc,EACd,cAAc,EACd,4BAA4B,EAC5B,wBAAwB,EACxB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EAET,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,4CAA4C;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAO,GAA2B,EAAiB,EAAE;IACzE,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GACX,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,eAAe,CAAC,CAAC;QAC5E,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC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AK,CAAC,GAAG,CAAC;KACV,KAAK,CAAC,KAAK,CAAC;KACZ,KAAK,CAAC,GAAG,CAAC;KACV,KAAK,CAAC,QAAQ,CAAC;KACf,WAAW,CACV,gLAAgL,CACjL;KACA,QAAQ,CAAC,QAAQ,EAAE,qDAAqD,CAAC;KACzE,QAAQ,CACP,WAAW,EACX,2DAA2D,CAC5D;KACA,QAAQ,CAAC,WAAW,EAAE,0CAA0C,CAAC,CAAC;AAErE,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE;IAC9C,YAAY,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env tsx\n//The line above calls the TSX typescript executer as runtime, which extends node.js and supports running typescript\n// see: https://www.npmjs.com/package/tsx\n\nimport chalk from 'chalk';\nimport {\n addCapacitor,\n buildAll,\n buildPackage,\n buildUpdated,\n checkImports,\n compilePackage,\n createApp,\n createComponent,\n createOntology,\n createPackage,\n createSetComponent,\n createShape,\n depCheck,\n depCheckStaged,\n developPackage,\n executeCommandForEachPackage,\n executeCommandForPackage,\n getLincdPackages,\n getScriptDir,\n publishPackage,\n publishUpdated,\n register,\n runMethod,\n runScript,\n startServer,\n upgradePackages,\n} from './cli-methods.js';\n// import {buildMetadata} from './metadata';\nimport {program} from 'commander';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport 'require-extensions';\n\n/**\n * Run an async command action and report a failure the way the rest of this\n * CLI does — one red message and exit code 1 — instead of letting the rejection\n * escape the action and print a raw unhandled-rejection stack.\n */\nconst runAppCommand = async (run: () => Promise<unknown>): Promise<void> => {\n try {\n await run();\n } catch (error) {\n const message =\n error instanceof Error ? error.message : String(error ?? 'Unknown error');\n console.error(chalk.red(message));\n if (process.env.LINKED_DEBUG && error instanceof Error && error.stack) {\n console.error(error.stack);\n }\n process.exitCode = 1;\n }\n};\n\n/** `--env a,b` → `['a', 'b']`. */\nconst splitEnvOption = (value?: string): string[] =>\n (value || '')\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean);\n\nprogram\n .command('create-app')\n .action((name, options) => {\n return createApp(name, process.cwd(), {\n appName: options.appName,\n appPrefix: options.appPrefix,\n appDomain: options.appDomain,\n skipInstall: options.skipInstall,\n template: options.template,\n }).catch((err) => {\n // Report and fail the process without cutting off pending output.\n console.error(chalk.red(err?.message ?? String(err)));\n process.exitCode = 1;\n });\n })\n .description(\n 'Creates a new folder with all the required files for a Linked app',\n )\n .argument(\n '<name>',\n 'the name of your Linked app. To use spaces, wrap the name in double quotes.',\n )\n .option('--app-name <name>', 'Display name for the app (skip interactive prompt)')\n .option('--app-prefix <prefix>', 'Short code prefix for data files (skip interactive prompt)')\n .option('--app-domain <domain>', 'Domain for the app (skip interactive prompt)')\n .option('--skip-install', 'Skip running npm install after scaffolding')\n .option(\n '--template <template>',\n 'App template: \"web\" (default) or \"react-native\"',\n );\n\nprogram\n .command('start')\n .action(async (options) => {\n const {startWithVite} = await import('./commands/start.js');\n return startWithVite({env: options?.env, apiOnly: options?.apiOnly});\n })\n .option('--env <env>', 'The node environment to use. Default is \"development\"')\n .option(\n '--api-only',\n 'Serve only the backend API: no vite.config, src/App.tsx or src/routes.tsx needed; page requests get a 404',\n )\n .description(\n 'Start the Linked dev server. Vite-backed by default.',\n );\n\nprogram\n .command('call')\n .action((packageName, method, options) => {\n return runMethod(packageName, method, {spawn: options.spawn});\n })\n .option(\n '--spawn',\n 'Start a new server instance instead of using an existing one',\n )\n .option('--env', 'The node environment to use. Default is \"development\"')\n .description(\n 'Start the Linked node.js server but without http server. Instead it immediately calls the specified method of the specified package and exits afterwards',\n )\n .argument(\n '<package>',\n 'the package of the backend provider that contains this method',\n )\n .argument('<method>', 'the name of the method you want to call');\n\nprogram\n .command('script')\n .action((scriptName, options) => {\n return runScript(scriptName, {spawn: options.spawn});\n })\n .option(\n '--spawn',\n 'Start a new server instance instead of using an existing one',\n )\n .option('--env', 'The node environment to use. Default is \"development\"')\n .description(\n 'Start the Linked node.js server but without http server. Instead it immediately runs the specified script and exits afterwards',\n )\n .argument(\n '<scriptName>',\n 'the name of the script file inside the /scripts folder',\n );\n\nprogram\n .command('create-package')\n .action((name, uriBase) => {\n return createPackage(name, uriBase);\n })\n .description(\n 'Create a new folder with all the required files for a new Linked package',\n )\n .argument(\n '<name>',\n 'The name of the package. Will be used as package name in package.json',\n )\n .argument(\n '[uri_base]',\n 'The base URL used for data of this package. Leave blank to use the URL of your package on lincd.org after you register it',\n );\n\nprogram\n .command('upgrade-packages')\n .action(() => {\n return upgradePackages();\n })\n .description(\n 'Upgrade all linked packages in the workspace to ESM/CJS dual packages',\n );\n\nprogram\n .command('create-shape')\n .action((name, uriBase) => {\n return createShape(name);\n })\n .description(\n 'Creates a new ShapeClass file for your package. Execute this from your package folder.',\n )\n .argument(\n '<name>',\n 'The name of the shape. Will be used for the file name and the class name',\n );\n\nprogram\n .command('create-component')\n .action((name, uriBase) => {\n return createComponent(name);\n })\n .description(\n 'Creates a new Component file for your package. Execute this from your package folder.',\n )\n .argument(\n '<name>',\n 'The name of the component. Will be used for the file name and the export name',\n );\n\nprogram\n .command('create-set-component')\n .action((name, uriBase) => {\n return createSetComponent(name);\n })\n .description(\n 'Creates a new SetComponent file for your package. Execute this from your package folder.',\n )\n .argument(\n '<name>',\n 'The name of the component. Will be used for the file name and the export name',\n );\n\nprogram\n .command('create-ontology')\n .action((prefix, uriBase) => {\n return createOntology(prefix, uriBase);\n })\n .description(\n 'Creates a new ontology file for your package. Execute this from your package folder.',\n )\n .argument(\n '<suggested-prefix>',\n 'The suggested prefix for your ontology. Also the shorthand code used for the file name and the exported ontology object',\n )\n .argument(\n '[uribase]',\n \"Optional argument to set the URI base for the URI's of all entities in your ontology. Leave blank to use the URI's provided by lincd.org once you register this package\",\n );\n\nprogram.command('app [action]', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-local', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-dev', {hidden: true}).action(() => {\n register('https://dev-registry.lincd.org');\n});\nprogram\n .command('register')\n .action(() => {\n register('https://registry.lincd.org');\n })\n .description(\n 'Register (a new version of) this package to the Linked registry. If successful your package will appear on linked.cm',\n );\n\nprogram\n .command('info')\n .action(() => {\n let localDir = getScriptDir();\n let packageJsonPath = path.join(localDir, 'package.json');\n try {\n var ownPackage = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n } catch (e) {\n console.warn(\n 'Could not read package.json at ' + packageJsonPath + ': ' + e,\n );\n process.exit();\n }\n console.log(ownPackage.version);\n console.log('Running from: ' + localDir);\n })\n .description(\n \"Log the version of this tool and the path that it's running from\",\n );\n\nprogram\n .command('build [target] [target2]', {isDefault: true})\n .action(async (target, target2, options) => {\n const result = await buildPackage(target, target2, process.cwd(), !options?.silent);\n if (result !== true) {\n process.exitCode = 1;\n }\n })\n .option(\n '--silent',\n 'No output to console unless errors occur. The exit code is unaffected: 0 when the build succeeds (warnings included), 1 when it fails',\n );\n\nprogram\n .command('compile-only')\n .action(() => {\n compilePackage();\n })\n .description(\n 'Compile the package without other build steps. Run this command from the package folder',\n );\nprogram.command('build-metadata').action(() => {\n console.log('Needs to be reimplemented');\n // buildMetadata();\n});\nprogram\n .command('build-app')\n .action(async (options) => {\n // Vite is the only app build. An app without a `vite.config.{ts,js,mjs}`\n // is rejected by name rather than falling back to anything.\n await runAppCommand(async () => {\n const {assertViteApp, buildViteApp} = await import(\n './commands/build-app.js'\n );\n assertViteApp();\n await buildViteApp({\n environmentNames: splitEnvOption(options?.env),\n target: options?.target,\n publish: options?.publish === true,\n revision: options?.revision,\n allowDirty: options?.allowDirty === true,\n });\n });\n })\n .option('--env <env>', 'The node environment to use. Default is \"development\"')\n .option('--target <target>', 'Build target: web or capacitor')\n .option(\n '--publish',\n 'Upload the release after a successful web build (off by default; use `linked publish-app`)',\n )\n .option(\n '--revision <sha>',\n 'Revision identifying the release. Defaults to LINKED_RELEASE_REVISION, GITHUB_SHA, then git HEAD',\n )\n .option(\n '--allow-dirty',\n 'Build from a working tree with uncommitted changes; the release revision gets a \"-dirty\" suffix',\n )\n .description(\n 'Build the linked app frontend and backend for production, and write a release manifest. Requires a vite.config in the app root.',\n );\n\nprogram\n .command('publish-app')\n .option('--env <env>', 'The node environment to use')\n .option(\n '--manifest <path>',\n 'Release manifest to publish, relative to the app root. Default public/bundles/linked-release.json',\n )\n .option('--yes', 'Upload the verified release. Without it this is a dry run')\n .action(async (options) => {\n // Retry or inspect an existing release without rebuilding the app.\n await runAppCommand(async () => {\n const {ensureEnvironmentLoaded} = await import('./lifecycle.js');\n const {resolveAppAssetsStore} = await import(\n './app-release/app-assets-store.js'\n );\n const {publishApp} = await import('./commands/publish-app.js');\n await ensureEnvironmentLoaded(splitEnvOption(options?.env));\n // The store is resolved by publishApp, after the manifest is read.\n await publishApp({\n manifestPath: options?.manifest,\n resolveStore: () => resolveAppAssetsStore(),\n yes: options?.yes === true,\n });\n });\n })\n .description(\n 'Validate or retry publishing a previously built release. Defaults to dry run.',\n );\n\nprogram\n .command('serve-app')\n .option('--env <env>', 'The node environment to use')\n .action(async (options) => {\n // Production runtime loads compiled output and never starts Vite/HMR.\n await runAppCommand(async () => {\n const {serveCompiledApp} = await import('./commands/serve-app.js');\n await serveCompiledApp({environmentNames: splitEnvOption(options?.env)});\n });\n })\n .description('Start a compiled Linked app without Vite or HMR.');\n\nprogram.command('publish-updated').action(() => {\n return publishUpdated();\n});\nprogram.command('publish [version]').action((version) => {\n publishPackage(null, false, null, version);\n});\n\nprogram.command('status').action(() => {\n //log which packages need to be published\n return publishUpdated(true).then(() => {\n //log which packages need to be build\n return buildUpdated(undefined, '', '', true);\n });\n});\nprogram\n .command('build-updated [target] [target2]')\n .action((target, target2, options) => {\n const {useGit}: {useGit?: boolean} = options;\n return buildUpdated(1, target, target2, useGit || false);\n })\n .option(\n '--use-git',\n 'Use git commit timestamps to check which packages have been updated since the last build',\n );\nprogram\n .command('build-updated-since [num-commits-back] [target] [target2]')\n .action((back, target, target2) => {\n return buildUpdated(back, target, target2);\n });\nprogram\n .command('build-all')\n .action((options) => {\n buildAll(options);\n })\n .option(\n '--sync',\n 'build each package 1 by 1 - use this if you have build issues due to low available RAM memory',\n )\n .option('--from <char>', 'start from a specific package');\n\nprogram\n .command('build-workspace')\n .description(\n 'Build all linked packages in the current workspace in dependency order',\n )\n .option('-u, --updated', 'Only build updated packages')\n .option(\n '--use-git',\n 'Use git commit timestamps to determine which packages need updating',\n )\n .action(async (options) => {\n if (options.updated) {\n return buildUpdated(1, undefined, undefined, !!options.useGit);\n }\n return buildAll(options);\n });\n\nprogram\n .command('build-package <filepath>')\n .description(\n 'Given a file path, find its package.json and rebuild that package. Use for editor save hooks.',\n )\n .action(async (filepath) => {\n const {buildPackageByPath} = await import(\n './commands/build-package.js'\n );\n return buildPackageByPath(filepath);\n });\n\nprogram\n .command('localize [packages...]')\n .description(\n 'Develop an npm dependency from a git checkout: clone it, install inside the checkout, build it and symlink it into node_modules — without touching package.json or package-lock.json. Name packages exactly as npm names them (@_linked/rdfs, lodash); the repository is read from the published `repository` field. With no names, reports what is localized.',\n )\n .option('--list', 'Report what is localized rather than localizing anything.')\n .option(\n '--check',\n 'With --list: exit 1 when something recorded is not actually linked.',\n )\n .option(\n '--relink',\n 'Recreate the recorded symlinks. This is what a postinstall runs.',\n )\n .option('--dir <path>', 'Where checkouts live (default: packages-local).')\n .option(\n '--repo <git-url>',\n 'Clone this instead of the published repository, and record it.',\n )\n .option(\n '--subdir <path>',\n \"The package's directory inside the repository (monorepos).\",\n )\n .option(\n '--build <cmd>',\n 'Run this in the checkout after installing; a failure only warns. Defaults to `linked build`; pass an empty string to build nothing.',\n )\n .option(\n '--force',\n 'Overwrite a symlink pointing outside the checkout directory.',\n )\n .action(async (packages: string[], options) => {\n const {runLocalize} = await import('./commands/localize.js');\n return runLocalize(packages, options);\n });\n\nprogram\n .command('delocalize [packages...]')\n .description(\n 'Undo localize: unlink the packages and forget them, keeping the checkout. With no names, undoes every localized package.',\n )\n .option('--purge', 'Also delete the checkout.')\n .option('--force', 'With --purge, delete even a checkout localize refuses.')\n .action(async (packages: string[], options) => {\n const {runDelocalize} = await import('./commands/localize.js');\n return runDelocalize(packages, options);\n });\n\nprogram\n .command('doctor')\n .description(\n \"Check the app's dev dependency setup: optimizeDeps.include entries that do not resolve, and linked packages whose dependencies' React peer range excludes the app's React. Exits 1 on a warning.\",\n )\n .action(async () => {\n const {runDoctor} = await import('./commands/doctor.js');\n return runDoctor();\n });\n\nprogram\n .command('yarn')\n .description(\n 'Run yarn at the workspace root. Forwards all extra args to yarn.',\n )\n .allowUnknownOption(true)\n .action(async () => {\n const yarnArgs = program.args.slice(1); // drop 'yarn' itself\n const {safeYarn} = await import('./commands/safe-yarn.js');\n return safeYarn(yarnArgs);\n });\n\nprogram\n .command('setup-publish')\n .description(\n \"Set up the changesets publish pipeline in the current package repo. Writes the pr.yml/publish.yml callers of the shared workflows in the repo's own org .github repo, changesets config, .gitignore entries, and patches package.json.\",\n )\n .option(\n '--configure-github',\n 'Also apply the uniform branch protection on main and enable auto-merge (requires gh CLI installed and authenticated).',\n )\n .option(\n '--dual-branch',\n 'Deprecated and ignored: the main + dev flow and its @next prereleases are retired. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--scope <scope>',\n 'Deprecated and ignored: the npm secret is NPM_AUTH_TOKEN in every org, holding that org\\'s own token. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--grant-team <slug>',\n 'GitHub team slug to grant push access on the repo. Requires gh CLI.',\n )\n .action(async (options) => {\n const {setupPublish} = await import('./commands/setup-publish.js');\n await setupPublish({\n configureGithub: !!options.configureGithub,\n dualBranch: !!options.dualBranch,\n scope: options.scope,\n grantTeam: options.grantTeam,\n });\n });\n\nprogram\n .command('all [action] [filter] [filter-value]')\n .action((command, filter, filterValue) => {\n executeCommandForEachPackage(\n getLincdPackages(),\n command,\n filter,\n filterValue,\n );\n });\n// program.command('all-except [excludedSpaces] [action]').action((excludedSpaces, command) => {\n// executeCommandForEachModule(getLincdModules(), command, null, excludedSpaces);\n// });\n\nprogram.command('dev [target] [mode]').action((target, mode) => {\n developPackage(target, mode);\n});\n\nprogram.command('depcheck').action((target, mode) => {\n depCheck();\n});\nprogram.command('depcheck-staged').action((target, mode) => {\n depCheckStaged();\n});\nprogram\n .command('check-imports')\n .description(\n 'Check the imports of the package in the current folder. Exits 1 when an invalid import is found',\n )\n .action(async () => {\n try {\n await checkImports();\n } catch (report) {\n // checkImports throws the formatted report of every invalid import.\n console.error(typeof report === 'string' ? report : String(report));\n process.exitCode = 1;\n }\n });\n\nprogram\n .command('package')\n .action((name, command, args: string[]) => {\n let fullCommand = command\n ? command +\n ' ' +\n args\n .slice(0, 3)\n .filter((a) => a && true)\n .join(' ')\n : null;\n\n //TODO: call\n // let pkgName = process.argv[1];\n // console.log(pkgName);\n // let restArgs = process.argv.slice(2)\n // program.parse([],{from:'user'});\n // program.parse(['--port', '80'], { from: 'user' })\n\n executeCommandForPackage(name, fullCommand);\n })\n .alias('p')\n .alias('pkg')\n .alias('m')\n .alias('module')\n .description(\n 'Searches for a package in this workspace with a partially matching name and executes a command for that package (without needing to execute it from the folder of the package)',\n )\n .argument('<name>', 'the name of the package. Can be a part of the name.')\n .argument(\n '[command]',\n 'the linked command you want to execute. Like dev or build',\n )\n .argument('[args...]', 'the additional arguments of that command');\n\nprogram.command('enable-capacitor').action(() => {\n addCapacitor();\n});\n\nprogram.parse(process.argv);\n"]}
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA,oHAAoH;AACpH,yCAAyC;;;;;;;;;;AAEzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,SAAS,EACT,eAAe,EACf,cAAc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,OAAO;QACvB,CAAC,CAAC,OAAO;YACP,GAAG;YACH,IAAI;iBACD,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;iBACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;iBACxB,IAAI,CAAC,GAAG,CAAC;QACd,CAAC,CAAC,IAAI,CAAC;IAET,YAAY;IACZ,iCAAiC;IACjC,wBAAwB;IACxB,uCAAuC;IACvC,mCAAmC;IACnC,oDAAoD;IAEpD,wBAAwB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAC9C,CAAC,CAAC;KACD,KAAK,CAAC,GAAG,CAAC;KACV,KAAK,CAAC,KAAK,CAAC;KACZ,KAAK,CAAC,GAAG,CAAC;KACV,KAAK,CAAC,QAAQ,CAAC;KACf,WAAW,CACV,gLAAgL,CACjL;KACA,QAAQ,CAAC,QAAQ,EAAE,qDAAqD,CAAC;KACzE,QAAQ,CACP,WAAW,EACX,2DAA2D,CAC5D;KACA,QAAQ,CAAC,WAAW,EAAE,0CAA0C,CAAC,CAAC;AAErE,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE;IAC9C,YAAY,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env tsx\n//The line above calls the TSX typescript executer as runtime, which extends node.js and supports running typescript\n// see: https://www.npmjs.com/package/tsx\n\nimport chalk from 'chalk';\nimport {\n addCapacitor,\n buildAll,\n buildPackage,\n buildUpdated,\n checkImports,\n compilePackage,\n createApp,\n createComponent,\n createOntology,\n createPackage,\n createSetComponent,\n createShape,\n depCheck,\n depCheckStaged,\n developPackage,\n executeCommandForEachPackage,\n executeCommandForPackage,\n getLincdPackages,\n getScriptDir,\n publishPackage,\n publishUpdated,\n register,\n runMethod,\n runScript,\n startServer,\n upgradePackages,\n} from './cli-methods.js';\n// import {buildMetadata} from './metadata';\nimport {program} from 'commander';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport 'require-extensions';\n\n/**\n * Run an async command action and report a failure the way the rest of this\n * CLI does — one red message and exit code 1 — instead of letting the rejection\n * escape the action and print a raw unhandled-rejection stack.\n */\nconst runAppCommand = async (run: () => Promise<unknown>): Promise<void> => {\n try {\n await run();\n } catch (error) {\n const message =\n error instanceof Error ? error.message : String(error ?? 'Unknown error');\n console.error(chalk.red(message));\n if (process.env.LINKED_DEBUG && error instanceof Error && error.stack) {\n console.error(error.stack);\n }\n process.exitCode = 1;\n }\n};\n\n/** `--env a,b` → `['a', 'b']`. */\nconst splitEnvOption = (value?: string): string[] =>\n (value || '')\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean);\n\nprogram\n .command('create-app')\n .action((name, options) => {\n return createApp(name, process.cwd(), {\n appName: options.appName,\n appPrefix: options.appPrefix,\n appDomain: options.appDomain,\n skipInstall: options.skipInstall,\n template: options.template,\n }).catch((err) => {\n // Report and fail the process without cutting off pending output.\n console.error(chalk.red(err?.message ?? String(err)));\n process.exitCode = 1;\n });\n })\n .description(\n 'Creates a new folder with all the required files for a Linked app',\n )\n .argument(\n '<name>',\n 'the name of your Linked app. To use spaces, wrap the name in double quotes.',\n )\n .option('--app-name <name>', 'Display name for the app (skip interactive prompt)')\n .option('--app-prefix <prefix>', 'Short code prefix for data files (skip interactive prompt)')\n .option('--app-domain <domain>', 'Domain for the app (skip interactive prompt)')\n .option('--skip-install', 'Skip running npm install after scaffolding')\n .option(\n '--template <template>',\n 'App template: \"web\" (default) or \"react-native\"',\n );\n\nprogram\n .command('start')\n .action(async (options) => {\n const {startWithVite} = await import('./commands/start.js');\n return startWithVite({env: options?.env, apiOnly: options?.apiOnly});\n })\n .option('--env <env>', 'The node environment to use. Default is \"development\"')\n .option(\n '--api-only',\n 'Serve only the backend API: no vite.config, src/App.tsx or src/routes.tsx needed; page requests get a 404',\n )\n .description(\n 'Start the Linked dev server. Vite-backed by default.',\n );\n\nprogram\n .command('call')\n .action((packageName, method, options) => {\n return runMethod(packageName, method, {spawn: options.spawn});\n })\n .option(\n '--spawn',\n 'Start a new server instance instead of using an existing one',\n )\n .option('--env', 'The node environment to use. Default is \"development\"')\n .description(\n 'Start the Linked node.js server but without http server. Instead it immediately calls the specified method of the specified package and exits afterwards',\n )\n .argument(\n '<package>',\n 'the package of the backend provider that contains this method',\n )\n .argument('<method>', 'the name of the method you want to call');\n\nprogram\n .command('script')\n .action((scriptName, options) => {\n return runScript(scriptName, {spawn: options.spawn});\n })\n .option(\n '--spawn',\n 'Start a new server instance instead of using an existing one',\n )\n .option('--env', 'The node environment to use. Default is \"development\"')\n .description(\n 'Start the Linked node.js server but without http server. Instead it immediately runs the specified script and exits afterwards',\n )\n .argument(\n '<scriptName>',\n 'the name of the script file inside the /scripts folder',\n );\n\nprogram\n .command('create-package')\n .action((name, uriBase) => {\n return createPackage(name, uriBase);\n })\n .description(\n 'Create a new folder with all the required files for a new Linked package',\n )\n .argument(\n '<name>',\n 'The name of the package. Will be used as package name in package.json',\n )\n .argument(\n '[uri_base]',\n 'The base URL used for data of this package. Leave blank to use the URL of your package on lincd.org after you register it',\n );\n\nprogram\n .command('upgrade-packages')\n .action(() => {\n return upgradePackages();\n })\n .description(\n 'Upgrade all linked packages in the workspace to ESM/CJS dual packages',\n );\n\nprogram\n .command('create-shape')\n .action((name, uriBase) => {\n return createShape(name);\n })\n .description(\n 'Creates a new ShapeClass file for your package. Execute this from your package folder.',\n )\n .argument(\n '<name>',\n 'The name of the shape. Will be used for the file name and the class name',\n );\n\nprogram\n .command('create-component')\n .action((name, uriBase) => {\n return createComponent(name);\n })\n .description(\n 'Creates a new Component file for your package. Execute this from your package folder.',\n )\n .argument(\n '<name>',\n 'The name of the component. Will be used for the file name and the export name',\n );\n\nprogram\n .command('create-set-component')\n .action((name, uriBase) => {\n return createSetComponent(name);\n })\n .description(\n 'Creates a new SetComponent file for your package. Execute this from your package folder.',\n )\n .argument(\n '<name>',\n 'The name of the component. Will be used for the file name and the export name',\n );\n\nprogram\n .command('create-ontology')\n .action((prefix, uriBase) => {\n return createOntology(prefix, uriBase);\n })\n .description(\n 'Creates a new ontology file for your package. Execute this from your package folder.',\n )\n .argument(\n '<suggested-prefix>',\n 'The suggested prefix for your ontology. Also the shorthand code used for the file name and the exported ontology object',\n )\n .argument(\n '[uribase]',\n \"Optional argument to set the URI base for the URI's of all entities in your ontology. Leave blank to use the URI's provided by lincd.org once you register this package\",\n );\n\nprogram.command('app [action]', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-local', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-dev', {hidden: true}).action(() => {\n register('https://dev-registry.lincd.org');\n});\nprogram\n .command('register')\n .action(() => {\n register('https://registry.lincd.org');\n })\n .description(\n 'Register (a new version of) this package to the Linked registry. If successful your package will appear on linked.cm',\n );\n\nprogram\n .command('info')\n .action(() => {\n let localDir = getScriptDir();\n let packageJsonPath = path.join(localDir, 'package.json');\n try {\n var ownPackage = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n } catch (e) {\n console.warn(\n 'Could not read package.json at ' + packageJsonPath + ': ' + e,\n );\n process.exit();\n }\n console.log(ownPackage.version);\n console.log('Running from: ' + localDir);\n })\n .description(\n \"Log the version of this tool and the path that it's running from\",\n );\n\nprogram\n .command('build [target] [target2]', {isDefault: true})\n .action(async (target, target2, options) => {\n const result = await buildPackage(target, target2, process.cwd(), !options?.silent);\n if (result !== true) {\n process.exitCode = 1;\n }\n })\n .option(\n '--silent',\n 'No output to console unless errors occur. The exit code is unaffected: 0 when the build succeeds (warnings included), 1 when it fails',\n );\n\nprogram\n .command('compile-only')\n .action(() => {\n compilePackage();\n })\n .description(\n 'Compile the package without other build steps. Run this command from the package folder',\n );\nprogram.command('build-metadata').action(() => {\n console.log('Needs to be reimplemented');\n // buildMetadata();\n});\nprogram\n .command('build-app')\n .action(async (options) => {\n // Vite is the only app build. An app without a `vite.config.{ts,js,mjs}`\n // is rejected by name rather than falling back to anything.\n await runAppCommand(async () => {\n const {assertViteApp, buildViteApp} = await import(\n './commands/build-app.js'\n );\n assertViteApp();\n await buildViteApp({\n environmentNames: splitEnvOption(options?.env),\n target: options?.target,\n publish: options?.publish === true,\n revision: options?.revision,\n allowDirty: options?.allowDirty === true,\n });\n });\n })\n .option('--env <env>', 'The node environment to use. Default is \"development\"')\n .option('--target <target>', 'Build target: web or capacitor')\n .option(\n '--publish',\n 'Upload the release after a successful web build (off by default; use `linked publish-app`)',\n )\n .option(\n '--revision <sha>',\n 'Revision identifying the release. Defaults to LINKED_RELEASE_REVISION, GITHUB_SHA, then git HEAD',\n )\n .option(\n '--allow-dirty',\n 'Build from a working tree with uncommitted changes; the release revision gets a \"-dirty\" suffix',\n )\n .description(\n 'Build the linked app frontend and backend for production, and write a release manifest. Requires a vite.config in the app root.',\n );\n\nprogram\n .command('publish-app')\n .option('--env <env>', 'The node environment to use')\n .option(\n '--manifest <path>',\n 'Release manifest to publish, relative to the app root. Default public/bundles/linked-release.json',\n )\n .option('--yes', 'Upload the verified release. Without it this is a dry run')\n .action(async (options) => {\n // Retry or inspect an existing release without rebuilding the app.\n await runAppCommand(async () => {\n const {ensureEnvironmentLoaded} = await import('./lifecycle.js');\n const {resolveAppAssetsStore} = await import(\n './app-release/app-assets-store.js'\n );\n const {publishApp} = await import('./commands/publish-app.js');\n await ensureEnvironmentLoaded(splitEnvOption(options?.env));\n // The store is resolved by publishApp, after the manifest is read.\n await publishApp({\n manifestPath: options?.manifest,\n resolveStore: () => resolveAppAssetsStore(),\n yes: options?.yes === true,\n });\n });\n })\n .description(\n 'Validate or retry publishing a previously built release. Defaults to dry run.',\n );\n\nprogram\n .command('serve-app')\n .option('--env <env>', 'The node environment to use')\n .action(async (options) => {\n // Production runtime loads compiled output and never starts Vite/HMR.\n await runAppCommand(async () => {\n const {serveCompiledApp} = await import('./commands/serve-app.js');\n await serveCompiledApp({environmentNames: splitEnvOption(options?.env)});\n });\n })\n .description('Start a compiled Linked app without Vite or HMR.');\n\nprogram.command('publish-updated').action(() => {\n return publishUpdated();\n});\nprogram.command('publish [version]').action((version) => {\n publishPackage(null, false, null, version);\n});\n\nprogram.command('status').action(() => {\n //log which packages need to be published\n return publishUpdated(true).then(() => {\n //log which packages need to be build\n return buildUpdated(undefined, '', '', true);\n });\n});\nprogram\n .command('build-updated [target] [target2]')\n .action((target, target2, options) => {\n const {useGit}: {useGit?: boolean} = options;\n return buildUpdated(1, target, target2, useGit || false);\n })\n .option(\n '--use-git',\n 'Use git commit timestamps to check which packages have been updated since the last build',\n );\nprogram\n .command('build-updated-since [num-commits-back] [target] [target2]')\n .action((back, target, target2) => {\n return buildUpdated(back, target, target2);\n });\nprogram\n .command('build-all')\n .action((options) => {\n buildAll(options);\n })\n .option(\n '--sync',\n 'build each package 1 by 1 - use this if you have build issues due to low available RAM memory',\n )\n .option('--from <char>', 'start from a specific package');\n\nprogram\n .command('build-workspace')\n .description(\n 'Build all linked packages in the current workspace in dependency order',\n )\n .option('-u, --updated', 'Only build updated packages')\n .option(\n '--use-git',\n 'Use git commit timestamps to determine which packages need updating',\n )\n .action(async (options) => {\n if (options.updated) {\n return buildUpdated(1, undefined, undefined, !!options.useGit);\n }\n return buildAll(options);\n });\n\nprogram\n .command('build-package <filepath>')\n .description(\n 'Given a file path, find its package.json and rebuild that package. Use for editor save hooks.',\n )\n .action(async (filepath) => {\n const {buildPackageByPath} = await import(\n './commands/build-package.js'\n );\n return buildPackageByPath(filepath);\n });\n\nprogram\n .command('localize [packages...]')\n .description(\n 'Develop an npm dependency from a git checkout: clone it, install inside the checkout, build it and symlink it into node_modules — without touching package.json or package-lock.json. Name packages exactly as npm names them (@_linked/rdfs, lodash); the repository is read from the published `repository` field. With no names, reports what is localized.',\n )\n .option('--list', 'Report what is localized rather than localizing anything.')\n .option(\n '--check',\n 'With --list: exit 1 when something recorded is not actually linked.',\n )\n .option(\n '--relink',\n 'Recreate the recorded symlinks. This is what a postinstall runs.',\n )\n .option('--dir <path>', 'Where checkouts live (default: packages-local).')\n .option(\n '--repo <git-url>',\n 'Clone this instead of the published repository, and record it.',\n )\n .option(\n '--subdir <path>',\n \"The package's directory inside the repository (monorepos).\",\n )\n .option(\n '--build <cmd>',\n 'Run this in the checkout after installing; a failure only warns. Defaults to `linked build`; pass an empty string to build nothing.',\n )\n .option(\n '--force',\n 'Overwrite a symlink pointing outside the checkout directory.',\n )\n .action(async (packages: string[], options) => {\n const {runLocalize} = await import('./commands/localize.js');\n return runLocalize(packages, options);\n });\n\nprogram\n .command('delocalize [packages...]')\n .description(\n 'Undo localize: unlink the packages and forget them, keeping the checkout. With no names, undoes every localized package.',\n )\n .option('--purge', 'Also delete the checkout.')\n .option('--force', 'With --purge, delete even a checkout localize refuses.')\n .action(async (packages: string[], options) => {\n const {runDelocalize} = await import('./commands/localize.js');\n return runDelocalize(packages, options);\n });\n\nprogram\n .command('app-doctor')\n .description(\n \"Run in an app. Checks how the app uses linked packages: Vite pre-bundle entries that don't resolve (and the fix), linked packages whose dependencies don't support the app's React version (and which to bump), and hand-written entries that are now generated and can be removed. Exits 1 if anything needs fixing.\",\n )\n .action(async () => {\n const {runAppDoctor} = await import('./commands/app-doctor.js');\n return runAppDoctor();\n });\n\nprogram\n .command('setup-publish')\n .description(\n \"Set up the changesets publish pipeline in the current package repo. Writes the pr.yml/publish.yml callers of the shared workflows in the repo's own org .github repo, changesets config, .gitignore entries, and patches package.json.\",\n )\n .option(\n '--configure-github',\n 'Also apply the uniform branch protection on main and enable auto-merge (requires gh CLI installed and authenticated).',\n )\n .option(\n '--dual-branch',\n 'Deprecated and ignored: the main + dev flow and its @next prereleases are retired. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--scope <scope>',\n 'Deprecated and ignored: the npm secret is NPM_AUTH_TOKEN in every org, holding that org\\'s own token. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--grant-team <slug>',\n 'GitHub team slug to grant push access on the repo. Requires gh CLI.',\n )\n .action(async (options) => {\n const {setupPublish} = await import('./commands/setup-publish.js');\n await setupPublish({\n configureGithub: !!options.configureGithub,\n dualBranch: !!options.dualBranch,\n scope: options.scope,\n grantTeam: options.grantTeam,\n });\n });\n\nprogram\n .command('all [action] [filter] [filter-value]')\n .action((command, filter, filterValue) => {\n executeCommandForEachPackage(\n getLincdPackages(),\n command,\n filter,\n filterValue,\n );\n });\n// program.command('all-except [excludedSpaces] [action]').action((excludedSpaces, command) => {\n// executeCommandForEachModule(getLincdModules(), command, null, excludedSpaces);\n// });\n\nprogram.command('dev [target] [mode]').action((target, mode) => {\n developPackage(target, mode);\n});\n\nprogram.command('depcheck').action((target, mode) => {\n depCheck();\n});\nprogram.command('depcheck-staged').action((target, mode) => {\n depCheckStaged();\n});\nprogram\n .command('check-imports')\n .description(\n 'Check the imports of the package in the current folder. Exits 1 when an invalid import is found',\n )\n .action(async () => {\n try {\n await checkImports();\n } catch (report) {\n // checkImports throws the formatted report of every invalid import.\n console.error(typeof report === 'string' ? report : String(report));\n process.exitCode = 1;\n }\n });\n\nprogram\n .command('package')\n .action((name, command, args: string[]) => {\n let fullCommand = command\n ? command +\n ' ' +\n args\n .slice(0, 3)\n .filter((a) => a && true)\n .join(' ')\n : null;\n\n //TODO: call\n // let pkgName = process.argv[1];\n // console.log(pkgName);\n // let restArgs = process.argv.slice(2)\n // program.parse([],{from:'user'});\n // program.parse(['--port', '80'], { from: 'user' })\n\n executeCommandForPackage(name, fullCommand);\n })\n .alias('p')\n .alias('pkg')\n .alias('m')\n .alias('module')\n .description(\n 'Searches for a package in this workspace with a partially matching name and executes a command for that package (without needing to execute it from the folder of the package)',\n )\n .argument('<name>', 'the name of the package. Can be a part of the name.')\n .argument(\n '[command]',\n 'the linked command you want to execute. Like dev or build',\n )\n .argument('[args...]', 'the additional arguments of that command');\n\nprogram.command('enable-capacitor').action(() => {\n addCapacitor();\n});\n\nprogram.parse(process.argv);\n"]}
|
|
@@ -114,7 +114,7 @@ export interface RecordedClientDepScan {
|
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* The most recent scan the plugin ran in this process, with the app's own
|
|
117
|
-
* include list — `linked doctor` loads the app's config and reads this, so it
|
|
117
|
+
* include list — `linked app-doctor` loads the app's config and reads this, so it
|
|
118
118
|
* checks exactly what the dev server would use.
|
|
119
119
|
*/
|
|
120
120
|
export declare const lastClientDepScan: {
|
|
@@ -746,7 +746,7 @@ export function linkedClientDepIncludes(excluded_1) {
|
|
|
746
746
|
}
|
|
747
747
|
/**
|
|
748
748
|
* The most recent scan the plugin ran in this process, with the app's own
|
|
749
|
-
* include list — `linked doctor` loads the app's config and reads this, so it
|
|
749
|
+
* include list — `linked app-doctor` loads the app's config and reads this, so it
|
|
750
750
|
* checks exactly what the dev server would use.
|
|
751
751
|
*/
|
|
752
752
|
export const lastClientDepScan = ((_a = (_b = globalThis)[_c = Symbol.for('@_linked/cli.lastClientDepScan')]) !== null && _a !== void 0 ? _a : (_b[_c] = { current: null }));
|
|
@@ -764,7 +764,7 @@ const debugEnabled = () => { var _a; return /(^|[\s,])(linked(:[\w*]+)?|\*)($|[\
|
|
|
764
764
|
*/
|
|
765
765
|
export function linkedClientDepIncludesPlugin(opts = {}) {
|
|
766
766
|
// What the app itself lists, before other plugins add theirs
|
|
767
|
-
// (@vitejs/plugin-react adds `react`, `react/jsx-runtime`…): `linked doctor`
|
|
767
|
+
// (@vitejs/plugin-react adds `react`, `react/jsx-runtime`…): `linked app-doctor`
|
|
768
768
|
// must not tell anyone to delete an entry they never wrote.
|
|
769
769
|
let appInclude = [];
|
|
770
770
|
const snapshot = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-dep-includes.js","sourceRoot":"","sources":["../../src/client-dep-includes.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4EAA4E;AAC5E,6BAA6B;AAC7B,EAAE;AACF,gFAAgF;AAChF,4EAA4E;AAC5E,6EAA6E;AAC7E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MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;wBACnC,iBAAiB,CAAC,OAAO,GAAG;4BAC1B,GAAG;4BACH,IAAI;4BACJ,UAAU;4BACV,OAAO,EAAE,MAAA,YAAY,CAAC,OAAO,mCAAI,EAAE;yBACpC,CAAC;wBACF,IAAI,YAAY,EAAE,EAAE,CAAC;4BACnB,OAAO,CAAC,GAAG,CACT,kCAAkC,KAAK,CAAC,MAAM,oDAAoD;gCAChG,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,YAAY,SAAS;gCAC5E,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CACxC,CAAC;wBACJ,CAAC;wBACD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,YAAY,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,EAAC,CAAC,CAAC,CAAC,SAAS,CAAC;oBACrE,CAAC;iBAAA;aACF;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["// `optimizeDeps.include` entries for the third-party client dependencies of\n// linked framework packages.\n//\n// Apps exclude the framework packages (`@_linked/*`, `lincd-*`, anything marked\n// `\"linkedPackage\": true`) from Vite's dependency optimizer, so the browser\n// loads exactly one copy of each. The cost of that exclusion: Vite no longer\n// crawls into those packages, so it never learns about THEIR dependencies until\n// the browser happens to request one. Two things then go wrong:\n//\n// - a CommonJS dependency (`use-sync-external-store/shim`, `js-cookie`) is\n// served raw, and the browser fails on `require`/`module.exports`;\n// - any other dependency is discovered mid-session, and Vite re-optimises and\n// reloads the page — which can mix old and new chunks into two Reacts.\n//\n// So apps used to list every such dependency in `optimizeDeps.include` by hand,\n// including nested installs (`'@_linked/primitives > vaul'`, where npm put vaul\n// under primitives because its React peer range excluded the app's React).\n//\n// Reading `package.json` dependencies would list server-only packages too\n// (bcrypt, express, sharp…), which then fail in esbuild. This module reads the\n// import graph instead: which bare specifiers the framework packages' client\n// entry files actually import, and which of those can run in a browser.\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport {isBuiltin} from 'node:module';\nimport {init as initLexer, parse as parseImports} from 'es-module-lexer';\nimport {isFrameworkPkg, readInstalledPkg} from './installed-packages.js';\nimport type {Plugin} from 'vite';\n\nexport interface SourceWorkspace {\n name: string;\n srcDir: string;\n}\n\nexport interface ClientDepEntry {\n /** The `optimizeDeps.include` entry: `dep/sub` or `from > dep/sub`. */\n entry: string;\n /** The specifier as the framework package imports it. */\n specifier: string;\n /** The framework package the import was found in. */\n from: string;\n /** Package name of the dependency. */\n depName: string;\n /** Real path of the dependency's package root, as resolved from `from`. */\n depRoot: string;\n /** True when the app root does not resolve `depName` to that same copy. */\n nested: boolean;\n}\n\nexport type SkipReason =\n 'unresolved' | 'server-only' | 'server-code' | 'excluded' | 'denied';\n\nexport interface SkippedClientDep {\n specifier: string;\n from: string;\n reason: SkipReason;\n}\n\nexport interface ClientDepScanOptions {\n /** App root. Default `process.cwd()`. */\n cwd?: string;\n /** Framework packages served from source: their `src/` is scanned instead of `lib/`. */\n sourceWorkspaces?: SourceWorkspace[];\n /** Entries never to add, matched against the entry, the specifier and the package name. */\n deny?: (string | RegExp)[];\n /**\n * JSON file remembering what does not change between runs: the module graphs\n * of installed (non-source) framework packages and the server-only verdicts\n * of dependencies, keyed by real path and version. Omit to scan everything.\n */\n cacheFile?: string;\n}\n\nexport interface ScannedFrameworkPackage {\n name: string;\n root: string;\n json: any;\n source: boolean;\n}\n\nexport interface ClientDepScan {\n entries: ClientDepEntry[];\n skipped: SkippedClientDep[];\n frameworkPackages: ScannedFrameworkPackage[];\n /** Excluded names that the app root does not resolve at all. */\n unresolvedExcludes: string[];\n filesScanned: number;\n}\n\n/** Conditions a browser build resolves, in the order a client resolver prefers them. */\nconst CLIENT_CONDITIONS = ['browser', 'import', 'module', 'default'];\n/** Conditions never taken for a client file. `development` points at `src/`, scanned separately. */\nconst NON_CLIENT_CONDITIONS = new Set([\n 'require',\n 'node',\n 'types',\n 'typings',\n 'development',\n 'deno',\n 'bun',\n 'worker',\n 'react-native',\n]);\n/** Specifiers that are assets, not modules the optimizer can pre-bundle. */\nconst ASSET_SPECIFIER =\n /\\.(css|scss|sass|less|styl|pcss|svg|png|jpe?g|gif|webp|avif|ico|bmp|woff2?|ttf|otf|eot|json|wasm|html?|txt|md|glsl)$/i;\nconst SOURCE_FILE = /\\.(m?[jt]sx?|cjs)$/;\nconst IGNORED_SOURCE_FILE = /(\\.d\\.ts|\\.(test|spec|stories)\\.[mc]?[jt]sx?)$/;\nconst IGNORED_SOURCE_DIR = new Set([\n 'node_modules',\n '__tests__',\n '__mocks__',\n '__fixtures__',\n]);\n/**\n * Never listed, whoever imports them. `typescript` is a peer of packages that\n * analyse source at build time (translation key sync); it declares a `browser`\n * field, so it passes the server-only test, and pre-bundling it costs seconds.\n */\nexport const DEFAULT_DENY: (string | RegExp)[] = ['typescript'];\n/** A server-only check stops after this many files of one dependency. */\nconst MAX_DEP_FILES = 400;\n\n/** `@scope/name/sub` → `@scope/name`; `name/sub` → `name`. */\nexport function packageNameOf(specifier: string): string {\n const parts = specifier.split('/');\n return specifier.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0];\n}\n\n/** A bare module specifier naming another package (not relative, builtin, virtual, asset or `#import`). */\nexport function isBarePackageSpecifier(specifier: string): boolean {\n if (!specifier || specifier.startsWith('.') || specifier.startsWith('/'))\n return false;\n if (specifier.startsWith('#') || specifier.startsWith('\\0')) return false;\n if (specifier.includes(':') || specifier.includes('?')) return false; // node:, virtual:, http:, ?raw\n if (isBuiltin(specifier)) return false;\n if (ASSET_SPECIFIER.test(specifier)) return false;\n return /^(@[\\w.-]+\\/)?[\\w.-]/.test(specifier);\n}\n\nconst matchesDeny = (deny: (string | RegExp)[], ...values: string[]): boolean =>\n deny.some((d) =>\n values.some((v) => (typeof d === 'string' ? d === v : d.test(v))),\n );\n\nasync function realpath(p: string): Promise<string> {\n try {\n return await fs.realpath(p);\n } catch {\n return path.resolve(p);\n }\n}\n\nasync function isFile(p: string): Promise<boolean> {\n try {\n return (await fs.stat(p)).isFile();\n } catch {\n return false;\n }\n}\n\nasync function listFiles(\n dir: string,\n accept: (file: string) => boolean,\n): Promise<string[]> {\n const out: string[] = [];\n const walk = async (d: string): Promise<void> => {\n let entries;\n try {\n entries = await fs.readdir(d, {withFileTypes: true});\n } catch {\n return;\n }\n await Promise.all(\n entries.map(async (ent) => {\n const full = path.join(d, ent.name);\n if (ent.isDirectory()) {\n if (!IGNORED_SOURCE_DIR.has(ent.name)) await walk(full);\n } else if (accept(full)) {\n out.push(full);\n }\n }),\n );\n };\n await walk(dir);\n return out;\n}\n\n/** Pick the target of one export entry for the given conditions (nested condition objects allowed). */\nfunction pickConditional(target: any, conditions: string[]): string | null {\n if (typeof target === 'string') return target;\n if (Array.isArray(target)) {\n for (const t of target) {\n const hit = pickConditional(t, conditions);\n if (hit) return hit;\n }\n return null;\n }\n if (target && typeof target === 'object') {\n for (const [key, value] of Object.entries(target)) {\n if (key === 'default' || conditions.includes(key)) {\n const hit = pickConditional(value, conditions);\n if (hit) return hit;\n }\n }\n }\n return null;\n}\n\n/** Normalise `exports` to a subpath map (`{'.': …}`), or null when there is none. */\nfunction exportsMap(exportsField: any): Record<string, any> | null {\n if (exportsField === undefined || exportsField === null) return null;\n if (typeof exportsField === 'string' || Array.isArray(exportsField))\n return {'.': exportsField};\n const keys = Object.keys(exportsField);\n if (keys.length > 0 && keys.every((k) => !k.startsWith('.')))\n return {'.': exportsField};\n return exportsField;\n}\n\n/**\n * Resolve a package subpath (`.` or `./shim`) through `exports` for the given\n * conditions, the way Node does (exact key first, then the longest `*` pattern).\n * Returns the relative target, `null` when the subpath is not exported, or\n * `undefined` when the package has no `exports` at all.\n */\nexport function resolveExportsSubpath(\n json: any,\n subpath: string,\n conditions: string[],\n): string | null | undefined {\n const map = exportsMap(json?.exports);\n if (!map) return undefined;\n if (subpath in map) return pickConditional(map[subpath], conditions);\n let best: {key: string; star: string} | null = null;\n for (const key of Object.keys(map)) {\n const star = key.indexOf('*');\n if (star < 0) continue;\n const prefix = key.slice(0, star);\n const suffix = key.slice(star + 1);\n if (\n subpath.startsWith(prefix) &&\n subpath.endsWith(suffix) &&\n subpath.length >= key.length - 1 &&\n (!best || prefix.length > best.key.indexOf('*'))\n ) {\n best = {\n key,\n star: subpath.slice(prefix.length, subpath.length - suffix.length),\n };\n }\n }\n if (!best) return null;\n const target = pickConditional(map[best.key], conditions);\n return target ? target.split('*').join(best.star) : null;\n}\n\n/** Probe a file path the way a CommonJS/ESM loader would (extension, then directory index). */\nasync function probeFile(base: string): Promise<string | null> {\n for (const candidate of [\n base,\n `${base}.js`,\n `${base}.mjs`,\n `${base}.cjs`,\n path.join(base, 'index.js'),\n path.join(base, 'index.mjs'),\n ]) {\n if (await isFile(candidate)) return candidate;\n }\n return null;\n}\n\n/** The file a package subpath resolves to for a browser-or-anything lookup; null when none exists. */\nexport async function resolvePackageFile(\n root: string,\n json: any,\n subpath: string,\n conditions: string[] = [\n 'browser',\n 'import',\n 'module',\n 'default',\n 'require',\n 'node',\n ],\n): Promise<string | null> {\n const viaExports = resolveExportsSubpath(json, subpath, conditions);\n if (viaExports !== undefined) {\n return viaExports ? probeFile(path.join(root, viaExports)) : null;\n }\n if (subpath === '.') {\n const browser =\n conditions.includes('browser') &&\n typeof json.browser === 'string' &&\n json.browser;\n const main = browser || json.module || json.main || 'index.js';\n return probeFile(path.join(root, main));\n }\n return probeFile(path.join(root, subpath));\n}\n\n/** Every string target under client conditions, anywhere in `exports`. */\nfunction clientExportTargets(json: any): string[] {\n const map = exportsMap(json?.exports);\n if (!map) {\n const main =\n (typeof json?.browser === 'string' && json.browser) ||\n json?.module ||\n json?.main ||\n 'index.js';\n return [main];\n }\n const out: string[] = [];\n const visit = (target: any): void => {\n if (typeof target === 'string') out.push(target);\n else if (Array.isArray(target)) target.forEach(visit);\n else if (target && typeof target === 'object') {\n for (const [key, value] of Object.entries(target)) {\n if (!NON_CLIENT_CONDITIONS.has(key)) visit(value);\n }\n }\n };\n Object.values(map).forEach(visit);\n return out;\n}\n\n/** Expand one export target (possibly a `*` pattern) to the files it can reach. */\nasync function expandTarget(root: string, target: string): Promise<string[]> {\n const abs = path.join(root, target);\n const star = abs.indexOf('*');\n if (star < 0) {\n const file = await probeFile(abs);\n return file ? [file] : [];\n }\n const prefix = abs.slice(0, star);\n const suffix = abs.slice(star + 1);\n const dir = prefix.endsWith(path.sep) ? prefix : path.dirname(prefix);\n return listFiles(\n dir,\n (f) => f.startsWith(prefix) && f.endsWith(suffix) && !f.endsWith('.d.ts'),\n );\n}\n\nlet lexerReady: Promise<void> | null = null;\nlet esbuildTransform:\n ((code: string, opts: any) => Promise<{code: string}>) | null = null;\n\n/** The static and literal-dynamic import specifiers of a module, plus `require('x')` calls. */\nexport async function importSpecifiers(\n code: string,\n file: string,\n): Promise<string[]> {\n lexerReady ??= initLexer;\n await lexerReady;\n let js = code;\n if (/\\.[mc]?tsx?$/.test(file) || /\\.jsx$/.test(file)) {\n esbuildTransform ??= (await import('esbuild')).transform as any;\n try {\n js = (\n await esbuildTransform!(code, {\n loader: file.endsWith('x')\n ? /\\.tsx$/.test(file)\n ? 'tsx'\n : 'jsx'\n : 'ts',\n format: 'esm',\n jsx: 'automatic',\n tsconfigRaw: {compilerOptions: {experimentalDecorators: true}},\n logLevel: 'silent',\n })\n ).code;\n } catch {\n return [];\n }\n }\n const out = new Set<string>();\n try {\n const [imports] = parseImports(js);\n for (const imp of imports) if (imp.n) out.add(imp.n);\n } catch {\n // Not parseable as a module (JSX in a .js file, say): fall back to the textual forms.\n for (const m of js.matchAll(\n /(?:\\bfrom\\s*|\\bimport\\s*\\(?\\s*)['\"]([^'\"\\n]+)['\"]/g,\n ))\n out.add(m[1]);\n }\n for (const m of js.matchAll(/\\brequire\\s*\\(\\s*['\"]([^'\"\\n]+)['\"]\\s*\\)/g))\n out.add(m[1]);\n return [...out];\n}\n\ninterface ScanCacheData {\n version: number;\n graphs: Record<string, Record<string, {bare: string[]; rel: string[]}>>;\n serverOnly: Record<string, boolean>;\n}\nconst CACHE_VERSION = 1;\n\nasync function loadCache(\n file: string | undefined,\n): Promise<{data: ScanCacheData; dirty: boolean}> {\n const empty = {\n data: {version: CACHE_VERSION, graphs: {}, serverOnly: {}},\n dirty: false,\n };\n if (!file) return empty;\n try {\n const data = JSON.parse(await fs.readFile(file, 'utf8'));\n return data?.version === CACHE_VERSION && data.graphs && data.serverOnly\n ? {data, dirty: false}\n : empty;\n } catch {\n return empty;\n }\n}\n\nasync function saveCache(\n file: string | undefined,\n cache: {data: ScanCacheData; dirty: boolean},\n): Promise<void> {\n if (!file || !cache.dirty) return;\n try {\n await fs.mkdir(path.dirname(file), {recursive: true});\n const tmp = `${file}.${process.pid}.tmp`;\n await fs.writeFile(tmp, JSON.stringify(cache.data));\n await fs.rename(tmp, file);\n } catch {\n // A cache is an optimisation: an unwritable node_modules just means a full scan next time.\n }\n}\n\n/** Limit concurrent file reads: a few hundred open at once can exceed the fd limit. */\nfunction semaphore(limit: number): <T>(fn: () => Promise<T>) => Promise<T> {\n let active = 0;\n const waiting: (() => void)[] = [];\n return async (fn) => {\n if (active >= limit) await new Promise<void>((r) => waiting.push(r));\n active++;\n try {\n return await fn();\n } finally {\n active--;\n waiting.shift()?.();\n }\n };\n}\n\n/** Resolve a relative import to a module file, including the TS-source `./Sibling.js` → `.ts(x)` convention. */\nasync function resolveRelative(\n importer: string,\n specifier: string,\n): Promise<string | null> {\n if (ASSET_SPECIFIER.test(specifier)) return null;\n const base = path.resolve(path.dirname(importer), specifier);\n const candidates: string[] = [];\n if (/\\.[mc]?tsx?$/.test(importer) && /\\.jsx?$/.test(base)) {\n candidates.push(\n base.replace(/\\.jsx?$/, '.ts'),\n base.replace(/\\.jsx?$/, '.tsx'),\n );\n }\n candidates.push(base);\n for (const ext of ['.js', '.mjs', '.cjs', '.ts', '.tsx', '.jsx'])\n candidates.push(base + ext);\n for (const ext of ['.js', '.mjs', '.ts', '.tsx'])\n candidates.push(path.join(base, 'index' + ext));\n for (const c of candidates) {\n if (SOURCE_FILE.test(c) && (await isFile(c))) return c;\n }\n return null;\n}\n\nexport interface ModuleNode {\n file: string;\n /** Bare specifiers the module imports (packages and builtins). */\n bare: string[];\n /** Module files it imports relatively. */\n rel: string[];\n}\n\ninterface ReadGraphOptions {\n maxFiles?: number;\n /** Also follow a bare import: return the file it resolves to, or null to not follow it. */\n followBare?: (specifier: string, importer: string) => Promise<string | null>;\n /** Stop reading once this returns true for a node. */\n stopWhen?: (node: ModuleNode) => boolean;\n}\n\nconst readLimit = semaphore(64);\n\n/** Read the module graph reachable from `entries` through relative imports (and `followBare`). */\nasync function readGraph(\n entries: string[],\n opts: ReadGraphOptions = {},\n): Promise<Map<string, ModuleNode>> {\n const nodes = new Map<string, ModuleNode>();\n const maxFiles = opts.maxFiles ?? Infinity;\n let stopped = false;\n const visit = async (file: string): Promise<void> => {\n if (stopped || nodes.has(file) || nodes.size >= maxFiles) return;\n const node: ModuleNode = {file, bare: [], rel: []};\n nodes.set(file, node);\n const specs = await readLimit(async () => {\n try {\n return await importSpecifiers(await fs.readFile(file, 'utf8'), file);\n } catch {\n return [];\n }\n });\n const children: (string | null)[] = await Promise.all(\n specs.map(async (spec) => {\n if (spec.startsWith('.') || spec.startsWith('/')) {\n const resolved = await resolveRelative(file, spec);\n if (resolved) node.rel.push(resolved);\n return resolved;\n }\n node.bare.push(spec);\n return opts.followBare ? opts.followBare(spec, file) : null;\n }),\n );\n if (opts.stopWhen?.(node)) {\n stopped = true;\n return;\n }\n await Promise.all(children.filter((c): c is string => !!c).map(visit));\n };\n await Promise.all(entries.map(visit));\n return nodes;\n}\n\n/** True when the package declares a browser entry anywhere (`browser` field or condition). */\nfunction hasBrowserEntry(json: any): boolean {\n if (json?.browser) return true;\n let found = false;\n const visit = (v: any): void => {\n if (found || !v || typeof v !== 'object') return;\n for (const [key, value] of Object.entries(v)) {\n if (key === 'browser') found = true;\n else visit(value);\n }\n };\n visit(json?.exports);\n return found;\n}\n\nconst isBuiltinSpecifier = (spec: string): boolean =>\n spec.startsWith('node:') || isBuiltin(spec);\nconst subpathOf = (specifier: string): string => {\n const name = packageNameOf(specifier);\n return specifier === name ? '.' : `.${specifier.slice(name.length)}`;\n};\nconst NODE_CONDITIONS = ['import', 'module', 'default', 'require', 'node'];\n\ntype InstalledLookup = (\n name: string,\n fromDir: string,\n) => Promise<{root: string; json: any} | null>;\n\n/** `readInstalledPkg`, memoised for one scan. */\nfunction memoInstalled(): InstalledLookup {\n const cache = new Map<string, Promise<{root: string; json: any} | null>>();\n return (name, fromDir) => {\n const key = `${name}\\0${fromDir}`;\n if (!cache.has(key)) cache.set(key, readInstalledPkg(name, fromDir));\n return cache.get(key)!;\n };\n}\n\n/**\n * Server-only: no browser entry, and the module graph behind the imported\n * subpath — followed through its own dependencies, as long as those have no\n * browser entry either — reaches a Node builtin. Such a package (express,\n * sharp, bcrypt, jsonwebtoken, cookie-parser) serves a framework package's\n * server code; listing it would make esbuild bundle it for the browser.\n */\nexport async function isServerOnlyDependency(\n root: string,\n json: any,\n subpath: string,\n lookup: InstalledLookup = readInstalledPkg,\n): Promise<boolean> {\n if (hasBrowserEntry(json)) return false;\n const entry = await resolvePackageFile(root, json, subpath, NODE_CONDITIONS);\n if (!entry) return false;\n let builtin = false;\n await readGraph([entry], {\n maxFiles: MAX_DEP_FILES,\n followBare: async (spec, importer) => {\n if (!isBarePackageSpecifier(spec)) return null;\n const dep = await lookup(packageNameOf(spec), path.dirname(importer));\n if (!dep || hasBrowserEntry(dep.json)) return null;\n return resolvePackageFile(\n dep.root,\n dep.json,\n subpathOf(spec),\n NODE_CONDITIONS,\n );\n },\n stopWhen: (node) =>\n (builtin = builtin || node.bare.some(isBuiltinSpecifier)),\n });\n return builtin;\n}\n\n/** The files a framework package's client code can start from. */\nasync function clientEntryFiles(\n pkg: ScannedFrameworkPackage,\n): Promise<string[]> {\n if (pkg.source) {\n return listFiles(\n path.join(pkg.root, 'src'),\n (f) => SOURCE_FILE.test(f) && !IGNORED_SOURCE_FILE.test(f),\n );\n }\n return (\n await Promise.all(\n clientExportTargets(pkg.json).map((t) => expandTarget(pkg.root, t)),\n )\n ).flat();\n}\n\ninterface DepVerdict {\n reason?: 'unresolved' | 'server-only';\n depName: string;\n depRoot?: string;\n}\n\n/**\n * Scan the framework packages among `excluded` for the third-party\n * dependencies their client code imports, and work out the\n * `optimizeDeps.include` entry for each.\n *\n * Framework packages export whole directories (`\"./*\": \"./lib/esm/*.js\"`), so\n * \"reachable from the client exports\" is every file — server code included. A\n * file is therefore treated as SERVER code when it imports a Node builtin or a\n * server-only dependency, or relatively imports a file that does; only the\n * imports of the remaining files are listed.\n */\nexport async function scanLinkedClientDeps(\n excluded: string[],\n opts: ClientDepScanOptions = {},\n): Promise<ClientDepScan> {\n const cwd = path.resolve(opts.cwd ?? process.cwd());\n const deny = [...DEFAULT_DENY, ...(opts.deny ?? [])];\n const excludedSet = new Set(excluded);\n const sourceByName = new Map(\n (opts.sourceWorkspaces ?? []).map((w) => [w.name, w]),\n );\n const lookup = memoInstalled();\n const cache = await loadCache(opts.cacheFile);\n const unresolvedExcludes: string[] = [];\n\n // 1. The excluded packages to scan: every source workspace (Vite does not crawl\n // an excluded package, whatever it is), and the installed framework packages.\n // A package with a `bin` is a command-line tool (`@_linked/cli`), whose code\n // no browser loads; scanning it would only list build tooling.\n const frameworkPackages = (\n await Promise.all(\n [...excludedSet].map(\n async (name): Promise<ScannedFrameworkPackage | null> => {\n const ws = sourceByName.get(name);\n if (ws) {\n const root = await realpath(path.dirname(ws.srcDir));\n let json: any = {};\n try {\n json = JSON.parse(\n await fs.readFile(path.join(root, 'package.json'), 'utf8'),\n );\n } catch {}\n return {name, root, json, source: true};\n }\n const installed = await lookup(name, cwd);\n if (!installed) {\n unresolvedExcludes.push(name);\n return null;\n }\n if (!isFrameworkPkg(name) && installed.json.linkedPackage !== true)\n return null;\n return {\n name,\n root: await realpath(installed.root),\n json: installed.json,\n source: false,\n };\n },\n ),\n )\n ).filter((p): p is ScannedFrameworkPackage => !!p && !p.json?.bin);\n\n // 2. Each package's module graph.\n const owner = new Map<string, ScannedFrameworkPackage>();\n const nodes = new Map<string, ModuleNode>();\n await Promise.all(\n frameworkPackages.map(async (pkg) => {\n const cacheKey = pkg.source ? null : `${pkg.root}\\0${pkg.json.version}`;\n let graph: Map<string, ModuleNode>;\n if (cacheKey && cache.data.graphs[cacheKey]) {\n graph = new Map(\n Object.entries(cache.data.graphs[cacheKey]).map(([file, n]) => [\n file,\n {file, ...n},\n ]),\n );\n } else {\n graph = await readGraph(await clientEntryFiles(pkg));\n if (cacheKey) {\n cache.data.graphs[cacheKey] = Object.fromEntries(\n [...graph].map(([file, n]) => [file, {bare: n.bare, rel: n.rel}]),\n );\n cache.dirty = true;\n }\n }\n for (const [file, node] of graph) {\n if (nodes.has(file)) continue;\n nodes.set(file, node);\n owner.set(file, pkg);\n }\n }),\n );\n\n // 3. A verdict for every (package, dependency specifier) pair.\n const verdicts = new Map<string, Promise<DepVerdict | null>>();\n const serverOnly = new Map<string, Promise<boolean>>();\n const pairKey = (pkg: ScannedFrameworkPackage, spec: string): string =>\n `${pkg.name}\\0${spec}`;\n const verdictFor = (\n pkg: ScannedFrameworkPackage,\n spec: string,\n ): Promise<DepVerdict | null> => {\n const key = pairKey(pkg, spec);\n if (!verdicts.has(key)) {\n verdicts.set(\n key,\n (async (): Promise<DepVerdict | null> => {\n if (!isBarePackageSpecifier(spec)) return null;\n const depName = packageNameOf(spec);\n if (depName === pkg.name || isFrameworkPkg(depName)) return null;\n const installed = await lookup(depName, pkg.root);\n if (!installed) return {reason: 'unresolved', depName};\n if (installed.json.linkedPackage === true) return null;\n const depRoot = await realpath(installed.root);\n const cacheKey = `${depRoot}\\0${subpathOf(spec)}`;\n if (!serverOnly.has(cacheKey)) {\n const persisted = `${cacheKey}\\0${installed.json.version}`;\n serverOnly.set(\n cacheKey,\n persisted in cache.data.serverOnly\n ? Promise.resolve(cache.data.serverOnly[persisted])\n : isServerOnlyDependency(\n depRoot,\n installed.json,\n subpathOf(spec),\n lookup,\n ).then((v) => {\n cache.data.serverOnly[persisted] = v;\n cache.dirty = true;\n return v;\n }),\n );\n }\n return {\n reason: (await serverOnly.get(cacheKey))\n ? 'server-only'\n : undefined,\n depName,\n depRoot,\n };\n })(),\n );\n }\n return verdicts.get(key)!;\n };\n await Promise.all(\n [...nodes.values()].flatMap((n) =>\n n.bare.map((spec) => verdictFor(owner.get(n.file)!, spec)),\n ),\n );\n\n // 4. Server code: files importing a builtin or a server-only dependency, and\n // every file that relatively imports one of those.\n const server = new Set<string>();\n const importers = new Map<string, string[]>();\n for (const node of nodes.values()) {\n for (const dep of node.rel) {\n if (!importers.has(dep)) importers.set(dep, []);\n importers.get(dep)!.push(node.file);\n }\n }\n const queue: string[] = [];\n for (const node of nodes.values()) {\n const pkg = owner.get(node.file)!;\n for (const spec of node.bare) {\n if (\n isBuiltinSpecifier(spec) ||\n (await verdicts.get(pairKey(pkg, spec)))?.reason === 'server-only'\n ) {\n server.add(node.file);\n queue.push(node.file);\n break;\n }\n }\n }\n while (queue.length) {\n for (const parent of importers.get(queue.pop()!) ?? []) {\n if (!server.has(parent)) {\n server.add(parent);\n queue.push(parent);\n }\n }\n }\n\n // 5. Entries from client files; everything else is reported as skipped.\n const rootCopy = new Map<string, Promise<string | null>>();\n const rootResolution = (depName: string): Promise<string | null> => {\n if (!rootCopy.has(depName)) {\n rootCopy.set(\n depName,\n lookup(depName, cwd).then((r) => (r ? realpath(r.root) : null)),\n );\n }\n return rootCopy.get(depName)!;\n };\n const entries = new Map<string, ClientDepEntry>();\n const clientPairs = new Set<string>();\n const skipped = new Map<string, SkippedClientDep>();\n const skip = (specifier: string, from: string, reason: SkipReason): void => {\n skipped.set(`${specifier}\\0${from}`, {specifier, from, reason});\n };\n for (const node of nodes.values()) {\n if (server.has(node.file)) continue;\n const pkg = owner.get(node.file)!;\n for (const spec of node.bare) clientPairs.add(pairKey(pkg, spec));\n }\n for (const node of nodes.values()) {\n const pkg = owner.get(node.file)!;\n for (const spec of node.bare) {\n const key = pairKey(pkg, spec);\n const verdict = await verdicts.get(key);\n if (!verdict) continue;\n if (verdict.reason) {\n skip(spec, pkg.name, verdict.reason);\n continue;\n }\n if (!clientPairs.has(key)) {\n if (!skipped.has(`${spec}\\0${pkg.name}`))\n skip(spec, pkg.name, 'server-code');\n continue;\n }\n if (excludedSet.has(verdict.depName) || excludedSet.has(spec)) {\n skip(spec, pkg.name, 'excluded');\n continue;\n }\n const nested =\n (await rootResolution(verdict.depName)) !== verdict.depRoot;\n const entry = nested ? `${pkg.name} > ${spec}` : spec;\n if (matchesDeny(deny, entry, spec, verdict.depName)) {\n skip(spec, pkg.name, 'denied');\n continue;\n }\n if (!entries.has(entry)) {\n entries.set(entry, {\n entry,\n specifier: spec,\n from: pkg.name,\n depName: verdict.depName,\n depRoot: verdict.depRoot!,\n nested,\n });\n }\n }\n }\n for (const {specifier, from} of entries.values())\n skipped.delete(`${specifier}\\0${from}`);\n await saveCache(opts.cacheFile, cache);\n\n return {\n entries: [...entries.values()].sort((a, b) =>\n a.entry.localeCompare(b.entry),\n ),\n skipped: [...skipped.values()].sort(\n (a, b) =>\n a.specifier.localeCompare(b.specifier) || a.from.localeCompare(b.from),\n ),\n frameworkPackages,\n unresolvedExcludes,\n filesScanned: nodes.size,\n };\n}\n\n/** Just the entries, for `optimizeDeps.include`. */\nexport async function linkedClientDepIncludes(\n excluded: string[],\n opts: ClientDepScanOptions = {},\n): Promise<string[]> {\n return (await scanLinkedClientDeps(excluded, opts)).entries.map(\n (e) => e.entry,\n );\n}\n\nexport interface RecordedClientDepScan {\n cwd: string;\n scan: ClientDepScan;\n /** The app's own `optimizeDeps.include`, before anything was added. */\n appInclude: string[];\n exclude: string[];\n}\n\n/**\n * The most recent scan the plugin ran in this process, with the app's own\n * include list — `linked doctor` loads the app's config and reads this, so it\n * checks exactly what the dev server would use.\n */\nexport const lastClientDepScan: {current: RecordedClientDepScan | null} = ((\n globalThis as any\n)[Symbol.for('@_linked/cli.lastClientDepScan')] ??= {current: null});\n\nexport interface ClientDepIncludesPluginOptions {\n /** Framework packages served from source (the discovered workspaces). */\n sourceWorkspaces?: SourceWorkspace[];\n /** Entries never to add. See `ClientDepScanOptions.deny`. */\n deny?: (string | RegExp)[];\n /** Override the scan cache location; `false` disables the cache. */\n cacheFile?: string | false;\n}\n\n/** Where the scan cache lives: beside Vite's own cache, inside the app's node_modules. */\nexport const defaultClientDepCacheFile = (cwd: string): string =>\n path.join(cwd, 'node_modules', '.cache', 'linked', 'client-deps.json');\n\nconst debugEnabled = (): boolean =>\n /(^|[\\s,])(linked(:[\\w*]+)?|\\*)($|[\\s,])/.test(process.env.DEBUG ?? '');\n\n/**\n * Adds the scan's entries to `optimizeDeps.include` in dev.\n *\n * It is a `config` hook ordered `post` rather than a value computed inside\n * `createViteConfig`, because the exclude list it reads is only final once the\n * app has merged its own config on top — an app that excludes every installed\n * `@_linked/*` package does that in its own `vite.config.ts`. Vite concatenates\n * the returned array onto the app's own `include`, which is never replaced.\n */\nexport function linkedClientDepIncludesPlugin(\n opts: ClientDepIncludesPluginOptions = {},\n): Plugin[] {\n // What the app itself lists, before other plugins add theirs\n // (@vitejs/plugin-react adds `react`, `react/jsx-runtime`…): `linked doctor`\n // must not tell anyone to delete an entry they never wrote.\n let appInclude: string[] = [];\n const snapshot: Plugin = {\n name: 'linked:client-dep-includes:app-include',\n apply: 'serve',\n config: {\n order: 'pre',\n handler(userConfig) {\n appInclude = [...(userConfig.optimizeDeps?.include ?? [])];\n },\n },\n };\n return [\n snapshot,\n {\n name: 'linked:client-dep-includes',\n apply: 'serve',\n config: {\n order: 'post',\n async handler(userConfig) {\n const optimizeDeps = userConfig.optimizeDeps ?? {};\n // `linked start --api-only` has no browser client to optimise for.\n if (optimizeDeps.noDiscovery) return;\n const cwd = path.resolve(userConfig.root ?? process.cwd());\n const started = performance.now();\n const scan = await scanLinkedClientDeps(optimizeDeps.exclude ?? [], {\n cwd,\n sourceWorkspaces: opts.sourceWorkspaces,\n deny: opts.deny,\n cacheFile:\n opts.cacheFile === false\n ? undefined\n : (opts.cacheFile ?? defaultClientDepCacheFile(cwd)),\n });\n const existing = new Set(optimizeDeps.include ?? []);\n const added = scan.entries\n .map((e) => e.entry)\n .filter((e) => !existing.has(e));\n lastClientDepScan.current = {\n cwd,\n scan,\n appInclude,\n exclude: optimizeDeps.exclude ?? [],\n };\n if (debugEnabled()) {\n console.log(\n `[linked] optimizeDeps.include: ${added.length} entries for linked packages' client dependencies ` +\n `(${Math.round(performance.now() - started)}ms, ${scan.filesScanned} files)` +\n added.map((e) => `\\n ${e}`).join(''),\n );\n }\n return added.length ? {optimizeDeps: {include: added}} : undefined;\n },\n },\n },\n ];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"client-dep-includes.js","sourceRoot":"","sources":["../../src/client-dep-includes.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4EAA4E;AAC5E,6BAA6B;AAC7B,EAAE;AACF,gFAAgF;AAChF,4EAA4E;AAC5E,6EAA6E;AAC7E,gFAAgF;AAChF,gEAAgE;AAChE,EAAE;AACF,2EAA2E;AAC3E,qEAAqE;AACrE,8EAA8E;AAC9E,yEAAyE;AACzE,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,2EAA2E;AAC3E,EAAE;AACF,0EAA0E;AAC1E,+EAA+E;AAC/E,6EAA6E;AAC7E,wEAAwE;AACxE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,IAAI,IAAI,SAAS,EAAE,KAAK,IAAI,YAA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G,OAAO,CAAC,OAAO,IAAI,CAAC,YAAY,SAAS;gCAC5E,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CACxC,CAAC;wBACJ,CAAC;wBACD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,YAAY,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,EAAC,CAAC,CAAC,CAAC,SAAS,CAAC;oBACrE,CAAC;iBAAA;aACF;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["// `optimizeDeps.include` entries for the third-party client dependencies of\n// linked framework packages.\n//\n// Apps exclude the framework packages (`@_linked/*`, `lincd-*`, anything marked\n// `\"linkedPackage\": true`) from Vite's dependency optimizer, so the browser\n// loads exactly one copy of each. The cost of that exclusion: Vite no longer\n// crawls into those packages, so it never learns about THEIR dependencies until\n// the browser happens to request one. Two things then go wrong:\n//\n// - a CommonJS dependency (`use-sync-external-store/shim`, `js-cookie`) is\n// served raw, and the browser fails on `require`/`module.exports`;\n// - any other dependency is discovered mid-session, and Vite re-optimises and\n// reloads the page — which can mix old and new chunks into two Reacts.\n//\n// So apps used to list every such dependency in `optimizeDeps.include` by hand,\n// including nested installs (`'@_linked/primitives > vaul'`, where npm put vaul\n// under primitives because its React peer range excluded the app's React).\n//\n// Reading `package.json` dependencies would list server-only packages too\n// (bcrypt, express, sharp…), which then fail in esbuild. This module reads the\n// import graph instead: which bare specifiers the framework packages' client\n// entry files actually import, and which of those can run in a browser.\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport {isBuiltin} from 'node:module';\nimport {init as initLexer, parse as parseImports} from 'es-module-lexer';\nimport {isFrameworkPkg, readInstalledPkg} from './installed-packages.js';\nimport type {Plugin} from 'vite';\n\nexport interface SourceWorkspace {\n name: string;\n srcDir: string;\n}\n\nexport interface ClientDepEntry {\n /** The `optimizeDeps.include` entry: `dep/sub` or `from > dep/sub`. */\n entry: string;\n /** The specifier as the framework package imports it. */\n specifier: string;\n /** The framework package the import was found in. */\n from: string;\n /** Package name of the dependency. */\n depName: string;\n /** Real path of the dependency's package root, as resolved from `from`. */\n depRoot: string;\n /** True when the app root does not resolve `depName` to that same copy. */\n nested: boolean;\n}\n\nexport type SkipReason =\n 'unresolved' | 'server-only' | 'server-code' | 'excluded' | 'denied';\n\nexport interface SkippedClientDep {\n specifier: string;\n from: string;\n reason: SkipReason;\n}\n\nexport interface ClientDepScanOptions {\n /** App root. Default `process.cwd()`. */\n cwd?: string;\n /** Framework packages served from source: their `src/` is scanned instead of `lib/`. */\n sourceWorkspaces?: SourceWorkspace[];\n /** Entries never to add, matched against the entry, the specifier and the package name. */\n deny?: (string | RegExp)[];\n /**\n * JSON file remembering what does not change between runs: the module graphs\n * of installed (non-source) framework packages and the server-only verdicts\n * of dependencies, keyed by real path and version. Omit to scan everything.\n */\n cacheFile?: string;\n}\n\nexport interface ScannedFrameworkPackage {\n name: string;\n root: string;\n json: any;\n source: boolean;\n}\n\nexport interface ClientDepScan {\n entries: ClientDepEntry[];\n skipped: SkippedClientDep[];\n frameworkPackages: ScannedFrameworkPackage[];\n /** Excluded names that the app root does not resolve at all. */\n unresolvedExcludes: string[];\n filesScanned: number;\n}\n\n/** Conditions a browser build resolves, in the order a client resolver prefers them. */\nconst CLIENT_CONDITIONS = ['browser', 'import', 'module', 'default'];\n/** Conditions never taken for a client file. `development` points at `src/`, scanned separately. */\nconst NON_CLIENT_CONDITIONS = new Set([\n 'require',\n 'node',\n 'types',\n 'typings',\n 'development',\n 'deno',\n 'bun',\n 'worker',\n 'react-native',\n]);\n/** Specifiers that are assets, not modules the optimizer can pre-bundle. */\nconst ASSET_SPECIFIER =\n /\\.(css|scss|sass|less|styl|pcss|svg|png|jpe?g|gif|webp|avif|ico|bmp|woff2?|ttf|otf|eot|json|wasm|html?|txt|md|glsl)$/i;\nconst SOURCE_FILE = /\\.(m?[jt]sx?|cjs)$/;\nconst IGNORED_SOURCE_FILE = /(\\.d\\.ts|\\.(test|spec|stories)\\.[mc]?[jt]sx?)$/;\nconst IGNORED_SOURCE_DIR = new Set([\n 'node_modules',\n '__tests__',\n '__mocks__',\n '__fixtures__',\n]);\n/**\n * Never listed, whoever imports them. `typescript` is a peer of packages that\n * analyse source at build time (translation key sync); it declares a `browser`\n * field, so it passes the server-only test, and pre-bundling it costs seconds.\n */\nexport const DEFAULT_DENY: (string | RegExp)[] = ['typescript'];\n/** A server-only check stops after this many files of one dependency. */\nconst MAX_DEP_FILES = 400;\n\n/** `@scope/name/sub` → `@scope/name`; `name/sub` → `name`. */\nexport function packageNameOf(specifier: string): string {\n const parts = specifier.split('/');\n return specifier.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0];\n}\n\n/** A bare module specifier naming another package (not relative, builtin, virtual, asset or `#import`). */\nexport function isBarePackageSpecifier(specifier: string): boolean {\n if (!specifier || specifier.startsWith('.') || specifier.startsWith('/'))\n return false;\n if (specifier.startsWith('#') || specifier.startsWith('\\0')) return false;\n if (specifier.includes(':') || specifier.includes('?')) return false; // node:, virtual:, http:, ?raw\n if (isBuiltin(specifier)) return false;\n if (ASSET_SPECIFIER.test(specifier)) return false;\n return /^(@[\\w.-]+\\/)?[\\w.-]/.test(specifier);\n}\n\nconst matchesDeny = (deny: (string | RegExp)[], ...values: string[]): boolean =>\n deny.some((d) =>\n values.some((v) => (typeof d === 'string' ? d === v : d.test(v))),\n );\n\nasync function realpath(p: string): Promise<string> {\n try {\n return await fs.realpath(p);\n } catch {\n return path.resolve(p);\n }\n}\n\nasync function isFile(p: string): Promise<boolean> {\n try {\n return (await fs.stat(p)).isFile();\n } catch {\n return false;\n }\n}\n\nasync function listFiles(\n dir: string,\n accept: (file: string) => boolean,\n): Promise<string[]> {\n const out: string[] = [];\n const walk = async (d: string): Promise<void> => {\n let entries;\n try {\n entries = await fs.readdir(d, {withFileTypes: true});\n } catch {\n return;\n }\n await Promise.all(\n entries.map(async (ent) => {\n const full = path.join(d, ent.name);\n if (ent.isDirectory()) {\n if (!IGNORED_SOURCE_DIR.has(ent.name)) await walk(full);\n } else if (accept(full)) {\n out.push(full);\n }\n }),\n );\n };\n await walk(dir);\n return out;\n}\n\n/** Pick the target of one export entry for the given conditions (nested condition objects allowed). */\nfunction pickConditional(target: any, conditions: string[]): string | null {\n if (typeof target === 'string') return target;\n if (Array.isArray(target)) {\n for (const t of target) {\n const hit = pickConditional(t, conditions);\n if (hit) return hit;\n }\n return null;\n }\n if (target && typeof target === 'object') {\n for (const [key, value] of Object.entries(target)) {\n if (key === 'default' || conditions.includes(key)) {\n const hit = pickConditional(value, conditions);\n if (hit) return hit;\n }\n }\n }\n return null;\n}\n\n/** Normalise `exports` to a subpath map (`{'.': …}`), or null when there is none. */\nfunction exportsMap(exportsField: any): Record<string, any> | null {\n if (exportsField === undefined || exportsField === null) return null;\n if (typeof exportsField === 'string' || Array.isArray(exportsField))\n return {'.': exportsField};\n const keys = Object.keys(exportsField);\n if (keys.length > 0 && keys.every((k) => !k.startsWith('.')))\n return {'.': exportsField};\n return exportsField;\n}\n\n/**\n * Resolve a package subpath (`.` or `./shim`) through `exports` for the given\n * conditions, the way Node does (exact key first, then the longest `*` pattern).\n * Returns the relative target, `null` when the subpath is not exported, or\n * `undefined` when the package has no `exports` at all.\n */\nexport function resolveExportsSubpath(\n json: any,\n subpath: string,\n conditions: string[],\n): string | null | undefined {\n const map = exportsMap(json?.exports);\n if (!map) return undefined;\n if (subpath in map) return pickConditional(map[subpath], conditions);\n let best: {key: string; star: string} | null = null;\n for (const key of Object.keys(map)) {\n const star = key.indexOf('*');\n if (star < 0) continue;\n const prefix = key.slice(0, star);\n const suffix = key.slice(star + 1);\n if (\n subpath.startsWith(prefix) &&\n subpath.endsWith(suffix) &&\n subpath.length >= key.length - 1 &&\n (!best || prefix.length > best.key.indexOf('*'))\n ) {\n best = {\n key,\n star: subpath.slice(prefix.length, subpath.length - suffix.length),\n };\n }\n }\n if (!best) return null;\n const target = pickConditional(map[best.key], conditions);\n return target ? target.split('*').join(best.star) : null;\n}\n\n/** Probe a file path the way a CommonJS/ESM loader would (extension, then directory index). */\nasync function probeFile(base: string): Promise<string | null> {\n for (const candidate of [\n base,\n `${base}.js`,\n `${base}.mjs`,\n `${base}.cjs`,\n path.join(base, 'index.js'),\n path.join(base, 'index.mjs'),\n ]) {\n if (await isFile(candidate)) return candidate;\n }\n return null;\n}\n\n/** The file a package subpath resolves to for a browser-or-anything lookup; null when none exists. */\nexport async function resolvePackageFile(\n root: string,\n json: any,\n subpath: string,\n conditions: string[] = [\n 'browser',\n 'import',\n 'module',\n 'default',\n 'require',\n 'node',\n ],\n): Promise<string | null> {\n const viaExports = resolveExportsSubpath(json, subpath, conditions);\n if (viaExports !== undefined) {\n return viaExports ? probeFile(path.join(root, viaExports)) : null;\n }\n if (subpath === '.') {\n const browser =\n conditions.includes('browser') &&\n typeof json.browser === 'string' &&\n json.browser;\n const main = browser || json.module || json.main || 'index.js';\n return probeFile(path.join(root, main));\n }\n return probeFile(path.join(root, subpath));\n}\n\n/** Every string target under client conditions, anywhere in `exports`. */\nfunction clientExportTargets(json: any): string[] {\n const map = exportsMap(json?.exports);\n if (!map) {\n const main =\n (typeof json?.browser === 'string' && json.browser) ||\n json?.module ||\n json?.main ||\n 'index.js';\n return [main];\n }\n const out: string[] = [];\n const visit = (target: any): void => {\n if (typeof target === 'string') out.push(target);\n else if (Array.isArray(target)) target.forEach(visit);\n else if (target && typeof target === 'object') {\n for (const [key, value] of Object.entries(target)) {\n if (!NON_CLIENT_CONDITIONS.has(key)) visit(value);\n }\n }\n };\n Object.values(map).forEach(visit);\n return out;\n}\n\n/** Expand one export target (possibly a `*` pattern) to the files it can reach. */\nasync function expandTarget(root: string, target: string): Promise<string[]> {\n const abs = path.join(root, target);\n const star = abs.indexOf('*');\n if (star < 0) {\n const file = await probeFile(abs);\n return file ? [file] : [];\n }\n const prefix = abs.slice(0, star);\n const suffix = abs.slice(star + 1);\n const dir = prefix.endsWith(path.sep) ? prefix : path.dirname(prefix);\n return listFiles(\n dir,\n (f) => f.startsWith(prefix) && f.endsWith(suffix) && !f.endsWith('.d.ts'),\n );\n}\n\nlet lexerReady: Promise<void> | null = null;\nlet esbuildTransform:\n ((code: string, opts: any) => Promise<{code: string}>) | null = null;\n\n/** The static and literal-dynamic import specifiers of a module, plus `require('x')` calls. */\nexport async function importSpecifiers(\n code: string,\n file: string,\n): Promise<string[]> {\n lexerReady ??= initLexer;\n await lexerReady;\n let js = code;\n if (/\\.[mc]?tsx?$/.test(file) || /\\.jsx$/.test(file)) {\n esbuildTransform ??= (await import('esbuild')).transform as any;\n try {\n js = (\n await esbuildTransform!(code, {\n loader: file.endsWith('x')\n ? /\\.tsx$/.test(file)\n ? 'tsx'\n : 'jsx'\n : 'ts',\n format: 'esm',\n jsx: 'automatic',\n tsconfigRaw: {compilerOptions: {experimentalDecorators: true}},\n logLevel: 'silent',\n })\n ).code;\n } catch {\n return [];\n }\n }\n const out = new Set<string>();\n try {\n const [imports] = parseImports(js);\n for (const imp of imports) if (imp.n) out.add(imp.n);\n } catch {\n // Not parseable as a module (JSX in a .js file, say): fall back to the textual forms.\n for (const m of js.matchAll(\n /(?:\\bfrom\\s*|\\bimport\\s*\\(?\\s*)['\"]([^'\"\\n]+)['\"]/g,\n ))\n out.add(m[1]);\n }\n for (const m of js.matchAll(/\\brequire\\s*\\(\\s*['\"]([^'\"\\n]+)['\"]\\s*\\)/g))\n out.add(m[1]);\n return [...out];\n}\n\ninterface ScanCacheData {\n version: number;\n graphs: Record<string, Record<string, {bare: string[]; rel: string[]}>>;\n serverOnly: Record<string, boolean>;\n}\nconst CACHE_VERSION = 1;\n\nasync function loadCache(\n file: string | undefined,\n): Promise<{data: ScanCacheData; dirty: boolean}> {\n const empty = {\n data: {version: CACHE_VERSION, graphs: {}, serverOnly: {}},\n dirty: false,\n };\n if (!file) return empty;\n try {\n const data = JSON.parse(await fs.readFile(file, 'utf8'));\n return data?.version === CACHE_VERSION && data.graphs && data.serverOnly\n ? {data, dirty: false}\n : empty;\n } catch {\n return empty;\n }\n}\n\nasync function saveCache(\n file: string | undefined,\n cache: {data: ScanCacheData; dirty: boolean},\n): Promise<void> {\n if (!file || !cache.dirty) return;\n try {\n await fs.mkdir(path.dirname(file), {recursive: true});\n const tmp = `${file}.${process.pid}.tmp`;\n await fs.writeFile(tmp, JSON.stringify(cache.data));\n await fs.rename(tmp, file);\n } catch {\n // A cache is an optimisation: an unwritable node_modules just means a full scan next time.\n }\n}\n\n/** Limit concurrent file reads: a few hundred open at once can exceed the fd limit. */\nfunction semaphore(limit: number): <T>(fn: () => Promise<T>) => Promise<T> {\n let active = 0;\n const waiting: (() => void)[] = [];\n return async (fn) => {\n if (active >= limit) await new Promise<void>((r) => waiting.push(r));\n active++;\n try {\n return await fn();\n } finally {\n active--;\n waiting.shift()?.();\n }\n };\n}\n\n/** Resolve a relative import to a module file, including the TS-source `./Sibling.js` → `.ts(x)` convention. */\nasync function resolveRelative(\n importer: string,\n specifier: string,\n): Promise<string | null> {\n if (ASSET_SPECIFIER.test(specifier)) return null;\n const base = path.resolve(path.dirname(importer), specifier);\n const candidates: string[] = [];\n if (/\\.[mc]?tsx?$/.test(importer) && /\\.jsx?$/.test(base)) {\n candidates.push(\n base.replace(/\\.jsx?$/, '.ts'),\n base.replace(/\\.jsx?$/, '.tsx'),\n );\n }\n candidates.push(base);\n for (const ext of ['.js', '.mjs', '.cjs', '.ts', '.tsx', '.jsx'])\n candidates.push(base + ext);\n for (const ext of ['.js', '.mjs', '.ts', '.tsx'])\n candidates.push(path.join(base, 'index' + ext));\n for (const c of candidates) {\n if (SOURCE_FILE.test(c) && (await isFile(c))) return c;\n }\n return null;\n}\n\nexport interface ModuleNode {\n file: string;\n /** Bare specifiers the module imports (packages and builtins). */\n bare: string[];\n /** Module files it imports relatively. */\n rel: string[];\n}\n\ninterface ReadGraphOptions {\n maxFiles?: number;\n /** Also follow a bare import: return the file it resolves to, or null to not follow it. */\n followBare?: (specifier: string, importer: string) => Promise<string | null>;\n /** Stop reading once this returns true for a node. */\n stopWhen?: (node: ModuleNode) => boolean;\n}\n\nconst readLimit = semaphore(64);\n\n/** Read the module graph reachable from `entries` through relative imports (and `followBare`). */\nasync function readGraph(\n entries: string[],\n opts: ReadGraphOptions = {},\n): Promise<Map<string, ModuleNode>> {\n const nodes = new Map<string, ModuleNode>();\n const maxFiles = opts.maxFiles ?? Infinity;\n let stopped = false;\n const visit = async (file: string): Promise<void> => {\n if (stopped || nodes.has(file) || nodes.size >= maxFiles) return;\n const node: ModuleNode = {file, bare: [], rel: []};\n nodes.set(file, node);\n const specs = await readLimit(async () => {\n try {\n return await importSpecifiers(await fs.readFile(file, 'utf8'), file);\n } catch {\n return [];\n }\n });\n const children: (string | null)[] = await Promise.all(\n specs.map(async (spec) => {\n if (spec.startsWith('.') || spec.startsWith('/')) {\n const resolved = await resolveRelative(file, spec);\n if (resolved) node.rel.push(resolved);\n return resolved;\n }\n node.bare.push(spec);\n return opts.followBare ? opts.followBare(spec, file) : null;\n }),\n );\n if (opts.stopWhen?.(node)) {\n stopped = true;\n return;\n }\n await Promise.all(children.filter((c): c is string => !!c).map(visit));\n };\n await Promise.all(entries.map(visit));\n return nodes;\n}\n\n/** True when the package declares a browser entry anywhere (`browser` field or condition). */\nfunction hasBrowserEntry(json: any): boolean {\n if (json?.browser) return true;\n let found = false;\n const visit = (v: any): void => {\n if (found || !v || typeof v !== 'object') return;\n for (const [key, value] of Object.entries(v)) {\n if (key === 'browser') found = true;\n else visit(value);\n }\n };\n visit(json?.exports);\n return found;\n}\n\nconst isBuiltinSpecifier = (spec: string): boolean =>\n spec.startsWith('node:') || isBuiltin(spec);\nconst subpathOf = (specifier: string): string => {\n const name = packageNameOf(specifier);\n return specifier === name ? '.' : `.${specifier.slice(name.length)}`;\n};\nconst NODE_CONDITIONS = ['import', 'module', 'default', 'require', 'node'];\n\ntype InstalledLookup = (\n name: string,\n fromDir: string,\n) => Promise<{root: string; json: any} | null>;\n\n/** `readInstalledPkg`, memoised for one scan. */\nfunction memoInstalled(): InstalledLookup {\n const cache = new Map<string, Promise<{root: string; json: any} | null>>();\n return (name, fromDir) => {\n const key = `${name}\\0${fromDir}`;\n if (!cache.has(key)) cache.set(key, readInstalledPkg(name, fromDir));\n return cache.get(key)!;\n };\n}\n\n/**\n * Server-only: no browser entry, and the module graph behind the imported\n * subpath — followed through its own dependencies, as long as those have no\n * browser entry either — reaches a Node builtin. Such a package (express,\n * sharp, bcrypt, jsonwebtoken, cookie-parser) serves a framework package's\n * server code; listing it would make esbuild bundle it for the browser.\n */\nexport async function isServerOnlyDependency(\n root: string,\n json: any,\n subpath: string,\n lookup: InstalledLookup = readInstalledPkg,\n): Promise<boolean> {\n if (hasBrowserEntry(json)) return false;\n const entry = await resolvePackageFile(root, json, subpath, NODE_CONDITIONS);\n if (!entry) return false;\n let builtin = false;\n await readGraph([entry], {\n maxFiles: MAX_DEP_FILES,\n followBare: async (spec, importer) => {\n if (!isBarePackageSpecifier(spec)) return null;\n const dep = await lookup(packageNameOf(spec), path.dirname(importer));\n if (!dep || hasBrowserEntry(dep.json)) return null;\n return resolvePackageFile(\n dep.root,\n dep.json,\n subpathOf(spec),\n NODE_CONDITIONS,\n );\n },\n stopWhen: (node) =>\n (builtin = builtin || node.bare.some(isBuiltinSpecifier)),\n });\n return builtin;\n}\n\n/** The files a framework package's client code can start from. */\nasync function clientEntryFiles(\n pkg: ScannedFrameworkPackage,\n): Promise<string[]> {\n if (pkg.source) {\n return listFiles(\n path.join(pkg.root, 'src'),\n (f) => SOURCE_FILE.test(f) && !IGNORED_SOURCE_FILE.test(f),\n );\n }\n return (\n await Promise.all(\n clientExportTargets(pkg.json).map((t) => expandTarget(pkg.root, t)),\n )\n ).flat();\n}\n\ninterface DepVerdict {\n reason?: 'unresolved' | 'server-only';\n depName: string;\n depRoot?: string;\n}\n\n/**\n * Scan the framework packages among `excluded` for the third-party\n * dependencies their client code imports, and work out the\n * `optimizeDeps.include` entry for each.\n *\n * Framework packages export whole directories (`\"./*\": \"./lib/esm/*.js\"`), so\n * \"reachable from the client exports\" is every file — server code included. A\n * file is therefore treated as SERVER code when it imports a Node builtin or a\n * server-only dependency, or relatively imports a file that does; only the\n * imports of the remaining files are listed.\n */\nexport async function scanLinkedClientDeps(\n excluded: string[],\n opts: ClientDepScanOptions = {},\n): Promise<ClientDepScan> {\n const cwd = path.resolve(opts.cwd ?? process.cwd());\n const deny = [...DEFAULT_DENY, ...(opts.deny ?? [])];\n const excludedSet = new Set(excluded);\n const sourceByName = new Map(\n (opts.sourceWorkspaces ?? []).map((w) => [w.name, w]),\n );\n const lookup = memoInstalled();\n const cache = await loadCache(opts.cacheFile);\n const unresolvedExcludes: string[] = [];\n\n // 1. The excluded packages to scan: every source workspace (Vite does not crawl\n // an excluded package, whatever it is), and the installed framework packages.\n // A package with a `bin` is a command-line tool (`@_linked/cli`), whose code\n // no browser loads; scanning it would only list build tooling.\n const frameworkPackages = (\n await Promise.all(\n [...excludedSet].map(\n async (name): Promise<ScannedFrameworkPackage | null> => {\n const ws = sourceByName.get(name);\n if (ws) {\n const root = await realpath(path.dirname(ws.srcDir));\n let json: any = {};\n try {\n json = JSON.parse(\n await fs.readFile(path.join(root, 'package.json'), 'utf8'),\n );\n } catch {}\n return {name, root, json, source: true};\n }\n const installed = await lookup(name, cwd);\n if (!installed) {\n unresolvedExcludes.push(name);\n return null;\n }\n if (!isFrameworkPkg(name) && installed.json.linkedPackage !== true)\n return null;\n return {\n name,\n root: await realpath(installed.root),\n json: installed.json,\n source: false,\n };\n },\n ),\n )\n ).filter((p): p is ScannedFrameworkPackage => !!p && !p.json?.bin);\n\n // 2. Each package's module graph.\n const owner = new Map<string, ScannedFrameworkPackage>();\n const nodes = new Map<string, ModuleNode>();\n await Promise.all(\n frameworkPackages.map(async (pkg) => {\n const cacheKey = pkg.source ? null : `${pkg.root}\\0${pkg.json.version}`;\n let graph: Map<string, ModuleNode>;\n if (cacheKey && cache.data.graphs[cacheKey]) {\n graph = new Map(\n Object.entries(cache.data.graphs[cacheKey]).map(([file, n]) => [\n file,\n {file, ...n},\n ]),\n );\n } else {\n graph = await readGraph(await clientEntryFiles(pkg));\n if (cacheKey) {\n cache.data.graphs[cacheKey] = Object.fromEntries(\n [...graph].map(([file, n]) => [file, {bare: n.bare, rel: n.rel}]),\n );\n cache.dirty = true;\n }\n }\n for (const [file, node] of graph) {\n if (nodes.has(file)) continue;\n nodes.set(file, node);\n owner.set(file, pkg);\n }\n }),\n );\n\n // 3. A verdict for every (package, dependency specifier) pair.\n const verdicts = new Map<string, Promise<DepVerdict | null>>();\n const serverOnly = new Map<string, Promise<boolean>>();\n const pairKey = (pkg: ScannedFrameworkPackage, spec: string): string =>\n `${pkg.name}\\0${spec}`;\n const verdictFor = (\n pkg: ScannedFrameworkPackage,\n spec: string,\n ): Promise<DepVerdict | null> => {\n const key = pairKey(pkg, spec);\n if (!verdicts.has(key)) {\n verdicts.set(\n key,\n (async (): Promise<DepVerdict | null> => {\n if (!isBarePackageSpecifier(spec)) return null;\n const depName = packageNameOf(spec);\n if (depName === pkg.name || isFrameworkPkg(depName)) return null;\n const installed = await lookup(depName, pkg.root);\n if (!installed) return {reason: 'unresolved', depName};\n if (installed.json.linkedPackage === true) return null;\n const depRoot = await realpath(installed.root);\n const cacheKey = `${depRoot}\\0${subpathOf(spec)}`;\n if (!serverOnly.has(cacheKey)) {\n const persisted = `${cacheKey}\\0${installed.json.version}`;\n serverOnly.set(\n cacheKey,\n persisted in cache.data.serverOnly\n ? Promise.resolve(cache.data.serverOnly[persisted])\n : isServerOnlyDependency(\n depRoot,\n installed.json,\n subpathOf(spec),\n lookup,\n ).then((v) => {\n cache.data.serverOnly[persisted] = v;\n cache.dirty = true;\n return v;\n }),\n );\n }\n return {\n reason: (await serverOnly.get(cacheKey))\n ? 'server-only'\n : undefined,\n depName,\n depRoot,\n };\n })(),\n );\n }\n return verdicts.get(key)!;\n };\n await Promise.all(\n [...nodes.values()].flatMap((n) =>\n n.bare.map((spec) => verdictFor(owner.get(n.file)!, spec)),\n ),\n );\n\n // 4. Server code: files importing a builtin or a server-only dependency, and\n // every file that relatively imports one of those.\n const server = new Set<string>();\n const importers = new Map<string, string[]>();\n for (const node of nodes.values()) {\n for (const dep of node.rel) {\n if (!importers.has(dep)) importers.set(dep, []);\n importers.get(dep)!.push(node.file);\n }\n }\n const queue: string[] = [];\n for (const node of nodes.values()) {\n const pkg = owner.get(node.file)!;\n for (const spec of node.bare) {\n if (\n isBuiltinSpecifier(spec) ||\n (await verdicts.get(pairKey(pkg, spec)))?.reason === 'server-only'\n ) {\n server.add(node.file);\n queue.push(node.file);\n break;\n }\n }\n }\n while (queue.length) {\n for (const parent of importers.get(queue.pop()!) ?? []) {\n if (!server.has(parent)) {\n server.add(parent);\n queue.push(parent);\n }\n }\n }\n\n // 5. Entries from client files; everything else is reported as skipped.\n const rootCopy = new Map<string, Promise<string | null>>();\n const rootResolution = (depName: string): Promise<string | null> => {\n if (!rootCopy.has(depName)) {\n rootCopy.set(\n depName,\n lookup(depName, cwd).then((r) => (r ? realpath(r.root) : null)),\n );\n }\n return rootCopy.get(depName)!;\n };\n const entries = new Map<string, ClientDepEntry>();\n const clientPairs = new Set<string>();\n const skipped = new Map<string, SkippedClientDep>();\n const skip = (specifier: string, from: string, reason: SkipReason): void => {\n skipped.set(`${specifier}\\0${from}`, {specifier, from, reason});\n };\n for (const node of nodes.values()) {\n if (server.has(node.file)) continue;\n const pkg = owner.get(node.file)!;\n for (const spec of node.bare) clientPairs.add(pairKey(pkg, spec));\n }\n for (const node of nodes.values()) {\n const pkg = owner.get(node.file)!;\n for (const spec of node.bare) {\n const key = pairKey(pkg, spec);\n const verdict = await verdicts.get(key);\n if (!verdict) continue;\n if (verdict.reason) {\n skip(spec, pkg.name, verdict.reason);\n continue;\n }\n if (!clientPairs.has(key)) {\n if (!skipped.has(`${spec}\\0${pkg.name}`))\n skip(spec, pkg.name, 'server-code');\n continue;\n }\n if (excludedSet.has(verdict.depName) || excludedSet.has(spec)) {\n skip(spec, pkg.name, 'excluded');\n continue;\n }\n const nested =\n (await rootResolution(verdict.depName)) !== verdict.depRoot;\n const entry = nested ? `${pkg.name} > ${spec}` : spec;\n if (matchesDeny(deny, entry, spec, verdict.depName)) {\n skip(spec, pkg.name, 'denied');\n continue;\n }\n if (!entries.has(entry)) {\n entries.set(entry, {\n entry,\n specifier: spec,\n from: pkg.name,\n depName: verdict.depName,\n depRoot: verdict.depRoot!,\n nested,\n });\n }\n }\n }\n for (const {specifier, from} of entries.values())\n skipped.delete(`${specifier}\\0${from}`);\n await saveCache(opts.cacheFile, cache);\n\n return {\n entries: [...entries.values()].sort((a, b) =>\n a.entry.localeCompare(b.entry),\n ),\n skipped: [...skipped.values()].sort(\n (a, b) =>\n a.specifier.localeCompare(b.specifier) || a.from.localeCompare(b.from),\n ),\n frameworkPackages,\n unresolvedExcludes,\n filesScanned: nodes.size,\n };\n}\n\n/** Just the entries, for `optimizeDeps.include`. */\nexport async function linkedClientDepIncludes(\n excluded: string[],\n opts: ClientDepScanOptions = {},\n): Promise<string[]> {\n return (await scanLinkedClientDeps(excluded, opts)).entries.map(\n (e) => e.entry,\n );\n}\n\nexport interface RecordedClientDepScan {\n cwd: string;\n scan: ClientDepScan;\n /** The app's own `optimizeDeps.include`, before anything was added. */\n appInclude: string[];\n exclude: string[];\n}\n\n/**\n * The most recent scan the plugin ran in this process, with the app's own\n * include list — `linked app-doctor` loads the app's config and reads this, so it\n * checks exactly what the dev server would use.\n */\nexport const lastClientDepScan: {current: RecordedClientDepScan | null} = ((\n globalThis as any\n)[Symbol.for('@_linked/cli.lastClientDepScan')] ??= {current: null});\n\nexport interface ClientDepIncludesPluginOptions {\n /** Framework packages served from source (the discovered workspaces). */\n sourceWorkspaces?: SourceWorkspace[];\n /** Entries never to add. See `ClientDepScanOptions.deny`. */\n deny?: (string | RegExp)[];\n /** Override the scan cache location; `false` disables the cache. */\n cacheFile?: string | false;\n}\n\n/** Where the scan cache lives: beside Vite's own cache, inside the app's node_modules. */\nexport const defaultClientDepCacheFile = (cwd: string): string =>\n path.join(cwd, 'node_modules', '.cache', 'linked', 'client-deps.json');\n\nconst debugEnabled = (): boolean =>\n /(^|[\\s,])(linked(:[\\w*]+)?|\\*)($|[\\s,])/.test(process.env.DEBUG ?? '');\n\n/**\n * Adds the scan's entries to `optimizeDeps.include` in dev.\n *\n * It is a `config` hook ordered `post` rather than a value computed inside\n * `createViteConfig`, because the exclude list it reads is only final once the\n * app has merged its own config on top — an app that excludes every installed\n * `@_linked/*` package does that in its own `vite.config.ts`. Vite concatenates\n * the returned array onto the app's own `include`, which is never replaced.\n */\nexport function linkedClientDepIncludesPlugin(\n opts: ClientDepIncludesPluginOptions = {},\n): Plugin[] {\n // What the app itself lists, before other plugins add theirs\n // (@vitejs/plugin-react adds `react`, `react/jsx-runtime`…): `linked app-doctor`\n // must not tell anyone to delete an entry they never wrote.\n let appInclude: string[] = [];\n const snapshot: Plugin = {\n name: 'linked:client-dep-includes:app-include',\n apply: 'serve',\n config: {\n order: 'pre',\n handler(userConfig) {\n appInclude = [...(userConfig.optimizeDeps?.include ?? [])];\n },\n },\n };\n return [\n snapshot,\n {\n name: 'linked:client-dep-includes',\n apply: 'serve',\n config: {\n order: 'post',\n async handler(userConfig) {\n const optimizeDeps = userConfig.optimizeDeps ?? {};\n // `linked start --api-only` has no browser client to optimise for.\n if (optimizeDeps.noDiscovery) return;\n const cwd = path.resolve(userConfig.root ?? process.cwd());\n const started = performance.now();\n const scan = await scanLinkedClientDeps(optimizeDeps.exclude ?? [], {\n cwd,\n sourceWorkspaces: opts.sourceWorkspaces,\n deny: opts.deny,\n cacheFile:\n opts.cacheFile === false\n ? undefined\n : (opts.cacheFile ?? defaultClientDepCacheFile(cwd)),\n });\n const existing = new Set(optimizeDeps.include ?? []);\n const added = scan.entries\n .map((e) => e.entry)\n .filter((e) => !existing.has(e));\n lastClientDepScan.current = {\n cwd,\n scan,\n appInclude,\n exclude: optimizeDeps.exclude ?? [],\n };\n if (debugEnabled()) {\n console.log(\n `[linked] optimizeDeps.include: ${added.length} entries for linked packages' client dependencies ` +\n `(${Math.round(performance.now() - started)}ms, ${scan.filesScanned} files)` +\n added.map((e) => `\\n ${e}`).join(''),\n );\n }\n return added.length ? {optimizeDeps: {include: added}} : undefined;\n },\n },\n },\n ];\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ClientDepScan } from '../client-dep-includes.js';
|
|
2
|
-
export interface
|
|
2
|
+
export interface AppDoctorFinding {
|
|
3
3
|
level: 'warn' | 'info';
|
|
4
4
|
message: string;
|
|
5
5
|
}
|
|
@@ -11,9 +11,15 @@ export interface DiagnoseInput {
|
|
|
11
11
|
}
|
|
12
12
|
/** Split a Vite include entry (`a > b > c/sub`) and resolve it hop by hop, like Vite's nested-dep syntax. */
|
|
13
13
|
export declare function resolveIncludeEntry(cwd: string, entry: string): Promise<string | null>;
|
|
14
|
-
export declare function diagnose({ cwd, appInclude, scan, }: DiagnoseInput): Promise<
|
|
15
|
-
export interface
|
|
14
|
+
export declare function diagnose({ cwd, appInclude, scan, }: DiagnoseInput): Promise<AppDoctorFinding[]>;
|
|
15
|
+
export interface AppDoctorOptions {
|
|
16
16
|
cwd?: string;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Why `cwd` is not an app, or null when it is. Without this, Vite resolves an
|
|
20
|
+
* empty default config, the scan finds nothing, and the report says
|
|
21
|
+
* "0 warnings" — a clean bill of health for a directory that was never checked.
|
|
22
|
+
*/
|
|
23
|
+
export declare function notAnAppReason(cwd: string): string | null;
|
|
24
|
+
export declare function runAppDoctor(options?: AppDoctorOptions): Promise<void>;
|
|
25
|
+
//# sourceMappingURL=app-doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-doctor.d.ts","sourceRoot":"","sources":["../../../src/commands/app-doctor.ts"],"names":[],"mappings":"AAuBA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,6GAA6G;AAC7G,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiBxB;AAKD,wBAAsB,QAAQ,CAAC,EAC7B,GAAG,EACH,UAAU,EACV,IAAI,GACL,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA2E7C;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAiCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASzD;AAED,wBAAsB,YAAY,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBhF"}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
* `linked doctor` — check an app's dev dependency setup for the problems that
|
|
11
|
+
* `linked app-doctor` — check an app's dev dependency setup for the problems that
|
|
12
12
|
* otherwise only show up in the browser.
|
|
13
13
|
*
|
|
14
14
|
* It loads the app's Vite config the way the dev server does, runs the same
|
|
@@ -26,6 +26,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
26
26
|
* Hand-written include entries that the scan now generates are listed too, as
|
|
27
27
|
* safe to delete.
|
|
28
28
|
*/
|
|
29
|
+
import fs from 'node:fs';
|
|
29
30
|
import path from 'node:path';
|
|
30
31
|
import semver from 'semver';
|
|
31
32
|
import { readInstalledPkg } from '../installed-packages.js';
|
|
@@ -147,10 +148,31 @@ function loadAppScan(cwd) {
|
|
|
147
148
|
};
|
|
148
149
|
});
|
|
149
150
|
}
|
|
150
|
-
|
|
151
|
+
/** The config names `linked start` and `linked build-app` accept as "this is an app". */
|
|
152
|
+
const APP_VITE_CONFIGS = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];
|
|
153
|
+
/**
|
|
154
|
+
* Why `cwd` is not an app, or null when it is. Without this, Vite resolves an
|
|
155
|
+
* empty default config, the scan finds nothing, and the report says
|
|
156
|
+
* "0 warnings" — a clean bill of health for a directory that was never checked.
|
|
157
|
+
*/
|
|
158
|
+
export function notAnAppReason(cwd) {
|
|
159
|
+
if (APP_VITE_CONFIGS.some((f) => fs.existsSync(path.join(cwd, f)))) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
return (`linked app-doctor: ${cwd} is not an app — no vite.config.{ts,js,mjs} found. ` +
|
|
163
|
+
'Run it from the root of an app (the directory with its vite.config); ' +
|
|
164
|
+
'it checks how the app uses linked packages, so there is nothing to check in a package.');
|
|
165
|
+
}
|
|
166
|
+
export function runAppDoctor() {
|
|
151
167
|
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
152
168
|
var _a;
|
|
153
169
|
const cwd = path.resolve((_a = options.cwd) !== null && _a !== void 0 ? _a : process.cwd());
|
|
170
|
+
const notAnApp = notAnAppReason(cwd);
|
|
171
|
+
if (notAnApp) {
|
|
172
|
+
console.error(notAnApp);
|
|
173
|
+
process.exitCode = 1;
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
154
176
|
const started = performance.now();
|
|
155
177
|
const { appInclude, scan } = yield loadAppScan(cwd);
|
|
156
178
|
const findings = yield diagnose({ cwd, appInclude, scan });
|
|
@@ -158,10 +180,10 @@ export function runDoctor() {
|
|
|
158
180
|
(f.level === 'warn' ? console.warn : console.log)(`${f.level === 'warn' ? 'warning' : 'note'}: ${f.message}`);
|
|
159
181
|
}
|
|
160
182
|
const warnings = findings.filter((f) => f.level === 'warn').length;
|
|
161
|
-
console.log(`linked doctor: ${warnings} warning${warnings === 1 ? '' : 's'}; ` +
|
|
183
|
+
console.log(`linked app-doctor: ${warnings} warning${warnings === 1 ? '' : 's'}; ` +
|
|
162
184
|
`${scan.entries.length} client dependencies of ${scan.frameworkPackages.length} linked packages ` +
|
|
163
185
|
`generated for optimizeDeps.include (${Math.round(performance.now() - started)}ms)`);
|
|
164
186
|
process.exitCode = warnings ? 1 : 0;
|
|
165
187
|
});
|
|
166
188
|
}
|
|
167
|
-
//# sourceMappingURL=doctor.js.map
|
|
189
|
+
//# sourceMappingURL=app-doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-doctor.js","sourceRoot":"","sources":["../../../src/commands/app-doctor.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AAcnC,6GAA6G;AAC7G,MAAM,UAAgB,mBAAmB,CACvC,GAAW,EACX,KAAa;;QAEb,MAAM,IAAI,GAAG,KAAK;aACf,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACpB,MAAM,CAAC,OAAO,CAAC,CAAC;QACnB,IAAI,OAAO,GAAG,GAAG,CAAC;QAClB,KAAK,IAAI,CAA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C,OAAO,CAAC,MAAM,2BAA2B,IAAI,CAAC,iBAAiB,CAAC,MAAM,mBAAmB;YACjG,uCAAuC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,CACtF,CAAC;QACF,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;CAAA","sourcesContent":["/**\n * `linked app-doctor` — check an app's dev dependency setup for the problems that\n * otherwise only show up in the browser.\n *\n * It loads the app's Vite config the way the dev server does, runs the same\n * client-dependency scan `createViteConfig` runs (./client-dep-includes.ts), and\n * warns about:\n *\n * - `optimizeDeps.include` entries that do not resolve. Vite only logs these,\n * and the dependency then reaches the browser unoptimised — a CommonJS one\n * fails on `require`. The usual cause is a package npm installed NESTED under\n * a framework package, which needs the `'<pkg> > <dep>'` form.\n * - a framework package's dependency whose React peer range excludes the app's\n * React. That is why npm nests it (vaul 0.9 under `@_linked/primitives` with\n * React 19); the fix is a newer release of the dependency in that package.\n *\n * Hand-written include entries that the scan now generates are listed too, as\n * safe to delete.\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport semver from 'semver';\nimport {readInstalledPkg} from '../installed-packages.js';\nimport {\n lastClientDepScan,\n packageNameOf,\n resolvePackageFile,\n scanLinkedClientDeps,\n type ClientDepScan,\n} from '../client-dep-includes.js';\n\nexport interface AppDoctorFinding {\n level: 'warn' | 'info';\n message: string;\n}\n\nexport interface DiagnoseInput {\n cwd: string;\n /** The app's own `optimizeDeps.include` (hand-written, before generation). */\n appInclude: string[];\n scan: ClientDepScan;\n}\n\n/** Split a Vite include entry (`a > b > c/sub`) and resolve it hop by hop, like Vite's nested-dep syntax. */\nexport async function resolveIncludeEntry(\n cwd: string,\n entry: string,\n): Promise<string | null> {\n const hops = entry\n .split('>')\n .map((s) => s.trim())\n .filter(Boolean);\n let fromDir = cwd;\n for (let i = 0; i < hops.length; i++) {\n const name = packageNameOf(hops[i]);\n const installed = await readInstalledPkg(name, fromDir);\n if (!installed) return null;\n if (i === hops.length - 1) {\n const subpath = hops[i] === name ? '.' : `.${hops[i].slice(name.length)}`;\n return resolvePackageFile(installed.root, installed.json, subpath);\n }\n fromDir = installed.root;\n }\n return null;\n}\n\n/** The peer names whose ranges must admit the app's copy. */\nconst CHECKED_PEERS = ['react', 'react-dom'];\n\nexport async function diagnose({\n cwd,\n appInclude,\n scan,\n}: DiagnoseInput): Promise<AppDoctorFinding[]> {\n const findings: AppDoctorFinding[] = [];\n const generated = new Map(scan.entries.map((e) => [e.entry, e]));\n\n // 1. Include entries that do not resolve.\n await Promise.all(\n appInclude.map(async (entry) => {\n if (await resolveIncludeEntry(cwd, entry)) return;\n const nestedForm = scan.entries.find(\n (e) => e.nested && (e.specifier === entry || e.depName === entry),\n );\n findings.push({\n level: 'warn',\n message:\n `optimizeDeps.include entry '${entry}' does not resolve from ${cwd}` +\n (nestedForm\n ? ` — it is installed under ${nestedForm.from}; use '${nestedForm.entry}' (generated automatically, so the entry can simply be removed)`\n : ' — remove it from vite.config, or install the package'),\n });\n }),\n );\n\n // 2. Dependencies of framework packages whose React peer range excludes the app's React.\n const appVersions = new Map<string, string>();\n for (const peer of CHECKED_PEERS) {\n const installed = await readInstalledPkg(peer, cwd);\n if (installed?.json?.version) appVersions.set(peer, installed.json.version);\n }\n const seen = new Set<string>();\n for (const pkg of scan.frameworkPackages) {\n for (const dep of Object.keys(pkg.json?.dependencies ?? {})) {\n const installed = await readInstalledPkg(dep, pkg.root);\n if (!installed || seen.has(`${pkg.name}\\0${dep}`)) continue;\n const excluded = [...appVersions].filter(([peer, version]) => {\n const range = installed.json.peerDependencies?.[peer];\n return (\n range && !semver.satisfies(version, range, {includePrerelease: true})\n );\n });\n if (!excluded.length) continue;\n seen.add(`${pkg.name}\\0${dep}`);\n const [firstPeer, appVersion] = excluded[0];\n const nested =\n path\n .relative(cwd, installed.root)\n .split(path.sep)\n .filter((s) => s === 'node_modules').length > 1;\n findings.push({\n level: 'warn',\n message:\n `${pkg.name} depends on ${dep}@${installed.json.version}, whose peer range ` +\n excluded\n .map(\n ([peer]) => `${peer} '${installed.json.peerDependencies[peer]}'`,\n )\n .join(', ') +\n ` excludes the app's ${excluded.map(([peer, v]) => `${peer} ${v}`).join(', ')}` +\n (nested ? `, so npm installed it nested under ${pkg.name}` : '') +\n `. Bump ${dep} in ${pkg.name} to a release that supports ${firstPeer} ${semver.major(appVersion)}.`,\n });\n }\n }\n\n // 3. Hand-written entries the scan generates anyway.\n const redundant = appInclude.filter((e) => generated.has(e));\n if (redundant.length) {\n findings.push({\n level: 'info',\n message:\n `${redundant.length} optimizeDeps.include entr${redundant.length === 1 ? 'y is' : 'ies are'} generated ` +\n `automatically and can be removed from vite.config:\\n` +\n redundant.map((e) => ` ${e}`).join('\\n'),\n });\n }\n return findings;\n}\n\nexport interface AppDoctorOptions {\n cwd?: string;\n}\n\n/** Load the app's dev config and return what the plugin scanned, running the scan itself if the plugin did not. */\nasync function loadAppScan(\n cwd: string,\n): Promise<{appInclude: string[]; scan: ClientDepScan}> {\n const {resolveConfig} = await import('vite');\n lastClientDepScan.current = null;\n const config = await resolveConfig(\n {root: cwd, mode: 'development', logLevel: 'error'},\n 'serve',\n );\n const recorded = lastClientDepScan.current as\n import('../client-dep-includes.js').RecordedClientDepScan | null;\n if (recorded && path.resolve(recorded.cwd) === path.resolve(cwd)) {\n return {appInclude: recorded.appInclude, scan: recorded.scan};\n }\n // The app does not use createViteConfig (or turned the generation off): scan\n // what it excludes, with the workspaces the helper would have discovered.\n const {discoverWorkspaces} = await import('../vite-config.js');\n const optimizeDeps = config.optimizeDeps ?? {};\n return {\n appInclude: optimizeDeps.include ?? [],\n scan: await scanLinkedClientDeps(optimizeDeps.exclude ?? [], {\n cwd,\n sourceWorkspaces: await discoverWorkspaces([], cwd),\n }),\n };\n}\n\n/** The config names `linked start` and `linked build-app` accept as \"this is an app\". */\nconst APP_VITE_CONFIGS = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n\n/**\n * Why `cwd` is not an app, or null when it is. Without this, Vite resolves an\n * empty default config, the scan finds nothing, and the report says\n * \"0 warnings\" — a clean bill of health for a directory that was never checked.\n */\nexport function notAnAppReason(cwd: string): string | null {\n if (APP_VITE_CONFIGS.some((f) => fs.existsSync(path.join(cwd, f)))) {\n return null;\n }\n return (\n `linked app-doctor: ${cwd} is not an app — no vite.config.{ts,js,mjs} found. ` +\n 'Run it from the root of an app (the directory with its vite.config); ' +\n 'it checks how the app uses linked packages, so there is nothing to check in a package.'\n );\n}\n\nexport async function runAppDoctor(options: AppDoctorOptions = {}): Promise<void> {\n const cwd = path.resolve(options.cwd ?? process.cwd());\n const notAnApp = notAnAppReason(cwd);\n if (notAnApp) {\n console.error(notAnApp);\n process.exitCode = 1;\n return;\n }\n const started = performance.now();\n const {appInclude, scan} = await loadAppScan(cwd);\n const findings = await diagnose({cwd, appInclude, scan});\n for (const f of findings) {\n (f.level === 'warn' ? console.warn : console.log)(\n `${f.level === 'warn' ? 'warning' : 'note'}: ${f.message}`,\n );\n }\n const warnings = findings.filter((f) => f.level === 'warn').length;\n console.log(\n `linked app-doctor: ${warnings} warning${warnings === 1 ? '' : 's'}; ` +\n `${scan.entries.length} client dependencies of ${scan.frameworkPackages.length} linked packages ` +\n `generated for optimizeDeps.include (${Math.round(performance.now() - started)}ms)`,\n );\n process.exitCode = warnings ? 1 : 0;\n}\n"]}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from './utils.js';
|
|
|
3
3
|
export { defineConfig } from './defineConfig.js';
|
|
4
4
|
export type { LinkedConfig, LinkedServerConfig } from './interfaces.js';
|
|
5
5
|
export { buildPackageByPath } from './commands/build-package.js';
|
|
6
|
-
export { safeYarn } from './commands/safe-yarn.js';
|
|
7
6
|
export { setupPublish } from './commands/setup-publish.js';
|
|
8
7
|
export { resolveBuildTarget } from './app-release/resolve-build-target.js';
|
|
9
8
|
export { buildReleasePrefix, createReleaseManifest, getCacheControl, releaseBaseURL, releaseObjectKey, releaseStaticAccessURL, resolveReleaseIdentity, resolveSourceRevision, serializeReleaseManifest, writeReleaseManifest, DEFAULT_RELEASE_PREFIX, ENTRY_CACHE_CONTROL, IMMUTABLE_CACHE_CONTROL, MANIFEST_SOURCE_PATH, VITE_OUTPUT_DIR, } from './app-release/create-release-manifest.js';
|
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAE/D,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAC,YAAY,EAAE,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAE/D,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAC,YAAY,EAAE,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAC,kBAAkB,EAAC,MAAM,uCAAuC,CAAC;AACzE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,GAChB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAC,2BAA2B,EAAC,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,2BAA2B,EAC3B,oBAAoB,EACpB,wBAAwB,EACxB,WAAW,EACX,aAAa,GACd,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,4BAA4B,EAC5B,iBAAiB,EACjB,eAAe,GAChB,MAAM,0CAA0C,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -3,7 +3,6 @@ export { default as tailwindConfig } from './tailwind.config.js';
|
|
|
3
3
|
export * from './utils.js';
|
|
4
4
|
export { defineConfig } from './defineConfig.js';
|
|
5
5
|
export { buildPackageByPath } from './commands/build-package.js';
|
|
6
|
-
export { safeYarn } from './commands/safe-yarn.js';
|
|
7
6
|
export { setupPublish } from './commands/setup-publish.js';
|
|
8
7
|
export { resolveBuildTarget } from './app-release/resolve-build-target.js';
|
|
9
8
|
export { buildReleasePrefix, createReleaseManifest, getCacheControl, releaseBaseURL, releaseObjectKey, releaseStaticAccessURL, resolveReleaseIdentity, resolveSourceRevision, serializeReleaseManifest, writeReleaseManifest, DEFAULT_RELEASE_PREFIX, ENTRY_CACHE_CONTROL, IMMUTABLE_CACHE_CONTROL, MANIFEST_SOURCE_PATH, VITE_OUTPUT_DIR, } from './app-release/create-release-manifest.js';
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAC/D,+CAA+C;AAC/C,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAC/D,+CAA+C;AAC/C,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAC,kBAAkB,EAAC,MAAM,uCAAuC,CAAC;AACzE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,GAChB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAC,2BAA2B,EAAC,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC","sourcesContent":["export {default as tailwindConfig} from './tailwind.config.js';\n// export {buildMetadata} from './metadata.js';\nexport * from './utils.js';\nexport {defineConfig} from './defineConfig.js';\nexport type {LinkedConfig, LinkedServerConfig} from './interfaces.js';\n\nexport {buildPackageByPath} from './commands/build-package.js';\nexport {setupPublish} from './commands/setup-publish.js';\nexport {resolveBuildTarget} from './app-release/resolve-build-target.js';\nexport {\n buildReleasePrefix,\n createReleaseManifest,\n getCacheControl,\n releaseBaseURL,\n releaseObjectKey,\n releaseStaticAccessURL,\n resolveReleaseIdentity,\n resolveSourceRevision,\n serializeReleaseManifest,\n writeReleaseManifest,\n DEFAULT_RELEASE_PREFIX,\n ENTRY_CACHE_CONTROL,\n IMMUTABLE_CACHE_CONTROL,\n MANIFEST_SOURCE_PATH,\n VITE_OUTPUT_DIR,\n} from './app-release/create-release-manifest.js';\nexport {resolveDeclaredStaticAssets} from './app-release/static-assets.js';\nexport {\n loadReleaseManifest,\n planReleasePublish,\n publishRelease,\n} from './app-release/publisher.js';\nexport {\n normalizeAccessURL,\n resolveAppAssetsStore,\n} from './app-release/app-assets-store.js';\nexport {buildViteApp, hasViteConfig} from './commands/build-app.js';\nexport {publishApp} from './commands/publish-app.js';\nexport {\n serveCompiledApp,\n validateCompiledAppArtifacts,\n} from './commands/serve-app.js';\nexport {\n joinObjectKey,\n joinStaticAssetUrl,\n normalizeReleasePath,\n resolveExistingPathWithinRoot,\n} from './app-release/paths.js';\nexport type {\n AppBuildTarget,\n AppPublishConfig,\n BuildAppOptions,\n LinkedAppReleaseDestination,\n LinkedAppReleaseFile,\n LinkedAppReleaseManifest,\n PublishPlan,\n PublishResult,\n} from './app-release/types.js';\nexport type {\n CreateReleaseManifestOptions,\n ReleaseFileOrigin,\n ReleaseIdentity,\n} from './app-release/create-release-manifest.js';\n"]}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
// Locating installed packages the way Node does, shared by the Vite config
|
|
11
|
-
// helper and `linked doctor`.
|
|
11
|
+
// helper and `linked app-doctor`.
|
|
12
12
|
import fsExtra from 'fs-extra';
|
|
13
13
|
import path from 'node:path';
|
|
14
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installed-packages.js","sourceRoot":"","sources":["../../src/installed-packages.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2EAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"installed-packages.js","sourceRoot":"","sources":["../../src/installed-packages.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2EAA2E;AAC3E,kCAAkC;AAClC,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAa,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAW,EAAE,CACtD,sBAAsB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAErD,6EAA6E;AAC7E,oEAAoE;AACpE,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,sEAAsE;AACtE,MAAM,UAAgB,eAAe,CAAC,GAAW;;QAC/C,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;YACpE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;QAC3B,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CAAA;AAED,MAAM,UAAgB,gBAAgB,CACpC,IAAY,EACZ,OAAe;;QAEf,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChC,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;YAClD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;YAChD,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBACtC,IAAI,CAAC;oBACH,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAC,CAAC;gBACvD,CAAC;gBAAC,WAAM,CAAC;oBACP,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,eAAe,CAAC,GAAG,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC;YAChE,GAAG,GAAG,MAAM,CAAC;QACf,CAAC;IACH,CAAC;CAAA","sourcesContent":["// Locating installed packages the way Node does, shared by the Vite config\n// helper and `linked app-doctor`.\nimport fsExtra from 'fs-extra';\nimport path from 'node:path';\n\n/**\n * Framework packages that MUST be single-instance per runtime — they hold\n * module-level state (`@_linked/core`'s shape registry, `LinkedStorage`, the query\n * context) or register shapes into it. Two copies in one runtime split that state\n * and mangle shape identity (`Person`→`Person2`). This ONE list is the single source\n * of truth for the standalone `optimizeDeps.exclude` (`linkedDeps`). In workspace mode\n * `ssr.noExternal` is keyed on the discovered source workspaces instead (see\n * `ssrNoExternal`), so published framework packages stay external and single-instance\n * under Node.\n */\nexport const FRAMEWORK_PKG_PATTERNS: RegExp[] = [/^@_linked\\//, /^lincd-/];\nexport const isFrameworkPkg = (name: string): boolean =>\n FRAMEWORK_PKG_PATTERNS.some((re) => re.test(name));\n\n// Resolve a dependency name to its installed package.json the way Node does:\n// look in `<dir>/node_modules/<name>`, then each parent directory's\n// node_modules, starting from the requiring package's directory. This finds\n// deps that npm/yarn workspaces HOISTED to the monorepo root (an app under\n// `services/api` whose dep lives in `<root>/node_modules`). The walk stops\n// after the nearest directory whose package.json declares `workspaces` (the\n// workspace root), or at the filesystem root. Returns null when the package\n// isn't installed (e.g. an optional dep) — we skip rather than throw.\nexport async function isWorkspaceRoot(dir: string): Promise<boolean> {\n try {\n const json = await fsExtra.readJson(path.join(dir, 'package.json'));\n return !!json.workspaces;\n } catch {\n return false;\n }\n}\n\nexport async function readInstalledPkg(\n name: string,\n fromDir: string,\n): Promise<{root: string; json: any} | null> {\n let dir = path.resolve(fromDir);\n while (true) {\n const root = path.join(dir, 'node_modules', name);\n const pkgJson = path.join(root, 'package.json');\n if (await fsExtra.pathExists(pkgJson)) {\n try {\n return {root, json: await fsExtra.readJson(pkgJson)};\n } catch {\n return null;\n }\n }\n const parent = path.dirname(dir);\n if (parent === dir || (await isWorkspaceRoot(dir))) return null;\n dir = parent;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor.ts"],"names":[],"mappings":"AAsBA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAC;AAEnC,MAAM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G,MAAM,QAAQ,CAAC,EAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC,CAAC;QACzD,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;YACzB,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAC/C,GAAG,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,EAAE,CAC3D,CAAC;QACJ,CAAC;QACD,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;QACnE,OAAO,CAAC,GAAG,CACT,kBAAkB,QAAQ,WAAW,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI;YAChE,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,2BAA2B,IAAI,CAAC,iBAAiB,CAAC,MAAM,mBAAmB;YACjG,uCAAuC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,CACtF,CAAC;QACF,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;CAAA","sourcesContent":["/**\n * `linked doctor` — check an app's dev dependency setup for the problems that\n * otherwise only show up in the browser.\n *\n * It loads the app's Vite config the way the dev server does, runs the same\n * client-dependency scan `createViteConfig` runs (./client-dep-includes.ts), and\n * warns about:\n *\n * - `optimizeDeps.include` entries that do not resolve. Vite only logs these,\n * and the dependency then reaches the browser unoptimised — a CommonJS one\n * fails on `require`. The usual cause is a package npm installed NESTED under\n * a framework package, which needs the `'<pkg> > <dep>'` form.\n * - a framework package's dependency whose React peer range excludes the app's\n * React. That is why npm nests it (vaul 0.9 under `@_linked/primitives` with\n * React 19); the fix is a newer release of the dependency in that package.\n *\n * Hand-written include entries that the scan now generates are listed too, as\n * safe to delete.\n */\nimport path from 'node:path';\nimport semver from 'semver';\nimport {readInstalledPkg} from '../installed-packages.js';\nimport {\n lastClientDepScan,\n packageNameOf,\n resolvePackageFile,\n scanLinkedClientDeps,\n type ClientDepScan,\n} from '../client-dep-includes.js';\n\nexport interface DoctorFinding {\n level: 'warn' | 'info';\n message: string;\n}\n\nexport interface DiagnoseInput {\n cwd: string;\n /** The app's own `optimizeDeps.include` (hand-written, before generation). */\n appInclude: string[];\n scan: ClientDepScan;\n}\n\n/** Split a Vite include entry (`a > b > c/sub`) and resolve it hop by hop, like Vite's nested-dep syntax. */\nexport async function resolveIncludeEntry(\n cwd: string,\n entry: string,\n): Promise<string | null> {\n const hops = entry\n .split('>')\n .map((s) => s.trim())\n .filter(Boolean);\n let fromDir = cwd;\n for (let i = 0; i < hops.length; i++) {\n const name = packageNameOf(hops[i]);\n const installed = await readInstalledPkg(name, fromDir);\n if (!installed) return null;\n if (i === hops.length - 1) {\n const subpath = hops[i] === name ? '.' : `.${hops[i].slice(name.length)}`;\n return resolvePackageFile(installed.root, installed.json, subpath);\n }\n fromDir = installed.root;\n }\n return null;\n}\n\n/** The peer names whose ranges must admit the app's copy. */\nconst CHECKED_PEERS = ['react', 'react-dom'];\n\nexport async function diagnose({\n cwd,\n appInclude,\n scan,\n}: DiagnoseInput): Promise<DoctorFinding[]> {\n const findings: DoctorFinding[] = [];\n const generated = new Map(scan.entries.map((e) => [e.entry, e]));\n\n // 1. Include entries that do not resolve.\n await Promise.all(\n appInclude.map(async (entry) => {\n if (await resolveIncludeEntry(cwd, entry)) return;\n const nestedForm = scan.entries.find(\n (e) => e.nested && (e.specifier === entry || e.depName === entry),\n );\n findings.push({\n level: 'warn',\n message:\n `optimizeDeps.include entry '${entry}' does not resolve from ${cwd}` +\n (nestedForm\n ? ` — it is installed under ${nestedForm.from}; use '${nestedForm.entry}' (generated automatically, so the entry can simply be removed)`\n : ' — remove it from vite.config, or install the package'),\n });\n }),\n );\n\n // 2. Dependencies of framework packages whose React peer range excludes the app's React.\n const appVersions = new Map<string, string>();\n for (const peer of CHECKED_PEERS) {\n const installed = await readInstalledPkg(peer, cwd);\n if (installed?.json?.version) appVersions.set(peer, installed.json.version);\n }\n const seen = new Set<string>();\n for (const pkg of scan.frameworkPackages) {\n for (const dep of Object.keys(pkg.json?.dependencies ?? {})) {\n const installed = await readInstalledPkg(dep, pkg.root);\n if (!installed || seen.has(`${pkg.name}\\0${dep}`)) continue;\n const excluded = [...appVersions].filter(([peer, version]) => {\n const range = installed.json.peerDependencies?.[peer];\n return (\n range && !semver.satisfies(version, range, {includePrerelease: true})\n );\n });\n if (!excluded.length) continue;\n seen.add(`${pkg.name}\\0${dep}`);\n const [firstPeer, appVersion] = excluded[0];\n const nested =\n path\n .relative(cwd, installed.root)\n .split(path.sep)\n .filter((s) => s === 'node_modules').length > 1;\n findings.push({\n level: 'warn',\n message:\n `${pkg.name} depends on ${dep}@${installed.json.version}, whose peer range ` +\n excluded\n .map(\n ([peer]) => `${peer} '${installed.json.peerDependencies[peer]}'`,\n )\n .join(', ') +\n ` excludes the app's ${excluded.map(([peer, v]) => `${peer} ${v}`).join(', ')}` +\n (nested ? `, so npm installed it nested under ${pkg.name}` : '') +\n `. Bump ${dep} in ${pkg.name} to a release that supports ${firstPeer} ${semver.major(appVersion)}.`,\n });\n }\n }\n\n // 3. Hand-written entries the scan generates anyway.\n const redundant = appInclude.filter((e) => generated.has(e));\n if (redundant.length) {\n findings.push({\n level: 'info',\n message:\n `${redundant.length} optimizeDeps.include entr${redundant.length === 1 ? 'y is' : 'ies are'} generated ` +\n `automatically and can be removed from vite.config:\\n` +\n redundant.map((e) => ` ${e}`).join('\\n'),\n });\n }\n return findings;\n}\n\nexport interface DoctorOptions {\n cwd?: string;\n}\n\n/** Load the app's dev config and return what the plugin scanned, running the scan itself if the plugin did not. */\nasync function loadAppScan(\n cwd: string,\n): Promise<{appInclude: string[]; scan: ClientDepScan}> {\n const {resolveConfig} = await import('vite');\n lastClientDepScan.current = null;\n const config = await resolveConfig(\n {root: cwd, mode: 'development', logLevel: 'error'},\n 'serve',\n );\n const recorded = lastClientDepScan.current as\n import('../client-dep-includes.js').RecordedClientDepScan | null;\n if (recorded && path.resolve(recorded.cwd) === path.resolve(cwd)) {\n return {appInclude: recorded.appInclude, scan: recorded.scan};\n }\n // The app does not use createViteConfig (or turned the generation off): scan\n // what it excludes, with the workspaces the helper would have discovered.\n const {discoverWorkspaces} = await import('../vite-config.js');\n const optimizeDeps = config.optimizeDeps ?? {};\n return {\n appInclude: optimizeDeps.include ?? [],\n scan: await scanLinkedClientDeps(optimizeDeps.exclude ?? [], {\n cwd,\n sourceWorkspaces: await discoverWorkspaces([], cwd),\n }),\n };\n}\n\nexport async function runDoctor(options: DoctorOptions = {}): Promise<void> {\n const cwd = path.resolve(options.cwd ?? process.cwd());\n const started = performance.now();\n const {appInclude, scan} = await loadAppScan(cwd);\n const findings = await diagnose({cwd, appInclude, scan});\n for (const f of findings) {\n (f.level === 'warn' ? console.warn : console.log)(\n `${f.level === 'warn' ? 'warning' : 'note'}: ${f.message}`,\n );\n }\n const warnings = findings.filter((f) => f.level === 'warn').length;\n console.log(\n `linked doctor: ${warnings} warning${warnings === 1 ? '' : 's'}; ` +\n `${scan.entries.length} client dependencies of ${scan.frameworkPackages.length} linked packages ` +\n `generated for optimizeDeps.include (${Math.round(performance.now() - started)}ms)`,\n );\n process.exitCode = warnings ? 1 : 0;\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run a yarn command at the workspace root, forwarding every argument to yarn.
|
|
3
|
-
*
|
|
4
|
-
* This used to back up the yarn.lock of each nested sibling repository before
|
|
5
|
-
* running, because a multi-repo checkout tool dropped those repos under
|
|
6
|
-
* `packages/` and a root-level `yarn install` clobbered their lockfiles. That
|
|
7
|
-
* tool is retired and no such nested repos exist any more, so there is nothing
|
|
8
|
-
* left to preserve — the command is now a thin, arg-preserving passthrough.
|
|
9
|
-
*
|
|
10
|
-
* Set LINKED_YARN_DRY_RUN to log the command instead of executing it.
|
|
11
|
-
*/
|
|
12
|
-
export declare function safeYarn(args: string[]): Promise<void>;
|
|
13
|
-
//# sourceMappingURL=safe-yarn.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"safe-yarn.d.ts","sourceRoot":"","sources":["../../../src/commands/safe-yarn.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAU5D"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import chalk from 'chalk';
|
|
11
|
-
import { execp } from '../utils.js';
|
|
12
|
-
/**
|
|
13
|
-
* Run a yarn command at the workspace root, forwarding every argument to yarn.
|
|
14
|
-
*
|
|
15
|
-
* This used to back up the yarn.lock of each nested sibling repository before
|
|
16
|
-
* running, because a multi-repo checkout tool dropped those repos under
|
|
17
|
-
* `packages/` and a root-level `yarn install` clobbered their lockfiles. That
|
|
18
|
-
* tool is retired and no such nested repos exist any more, so there is nothing
|
|
19
|
-
* left to preserve — the command is now a thin, arg-preserving passthrough.
|
|
20
|
-
*
|
|
21
|
-
* Set LINKED_YARN_DRY_RUN to log the command instead of executing it.
|
|
22
|
-
*/
|
|
23
|
-
export function safeYarn(args) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const yarnCmd = `yarn ${args.join(' ')}`;
|
|
26
|
-
if (process.env.LINKED_YARN_DRY_RUN) {
|
|
27
|
-
console.log(chalk.cyan(`[dry-run] would execute: ${yarnCmd}`));
|
|
28
|
-
console.log(chalk.cyan(`[dry-run] received args: ${JSON.stringify(args)}`));
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
yield execp(yarnCmd, true, false);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=safe-yarn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"safe-yarn.js","sourceRoot":"","sources":["../../../src/commands/safe-yarn.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAElC;;;;;;;;;;GAUG;AACH,MAAM,UAAgB,QAAQ,CAAC,IAAc;;QAC3C,MAAM,OAAO,GAAG,QAAQ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAEzC,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,CAAC;YACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC,CAAC;YAC/D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,4BAA4B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAC5E,OAAO;QACT,CAAC;QAED,MAAM,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA","sourcesContent":["import chalk from 'chalk';\nimport {execp} from '../utils.js';\n\n/**\n * Run a yarn command at the workspace root, forwarding every argument to yarn.\n *\n * This used to back up the yarn.lock of each nested sibling repository before\n * running, because a multi-repo checkout tool dropped those repos under\n * `packages/` and a root-level `yarn install` clobbered their lockfiles. That\n * tool is retired and no such nested repos exist any more, so there is nothing\n * left to preserve — the command is now a thin, arg-preserving passthrough.\n *\n * Set LINKED_YARN_DRY_RUN to log the command instead of executing it.\n */\nexport async function safeYarn(args: string[]): Promise<void> {\n const yarnCmd = `yarn ${args.join(' ')}`;\n\n if (process.env.LINKED_YARN_DRY_RUN) {\n console.log(chalk.cyan(`[dry-run] would execute: ${yarnCmd}`));\n console.log(chalk.cyan(`[dry-run] received args: ${JSON.stringify(args)}`));\n return;\n }\n\n await execp(yarnCmd, true, false);\n}\n"]}
|