@_linked/cli 1.28.1 → 1.29.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 +30 -0
- package/README.md +28 -0
- package/lib/esm/cli.js +24 -0
- package/lib/esm/cli.js.map +1 -1
- package/lib/esm/commands/localize.d.ts +22 -0
- package/lib/esm/commands/localize.d.ts.map +1 -0
- package/lib/esm/commands/localize.js +69 -0
- package/lib/esm/commands/localize.js.map +1 -0
- package/lib/esm/commands/start.d.ts.map +1 -1
- package/lib/esm/commands/start.js +3 -0
- package/lib/esm/commands/start.js.map +1 -1
- package/lib/esm/plugins/pin-compiled-class-names.d.ts +11 -0
- package/lib/esm/plugins/pin-compiled-class-names.d.ts.map +1 -0
- package/lib/esm/plugins/pin-compiled-class-names.js +59 -0
- package/lib/esm/plugins/pin-compiled-class-names.js.map +1 -0
- package/lib/esm/utils/shapeNames.d.ts +7 -4
- package/lib/esm/utils/shapeNames.d.ts.map +1 -1
- package/lib/esm/utils/shapeNames.js +7 -4
- package/lib/esm/utils/shapeNames.js.map +1 -1
- package/lib/esm/vite-config.d.ts +17 -0
- package/lib/esm/vite-config.d.ts.map +1 -1
- package/lib/esm/vite-config.js +34 -6
- package/lib/esm/vite-config.js.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.29.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#173](https://github.com/linked-fw/cli/pull/173) [`830b7b9`](https://github.com/linked-fw/cli/commit/830b7b9fea6f1704bb91e135397a2e9011a28289) Thanks [@flyon](https://github.com/flyon)! - Add `linked localize` and `linked delocalize`, for developing an npm dependency
|
|
8
|
+
from a git checkout.
|
|
9
|
+
|
|
10
|
+
`linked localize <package…>` clones the package's repository (resolved from the
|
|
11
|
+
registry's `repository` field), installs inside the checkout, builds it and
|
|
12
|
+
symlinks it into `node_modules` — without touching `package.json` or
|
|
13
|
+
`package-lock.json`. `--list`/`--check` report what is localized and whether it
|
|
14
|
+
really is, `--relink` recreates the recorded symlinks and is what a
|
|
15
|
+
`postinstall` should run, and `delocalize` undoes it.
|
|
16
|
+
|
|
17
|
+
The work is done by the new dependency-free `@_linked/localize`, which
|
|
18
|
+
deliberately has no opinion about how a checkout is built. That is the only
|
|
19
|
+
thing this CLI adds: it supplies `linked build` as the build command
|
|
20
|
+
(overridable with `--build`, disabled with `--build ""`).
|
|
21
|
+
|
|
22
|
+
Packages are named exactly as npm names them; there is no short-name expansion
|
|
23
|
+
and no org probing.
|
|
24
|
+
|
|
25
|
+
## 1.28.2
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [#162](https://github.com/linked-fw/cli/pull/162) [`e965600`](https://github.com/linked-fw/cli/commit/e9656005679f137b023d811fc057409071109d27) Thanks [@flyon](https://github.com/flyon)! - `createViteConfig` now keeps compiled decorated classes named as written. Vite re-prints any published module that mentions `process.env` or `import.meta.env` (client build) or `process.env.NODE_ENV` (dev client) with esbuild, which renamed tsc's `let Foo = class Foo` to `class Foo2` — and an unnamed shape's IRI is its class name. A new `linked:pin-compiled-class-names` plugin pins each such class's name right after its declaration, before its decorators run.
|
|
30
|
+
|
|
31
|
+
- [#170](https://github.com/linked-fw/cli/pull/170) [`7a9e465`](https://github.com/linked-fw/cli/commit/7a9e465d498ff01247967d586b17e81c29536e08) Thanks [@flyon](https://github.com/flyon)! - `createViteConfig` now bundles `@_linked/server` in the dev SSR runner (`ssr.noExternal`), in workspace and standalone mode alike. `linked start` loads `LinkedServer` through `vite.ssrLoadModule`, so Vite already evaluated that entry and every file it reaches by relative import, while bare `@_linked/server/...` imports from the app and its storage config went to Node. The package was split across two loaders, and which one evaluated a given file depended on import order: in Create Now, `package.js` and `ontologies/lincd-server.js` evaluated once in each, and `shapes/filestores/LocalFileStore.js` too once the package's `backend` loaded. Vite is now the only loader for it. The new `SSR_ENTRY_PACKAGES` export names the packages this applies to.
|
|
32
|
+
|
|
3
33
|
## 1.28.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -188,6 +188,34 @@ linked dev # file-watch rebuild (package)
|
|
|
188
188
|
linked yarn <args> # safe-yarn: run yarn at the workspace root, forwarding all args
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
+
### Developing a dependency from a git checkout
|
|
192
|
+
|
|
193
|
+
`linked localize` clones an npm dependency, installs inside the checkout, builds
|
|
194
|
+
it with `linked build` and symlinks it into `node_modules` — **without** touching
|
|
195
|
+
`package.json` or `package-lock.json`, so the manifest still describes the
|
|
196
|
+
released dependency and CI is unaffected.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
linked localize @_linked/rdfs # clone, install, build, symlink into node_modules
|
|
200
|
+
linked localize # report what is localized (same as --list)
|
|
201
|
+
linked localize --list --check # exit 1 when something recorded is not actually linked
|
|
202
|
+
linked localize --relink # recreate the recorded symlinks — run this from postinstall
|
|
203
|
+
linked delocalize @_linked/rdfs # unlink and forget, keeping the checkout
|
|
204
|
+
linked delocalize --purge # undo everything and delete the checkouts
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Name packages exactly as npm names them (`@_linked/rdfs`, `lodash`): the
|
|
208
|
+
repository is read from the package's published `repository` field, so there is
|
|
209
|
+
no short-name expansion and no org guessing. `--dir` moves the checkout
|
|
210
|
+
directory (default `packages-local`), `--repo`/`--subdir` cover a package whose
|
|
211
|
+
published metadata does not point at the right place, and `--build "<cmd>"`
|
|
212
|
+
replaces `linked build` (an empty string builds nothing). A failing build only
|
|
213
|
+
warns — a package whose build is broken is usually why you localized it.
|
|
214
|
+
|
|
215
|
+
The work is done by [`@_linked/localize`](https://www.npmjs.com/package/@_linked/localize),
|
|
216
|
+
which is dependency-free and framework-agnostic; this CLI only supplies the
|
|
217
|
+
build command.
|
|
218
|
+
|
|
191
219
|
### Registry / dev utilities
|
|
192
220
|
|
|
193
221
|
```bash
|
package/lib/esm/cli.js
CHANGED
|
@@ -289,6 +289,30 @@ program
|
|
|
289
289
|
const { buildPackageByPath } = yield import('./commands/build-package.js');
|
|
290
290
|
return buildPackageByPath(filepath);
|
|
291
291
|
}));
|
|
292
|
+
program
|
|
293
|
+
.command('localize [packages...]')
|
|
294
|
+
.description('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.')
|
|
295
|
+
.option('--list', 'Report what is localized rather than localizing anything.')
|
|
296
|
+
.option('--check', 'With --list: exit 1 when something recorded is not actually linked.')
|
|
297
|
+
.option('--relink', 'Recreate the recorded symlinks. This is what a postinstall runs.')
|
|
298
|
+
.option('--dir <path>', 'Where checkouts live (default: packages-local).')
|
|
299
|
+
.option('--repo <git-url>', 'Clone this instead of the published repository, and record it.')
|
|
300
|
+
.option('--subdir <path>', "The package's directory inside the repository (monorepos).")
|
|
301
|
+
.option('--build <cmd>', 'Run this in the checkout after installing; a failure only warns. Defaults to `linked build`; pass an empty string to build nothing.')
|
|
302
|
+
.option('--force', 'Overwrite a symlink pointing outside the checkout directory.')
|
|
303
|
+
.action((packages, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
304
|
+
const { runLocalize } = yield import('./commands/localize.js');
|
|
305
|
+
return runLocalize(packages, options);
|
|
306
|
+
}));
|
|
307
|
+
program
|
|
308
|
+
.command('delocalize [packages...]')
|
|
309
|
+
.description('Undo localize: unlink the packages and forget them, keeping the checkout. With no names, undoes every localized package.')
|
|
310
|
+
.option('--purge', 'Also delete the checkout.')
|
|
311
|
+
.option('--force', 'With --purge, delete even a checkout localize refuses.')
|
|
312
|
+
.action((packages, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
313
|
+
const { runDelocalize } = yield import('./commands/localize.js');
|
|
314
|
+
return runDelocalize(packages, options);
|
|
315
|
+
}));
|
|
292
316
|
program
|
|
293
317
|
.command('yarn')
|
|
294
318
|
.description('Run yarn at the workspace root. Forwards all extra args to yarn.')
|
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,CAAC;QAClC,IAAI,OAAO,CAAC,GAAG,CAAC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,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('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,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C,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QACpE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAA,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,IAAc,EAAE,EAAE;IACxC,IAAI,WAAW,GAAG,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('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"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** The build command `localize` runs inside a fresh checkout by default. */
|
|
2
|
+
export declare const DEFAULT_BUILD_COMMAND = "linked build";
|
|
3
|
+
export interface LocalizeCommandOptions {
|
|
4
|
+
list?: boolean;
|
|
5
|
+
check?: boolean;
|
|
6
|
+
relink?: boolean;
|
|
7
|
+
dir?: string;
|
|
8
|
+
repo?: string;
|
|
9
|
+
subdir?: string;
|
|
10
|
+
build?: string;
|
|
11
|
+
force?: boolean;
|
|
12
|
+
purge?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `localize` reports failure through an exit code rather than by throwing, so
|
|
16
|
+
* that a partial run still prints what it did. Mirror that: set `exitCode` and
|
|
17
|
+
* return, instead of exiting, so pending output is flushed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function runLocalize(packages?: string[], options?: LocalizeCommandOptions): Promise<void>;
|
|
20
|
+
/** `linked delocalize [packages...]` — unlink and forget; no names means all. */
|
|
21
|
+
export declare function runDelocalize(packages?: string[], options?: Pick<LocalizeCommandOptions, 'purge' | 'force'>): Promise<void>;
|
|
22
|
+
//# sourceMappingURL=localize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localize.d.ts","sourceRoot":"","sources":["../../../src/commands/localize.ts"],"names":[],"mappings":"AAuBA,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,iBAAiB,CAAC;AAEpD,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,GAAE,MAAM,EAAO,EACvB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED,iFAAiF;AACjF,wBAAsB,aAAa,CACjC,QAAQ,GAAE,MAAM,EAAO,EACvB,OAAO,GAAE,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,OAAO,CAAM,GAC5D,OAAO,CAAC,IAAI,CAAC,CAQf"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* `linked localize` / `linked delocalize` — develop an npm dependency from a
|
|
12
|
+
* git checkout.
|
|
13
|
+
*
|
|
14
|
+
* All of the work lives in `@_linked/localize`, which is dependency-free and
|
|
15
|
+
* knows nothing about this framework on purpose: it resolves a package's
|
|
16
|
+
* repository from the registry, clones it, installs inside the checkout and
|
|
17
|
+
* symlinks it into `node_modules`, without touching `package.json` or
|
|
18
|
+
* `package-lock.json`.
|
|
19
|
+
*
|
|
20
|
+
* The one thing it deliberately does not know is how to build what it cloned.
|
|
21
|
+
* That is the seam this module fills: `@_linked/cli` passes `build: 'linked
|
|
22
|
+
* build'`, because in this ecosystem that is what building a package means.
|
|
23
|
+
* A failing build only warns — a package whose build is broken is usually
|
|
24
|
+
* exactly what you localized it to fix.
|
|
25
|
+
*
|
|
26
|
+
* Packages are named exactly as npm names them (`@_linked/rdfs`, `lodash`).
|
|
27
|
+
* There is no short-name expansion and no org probing: the repository comes
|
|
28
|
+
* from the registry's `repository` field, so a name that npm cannot resolve is
|
|
29
|
+
* an error rather than a guess.
|
|
30
|
+
*/
|
|
31
|
+
import process from 'node:process';
|
|
32
|
+
/** The build command `localize` runs inside a fresh checkout by default. */
|
|
33
|
+
export const DEFAULT_BUILD_COMMAND = 'linked build';
|
|
34
|
+
/**
|
|
35
|
+
* `localize` reports failure through an exit code rather than by throwing, so
|
|
36
|
+
* that a partial run still prints what it did. Mirror that: set `exitCode` and
|
|
37
|
+
* return, instead of exiting, so pending output is flushed.
|
|
38
|
+
*/
|
|
39
|
+
export function runLocalize() {
|
|
40
|
+
return __awaiter(this, arguments, void 0, function* (packages = [], options = {}) {
|
|
41
|
+
const { defaultDeps, localize, list, relink } = yield import('@_linked/localize');
|
|
42
|
+
const deps = defaultDeps(process.cwd());
|
|
43
|
+
if (options.relink) {
|
|
44
|
+
process.exitCode = relink(deps);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (options.list || packages.length === 0) {
|
|
48
|
+
process.exitCode = list({ check: options.check }, deps);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
process.exitCode = localize(packages, {
|
|
52
|
+
force: options.force,
|
|
53
|
+
dir: options.dir,
|
|
54
|
+
repo: options.repo,
|
|
55
|
+
subdir: options.subdir,
|
|
56
|
+
// `--build ''` is how you ask for no build at all.
|
|
57
|
+
build: options.build === undefined ? DEFAULT_BUILD_COMMAND : options.build,
|
|
58
|
+
}, deps);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/** `linked delocalize [packages...]` — unlink and forget; no names means all. */
|
|
62
|
+
export function runDelocalize() {
|
|
63
|
+
return __awaiter(this, arguments, void 0, function* (packages = [], options = {}) {
|
|
64
|
+
const { defaultDeps, delocalize } = yield import('@_linked/localize');
|
|
65
|
+
const deps = defaultDeps(process.cwd());
|
|
66
|
+
process.exitCode = delocalize(packages, { purge: options.purge, force: options.force }, deps);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=localize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localize.js","sourceRoot":"","sources":["../../../src/commands/localize.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAcpD;;;;GAIG;AACH,MAAM,UAAgB,WAAW;yDAC/B,WAAqB,EAAE,EACvB,UAAkC,EAAE;QAEpC,MAAM,EAAC,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAC,GACzC,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACpC,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAExC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO;QACT,CAAC;QACD,IAAI,OAAO,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1C,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAC,EAAE,IAAI,CAAC,CAAC;YACtD,OAAO;QACT,CAAC;QACD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CACzB,QAAQ,EACR;YACE,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,mDAAmD;YACnD,KAAK,EACH,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK;SACtE,EACD,IAAI,CACL,CAAC;IACJ,CAAC;CAAA;AAED,iFAAiF;AACjF,MAAM,UAAgB,aAAa;yDACjC,WAAqB,EAAE,EACvB,UAA2D,EAAE;QAE7D,MAAM,EAAC,WAAW,EAAE,UAAU,EAAC,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACpE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACxC,OAAO,CAAC,QAAQ,GAAG,UAAU,CAC3B,QAAQ,EACR,EAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAC,EAC5C,IAAI,CACL,CAAC;IACJ,CAAC;CAAA","sourcesContent":["/**\n * `linked localize` / `linked delocalize` — develop an npm dependency from a\n * git checkout.\n *\n * All of the work lives in `@_linked/localize`, which is dependency-free and\n * knows nothing about this framework on purpose: it resolves a package's\n * repository from the registry, clones it, installs inside the checkout and\n * symlinks it into `node_modules`, without touching `package.json` or\n * `package-lock.json`.\n *\n * The one thing it deliberately does not know is how to build what it cloned.\n * That is the seam this module fills: `@_linked/cli` passes `build: 'linked\n * build'`, because in this ecosystem that is what building a package means.\n * A failing build only warns — a package whose build is broken is usually\n * exactly what you localized it to fix.\n *\n * Packages are named exactly as npm names them (`@_linked/rdfs`, `lodash`).\n * There is no short-name expansion and no org probing: the repository comes\n * from the registry's `repository` field, so a name that npm cannot resolve is\n * an error rather than a guess.\n */\nimport process from 'node:process';\n\n/** The build command `localize` runs inside a fresh checkout by default. */\nexport const DEFAULT_BUILD_COMMAND = 'linked build';\n\nexport interface LocalizeCommandOptions {\n list?: boolean;\n check?: boolean;\n relink?: boolean;\n dir?: string;\n repo?: string;\n subdir?: string;\n build?: string;\n force?: boolean;\n purge?: boolean;\n}\n\n/**\n * `localize` reports failure through an exit code rather than by throwing, so\n * that a partial run still prints what it did. Mirror that: set `exitCode` and\n * return, instead of exiting, so pending output is flushed.\n */\nexport async function runLocalize(\n packages: string[] = [],\n options: LocalizeCommandOptions = {},\n): Promise<void> {\n const {defaultDeps, localize, list, relink} =\n await import('@_linked/localize');\n const deps = defaultDeps(process.cwd());\n\n if (options.relink) {\n process.exitCode = relink(deps);\n return;\n }\n if (options.list || packages.length === 0) {\n process.exitCode = list({check: options.check}, deps);\n return;\n }\n process.exitCode = localize(\n packages,\n {\n force: options.force,\n dir: options.dir,\n repo: options.repo,\n subdir: options.subdir,\n // `--build ''` is how you ask for no build at all.\n build:\n options.build === undefined ? DEFAULT_BUILD_COMMAND : options.build,\n },\n deps,\n );\n}\n\n/** `linked delocalize [packages...]` — unlink and forget; no names means all. */\nexport async function runDelocalize(\n packages: string[] = [],\n options: Pick<LocalizeCommandOptions, 'purge' | 'force'> = {},\n): Promise<void> {\n const {defaultDeps, delocalize} = await import('@_linked/localize');\n const deps = defaultDeps(process.cwd());\n process.exitCode = delocalize(\n packages,\n {purge: options.purge, force: options.force},\n deps,\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,YAAY,EAAoB,aAAa,EAAC,MAAM,MAAM,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG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AE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,iBAAiB,UAA0D,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,UAA0C,CAAC;AAE3E;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,GAAG,OAAO,CAExE;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,YAAY,CAAC,CA6BvB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,GAAG,EACjB,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,eAAe,CAAC,EAC1D,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,GACf,IAAI,CA0CN;AAED,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAkExF;AAqFD,wBAAsB,aAAa,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqJ1E"}
|
|
@@ -367,6 +367,9 @@ export function startWithVite() {
|
|
|
367
367
|
// created in one tree don't reach consumers in the other, causing
|
|
368
368
|
// "Cannot destructure property 'isNativeApp' of useAppContext()" type
|
|
369
369
|
// errors on every SSR render.
|
|
370
|
+
// Loading this entry through Vite is why `@_linked/server` is in
|
|
371
|
+
// `SSR_ENTRY_PACKAGES` (vite-config.ts): the package's bare imports must go
|
|
372
|
+
// through Vite as well, or some of its files evaluate once per loader.
|
|
370
373
|
const ServerClass = (yield vite.ssrLoadModule('@_linked/server/shapes/LinkedServer')).LinkedServer;
|
|
371
374
|
const server = new ServerClass(linkedConfig);
|
|
372
375
|
// Surface stack traces from Vite ssrLoadModule failures cleanly.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start.ts"],"names":[],"mappings":";;;;;;;;;AAAA,sCAAsC;AACtC,EAAE;AACF,0EAA0E;AAC1E,sEAAsE;AACtE,2EAA2E;AAC3E,uEAAuE;AACvE,yDAAyD;AACzD,EAAE;AACF,+CAA+C;AAC/C,kFAAkF;AAClF,8CAA8C;AAC9C,uEAAuE;AACvE,yEAAyE;AACzE,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AACzC,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,uBAAuB,CAAC;AAerF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;AAEzF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW;;IACjD,OAAO,CACL,MAAA,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CACzE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAC9B,mCAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,C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vB,IAAI,CAAC;wBACH,MAAO,MAAc,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;oBAC5C,CAAC;oBAAC,OAAO,GAAQ,EAAE,CAAC;wBAClB,OAAO,CAAC,IAAI,CACV,sBAAsB,GAAG,YAAY,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,mCAAI,GAAG,EAAE,CAC3D,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC,CAAA,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAgB,EAAE,EAAE;YAC7C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAAE,OAAO;YAC7C,MAAM,GAAG,GAAG,uBAAuB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;YACjE,IAAI,CAAC,GAAG;gBAAE,OAAO;YACjB,IAAI,OAAQ,MAAc,CAAC,cAAc,KAAK,UAAU;gBAAE,OAAO;YACjE,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxB,YAAY,CAAC,WAAW,CAAC,CAAC;YAC1B,WAAW,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,0BAA0B;QAC1B,MAAM,IAAI,GAAG,MAAA,MAAC,YAAY,CAAC,MAAc,CAAC,IAAI,mCAAI,IAAI,CAAC,IAAI,mCAAI,IAAI,CAAC;QACpE,gBAAgB,CAAC;YACf,GAAG,EAAE,oBAAoB,IAAI,GAAG;YAChC,SAAS,EAAE,cAAc;SAC1B,CAAC,CAAC;IACL,CAAC;CAAA","sourcesContent":["// `linked start --vite` orchestrator.\n//\n// Follows the existing startServer() flow from cli-methods.ts but injects\n// a Vite dev server in middleware mode + overrides loadAppComponent /\n// loadRoutes to use vite.ssrLoadModule. This means LinkedServer's existing\n// initialization works unchanged; we just route module loading through\n// Vite instead of loading modules through Node directly.\n//\n// What's different vs the plain startServer():\n// - LinkedServer renders through the Vite middleware when viteMiddleware is set\n// - Vite handles the client transform + HMR\n// - ssrLoadModule handles the server transform (decorators, jsx, ts)\n// - Server changes still need full process restart for now (server HMR\n// deferred to vite-node migration)\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport {spawn} from 'node:child_process';\nimport fsExtra from 'fs-extra';\nimport {parseWorkspacePatterns, isWorkspacePathNegated} from '../workspace-globs.js';\n\nimport type {InlineConfig, UserConfigExport, ViteDevServer} from 'vite';\n\nexport interface StartOptions {\n env?: string;\n port?: number;\n /**\n * Serve only the backend API (`/call/...`, `/api/...`, provider routes).\n * No `vite.config.*`, `src/App.tsx` or `src/routes.tsx` is needed, and page\n * requests get a 404 instead of server-side rendering.\n */\n apiOnly?: boolean;\n}\n\nexport const VITE_CONFIG_FILES = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n\n/**\n * Names for the app's linked config, in priority order. `lincd.config.js` is\n * the legacy name: apps predating the rename still ship it, and dropping it\n * would silently discard their whole `server` config (cachePaths, `apiOnly`, …).\n */\nexport const LINKED_CONFIG_FILES = ['linked.config.js', 'lincd.config.js'];\n\n/**\n * Absolute path to the app's linked config. Returns the first name that exists;\n * when none does, the current name — the caller still `existsSync`-guards the\n * import, so this is simply the \"no config here\" path, not a promise of a file.\n */\nexport function resolveLinkedConfigPath(cwd: string): string {\n return (\n LINKED_CONFIG_FILES.map((name) => path.join(cwd, name)).find((candidate) =>\n fsExtra.existsSync(candidate),\n ) ?? path.join(cwd, LINKED_CONFIG_FILES[0])\n );\n}\n\n/**\n * API-only mode is explicit: `linked start --api-only`, or `server.apiOnly: true`\n * in `linked.config.js`. It is never inferred from missing frontend files, so a\n * web app that lost its `vite.config.ts` still fails loudly instead of silently\n * serving no pages.\n */\nexport function isApiOnly(opts: StartOptions, linkedConfig: any): boolean {\n return opts.apiOnly === true || linkedConfig?.server?.apiOnly === true;\n}\n\n/**\n * The Vite dev-server config for `linked start`.\n *\n * With a `vite.config.*` in `cwd`, Vite loads it itself. Without one, API-only\n * mode uses `createViteConfig()`'s defaults inline — Vite is still needed on the\n * backend to transform TypeScript, decorators and extensionless imports of\n * source-only shape packages. Without one in page mode, it is an error.\n */\nexport async function resolveViteServerConfig(\n cwd: string,\n apiOnly: boolean,\n): Promise<InlineConfig> {\n const base: InlineConfig = {\n root: cwd,\n server: {middlewareMode: true},\n appType: 'custom',\n };\n if (VITE_CONFIG_FILES.some((c) => fsExtra.existsSync(path.join(cwd, c)))) {\n return base;\n }\n if (!apiOnly) {\n throw new Error(\n `[linked start] no vite.config.{ts,js,mjs} found in ${cwd}. Add one:\\n\\n import {createViteConfig} from '@_linked/cli/vite-config';\\n export default createViteConfig({port: 4040, cssMode: 'tailwind'});\\n\\nFor a backend without a web frontend, run \\`linked start --api-only\\` instead.\\n`,\n );\n }\n const {createViteConfig} = await import('../vite-config.js');\n const exported: UserConfigExport = createViteConfig();\n const defaults =\n typeof exported === 'function'\n ? await exported({command: 'serve', mode: 'development'})\n : await exported;\n return {\n ...defaults,\n ...base,\n configFile: false,\n server: {...defaults.server, ...base.server},\n // No browser client: skip the client dependency scan, whose entry\n // (`src/index.tsx`) does not exist in a backend.\n optimizeDeps: {...defaults.optimizeDeps, noDiscovery: true},\n };\n}\n\n/**\n * Inject Vite into LinkedServer's config:\n * - vite: handle for ssrLoadModule (used to load app's backend.ts via self-reference)\n * and, unless API-only (where `apiOnly` makes LinkedServer skip page rendering):\n * - viteMiddleware: mounted as the dev-server middleware\n * - loadAppComponent / loadRoutes: route through vite.ssrLoadModule for SSR transform\n * - viteSsrPreload: page modules to preload for SSR CSS collection\n */\nexport function configureLinkedServer(\n serverConfig: any,\n vite: Pick<ViteDevServer, 'middlewares' | 'ssrLoadModule'>,\n cwd: string,\n apiOnly: boolean,\n): void {\n serverConfig.vite = vite;\n if (apiOnly) {\n serverConfig.apiOnly = true;\n return;\n }\n serverConfig.viteMiddleware = vite.middlewares;\n serverConfig.loadAppComponent = async () => {\n const mod = await vite.ssrLoadModule('/src/App.tsx');\n return mod.default;\n };\n serverConfig.loadRoutes = async () => {\n return await vite.ssrLoadModule('/src/routes.tsx');\n };\n\n // Vite SSR CSS collection support:\n // List all `src/pages/*.{ts,tsx}` files so LinkedServer can ssrLoadModule\n // each into Vite's moduleGraph BEFORE the first render of a session.\n // React.lazy() doesn't auto-fire — without this, only App's eager\n // imports' CSS is collected; lazy pages' CSS arrives after hydration\n // causing an unstyled flash. After the first preload sweep, all\n // subsequent renders have full CSS available.\n serverConfig.viteSsrPreload = async () => {\n const pagesDir = path.join(cwd, 'src', 'pages');\n if (!fsExtra.existsSync(pagesDir)) return [];\n const files = fsExtra.readdirSync(pagesDir, {withFileTypes: true});\n const paths: string[] = [];\n for (const file of files) {\n // Test files live beside pages but call vi.mock() at module scope,\n // which throws outside Vitest — never load them into the SSR graph.\n // `.d.ts` files are types only: they have no runtime module to load.\n if (\n file.isFile() &&\n /\\.(tsx|ts)$/.test(file.name) &&\n !/\\.(test|spec)\\.(tsx|ts)$/.test(file.name) &&\n !file.name.endsWith('.d.ts')\n ) {\n paths.push(`/src/pages/${file.name}`);\n }\n }\n return paths;\n };\n}\n\ninterface WorkspacePackage {\n name: string;\n root: string;\n srcDir: string;\n}\n\n/**\n * Discover the packages whose sources `linked start` watches for HMR, from two\n * sources. No hand-maintained list anywhere.\n *\n * 1. The app's `package.json` `workspaces` field — adding a new linked package\n * = appearing in the right glob.\n * 2. The app's linked dependencies that are installed as SOURCE — the same rule\n * the Vite resolver table uses (`discoverLinkedSourceDependencies`), so the\n * two lists cannot disagree about what is source. This covers a LOCALIZED\n * checkout (`packages-local/<pkg>`), which is deliberately in no workspace\n * glob and reachable only through its `node_modules` symlink. Without it\n * `workspacePackageForPath` returns null for the checkout, so a saved backend\n * edit is reloaded by Vite and then never re-indexed: the registered provider\n * instance is never replaced.\n *\n * Returns each package's npm `name` (so we can call `onSourceChange(name)`), its\n * absolute root, and its `src/` directory for fast prefix matching. Dependency\n * roots are realpathed by the shared discovery, matching the ids Vite reports.\n */\nexport async function discoverWorkspacePackages(cwd: string): Promise<WorkspacePackage[]> {\n const pkgJsonPath = path.join(cwd, 'package.json');\n if (!(await fsExtra.pathExists(pkgJsonPath))) return [];\n const pkgJson = await fsExtra.readJson(pkgJsonPath);\n const {patterns, negatedPatterns} = parseWorkspacePatterns(pkgJson.workspaces);\n const out: WorkspacePackage[] = [];\n\n // Include the root app itself so edits to <cwd>/src/* trigger HMR for\n // the app's own providers (e.g. CN's src/backend.ts which registers ~25\n // Express routes).\n if (pkgJson.name && (await fsExtra.pathExists(path.join(cwd, 'src')))) {\n out.push({name: pkgJson.name, root: cwd, srcDir: path.join(cwd, 'src')});\n }\n for (const glob of patterns) {\n // Positive patterns are expanded by directory listing rather than with a\n // full glob library, so only a trailing /* is honoured. Negated entries\n // (\"!packages/core\") are honoured in full — watching an excluded directory\n // would trigger HMR for a package the app does not actually resolve.\n const m = glob.match(/^(.+?)\\/\\*$/);\n const candidates: string[] = [];\n if (m) {\n const parent = path.join(cwd, m[1]);\n if (await fsExtra.pathExists(parent)) {\n const entries = await fs.readdir(parent, {withFileTypes: true});\n for (const dirent of entries) {\n if (dirent.isDirectory() || dirent.isSymbolicLink()) {\n candidates.push(path.join(parent, dirent.name));\n }\n }\n }\n } else {\n candidates.push(path.join(cwd, glob));\n }\n for (const root of candidates) {\n const rel = path.relative(cwd, root).split(path.sep).join('/');\n if (isWorkspacePathNegated(rel, negatedPatterns)) continue;\n const pkgPath = path.join(root, 'package.json');\n if (!(await fsExtra.pathExists(pkgPath))) continue;\n try {\n const sub = await fsExtra.readJson(pkgPath);\n if (sub.name) {\n out.push({name: sub.name, root, srcDir: path.join(root, 'src')});\n }\n } catch {\n // ignore broken package.json\n }\n }\n }\n\n // Linked deps installed as source, realpathed — a localized checkout is here\n // and nowhere else. Imported lazily because vite-config pulls in Vite itself.\n const {discoverLinkedSourceDependencies} = await import('../vite-config.js');\n const names = new Set(out.map((p) => p.name));\n for (const entry of await discoverLinkedSourceDependencies(cwd)) {\n if (names.has(entry.name)) continue;\n // Only working copies. Some PUBLISHED packages ship `src/` in their tarball,\n // so the resolver registers them (it serves that source) — but they stay\n // inside `node_modules`, which Vite's watcher ignores, so no change event\n // can ever match them. Listing them would inflate the count printed at boot\n // with packages nothing watches. A localized checkout, a workspace clone and\n // an `npm link` all realpath to a directory outside `node_modules`.\n if (isInsideNodeModules(entry.srcDir)) continue;\n names.add(entry.name);\n out.push({name: entry.name, root: path.dirname(entry.srcDir), srcDir: entry.srcDir});\n }\n return out;\n}\n\nfunction isInsideNodeModules(p: string): boolean {\n return p.split(path.sep).includes('node_modules');\n}\n\nfunction workspacePackageForPath(\n filepath: string,\n pkgs: WorkspacePackage[],\n): string | null {\n for (const p of pkgs) {\n if (filepath.startsWith(p.srcDir + path.sep) || filepath === p.srcDir) {\n return p.name;\n }\n }\n return null;\n}\n\nfunction openBrowser(url: string): void {\n const cmd =\n process.platform === 'darwin'\n ? 'open'\n : process.platform === 'win32'\n ? 'start'\n : 'xdg-open';\n spawn(cmd, [url], {detached: true, stdio: 'ignore'}).unref();\n}\n\nfunction installShortcuts(opts: {url: string; onRestart: () => void}): void {\n if (!process.stdin.isTTY) return;\n let buf = '';\n try {\n process.stdin.setRawMode(true);\n } catch {\n return;\n }\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n const cleanup = () => {\n try {\n process.stdin.setRawMode(false);\n } catch {}\n };\n process.on('exit', cleanup);\n process.stdin.on('data', (chunk: string) => {\n for (const ch of chunk) {\n // Ctrl-C → graceful exit, restore terminal first.\n if (ch === '\u0003') {\n cleanup();\n process.exit(0);\n }\n if (ch === '\\r' || ch === '\\n') {\n const cmd = buf.trim();\n buf = '';\n if (cmd === 'r') {\n console.log('[linked] restarting…');\n opts.onRestart();\n } else if (cmd === 'o') {\n console.log(`[linked] opening ${opts.url}`);\n openBrowser(opts.url);\n }\n } else {\n buf += ch;\n }\n }\n });\n console.log(\n `[linked] press r<enter> to restart · o<enter> to open ${opts.url}`,\n );\n}\n\nfunction restartProcess(): void {\n // nodemon-style respawn: launch a fresh process from the same argv,\n // then exit. The new process inherits stdio so the dev experience is\n // continuous.\n const [node, ...argv] = process.argv;\n const child = spawn(node, argv, {\n stdio: 'inherit',\n detached: true,\n env: process.env,\n });\n child.unref();\n process.exit(0);\n}\n\nexport async function startWithVite(opts: StartOptions = {}): Promise<void> {\n const cwd = process.cwd();\n\n // Load the app's own `.env` (Node 20.12+ `process.loadEnvFile`) if present — the\n // standard, dependency-free env source for a linked app. Node does NOT override\n // vars already set in the environment, so CN's injected per-(project,branch) vars\n // (PORT, FUSEKI_DATASET, CN_APP_ADMIN_SECRET, …) take precedence over the file.\n try {\n const envPath = path.join(cwd, '.env');\n if (\n (await fsExtra.pathExists(envPath)) &&\n typeof (process as {loadEnvFile?: (p: string) => void}).loadEnvFile === 'function'\n ) {\n (process as {loadEnvFile: (p: string) => void}).loadEnvFile(envPath);\n }\n } catch {\n // best-effort — a missing/invalid .env never blocks start\n }\n\n // `--env` still loads env-cmd (`.env-cmdrc.json`) for CN's own start:local flow.\n const {ensureEnvironmentLoaded} = await import('../lifecycle.js');\n await ensureEnvironmentLoaded();\n\n // Load user's linked.config.js (legacy hook). It still drives things\n // like server.cachePaths and the rest of LinkedServer's options.\n const linkedConfigPath = resolveLinkedConfigPath(cwd);\n let linkedConfig: any = {};\n if (fsExtra.existsSync(linkedConfigPath)) {\n linkedConfig = (await import(linkedConfigPath)).default ?? {};\n }\n linkedConfig.server = linkedConfig.server || {};\n const apiOnly = isApiOnly(opts, linkedConfig);\n\n const {createServer: createViteServer} = await import('vite');\n const vite = await createViteServer(await resolveViteServerConfig(cwd, apiOnly));\n configureLinkedServer(linkedConfig.server, vite, cwd, apiOnly);\n\n // Load the storage config through Vite SSR so it\n // configures the SAME LinkedStorage instance the rest of the SSR graph\n // (LinkedServer, CN providers) uses. Replaces the former Node-direct\n // `loadBackendStorageConfig()` (which resolved @_linked/core via the\n // `default`→lib condition, a SEPARATE instance). Safe now that core's lib\n // `initTree` is idempotent. `loadBackendStorageConfig` stays in\n // lifecycle.ts for the Node-only CLI commands (`script`/`call`) that have no\n // Vite server (contract C5).\n // The first two names are current; the rest are legacy filenames kept so\n // older apps that never renamed their storage config still start.\n for (const rel of [\n '/linked.backend.storage.ts',\n '/linked.backend.storage.js',\n '/backend-storage-config.ts',\n '/backend-storage-config.js',\n '/scripts/backend-storage-config.ts',\n '/scripts/backend-storage-config.js',\n '/scripts/storage-config.js',\n ]) {\n if (fsExtra.existsSync(path.join(cwd, rel.slice(1)))) {\n await vite.ssrLoadModule(rel);\n break;\n }\n }\n\n // Load LinkedServer through Vite SSR so it shares the SAME\n // module instances as everything else in the SSR call graph. Without\n // this, LinkedServer is loaded by Node (→ lib/esm) while CN's App.tsx +\n // its transitive imports are loaded by Vite (→ src/). React contexts\n // created in one tree don't reach consumers in the other, causing\n // \"Cannot destructure property 'isNativeApp' of useAppContext()\" type\n // errors on every SSR render.\n const ServerClass = (\n await vite.ssrLoadModule('@_linked/server/shapes/LinkedServer')\n ).LinkedServer;\n\n const server = new (ServerClass as any)(linkedConfig);\n\n // Surface stack traces from Vite ssrLoadModule failures cleanly.\n process.on('unhandledRejection', (err: any) => {\n if (err && err.stack) {\n try {\n vite.ssrFixStacktrace(err);\n } catch {\n // ignore\n }\n }\n console.error(err);\n });\n\n await server.start();\n\n // Watcher → onSourceChange wiring.\n //\n // Discover workspace packages once at boot. On each change, look up\n // which workspace package the file belongs to and call onSourceChange\n // with that package's npm name. LinkedServer disposes the old providers,\n // re-imports via vite.ssrLoadModule (transparent because Vite invalidated\n // the module already), and re-instantiates. No process restart.\n const workspacePackages = await discoverWorkspacePackages(cwd);\n if (workspacePackages.length > 0) {\n console.log(\n `[linked] watching ${workspacePackages.length} workspace packages for HMR`,\n );\n }\n // Reloads are DEBOUNCED and SERIALISED. `onSourceChange` disposes a\n // package's providers and re-registers their express routes, i.e. it mutates\n // the shared router stack. Firing it per file change (a multi-file save, a\n // format-on-save, a branch switch) ran overlapping dispose/re-register\n // cycles against that same stack with nothing ordering them. Collect the\n // affected packages over a short window, then run the cycles one at a time.\n const RELOAD_DEBOUNCE_MS = 150;\n const pendingReloads = new Set<string>();\n let reloadTimer: NodeJS.Timeout | undefined;\n // Tail of the reload chain — each flush appends, so cycles never interleave.\n let reloadChain: Promise<void> = Promise.resolve();\n\n const flushReloads = () => {\n const pkgs = [...pendingReloads];\n pendingReloads.clear();\n reloadChain = reloadChain.then(async () => {\n for (const pkg of pkgs) {\n try {\n await (server as any).onSourceChange(pkg);\n } catch (err: any) {\n console.warn(\n `[linked] reload of ${pkg} failed: ${err?.message ?? err}`,\n );\n }\n }\n });\n };\n\n vite.watcher.on('change', (filepath: string) => {\n if (!/\\.(tsx?|jsx?)$/.test(filepath)) return;\n const pkg = workspacePackageForPath(filepath, workspacePackages);\n if (!pkg) return;\n if (typeof (server as any).onSourceChange !== 'function') return;\n pendingReloads.add(pkg);\n clearTimeout(reloadTimer);\n reloadTimer = setTimeout(flushReloads, RELOAD_DEBOUNCE_MS);\n });\n\n // r/o keyboard shortcuts.\n const port = (linkedConfig.server as any).port ?? opts.port ?? 4040;\n installShortcuts({\n url: `http://localhost:${port}/`,\n onRestart: restartProcess,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start.ts"],"names":[],"mappings":";;;;;;;;;AAAA,sCAAsC;AACtC,EAAE;AACF,0EAA0E;AAC1E,sEAAsE;AACtE,2EAA2E;AAC3E,uEAAuE;AACvE,yDAAyD;AACzD,EAAE;AACF,+CAA+C;AAC/C,kFAAkF;AAClF,8CAA8C;AAC9C,uEAAuE;AACvE,yEAAyE;AACzE,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AACzC,OAAO,OAAO,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AI,CAAC,GAAG;gBAAE,OAAO;YACjB,IAAI,OAAQ,MAAc,CAAC,cAAc,KAAK,UAAU;gBAAE,OAAO;YACjE,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxB,YAAY,CAAC,WAAW,CAAC,CAAC;YAC1B,WAAW,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,0BAA0B;QAC1B,MAAM,IAAI,GAAG,MAAA,MAAC,YAAY,CAAC,MAAc,CAAC,IAAI,mCAAI,IAAI,CAAC,IAAI,mCAAI,IAAI,CAAC;QACpE,gBAAgB,CAAC;YACf,GAAG,EAAE,oBAAoB,IAAI,GAAG;YAChC,SAAS,EAAE,cAAc;SAC1B,CAAC,CAAC;IACL,CAAC;CAAA","sourcesContent":["// `linked start --vite` orchestrator.\n//\n// Follows the existing startServer() flow from cli-methods.ts but injects\n// a Vite dev server in middleware mode + overrides loadAppComponent /\n// loadRoutes to use vite.ssrLoadModule. This means LinkedServer's existing\n// initialization works unchanged; we just route module loading through\n// Vite instead of loading modules through Node directly.\n//\n// What's different vs the plain startServer():\n// - LinkedServer renders through the Vite middleware when viteMiddleware is set\n// - Vite handles the client transform + HMR\n// - ssrLoadModule handles the server transform (decorators, jsx, ts)\n// - Server changes still need full process restart for now (server HMR\n// deferred to vite-node migration)\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport {spawn} from 'node:child_process';\nimport fsExtra from 'fs-extra';\nimport {parseWorkspacePatterns, isWorkspacePathNegated} from '../workspace-globs.js';\n\nimport type {InlineConfig, UserConfigExport, ViteDevServer} from 'vite';\n\nexport interface StartOptions {\n env?: string;\n port?: number;\n /**\n * Serve only the backend API (`/call/...`, `/api/...`, provider routes).\n * No `vite.config.*`, `src/App.tsx` or `src/routes.tsx` is needed, and page\n * requests get a 404 instead of server-side rendering.\n */\n apiOnly?: boolean;\n}\n\nexport const VITE_CONFIG_FILES = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n\n/**\n * Names for the app's linked config, in priority order. `lincd.config.js` is\n * the legacy name: apps predating the rename still ship it, and dropping it\n * would silently discard their whole `server` config (cachePaths, `apiOnly`, …).\n */\nexport const LINKED_CONFIG_FILES = ['linked.config.js', 'lincd.config.js'];\n\n/**\n * Absolute path to the app's linked config. Returns the first name that exists;\n * when none does, the current name — the caller still `existsSync`-guards the\n * import, so this is simply the \"no config here\" path, not a promise of a file.\n */\nexport function resolveLinkedConfigPath(cwd: string): string {\n return (\n LINKED_CONFIG_FILES.map((name) => path.join(cwd, name)).find((candidate) =>\n fsExtra.existsSync(candidate),\n ) ?? path.join(cwd, LINKED_CONFIG_FILES[0])\n );\n}\n\n/**\n * API-only mode is explicit: `linked start --api-only`, or `server.apiOnly: true`\n * in `linked.config.js`. It is never inferred from missing frontend files, so a\n * web app that lost its `vite.config.ts` still fails loudly instead of silently\n * serving no pages.\n */\nexport function isApiOnly(opts: StartOptions, linkedConfig: any): boolean {\n return opts.apiOnly === true || linkedConfig?.server?.apiOnly === true;\n}\n\n/**\n * The Vite dev-server config for `linked start`.\n *\n * With a `vite.config.*` in `cwd`, Vite loads it itself. Without one, API-only\n * mode uses `createViteConfig()`'s defaults inline — Vite is still needed on the\n * backend to transform TypeScript, decorators and extensionless imports of\n * source-only shape packages. Without one in page mode, it is an error.\n */\nexport async function resolveViteServerConfig(\n cwd: string,\n apiOnly: boolean,\n): Promise<InlineConfig> {\n const base: InlineConfig = {\n root: cwd,\n server: {middlewareMode: true},\n appType: 'custom',\n };\n if (VITE_CONFIG_FILES.some((c) => fsExtra.existsSync(path.join(cwd, c)))) {\n return base;\n }\n if (!apiOnly) {\n throw new Error(\n `[linked start] no vite.config.{ts,js,mjs} found in ${cwd}. Add one:\\n\\n import {createViteConfig} from '@_linked/cli/vite-config';\\n export default createViteConfig({port: 4040, cssMode: 'tailwind'});\\n\\nFor a backend without a web frontend, run \\`linked start --api-only\\` instead.\\n`,\n );\n }\n const {createViteConfig} = await import('../vite-config.js');\n const exported: UserConfigExport = createViteConfig();\n const defaults =\n typeof exported === 'function'\n ? await exported({command: 'serve', mode: 'development'})\n : await exported;\n return {\n ...defaults,\n ...base,\n configFile: false,\n server: {...defaults.server, ...base.server},\n // No browser client: skip the client dependency scan, whose entry\n // (`src/index.tsx`) does not exist in a backend.\n optimizeDeps: {...defaults.optimizeDeps, noDiscovery: true},\n };\n}\n\n/**\n * Inject Vite into LinkedServer's config:\n * - vite: handle for ssrLoadModule (used to load app's backend.ts via self-reference)\n * and, unless API-only (where `apiOnly` makes LinkedServer skip page rendering):\n * - viteMiddleware: mounted as the dev-server middleware\n * - loadAppComponent / loadRoutes: route through vite.ssrLoadModule for SSR transform\n * - viteSsrPreload: page modules to preload for SSR CSS collection\n */\nexport function configureLinkedServer(\n serverConfig: any,\n vite: Pick<ViteDevServer, 'middlewares' | 'ssrLoadModule'>,\n cwd: string,\n apiOnly: boolean,\n): void {\n serverConfig.vite = vite;\n if (apiOnly) {\n serverConfig.apiOnly = true;\n return;\n }\n serverConfig.viteMiddleware = vite.middlewares;\n serverConfig.loadAppComponent = async () => {\n const mod = await vite.ssrLoadModule('/src/App.tsx');\n return mod.default;\n };\n serverConfig.loadRoutes = async () => {\n return await vite.ssrLoadModule('/src/routes.tsx');\n };\n\n // Vite SSR CSS collection support:\n // List all `src/pages/*.{ts,tsx}` files so LinkedServer can ssrLoadModule\n // each into Vite's moduleGraph BEFORE the first render of a session.\n // React.lazy() doesn't auto-fire — without this, only App's eager\n // imports' CSS is collected; lazy pages' CSS arrives after hydration\n // causing an unstyled flash. After the first preload sweep, all\n // subsequent renders have full CSS available.\n serverConfig.viteSsrPreload = async () => {\n const pagesDir = path.join(cwd, 'src', 'pages');\n if (!fsExtra.existsSync(pagesDir)) return [];\n const files = fsExtra.readdirSync(pagesDir, {withFileTypes: true});\n const paths: string[] = [];\n for (const file of files) {\n // Test files live beside pages but call vi.mock() at module scope,\n // which throws outside Vitest — never load them into the SSR graph.\n // `.d.ts` files are types only: they have no runtime module to load.\n if (\n file.isFile() &&\n /\\.(tsx|ts)$/.test(file.name) &&\n !/\\.(test|spec)\\.(tsx|ts)$/.test(file.name) &&\n !file.name.endsWith('.d.ts')\n ) {\n paths.push(`/src/pages/${file.name}`);\n }\n }\n return paths;\n };\n}\n\ninterface WorkspacePackage {\n name: string;\n root: string;\n srcDir: string;\n}\n\n/**\n * Discover the packages whose sources `linked start` watches for HMR, from two\n * sources. No hand-maintained list anywhere.\n *\n * 1. The app's `package.json` `workspaces` field — adding a new linked package\n * = appearing in the right glob.\n * 2. The app's linked dependencies that are installed as SOURCE — the same rule\n * the Vite resolver table uses (`discoverLinkedSourceDependencies`), so the\n * two lists cannot disagree about what is source. This covers a LOCALIZED\n * checkout (`packages-local/<pkg>`), which is deliberately in no workspace\n * glob and reachable only through its `node_modules` symlink. Without it\n * `workspacePackageForPath` returns null for the checkout, so a saved backend\n * edit is reloaded by Vite and then never re-indexed: the registered provider\n * instance is never replaced.\n *\n * Returns each package's npm `name` (so we can call `onSourceChange(name)`), its\n * absolute root, and its `src/` directory for fast prefix matching. Dependency\n * roots are realpathed by the shared discovery, matching the ids Vite reports.\n */\nexport async function discoverWorkspacePackages(cwd: string): Promise<WorkspacePackage[]> {\n const pkgJsonPath = path.join(cwd, 'package.json');\n if (!(await fsExtra.pathExists(pkgJsonPath))) return [];\n const pkgJson = await fsExtra.readJson(pkgJsonPath);\n const {patterns, negatedPatterns} = parseWorkspacePatterns(pkgJson.workspaces);\n const out: WorkspacePackage[] = [];\n\n // Include the root app itself so edits to <cwd>/src/* trigger HMR for\n // the app's own providers (e.g. CN's src/backend.ts which registers ~25\n // Express routes).\n if (pkgJson.name && (await fsExtra.pathExists(path.join(cwd, 'src')))) {\n out.push({name: pkgJson.name, root: cwd, srcDir: path.join(cwd, 'src')});\n }\n for (const glob of patterns) {\n // Positive patterns are expanded by directory listing rather than with a\n // full glob library, so only a trailing /* is honoured. Negated entries\n // (\"!packages/core\") are honoured in full — watching an excluded directory\n // would trigger HMR for a package the app does not actually resolve.\n const m = glob.match(/^(.+?)\\/\\*$/);\n const candidates: string[] = [];\n if (m) {\n const parent = path.join(cwd, m[1]);\n if (await fsExtra.pathExists(parent)) {\n const entries = await fs.readdir(parent, {withFileTypes: true});\n for (const dirent of entries) {\n if (dirent.isDirectory() || dirent.isSymbolicLink()) {\n candidates.push(path.join(parent, dirent.name));\n }\n }\n }\n } else {\n candidates.push(path.join(cwd, glob));\n }\n for (const root of candidates) {\n const rel = path.relative(cwd, root).split(path.sep).join('/');\n if (isWorkspacePathNegated(rel, negatedPatterns)) continue;\n const pkgPath = path.join(root, 'package.json');\n if (!(await fsExtra.pathExists(pkgPath))) continue;\n try {\n const sub = await fsExtra.readJson(pkgPath);\n if (sub.name) {\n out.push({name: sub.name, root, srcDir: path.join(root, 'src')});\n }\n } catch {\n // ignore broken package.json\n }\n }\n }\n\n // Linked deps installed as source, realpathed — a localized checkout is here\n // and nowhere else. Imported lazily because vite-config pulls in Vite itself.\n const {discoverLinkedSourceDependencies} = await import('../vite-config.js');\n const names = new Set(out.map((p) => p.name));\n for (const entry of await discoverLinkedSourceDependencies(cwd)) {\n if (names.has(entry.name)) continue;\n // Only working copies. Some PUBLISHED packages ship `src/` in their tarball,\n // so the resolver registers them (it serves that source) — but they stay\n // inside `node_modules`, which Vite's watcher ignores, so no change event\n // can ever match them. Listing them would inflate the count printed at boot\n // with packages nothing watches. A localized checkout, a workspace clone and\n // an `npm link` all realpath to a directory outside `node_modules`.\n if (isInsideNodeModules(entry.srcDir)) continue;\n names.add(entry.name);\n out.push({name: entry.name, root: path.dirname(entry.srcDir), srcDir: entry.srcDir});\n }\n return out;\n}\n\nfunction isInsideNodeModules(p: string): boolean {\n return p.split(path.sep).includes('node_modules');\n}\n\nfunction workspacePackageForPath(\n filepath: string,\n pkgs: WorkspacePackage[],\n): string | null {\n for (const p of pkgs) {\n if (filepath.startsWith(p.srcDir + path.sep) || filepath === p.srcDir) {\n return p.name;\n }\n }\n return null;\n}\n\nfunction openBrowser(url: string): void {\n const cmd =\n process.platform === 'darwin'\n ? 'open'\n : process.platform === 'win32'\n ? 'start'\n : 'xdg-open';\n spawn(cmd, [url], {detached: true, stdio: 'ignore'}).unref();\n}\n\nfunction installShortcuts(opts: {url: string; onRestart: () => void}): void {\n if (!process.stdin.isTTY) return;\n let buf = '';\n try {\n process.stdin.setRawMode(true);\n } catch {\n return;\n }\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n const cleanup = () => {\n try {\n process.stdin.setRawMode(false);\n } catch {}\n };\n process.on('exit', cleanup);\n process.stdin.on('data', (chunk: string) => {\n for (const ch of chunk) {\n // Ctrl-C → graceful exit, restore terminal first.\n if (ch === '\u0003') {\n cleanup();\n process.exit(0);\n }\n if (ch === '\\r' || ch === '\\n') {\n const cmd = buf.trim();\n buf = '';\n if (cmd === 'r') {\n console.log('[linked] restarting…');\n opts.onRestart();\n } else if (cmd === 'o') {\n console.log(`[linked] opening ${opts.url}`);\n openBrowser(opts.url);\n }\n } else {\n buf += ch;\n }\n }\n });\n console.log(\n `[linked] press r<enter> to restart · o<enter> to open ${opts.url}`,\n );\n}\n\nfunction restartProcess(): void {\n // nodemon-style respawn: launch a fresh process from the same argv,\n // then exit. The new process inherits stdio so the dev experience is\n // continuous.\n const [node, ...argv] = process.argv;\n const child = spawn(node, argv, {\n stdio: 'inherit',\n detached: true,\n env: process.env,\n });\n child.unref();\n process.exit(0);\n}\n\nexport async function startWithVite(opts: StartOptions = {}): Promise<void> {\n const cwd = process.cwd();\n\n // Load the app's own `.env` (Node 20.12+ `process.loadEnvFile`) if present — the\n // standard, dependency-free env source for a linked app. Node does NOT override\n // vars already set in the environment, so CN's injected per-(project,branch) vars\n // (PORT, FUSEKI_DATASET, CN_APP_ADMIN_SECRET, …) take precedence over the file.\n try {\n const envPath = path.join(cwd, '.env');\n if (\n (await fsExtra.pathExists(envPath)) &&\n typeof (process as {loadEnvFile?: (p: string) => void}).loadEnvFile === 'function'\n ) {\n (process as {loadEnvFile: (p: string) => void}).loadEnvFile(envPath);\n }\n } catch {\n // best-effort — a missing/invalid .env never blocks start\n }\n\n // `--env` still loads env-cmd (`.env-cmdrc.json`) for CN's own start:local flow.\n const {ensureEnvironmentLoaded} = await import('../lifecycle.js');\n await ensureEnvironmentLoaded();\n\n // Load user's linked.config.js (legacy hook). It still drives things\n // like server.cachePaths and the rest of LinkedServer's options.\n const linkedConfigPath = resolveLinkedConfigPath(cwd);\n let linkedConfig: any = {};\n if (fsExtra.existsSync(linkedConfigPath)) {\n linkedConfig = (await import(linkedConfigPath)).default ?? {};\n }\n linkedConfig.server = linkedConfig.server || {};\n const apiOnly = isApiOnly(opts, linkedConfig);\n\n const {createServer: createViteServer} = await import('vite');\n const vite = await createViteServer(await resolveViteServerConfig(cwd, apiOnly));\n configureLinkedServer(linkedConfig.server, vite, cwd, apiOnly);\n\n // Load the storage config through Vite SSR so it\n // configures the SAME LinkedStorage instance the rest of the SSR graph\n // (LinkedServer, CN providers) uses. Replaces the former Node-direct\n // `loadBackendStorageConfig()` (which resolved @_linked/core via the\n // `default`→lib condition, a SEPARATE instance). Safe now that core's lib\n // `initTree` is idempotent. `loadBackendStorageConfig` stays in\n // lifecycle.ts for the Node-only CLI commands (`script`/`call`) that have no\n // Vite server (contract C5).\n // The first two names are current; the rest are legacy filenames kept so\n // older apps that never renamed their storage config still start.\n for (const rel of [\n '/linked.backend.storage.ts',\n '/linked.backend.storage.js',\n '/backend-storage-config.ts',\n '/backend-storage-config.js',\n '/scripts/backend-storage-config.ts',\n '/scripts/backend-storage-config.js',\n '/scripts/storage-config.js',\n ]) {\n if (fsExtra.existsSync(path.join(cwd, rel.slice(1)))) {\n await vite.ssrLoadModule(rel);\n break;\n }\n }\n\n // Load LinkedServer through Vite SSR so it shares the SAME\n // module instances as everything else in the SSR call graph. Without\n // this, LinkedServer is loaded by Node (→ lib/esm) while CN's App.tsx +\n // its transitive imports are loaded by Vite (→ src/). React contexts\n // created in one tree don't reach consumers in the other, causing\n // \"Cannot destructure property 'isNativeApp' of useAppContext()\" type\n // errors on every SSR render.\n // Loading this entry through Vite is why `@_linked/server` is in\n // `SSR_ENTRY_PACKAGES` (vite-config.ts): the package's bare imports must go\n // through Vite as well, or some of its files evaluate once per loader.\n const ServerClass = (\n await vite.ssrLoadModule('@_linked/server/shapes/LinkedServer')\n ).LinkedServer;\n\n const server = new (ServerClass as any)(linkedConfig);\n\n // Surface stack traces from Vite ssrLoadModule failures cleanly.\n process.on('unhandledRejection', (err: any) => {\n if (err && err.stack) {\n try {\n vite.ssrFixStacktrace(err);\n } catch {\n // ignore\n }\n }\n console.error(err);\n });\n\n await server.start();\n\n // Watcher → onSourceChange wiring.\n //\n // Discover workspace packages once at boot. On each change, look up\n // which workspace package the file belongs to and call onSourceChange\n // with that package's npm name. LinkedServer disposes the old providers,\n // re-imports via vite.ssrLoadModule (transparent because Vite invalidated\n // the module already), and re-instantiates. No process restart.\n const workspacePackages = await discoverWorkspacePackages(cwd);\n if (workspacePackages.length > 0) {\n console.log(\n `[linked] watching ${workspacePackages.length} workspace packages for HMR`,\n );\n }\n // Reloads are DEBOUNCED and SERIALISED. `onSourceChange` disposes a\n // package's providers and re-registers their express routes, i.e. it mutates\n // the shared router stack. Firing it per file change (a multi-file save, a\n // format-on-save, a branch switch) ran overlapping dispose/re-register\n // cycles against that same stack with nothing ordering them. Collect the\n // affected packages over a short window, then run the cycles one at a time.\n const RELOAD_DEBOUNCE_MS = 150;\n const pendingReloads = new Set<string>();\n let reloadTimer: NodeJS.Timeout | undefined;\n // Tail of the reload chain — each flush appends, so cycles never interleave.\n let reloadChain: Promise<void> = Promise.resolve();\n\n const flushReloads = () => {\n const pkgs = [...pendingReloads];\n pendingReloads.clear();\n reloadChain = reloadChain.then(async () => {\n for (const pkg of pkgs) {\n try {\n await (server as any).onSourceChange(pkg);\n } catch (err: any) {\n console.warn(\n `[linked] reload of ${pkg} failed: ${err?.message ?? err}`,\n );\n }\n }\n });\n };\n\n vite.watcher.on('change', (filepath: string) => {\n if (!/\\.(tsx?|jsx?)$/.test(filepath)) return;\n const pkg = workspacePackageForPath(filepath, workspacePackages);\n if (!pkg) return;\n if (typeof (server as any).onSourceChange !== 'function') return;\n pendingReloads.add(pkg);\n clearTimeout(reloadTimer);\n reloadTimer = setTimeout(flushReloads, RELOAD_DEBOUNCE_MS);\n });\n\n // r/o keyboard shortcuts.\n const port = (linkedConfig.server as any).port ?? opts.port ?? 4040;\n installShortcuts({\n url: `http://localhost:${port}/`,\n onRestart: restartProcess,\n });\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
/** An ESTree parser — the plugin context's `this.parse` (Rollup's parser). */
|
|
3
|
+
export type ParseAst = (code: string) => any;
|
|
4
|
+
/**
|
|
5
|
+
* Returns `code` with the runtime name of every top-level tsc-style decorated
|
|
6
|
+
* class expression pinned, or `null` when there is nothing to pin (or the
|
|
7
|
+
* module does not parse as JavaScript).
|
|
8
|
+
*/
|
|
9
|
+
export declare function pinDecoratedClassNames(code: string, parse: ParseAst): string | null;
|
|
10
|
+
export declare function pinCompiledClassNames(): Plugin;
|
|
11
|
+
//# sourceMappingURL=pin-compiled-class-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pin-compiled-class-names.d.ts","sourceRoot":"","sources":["../../../src/plugins/pin-compiled-class-names.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,MAAM,CAAC;AAEjC,8EAA8E;AAC9E,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;AAO7C;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,QAAQ,GACd,MAAM,GAAG,IAAI,CA+Bf;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAU9C"}
|