@_linked/cli 1.34.0 → 1.35.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/lib/esm/launch.js CHANGED
File without changes
@@ -0,0 +1,123 @@
1
+ // Type definitions for Colors.js 0.6.0-1
2
+ // Project: https://github.com/Marak/colors.js
3
+ // Definitions by: Bart van der Schoor <https://github.com/Bartvds>
4
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+
6
+ declare module 'colors' {
7
+ interface Color {
8
+ black: Color;
9
+ red: Color;
10
+ green: Color;
11
+ yellow: Color;
12
+ blue: Color;
13
+ magenta: Color;
14
+ cyan: Color;
15
+ white: Color;
16
+ gray: Color;
17
+ grey: Color;
18
+ bgBlack: Color;
19
+ bgRed: Color;
20
+ bgGreen: Color;
21
+ bgYellow: Color;
22
+ bgBlue: Color;
23
+ bgMagenta: Color;
24
+ bgCyan: Color;
25
+ bgWhite: Color;
26
+ reset: Color;
27
+ bold: Color;
28
+ dim: Color;
29
+ italic: Color;
30
+ underline: Color;
31
+ inverse: Color;
32
+ hidden: Color;
33
+ strikethrough: Color;
34
+ rainbow: Color;
35
+ zebra: Color;
36
+ america: Color;
37
+ trap: Color;
38
+ random: Color;
39
+ zalgo: Color;
40
+
41
+ (text: string): string;
42
+ }
43
+
44
+ namespace e {
45
+ export function setTheme(theme: any): void;
46
+
47
+ export var black: Color;
48
+ export var red: Color;
49
+ export var green: Color;
50
+ export var yellow: Color;
51
+ export var blue: Color;
52
+ export var magenta: Color;
53
+ export var cyan: Color;
54
+ export var white: Color;
55
+ export var gray: Color;
56
+ export var grey: Color;
57
+
58
+ export var bgBlack: Color;
59
+ export var bgRed: Color;
60
+ export var bgGreen: Color;
61
+ export var bgYellow: Color;
62
+ export var bgBlue: Color;
63
+ export var bgMagenta: Color;
64
+ export var bgCyan: Color;
65
+ export var bgWhite: Color;
66
+
67
+ export var reset: Color;
68
+ export var bold: Color;
69
+ export var dim: Color;
70
+ export var italic: Color;
71
+ export var underline: Color;
72
+ export var inverse: Color;
73
+ export var hidden: Color;
74
+ export var strikethrough: Color;
75
+
76
+ export var rainbow: Color;
77
+ export var zebra: Color;
78
+ export var america: Color;
79
+ export var trap: Color;
80
+ export var random: Color;
81
+ export var zalgo: Color;
82
+ }
83
+
84
+ export = e;
85
+ }
86
+
87
+ interface String {
88
+ black: string;
89
+ red: string;
90
+ green: string;
91
+ yellow: string;
92
+ blue: string;
93
+ magenta: string;
94
+ cyan: string;
95
+ white: string;
96
+ gray: string;
97
+ grey: string;
98
+
99
+ bgBlack: string;
100
+ bgRed: string;
101
+ bgGreen: string;
102
+ bgYellow: string;
103
+ bgBlue: string;
104
+ bgMagenta: string;
105
+ bgCyan: string;
106
+ bgWhite: string;
107
+
108
+ reset: string;
109
+ // bold: string;
110
+ dim: string;
111
+ italic: string;
112
+ underline: string;
113
+ inverse: string;
114
+ hidden: string;
115
+ strikethrough: string;
116
+
117
+ rainbow: string;
118
+ zebra: string;
119
+ america: string;
120
+ trap: string;
121
+ random: string;
122
+ zalgo: string;
123
+ }
@@ -99,7 +99,7 @@ export interface LinkedViteConfigOptions {
99
99
  deny?: (string | RegExp)[];
100
100
  };
101
101
  }
102
- interface WorkspaceEntry {
102
+ export interface WorkspaceEntry {
103
103
  name: string;
104
104
  srcDir: string;
105
105
  }
@@ -163,6 +163,16 @@ export declare function discoverLinkedSourceDependencies(cwd?: string): Promise<
163
163
  * dependencies for.
164
164
  */
165
165
  export declare function discoverWorkspaces(extraGlobs?: string[], cwd?: string): Promise<WorkspaceEntry[]>;
166
+ /**
167
+ * Resolve a bare specifier like `@_linked/foo/bar`, `lincd-rdfs/Foo`, or
168
+ * `pkg/utils/Bar.js` against the workspace lookup. Tries the file name first:
169
+ * .tsx, .ts, then the literal file (for files that already include an
170
+ * extension or for non-TS assets). When the name matches no file, falls back to
171
+ * the workspace's `exports` map (see `resolveViaWorkspaceExports`). Returns null
172
+ * when the specifier doesn't match any workspace package or no candidate exists
173
+ * on disk.
174
+ */
175
+ export declare function resolveWorkspaceSpecifier(specifier: string, workspaces: WorkspaceEntry[]): Promise<string | null>;
166
176
  /**
167
177
  * Packages whose entry `linked start` hands to `vite.ssrLoadModule` by name
168
178
  * (`@_linked/server/shapes/LinkedServer`, see `commands/start.ts`).
@@ -199,5 +209,4 @@ export declare function ssrNoExternal(workspaces: {
199
209
  */
200
210
  export declare function clientDefine(opts?: Pick<LinkedViteConfigOptions, 'define' | 'port'>): Record<string, string>;
201
211
  export declare function createViteConfig(opts?: LinkedViteConfigOptions): ReturnType<typeof defineConfig>;
202
- export {};
203
212
  //# sourceMappingURL=vite-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-config.d.ts","sourceRoot":"","sources":["../../src/vite-config.ts"],"names":[],"mappings":"AAYA,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAUlC,OAAO,KAAK,EAAC,MAAM,EAAa,MAAM,MAAM,CAAC;AAS7C;;;;;;;;;;;;;;;GAeG;AACH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,KAAG,MAAM,GAAG,SAyDtD,CAAC;AAEF,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAQnD;AAKD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAUxE;AAWD,MAAM,WAAW,qBAAqB;IACpC,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,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,CAAC,MAAM,EAAE,CAAC,CAsEnB;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,gCAAgC,CACpD,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,cAAc,EAAE,CAAC,CAmC3B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,GAAE,MAAM,EAAO,EACzB,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,cAAc,EAAE,CAAC,CAyD3B;AAuDD;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,cAAc,EAAE,GAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA2BxB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,UAAsB,CAAC;AAEtD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,EAAE,EAC5B,UAAU,GAAE,MAAM,EAAO,GACxB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAKrB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,IAAI,GAAE,IAAI,CAAC,uBAAuB,EAAE,QAAQ,GAAG,MAAM,CAAM,GAC1D,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAaxB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,uBAA4B,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAmYpG"}
@@ -30,7 +30,7 @@ import { generateScopedNameProduction } from './css-module-names.js';
30
30
  import { parseWorkspacePatterns, isWorkspacePathNegated } from './workspace-globs.js';
31
31
  import { pinCompiledClassNames } from './plugins/pin-compiled-class-names.js';
32
32
  import { isFrameworkPkg, readInstalledPkg } from './installed-packages.js';
33
- import { linkedClientDepIncludesPlugin } from './client-dep-includes.js';
33
+ import { linkedClientDepIncludesPlugin, resolveExportsSubpath, } from './client-dep-includes.js';
34
34
  /** Default dev server port, and Vite's default HMR websocket port. */
35
35
  const DEFAULT_DEV_PORT = 4040;
36
36
  const DEFAULT_HMR_PORT = 24678;
@@ -443,14 +443,68 @@ export function discoverWorkspaces() {
443
443
  return out;
444
444
  });
445
445
  }
446
+ const isFile = (p) => __awaiter(void 0, void 0, void 0, function* () {
447
+ return fsExtra
448
+ .stat(p)
449
+ .then((st) => st.isFile())
450
+ .catch(() => false);
451
+ });
452
+ /**
453
+ * Map a `lib/esm` file back to its source under `srcDir`: `.js`/`.jsx` probe
454
+ * `.tsx` then `.ts`, anything else (css, json, ...) is taken literally.
455
+ */
456
+ function libTargetToSource(srcDir, rel) {
457
+ return __awaiter(this, void 0, void 0, function* () {
458
+ if (/\.jsx?$/.test(rel)) {
459
+ const base = path.join(srcDir, rel.replace(/\.jsx?$/, ''));
460
+ for (const ext of ['.tsx', '.ts']) {
461
+ if (yield isFile(base + ext))
462
+ return base + ext;
463
+ }
464
+ return null;
465
+ }
466
+ const literal = path.join(srcDir, rel);
467
+ return (yield isFile(literal)) ? literal : null;
468
+ });
469
+ }
470
+ /**
471
+ * The name-based lookup's fallback: resolve `subpath` (`.` or `./x/y`) through
472
+ * the workspace's own `exports` under `import`/`default`, and map a
473
+ * `./lib/esm/...` target to the same path under src. This is what reaches
474
+ * source for a subpath whose export key does not match a file name
475
+ * (`@_linked/translation/key-sync/node` -> `lib/esm/key-sync-node.js` ->
476
+ * `src/key-sync-node.ts`), a directory subpath (`./conformance` ->
477
+ * `lib/esm/conformance/index.js`), or a bare name whose src has no index.
478
+ * Without it such a specifier falls through to Vite, which picks the package's
479
+ * `lib/esm` copy while the rest of the package comes from src: two instances of
480
+ * every module-level registry. It must not depend on a `development` -> src
481
+ * condition, because src/ is not published and packages do not declare one.
482
+ */
483
+ function resolveViaWorkspaceExports(ws, subpath) {
484
+ return __awaiter(this, void 0, void 0, function* () {
485
+ let json;
486
+ try {
487
+ json = yield fsExtra.readJson(path.join(path.dirname(ws.srcDir), 'package.json'));
488
+ }
489
+ catch (_a) {
490
+ return null;
491
+ }
492
+ const target = resolveExportsSubpath(json, subpath, ['import', 'default']);
493
+ if (!target || !target.startsWith('./lib/esm/'))
494
+ return null;
495
+ return libTargetToSource(ws.srcDir, target.slice('./lib/esm/'.length));
496
+ });
497
+ }
446
498
  /**
447
499
  * Resolve a bare specifier like `@_linked/foo/bar`, `lincd-rdfs/Foo`, or
448
- * `pkg/utils/Bar.js` against the workspace lookup. Tries extensions in
449
- * order: .ts, .tsx, then the literal id (for files that already include
450
- * an extension or for non-TS assets). Returns null when the specifier
451
- * doesn't match any workspace package or no candidate exists on disk.
500
+ * `pkg/utils/Bar.js` against the workspace lookup. Tries the file name first:
501
+ * .tsx, .ts, then the literal file (for files that already include an
502
+ * extension or for non-TS assets). When the name matches no file, falls back to
503
+ * the workspace's `exports` map (see `resolveViaWorkspaceExports`). Returns null
504
+ * when the specifier doesn't match any workspace package or no candidate exists
505
+ * on disk.
452
506
  */
453
- function resolveWorkspaceSpecifier(specifier, workspaces) {
507
+ export function resolveWorkspaceSpecifier(specifier, workspaces) {
454
508
  return __awaiter(this, void 0, void 0, function* () {
455
509
  for (const ws of workspaces) {
456
510
  if (specifier === ws.name) {
@@ -459,7 +513,7 @@ function resolveWorkspaceSpecifier(specifier, workspaces) {
459
513
  if (yield fsExtra.pathExists(p))
460
514
  return p;
461
515
  }
462
- return null;
516
+ return resolveViaWorkspaceExports(ws, '.');
463
517
  }
464
518
  if (specifier.startsWith(ws.name + '/')) {
465
519
  const subpath = specifier.slice(ws.name.length + 1);
@@ -472,11 +526,12 @@ function resolveWorkspaceSpecifier(specifier, workspaces) {
472
526
  return p;
473
527
  }
474
528
  // Files that already include an extension Vite handles (.css, .json,
475
- // .svg, etc.) — return the literal path under src.
529
+ // .svg, etc.) — return the literal path under src. A FILE only: a
530
+ // directory of the same name is a directory subpath, left to `exports`.
476
531
  const literal = path.join(ws.srcDir, subpath);
477
- if (yield fsExtra.pathExists(literal))
532
+ if (yield isFile(literal))
478
533
  return literal;
479
- return null;
534
+ return resolveViaWorkspaceExports(ws, './' + subpath);
480
535
  }
481
536
  }
482
537
  return null;