@mycadet/cli 0.13.0-dev.202610311714.d661ca6 → 0.13.0-dev.202611011557.373f3d6
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/eslint.config.mjs +8 -0
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/package.json +1 -1
- package/node_modules/@mycadet/avatar-manifest/package.json +1 -1
- package/node_modules/@mycadet/environments/package.json +1 -1
- package/node_modules/@mycadet/ipc-server-utils/package.json +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/avatar-manifest/package.json +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/package.json +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/package.json +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/eslint/no-re-exports.mjs +136 -0
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/eslint/no-re-exports.test.mjs +167 -0
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/package.json +7 -2
- package/node_modules/@mycadet/local-mode/package.json +1 -1
- package/node_modules/@mycadet/local-mode/src/__tests__/gateway-proxy.test.ts +132 -145
- package/node_modules/@mycadet/local-mode/src/__tests__/guardian-token-refresh.test.ts +6 -6
- package/node_modules/@mycadet/local-mode/src/__tests__/guardian-token.test.ts +22 -106
- package/node_modules/@mycadet/local-mode/src/__tests__/hatch.test.ts +22 -8
- package/node_modules/@mycadet/local-mode/src/__tests__/helpers/child-process-mock.ts +3 -0
- package/node_modules/@mycadet/local-mode/src/__tests__/helpers/lockfile-entry.ts +120 -0
- package/node_modules/@mycadet/local-mode/src/__tests__/operations-retire.test.ts +331 -0
- package/node_modules/@mycadet/local-mode/src/__tests__/operations-sleep.test.ts +470 -0
- package/{src/__tests__/retire-archive.test.ts → node_modules/@mycadet/local-mode/src/__tests__/remotes-local-archive.test.ts} +1 -1
- package/{src/__tests__/drain.test.ts → node_modules/@mycadet/local-mode/src/__tests__/remotes-local-drain.test.ts} +1 -1
- package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-retire.test.ts +424 -0
- package/node_modules/@mycadet/local-mode/src/__tests__/upgrade.test.ts +12 -6
- package/node_modules/@mycadet/local-mode/src/__tests__/wake.test.ts +19 -7
- package/node_modules/@mycadet/local-mode/src/cli-invocation.ts +85 -0
- package/node_modules/@mycadet/local-mode/src/cloud-auth.ts +194 -0
- package/node_modules/@mycadet/local-mode/src/devices.test.ts +44 -16
- package/node_modules/@mycadet/local-mode/src/devices.ts +3 -6
- package/node_modules/@mycadet/local-mode/src/environment.ts +13 -0
- package/node_modules/@mycadet/local-mode/src/exec.ts +105 -0
- package/node_modules/@mycadet/local-mode/src/gateway-proxy.ts +38 -13
- package/node_modules/@mycadet/local-mode/src/guardian-token.ts +52 -97
- package/node_modules/@mycadet/local-mode/src/hatch.ts +2 -3
- package/node_modules/@mycadet/local-mode/src/index.ts +85 -16
- package/node_modules/@mycadet/local-mode/src/ingress.ts +229 -0
- package/node_modules/@mycadet/local-mode/src/lifecycle-reporter.ts +31 -0
- package/node_modules/@mycadet/local-mode/src/lockfile-contract.ts +0 -8
- package/node_modules/@mycadet/local-mode/src/lockfile.test.ts +1 -515
- package/node_modules/@mycadet/local-mode/src/lockfile.ts +8 -169
- package/node_modules/@mycadet/local-mode/src/operations/lookup.ts +141 -0
- package/node_modules/@mycadet/local-mode/src/operations/retire.ts +93 -0
- package/node_modules/@mycadet/local-mode/src/operations/routes.ts +114 -0
- package/node_modules/@mycadet/local-mode/src/operations/sleep.ts +78 -0
- package/node_modules/@mycadet/local-mode/src/process.ts +357 -0
- package/{src/lib/retire-apple-container.ts → node_modules/@mycadet/local-mode/src/remotes/apple-container/retire.ts} +23 -18
- package/node_modules/@mycadet/local-mode/src/remotes/cloud/retire.ts +128 -0
- package/node_modules/@mycadet/local-mode/src/remotes/custom/retire.ts +44 -0
- package/node_modules/@mycadet/local-mode/src/remotes/docker/retire.ts +108 -0
- package/node_modules/@mycadet/local-mode/src/remotes/docker/sleep.ts +71 -0
- package/{src/lib/retire-archive.ts → node_modules/@mycadet/local-mode/src/remotes/local/archive.ts} +9 -3
- package/{src/lib → node_modules/@mycadet/local-mode/src/remotes/local}/drain.ts +1 -2
- package/node_modules/@mycadet/local-mode/src/remotes/local/instance.ts +38 -0
- package/{src/lib/retire-local.ts → node_modules/@mycadet/local-mode/src/remotes/local/retire.ts} +39 -70
- package/node_modules/@mycadet/local-mode/src/remotes/local/sleep.ts +253 -0
- package/node_modules/@mycadet/local-mode/src/upgrade.ts +3 -2
- package/node_modules/@mycadet/local-mode/src/util.ts +1 -1
- package/node_modules/@mycadet/local-mode/src/wake.ts +3 -4
- package/node_modules/@mycadet/service-contracts/package.json +1 -1
- package/node_modules/@mycadet/shared/eslint/no-re-exports.mjs +136 -0
- package/node_modules/@mycadet/shared/eslint/no-re-exports.test.mjs +167 -0
- package/node_modules/@mycadet/shared/package.json +7 -2
- package/package.json +3 -9
- package/src/__tests__/app-command.test.ts +8 -3
- package/src/__tests__/assistant-config.test.ts +26 -34
- package/src/__tests__/backup-ops.test.ts +7 -11
- package/src/__tests__/backup.test.ts +5 -4
- package/src/__tests__/cloud-client.test.ts +1 -2
- package/src/__tests__/cloud-releases.test.ts +1 -1
- package/src/__tests__/connect-import.test.ts +3 -3
- package/src/__tests__/debug.test.ts +4 -3
- package/src/__tests__/guardian-token.test.ts +3 -8
- package/src/__tests__/helpers/guardian-token.ts +1 -1
- package/src/__tests__/host-teleport-docker.test.ts +3 -34
- package/src/__tests__/host-teleport.test.ts +64 -75
- package/src/__tests__/local-runtime-version.test.ts +3 -14
- package/src/__tests__/multi-local.test.ts +4 -2
- package/src/__tests__/nginx.test.ts +10 -8
- package/src/__tests__/ngrok-spawn.test.ts +1 -1
- package/src/__tests__/ps-cloud-status.test.ts +5 -4
- package/src/__tests__/restore.test.ts +1 -1
- package/src/__tests__/retire.test.ts +38 -221
- package/src/__tests__/root-backup-docker.test.ts +12 -22
- package/src/__tests__/root-backup.test.ts +127 -134
- package/src/__tests__/root-process-lockfile.test.ts +1 -1
- package/src/__tests__/root-restore-command.test.ts +5 -3
- package/src/__tests__/runtime-url.test.ts +4 -4
- package/src/__tests__/setup.test.ts +14 -9
- package/src/__tests__/sleep.test.ts +295 -330
- package/src/__tests__/statefulset.test.ts +0 -1
- package/src/__tests__/teleport-backup.test.ts +5 -5
- package/src/__tests__/teleport.test.ts +2 -1
- package/src/__tests__/tunnel-stop.test.ts +5 -5
- package/src/__tests__/tunnel.test.ts +63 -105
- package/src/__tests__/uninstall.test.ts +6 -1
- package/src/__tests__/upgrade-local.test.ts +19 -23
- package/src/__tests__/upgrade-root-recovery.test.ts +19 -31
- package/src/__tests__/use.test.ts +2 -4
- package/src/__tests__/wake.test.ts +69 -81
- package/src/__tests__/windows-lifecycle.test.ts +3 -4
- package/src/commands/app.ts +3 -4
- package/src/commands/backup.ts +1 -2
- package/src/commands/client.ts +10 -10
- package/src/commands/completions.ts +1 -1
- package/src/commands/connect.ts +1 -1
- package/src/commands/debug.ts +11 -13
- package/src/commands/devices.ts +9 -12
- package/src/commands/exec.ts +8 -4
- package/src/commands/gateway/token.ts +6 -6
- package/src/commands/gateway.ts +1 -1
- package/src/commands/hatch.ts +8 -7
- package/src/commands/login.ts +9 -9
- package/src/commands/logs.ts +7 -6
- package/src/commands/pair.ts +38 -100
- package/src/commands/ps.ts +12 -9
- package/src/commands/restart.ts +1 -1
- package/src/commands/restore.ts +12 -13
- package/src/commands/retire.ts +16 -256
- package/src/commands/setup.ts +10 -15
- package/src/commands/sleep.ts +71 -292
- package/src/commands/teleport.ts +1 -1
- package/src/commands/terminal.ts +9 -7
- package/src/commands/tunnel.ts +2 -9
- package/src/commands/uninstall.ts +15 -37
- package/src/commands/upgrade.ts +21 -35
- package/src/commands/use.ts +4 -4
- package/src/commands/wake.ts +5 -8
- package/src/components/DefaultMainScreen.tsx +31 -22
- package/src/lib/__tests__/cloud-client-signed-url.test.ts +1 -1
- package/src/lib/__tests__/docker.test.ts +5 -7
- package/src/lib/__tests__/lifecycle-reporter.test.ts +5 -31
- package/src/lib/assistant-client.ts +8 -8
- package/src/lib/assistant-config.ts +12 -191
- package/src/lib/backup-ops.ts +0 -2
- package/src/lib/cloud-client.ts +20 -211
- package/src/lib/cloud-login-poll.ts +1 -2
- package/src/lib/cloud-login.ts +24 -18
- package/src/lib/cloud-releases.ts +3 -4
- package/src/lib/detached-process.ts +1 -6
- package/src/lib/guardian-token.ts +7 -35
- package/src/lib/hatch-next-steps.ts +1 -1
- package/src/lib/health-check.ts +8 -7
- package/src/lib/host-teleport.ts +34 -79
- package/src/lib/http-client.ts +1 -1
- package/src/lib/lifecycle-reporter.ts +9 -21
- package/src/lib/live-voice/connection.ts +6 -6
- package/src/lib/live-voice/tunnel.ts +3 -4
- package/src/lib/port-heal.ts +3 -3
- package/src/lib/process.ts +15 -328
- package/src/lib/remotes/apple-container.ts +35 -3
- package/src/lib/remotes/cloud.ts +36 -0
- package/src/lib/remotes/docker.ts +1905 -26
- package/src/lib/remotes/local.ts +81 -237
- package/src/lib/root-backup.ts +32 -45
- package/src/lib/runtime-url.ts +1 -1
- package/src/lib/servers/nginx.ts +17 -219
- package/src/lib/statefulset.ts +1 -9
- package/src/lib/sync-cloud-assistants.ts +4 -7
- package/src/lib/teleport-backup.ts +6 -6
- package/src/lib/terminal-client.ts +10 -7
- package/src/lib/terminal-session.ts +65 -23
- package/src/lib/tunnel.ts +50 -112
- package/src/lib/tunnels/cloudflare.ts +2 -5
- package/src/lib/tunnels/gateway-notify.ts +4 -2
- package/src/lib/tunnels/ngrok.ts +10 -13
- package/src/lib/tunnels/process-lifecycle.ts +1 -1
- package/src/lib/tunnels/tailscale.ts +2 -4
- package/src/lib/upgrade-lifecycle.ts +24 -45
- package/src/lib/workos-pkce.ts +1 -1
- package/node_modules/@mycadet/local-mode/src/__tests__/retire.test.ts +0 -81
- package/node_modules/@mycadet/local-mode/src/retire.ts +0 -89
- package/node_modules/@mycadet/local-mode/src/sleep.ts +0 -82
- package/src/__tests__/retire-local.test.ts +0 -252
- package/src/lib/cli-name.ts +0 -14
- package/src/lib/desktop-progress.ts +0 -22
- package/src/lib/docker.ts +0 -2041
- package/src/lib/ingress-config.ts +0 -6
- /package/{src/lib → node_modules/@mycadet/local-mode/src}/loopback-fetch.ts +0 -0
package/eslint.config.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
2
|
import tseslint from "typescript-eslint";
|
|
3
|
+
import { noReExports } from "@mycadet/shared/eslint/no-re-exports";
|
|
3
4
|
|
|
4
5
|
const eslintConfig = defineConfig([
|
|
5
6
|
...tseslint.configs.recommended,
|
|
@@ -19,6 +20,13 @@ const eslintConfig = defineConfig([
|
|
|
19
20
|
],
|
|
20
21
|
},
|
|
21
22
|
},
|
|
23
|
+
{
|
|
24
|
+
// Re-export shims are outlawed: consumers import from the defining
|
|
25
|
+
// module, and only index files aggregate a public surface. Warning
|
|
26
|
+
// level with a pinned count — each PR chips away at the remainder.
|
|
27
|
+
plugins: { "@mycadet": { rules: { "no-re-exports": noReExports } } },
|
|
28
|
+
rules: { "@mycadet/no-re-exports": "error" },
|
|
29
|
+
},
|
|
22
30
|
]);
|
|
23
31
|
|
|
24
32
|
export default eslintConfig;
|
package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/eslint/no-re-exports.mjs
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
/**
|
|
3
|
+
* `no-re-exports` — outlaw re-exports of imports outside index files.
|
|
4
|
+
*
|
|
5
|
+
* A file that imports a binding only to export it again (`export { x } from
|
|
6
|
+
* "y"`, `export * from "y"`, or `import { x } from "y"` + `export { x }`) is
|
|
7
|
+
* a re-export shim: it hides the true dependency graph, gives the binding a
|
|
8
|
+
* second home that drifts from its defining module, and earns the same
|
|
9
|
+
* review comment every time — delete the re-export and update the consumers.
|
|
10
|
+
* This rule encodes that review.
|
|
11
|
+
*
|
|
12
|
+
* Index files (a file named `index.ts`/`index.js`/…) are the one exception:
|
|
13
|
+
* they are the package's public surface and may aggregate exports from the
|
|
14
|
+
* modules beside them. Everything else must make consumers import from the
|
|
15
|
+
* defining module directly.
|
|
16
|
+
*
|
|
17
|
+
* Flagged shapes:
|
|
18
|
+
* - `export { x } from "y"` and `export type { x } from "y"` (fused re-export)
|
|
19
|
+
* - `export * from "y"` and `export * as ns from "y"` (star re-export)
|
|
20
|
+
* - `import { x } from "y"` + `export { x }` / `export { x as z }` (shim form,
|
|
21
|
+
* including the type-only variants of both halves)
|
|
22
|
+
*
|
|
23
|
+
* Not flagged: `export const x = y` — it binds a NEW name this file owns
|
|
24
|
+
* (a wrapper, not a re-export); if that wrapper is redundant, that is a
|
|
25
|
+
* deletion to make in review, not a lint error here.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { basename } from "node:path";
|
|
29
|
+
|
|
30
|
+
/** File extensions an index file may carry. */
|
|
31
|
+
const INDEX_EXTENSIONS = new Set([
|
|
32
|
+
".ts",
|
|
33
|
+
".tsx",
|
|
34
|
+
".js",
|
|
35
|
+
".jsx",
|
|
36
|
+
".mjs",
|
|
37
|
+
".cjs",
|
|
38
|
+
".mts",
|
|
39
|
+
".cts",
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Whether the linted file is an index file, which may aggregate exports.
|
|
44
|
+
* `context.filename` is the absolute path; only the basename matters.
|
|
45
|
+
*/
|
|
46
|
+
function isIndexFile(filename) {
|
|
47
|
+
const base = basename(filename);
|
|
48
|
+
const dot = base.lastIndexOf(".");
|
|
49
|
+
if (dot <= 0) return false;
|
|
50
|
+
return (
|
|
51
|
+
base.slice(0, dot) === "index" &&
|
|
52
|
+
INDEX_EXTENSIONS.has(base.slice(dot).toLowerCase())
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** The module string of an import/export source node, or a fallback. */
|
|
57
|
+
function moduleOf(node) {
|
|
58
|
+
return typeof node?.value === "string" ? node.value : "the defining module";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const rule = {
|
|
62
|
+
meta: {
|
|
63
|
+
type: "problem",
|
|
64
|
+
docs: {
|
|
65
|
+
description: "Outlaw re-exports of imports outside index files.",
|
|
66
|
+
},
|
|
67
|
+
schema: [],
|
|
68
|
+
messages: {
|
|
69
|
+
exportFrom:
|
|
70
|
+
"Re-exports are outlawed outside index files: update consumers to import from '{{module}}' directly and delete this re-export. If this file is meant to be a public surface, it should be an index file.",
|
|
71
|
+
exportStar:
|
|
72
|
+
"`export *` is outlawed outside index files: import from '{{module}}' directly, or make this file an index file whose exports are named explicitly.",
|
|
73
|
+
reExportedImport:
|
|
74
|
+
"'{{name}}' is an import re-exported back out — outside index files, consumers import from '{{module}}' directly. Export only what this file defines.",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
create(context) {
|
|
79
|
+
if (isIndexFile(context.filename)) return {};
|
|
80
|
+
|
|
81
|
+
/** local binding name -> the module it was imported from. */
|
|
82
|
+
const importedBindings = new Map();
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
// Imports are collected up front so a shim whose import trails its
|
|
86
|
+
// export (`export { x };` first — imports hoist at runtime) is still
|
|
87
|
+
// caught: visitors fire in source order, but the whole program is
|
|
88
|
+
// known before any export is judged. The `Program` visitor fires on
|
|
89
|
+
// entry, before any descendant statement is visited.
|
|
90
|
+
Program(program) {
|
|
91
|
+
for (const statement of program.body) {
|
|
92
|
+
if (
|
|
93
|
+
statement.type === "ImportDeclaration" &&
|
|
94
|
+
typeof statement.source?.value === "string"
|
|
95
|
+
) {
|
|
96
|
+
for (const spec of statement.specifiers) {
|
|
97
|
+
importedBindings.set(spec.local.name, statement.source.value);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
ExportAllDeclaration(node) {
|
|
104
|
+
context.report({
|
|
105
|
+
node,
|
|
106
|
+
messageId: "exportStar",
|
|
107
|
+
data: { module: moduleOf(node.source) },
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
ExportNamedDeclaration(node) {
|
|
112
|
+
if (node.source) {
|
|
113
|
+
context.report({
|
|
114
|
+
node,
|
|
115
|
+
messageId: "exportFrom",
|
|
116
|
+
data: { module: moduleOf(node.source) },
|
|
117
|
+
});
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
for (const spec of node.specifiers) {
|
|
121
|
+
const module = importedBindings.get(spec.local.name);
|
|
122
|
+
if (module !== undefined) {
|
|
123
|
+
context.report({
|
|
124
|
+
node: spec,
|
|
125
|
+
messageId: "reExportedImport",
|
|
126
|
+
data: { name: spec.local.name, module },
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const noReExports = rule;
|
|
136
|
+
export default rule;
|
package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/eslint/no-re-exports.test.mjs
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the no-re-exports ESLint rule.
|
|
3
|
+
*
|
|
4
|
+
* Run with: `bun test packages/eslint-plugin/no-re-exports.test.mjs`
|
|
5
|
+
*
|
|
6
|
+
* A passing run prints "Ran 0 tests". That is a reporting artifact, not a
|
|
7
|
+
* skip: bun does not expose `describe` / `it` as globals to `.mjs`, so
|
|
8
|
+
* `RuleTester` falls back to its own inline runner and never registers with
|
|
9
|
+
* bun's reporter. The cases still execute, a wrong expectation still throws,
|
|
10
|
+
* and the process still exits non-zero. Verify by breaking a case on purpose.
|
|
11
|
+
*/
|
|
12
|
+
import { RuleTester } from "eslint";
|
|
13
|
+
import tseslint from "typescript-eslint";
|
|
14
|
+
|
|
15
|
+
import { noReExports } from "./no-re-exports.mjs";
|
|
16
|
+
|
|
17
|
+
const ruleTester = new RuleTester({
|
|
18
|
+
languageOptions: {
|
|
19
|
+
parser: tseslint.parser,
|
|
20
|
+
ecmaVersion: "latest",
|
|
21
|
+
sourceType: "module",
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
ruleTester.run("no-re-exports", noReExports, {
|
|
26
|
+
valid: [
|
|
27
|
+
{
|
|
28
|
+
name: "a module exporting what it defines is fine",
|
|
29
|
+
code: [
|
|
30
|
+
'import { helper } from "./helper.js";',
|
|
31
|
+
"",
|
|
32
|
+
"export function local() {",
|
|
33
|
+
" return helper();",
|
|
34
|
+
"}",
|
|
35
|
+
].join("\n"),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "a bare export of a locally-defined binding is fine, even in a file that imports",
|
|
39
|
+
code: [
|
|
40
|
+
'import { helper } from "./helper.js";',
|
|
41
|
+
"",
|
|
42
|
+
"const thing = helper();",
|
|
43
|
+
"",
|
|
44
|
+
"export { thing };",
|
|
45
|
+
].join("\n"),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "a new const binding wrapping an import is a wrapper, not a re-export",
|
|
49
|
+
code: [
|
|
50
|
+
'import { Client } from "./client.js";',
|
|
51
|
+
"",
|
|
52
|
+
"export const sharedClient = new Client();",
|
|
53
|
+
].join("\n"),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "index files may aggregate fused re-exports",
|
|
57
|
+
code: [
|
|
58
|
+
'export { alpha } from "./alpha.js";',
|
|
59
|
+
'export type { Beta } from "./beta.js";',
|
|
60
|
+
].join("\n"),
|
|
61
|
+
filename: "/repo/packages/some-pkg/src/index.ts",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "index files may aggregate star re-exports",
|
|
65
|
+
code: 'export * from "./alpha.js";',
|
|
66
|
+
filename: "/repo/packages/some-pkg/index.mjs",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "index files may re-export their imports",
|
|
70
|
+
code: [
|
|
71
|
+
'import { alpha } from "./alpha.js";',
|
|
72
|
+
"",
|
|
73
|
+
"export { alpha };",
|
|
74
|
+
].join("\n"),
|
|
75
|
+
filename: "/repo/packages/some-pkg/index.js",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "default exports of locally-defined things are fine",
|
|
79
|
+
code: [
|
|
80
|
+
'import { helper } from "./helper.js";',
|
|
81
|
+
"",
|
|
82
|
+
"export default function local() {",
|
|
83
|
+
" return helper();",
|
|
84
|
+
"}",
|
|
85
|
+
].join("\n"),
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
|
|
89
|
+
invalid: [
|
|
90
|
+
{
|
|
91
|
+
name: "fused value re-export",
|
|
92
|
+
code: 'export { alpha } from "./alpha.js";',
|
|
93
|
+
errors: [{ messageId: "exportFrom" }],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "index exemption is basename-only: index-helper.ts is still an outlaw",
|
|
97
|
+
code: 'export { alpha } from "./alpha.js";',
|
|
98
|
+
filename: "/repo/packages/some-pkg/src/index-helper.ts",
|
|
99
|
+
errors: [{ messageId: "exportFrom" }],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "fused type re-export",
|
|
103
|
+
code: 'export type { Beta } from "./beta.js";',
|
|
104
|
+
errors: [{ messageId: "exportFrom" }],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "star re-export",
|
|
108
|
+
code: 'export * from "./alpha.js";',
|
|
109
|
+
errors: [{ messageId: "exportStar" }],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "star-as re-export",
|
|
113
|
+
code: 'export * as ns from "./alpha.js";',
|
|
114
|
+
errors: [{ messageId: "exportStar" }],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "shim form: import then bare export",
|
|
118
|
+
code: [
|
|
119
|
+
'import { alpha } from "./alpha.js";',
|
|
120
|
+
"",
|
|
121
|
+
"export { alpha };",
|
|
122
|
+
].join("\n"),
|
|
123
|
+
errors: [{ messageId: "reExportedImport" }],
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "shim form under a new name",
|
|
127
|
+
code: [
|
|
128
|
+
'import { alpha } from "./alpha.js";',
|
|
129
|
+
"",
|
|
130
|
+
"export { alpha as beta };",
|
|
131
|
+
].join("\n"),
|
|
132
|
+
errors: [{ messageId: "reExportedImport" }],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "type-only shim form",
|
|
136
|
+
code: [
|
|
137
|
+
'import type { Alpha } from "./alpha.js";',
|
|
138
|
+
"",
|
|
139
|
+
"export type { Alpha };",
|
|
140
|
+
].join("\n"),
|
|
141
|
+
errors: [{ messageId: "reExportedImport" }],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "the import can trail the export (imports hoist)",
|
|
145
|
+
code: [
|
|
146
|
+
"export { alpha };",
|
|
147
|
+
"",
|
|
148
|
+
'import { alpha } from "./alpha.js";',
|
|
149
|
+
].join("\n"),
|
|
150
|
+
errors: [{ messageId: "reExportedImport" }],
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "several shims in one file each report",
|
|
154
|
+
code: [
|
|
155
|
+
'import { alpha, beta } from "./alpha.js";',
|
|
156
|
+
'import { gamma } from "./gamma.js";',
|
|
157
|
+
"",
|
|
158
|
+
"export { alpha, beta, gamma };",
|
|
159
|
+
].join("\n"),
|
|
160
|
+
errors: [
|
|
161
|
+
{ messageId: "reExportedImport" },
|
|
162
|
+
{ messageId: "reExportedImport" },
|
|
163
|
+
{ messageId: "reExportedImport" },
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
});
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mycadet/shared",
|
|
3
|
-
"version": "0.13.0-dev.
|
|
3
|
+
"version": "0.13.0-dev.202611011557.373f3d6",
|
|
4
4
|
"private": true,
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./github-repository.ts",
|
|
7
7
|
"./github-repository": "./github-repository.ts",
|
|
8
8
|
"./providers/baseten": "./providers/baseten.ts",
|
|
9
9
|
"./scripts/run-isolated-tests": "./scripts/run-isolated-tests.ts",
|
|
10
|
-
"./version": "./version.ts"
|
|
10
|
+
"./version": "./version.ts",
|
|
11
|
+
"./eslint/no-re-exports": "./eslint/no-re-exports.mjs"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"eslint": "10.1.0",
|
|
15
|
+
"typescript-eslint": "8.58.0"
|
|
11
16
|
}
|
|
12
17
|
}
|