@codefast/cli 0.3.14 → 0.3.16-canary.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/README.md +8 -3
- package/dist/arrange/analyze.mjs +24 -0
- package/dist/{lib/arrange/presentation/arrange-cli.schema.mjs → arrange/cli-schema.mjs} +10 -1
- package/dist/arrange/command.mjs +106 -0
- package/dist/{lib/arrange/domain/arrange-analyze.service.mjs → arrange/domain/analyze-service.mjs} +17 -10
- package/dist/{lib/arrange/domain/ast/ast-node.model.mjs → arrange/domain/ast/ast-node.mjs} +57 -3
- package/dist/{lib/arrange/domain/ast/collectors-cn.collector.mjs → arrange/domain/ast/collectors-cn.mjs} +21 -9
- package/dist/{lib/arrange/domain/ast/collectors-jsx.collector.mjs → arrange/domain/ast/collectors-jsx.mjs} +5 -2
- package/dist/{lib/arrange/domain/ast/collectors-tv.collector.mjs → arrange/domain/ast/collectors-tv.mjs} +21 -6
- package/dist/{lib/arrange/domain/ast/ast-helpers.helper.mjs → arrange/domain/ast/helpers.mjs} +26 -9
- package/dist/{lib/arrange/domain/ast/targets.model.mjs → arrange/domain/ast/targets.mjs} +19 -10
- package/dist/{lib/arrange/domain/constants.domain.mjs → arrange/domain/constants.mjs} +63 -18
- package/dist/{lib/arrange/domain/arrange-grouping.service.mjs → arrange/domain/grouping-service.mjs} +31 -10
- package/dist/{lib/arrange/domain/grouping.domain.mjs → arrange/domain/grouping.mjs} +39 -18
- package/dist/{lib/arrange/domain/imports.domain.mjs → arrange/domain/imports.mjs} +7 -3
- package/dist/{lib/arrange/domain/source-text-formatters.formatter.mjs → arrange/domain/source-text-formatters.mjs} +22 -5
- package/dist/{lib/arrange/domain/tailwind-token.value-object.mjs → arrange/domain/tailwind-token.mjs} +12 -3
- package/dist/{lib/arrange/domain/tailwind-token-classifier.domain-service.mjs → arrange/domain/token-classifier.mjs} +40 -15
- package/dist/arrange/output.mjs +79 -0
- package/dist/arrange/process-file.mjs +42 -0
- package/dist/arrange/resolve-target.mjs +24 -0
- package/dist/arrange/scan-target.mjs +20 -0
- package/dist/arrange/source-parse.mjs +18 -0
- package/dist/arrange/suggest.mjs +15 -0
- package/dist/arrange/sync.mjs +51 -0
- package/dist/arrange/typescript-ast-translator.mjs +354 -0
- package/dist/arrange/workspace.mjs +31 -0
- package/dist/bin.mjs +1 -1
- package/dist/{program.mjs → cli.mjs} +14 -19
- package/dist/core/cli/format-error.mjs +15 -0
- package/dist/core/cli/global-options.mjs +10 -0
- package/dist/core/cli/positional.mjs +11 -0
- package/dist/core/cli/result-handle.mjs +51 -0
- package/dist/core/config/loader.mjs +79 -0
- package/dist/{lib/config/infrastructure/config-schema.adapter.mjs → core/config/schema.mjs} +20 -6
- package/dist/core/config/warnings.mjs +12 -0
- package/dist/core/config.mjs +19 -0
- package/dist/{lib/core/domain/caught-unknown-message.value-object.mjs → core/errors.mjs} +20 -4
- package/dist/core/exit-codes.mjs +17 -0
- package/dist/core/filesystem/node.mjs +32 -0
- package/dist/core/logger.mjs +15 -0
- package/dist/{lib/core/domain/result.model.mjs → core/result.mjs} +7 -3
- package/dist/{lib/core/application/services/schema-validator.service.mjs → core/schema-parse.mjs} +6 -5
- package/dist/{lib/shared/source-code/domain/text-edit.model.mjs → core/source-text-edit.mjs} +15 -14
- package/dist/core/verbose-diagnostics.mjs +11 -0
- package/dist/core/workspace/resolver.mjs +177 -0
- package/dist/core/workspace/typescript-walk.mjs +36 -0
- package/dist/mirror/cli-result.mjs +21 -0
- package/dist/{lib/mirror/presentation/mirror-cli.schema.mjs → mirror/cli-schema.mjs} +4 -4
- package/dist/mirror/command.mjs +57 -0
- package/dist/mirror/dist-filesystem-impl.mjs +42 -0
- package/dist/{lib/mirror/domain/constants.domain.mjs → mirror/domain/constants.mjs} +16 -1
- package/dist/{lib/mirror/infrastructure/dirent-list.guard.mjs → mirror/domain/dirent-guard.mjs} +5 -2
- package/dist/{lib/mirror/domain/errors.domain.mjs → mirror/domain/errors.mjs} +7 -1
- package/dist/{lib/mirror/application/services/generate-mirror-exports.service.mjs → mirror/domain/exports.mjs} +17 -10
- package/dist/{lib/mirror/domain/package-display-name.policy.mjs → mirror/domain/package-display-name.mjs} +5 -2
- package/dist/{lib/mirror/domain/path-normalizer.value-object.mjs → mirror/domain/path-normalizer.mjs} +4 -1
- package/dist/mirror/output.mjs +45 -0
- package/dist/mirror/package-path.mjs +32 -0
- package/dist/mirror/prepare.mjs +33 -0
- package/dist/mirror/sync-reporter.mjs +104 -0
- package/dist/mirror/sync-workspace-package.mjs +103 -0
- package/dist/mirror/sync.mjs +87 -0
- package/dist/{lib/mirror/infrastructure/package-json-exports.repository.mjs → mirror/write-exports.mjs} +35 -31
- package/dist/tag/cli-result.mjs +11 -0
- package/dist/{lib/tag/presentation/tag-cli.schema.mjs → tag/cli-schema.mjs} +4 -1
- package/dist/tag/command.mjs +56 -0
- package/dist/{lib/tag/presentation/tag-sync.presenter.mjs → tag/output.mjs} +54 -28
- package/dist/tag/prepare.mjs +29 -0
- package/dist/tag/resolve-target-path.mjs +12 -0
- package/dist/tag/since-writer.mjs +130 -0
- package/dist/tag/sync.mjs +141 -0
- package/dist/tag/target-candidates.mjs +68 -0
- package/dist/tag/target-runner.mjs +26 -0
- package/dist/tag/version-resolver.mjs +25 -0
- package/package.json +8 -9
- package/dist/lib/arrange/adapters/primary/cli/arrange.command.mjs +0 -324
- package/dist/lib/arrange/adapters/primary/cli/arrange.presentation.module.mjs +0 -14
- package/dist/lib/arrange/adapters/primary/cli/presentation.tokens.mjs +0 -5
- package/dist/lib/arrange/adapters/secondary/domain-source-parser.adapter.mjs +0 -239
- package/dist/lib/arrange/adapters/secondary/file-walker.adapter.mjs +0 -241
- package/dist/lib/arrange/adapters/secondary/workspace-resolver.adapter.mjs +0 -233
- package/dist/lib/arrange/application/requests/suggest-groups.request.mjs +0 -1
- package/dist/lib/arrange/application/services/arrange-file-processor.service.mjs +0 -267
- package/dist/lib/arrange/application/services/arrange-target-path-resolver.service.mjs +0 -21
- package/dist/lib/arrange/application/services/arrange-target-scanner.service.mjs +0 -243
- package/dist/lib/arrange/application/use-cases/analyze-directory.use-case.mjs +0 -255
- package/dist/lib/arrange/application/use-cases/prepare-arrange-workspace.use-case.mjs +0 -263
- package/dist/lib/arrange/application/use-cases/run-arrange-sync.use-case.mjs +0 -274
- package/dist/lib/arrange/application/use-cases/suggest-cn-groups.use-case.mjs +0 -237
- package/dist/lib/arrange/arrange.module.mjs +0 -31
- package/dist/lib/arrange/contracts/analyze-report-presenter.contract.mjs +0 -1
- package/dist/lib/arrange/contracts/models.mjs +0 -1
- package/dist/lib/arrange/contracts/services.contract.mjs +0 -1
- package/dist/lib/arrange/contracts/tokens.mjs +0 -15
- package/dist/lib/arrange/domain/tailwind-grouping.service.mjs +0 -231
- package/dist/lib/arrange/domain/types.domain.mjs +0 -1
- package/dist/lib/arrange/infrastructure/typescript-ast-translator.adapter.mjs +0 -355
- package/dist/lib/arrange/presentation/arrange-analyze.presenter.mjs +0 -259
- package/dist/lib/arrange/presentation/arrange-sync.presenter.mjs +0 -33
- package/dist/lib/arrange/presentation/group-file-preview.presenter.mjs +0 -271
- package/dist/lib/bootstrap/composition-root.mjs +0 -33
- package/dist/lib/config/application/ports/config-loader.port.mjs +0 -1
- package/dist/lib/config/application/ports/config-warning-reporter.port.mjs +0 -1
- package/dist/lib/config/application/services/load-config.service.mjs +0 -17
- package/dist/lib/config/contracts/tokens.mjs +0 -6
- package/dist/lib/config/domain/schema.domain.mjs +0 -1
- package/dist/lib/config/infrastructure/config-loader.adapter.mjs +0 -306
- package/dist/lib/config/infrastructure/config-warning-reporter.adapter.mjs +0 -234
- package/dist/lib/core/application/load-codefast-config.use-case.mjs +0 -245
- package/dist/lib/core/application/ports/cli-io.port.mjs +0 -1
- package/dist/lib/core/application/ports/path.port.mjs +0 -1
- package/dist/lib/core/application/ports/repo-root-resolver.port.mjs +0 -1
- package/dist/lib/core/application/ports/runtime.port.mjs +0 -1
- package/dist/lib/core/application/services/global-cli-options-parser.service.mjs +0 -9
- package/dist/lib/core/contracts/tokens.mjs +0 -10
- package/dist/lib/core/core.module.mjs +0 -9
- package/dist/lib/core/domain/cli-exit-codes.domain.mjs +0 -11
- package/dist/lib/core/domain/errors.domain.mjs +0 -17
- package/dist/lib/core/infrastructure/infrastructure.module.mjs +0 -30
- package/dist/lib/core/infrastructure/path.adapter.mjs +0 -246
- package/dist/lib/core/infrastructure/port-telemetry.decorator.mjs +0 -62
- package/dist/lib/core/infrastructure/repo-root-resolver.adapter.mjs +0 -233
- package/dist/lib/core/infrastructure/verbose-diagnostics.policy.mjs +0 -9
- package/dist/lib/core/presentation/cli-executor.presenter.mjs +0 -42
- package/dist/lib/core/presentation/cli-schema.parser.mjs +0 -7
- package/dist/lib/core/presentation/format-app-error.presenter.mjs +0 -17
- package/dist/lib/core/presentation/presentation.module.mjs +0 -5
- package/dist/lib/infrastructure/node-io.adapter.mjs +0 -285
- package/dist/lib/infrastructure/workspace/repo-root-resolver.service.mjs +0 -21
- package/dist/lib/kernel/contracts/cli-command.contract.mjs +0 -1
- package/dist/lib/kernel/contracts/tokens.mjs +0 -5
- package/dist/lib/mirror/adapters/primary/cli/mirror.command.mjs +0 -272
- package/dist/lib/mirror/adapters/secondary/file-system-service.adapter.mjs +0 -261
- package/dist/lib/mirror/adapters/secondary/mirror-sync-reporter.adapter.mjs +0 -243
- package/dist/lib/mirror/adapters/secondary/package-repository.adapter.mjs +0 -241
- package/dist/lib/mirror/adapters/secondary/sync-workspace-package.adapter.mjs +0 -351
- package/dist/lib/mirror/adapters/secondary/workspace-service.adapter.mjs +0 -237
- package/dist/lib/mirror/application/mirror-sync-json.format.mjs +0 -12
- package/dist/lib/mirror/application/ports/file-system-service.port.mjs +0 -1
- package/dist/lib/mirror/application/ports/mirror-sync-reporter.port.mjs +0 -1
- package/dist/lib/mirror/application/ports/package-repository.port.mjs +0 -1
- package/dist/lib/mirror/application/ports/sync-workspace-package.port.mjs +0 -1
- package/dist/lib/mirror/application/ports/workspace-service.port.mjs +0 -1
- package/dist/lib/mirror/application/requests/mirror-sync.request.mjs +0 -1
- package/dist/lib/mirror/application/services/mirror-package-arg-resolver.service.mjs +0 -20
- package/dist/lib/mirror/application/use-cases/prepare-mirror-sync.use-case.mjs +0 -264
- package/dist/lib/mirror/application/use-cases/run-mirror-sync.use-case.mjs +0 -302
- package/dist/lib/mirror/contracts/models.mjs +0 -1
- package/dist/lib/mirror/contracts/tokens.mjs +0 -11
- package/dist/lib/mirror/domain/types.domain.mjs +0 -1
- package/dist/lib/mirror/infrastructure/mirror-console-reporter.presenter.mjs +0 -99
- package/dist/lib/mirror/infrastructure/package-filter-resolver.service.mjs +0 -25
- package/dist/lib/mirror/infrastructure/workspace-packages.service.mjs +0 -158
- package/dist/lib/mirror/mirror.module.mjs +0 -25
- package/dist/lib/shared/source-code/infrastructure/typescript-source-file-walker.service.mjs +0 -33
- package/dist/lib/tag/adapters/primary/cli/presentation.tokens.mjs +0 -6
- package/dist/lib/tag/adapters/primary/cli/tag.command.mjs +0 -285
- package/dist/lib/tag/adapters/primary/cli/tag.presentation.module.mjs +0 -13
- package/dist/lib/tag/adapters/secondary/tag-since-writer.adapter.mjs +0 -348
- package/dist/lib/tag/adapters/secondary/tag-target-resolver.adapter.mjs +0 -233
- package/dist/lib/tag/adapters/secondary/tag-version-resolver.adapter.mjs +0 -249
- package/dist/lib/tag/adapters/secondary/typescript-tree-walk.adapter.mjs +0 -233
- package/dist/lib/tag/application/ports/tag-since-writer.port.mjs +0 -1
- package/dist/lib/tag/application/ports/tag-version-resolver.port.mjs +0 -1
- package/dist/lib/tag/application/ports/target-resolver.port.mjs +0 -1
- package/dist/lib/tag/application/ports/typescript-tree-walk.port.mjs +0 -1
- package/dist/lib/tag/application/requests/tag-sync.request.mjs +0 -1
- package/dist/lib/tag/application/services/tag-cli-target-path-resolver.service.mjs +0 -9
- package/dist/lib/tag/application/services/tag-target-runner.service.mjs +0 -21
- package/dist/lib/tag/application/tag-sync-cli-result.mjs +0 -11
- package/dist/lib/tag/application/tag-sync-json.format.mjs +0 -14
- package/dist/lib/tag/application/use-cases/prepare-tag-sync.use-case.mjs +0 -264
- package/dist/lib/tag/application/use-cases/run-tag-sync.use-case.mjs +0 -381
- package/dist/lib/tag/contracts/models.mjs +0 -1
- package/dist/lib/tag/contracts/tag-sync-result-presenter.contract.mjs +0 -1
- package/dist/lib/tag/contracts/tokens.mjs +0 -10
- package/dist/lib/tag/domain/types.domain.mjs +0 -1
- package/dist/lib/tag/infrastructure/tag-target-candidates.adapter.mjs +0 -170
- package/dist/lib/tag/presentation/colors.presenter.mjs +0 -12
- package/dist/lib/tag/presentation/present-tag-sync-result.presenter.mjs +0 -233
- package/dist/lib/tag/presentation/tag-sync-progress-listener.presenter.mjs +0 -243
- package/dist/lib/tag/tag.module.mjs +0 -23
- /package/dist/{lib/arrange/application/ports/domain-source-parser.port.mjs → arrange/domain/types.mjs} +0 -0
- /package/dist/{lib/arrange/application/ports/file-walker.port.mjs → core/filesystem/port.mjs} +0 -0
- /package/dist/{lib/arrange/application/ports/group-file-preview.port.mjs → mirror/domain/dist-filesystem.mjs} +0 -0
- /package/dist/{lib/arrange/application/ports/workspace-resolver.port.mjs → mirror/domain/types.mjs} +0 -0
- /package/dist/{lib/arrange/application/requests/analyze-directory.request.mjs → mirror/sync-types.mjs} +0 -0
- /package/dist/{lib/arrange/application/requests/arrange-sync.request.mjs → tag/domain/types.mjs} +0 -0
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { messageFromCaughtUnknown } from "../../core/domain/caught-unknown-message.value-object.mjs";
|
|
2
|
-
import { globSync } from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import picomatch from "picomatch";
|
|
6
|
-
import { parse } from "yaml";
|
|
7
|
-
//#region src/lib/tag/infrastructure/tag-target-candidates.adapter.ts
|
|
8
|
-
const PNPM_WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
9
|
-
const PACKAGE_JSON_FILE = "package.json";
|
|
10
|
-
const DEFAULT_WORKSPACE_PACKAGE_PATTERNS = ["packages/*"];
|
|
11
|
-
const pnpmWorkspaceSchema = z.looseObject({ packages: z.array(z.string()).optional() });
|
|
12
|
-
const packageNameSchema = z.looseObject({ name: z.string().min(1).optional() });
|
|
13
|
-
function toPosix(filePath) {
|
|
14
|
-
return filePath.split(path.sep).join("/");
|
|
15
|
-
}
|
|
16
|
-
function workspacePatternToPackageJsonGlob(pattern) {
|
|
17
|
-
const normalizedPattern = toPosix(pattern.trim()).replace(/\/+$/, "");
|
|
18
|
-
if (!normalizedPattern) return `**/${PACKAGE_JSON_FILE}`;
|
|
19
|
-
return `${normalizedPattern}/${PACKAGE_JSON_FILE}`;
|
|
20
|
-
}
|
|
21
|
-
function splitWorkspacePackagePatterns(rawPatterns) {
|
|
22
|
-
const include = [];
|
|
23
|
-
const exclude = [];
|
|
24
|
-
for (const rawPattern of rawPatterns) {
|
|
25
|
-
const trimmedPattern = rawPattern.trim();
|
|
26
|
-
if (!trimmedPattern) continue;
|
|
27
|
-
if (trimmedPattern.startsWith("!")) {
|
|
28
|
-
exclude.push(trimmedPattern.slice(1).trim());
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
include.push(trimmedPattern);
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
include,
|
|
35
|
-
exclude
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
async function readWorkspacePackagePatterns(rootDir, fs) {
|
|
39
|
-
const workspaceYamlPath = path.join(rootDir, PNPM_WORKSPACE_FILE);
|
|
40
|
-
if (!fs.existsSync(workspaceYamlPath)) return {
|
|
41
|
-
patterns: [...DEFAULT_WORKSPACE_PACKAGE_PATTERNS],
|
|
42
|
-
hasWorkspaceFile: false,
|
|
43
|
-
declaredEmptyPackages: false
|
|
44
|
-
};
|
|
45
|
-
let workspaceYamlRaw = "";
|
|
46
|
-
try {
|
|
47
|
-
workspaceYamlRaw = await fs.readFile(workspaceYamlPath, "utf8");
|
|
48
|
-
} catch (caughtReadError) {
|
|
49
|
-
throw new Error(`Failed to read ${PNPM_WORKSPACE_FILE}: ${messageFromCaughtUnknown(caughtReadError)}`);
|
|
50
|
-
}
|
|
51
|
-
let parsedWorkspaceDoc;
|
|
52
|
-
try {
|
|
53
|
-
parsedWorkspaceDoc = parse(workspaceYamlRaw);
|
|
54
|
-
} catch (caughtParseError) {
|
|
55
|
-
throw new Error(`Failed to parse ${PNPM_WORKSPACE_FILE}: ${messageFromCaughtUnknown(caughtParseError)}`);
|
|
56
|
-
}
|
|
57
|
-
const parsedWorkspaceResult = pnpmWorkspaceSchema.safeParse(parsedWorkspaceDoc);
|
|
58
|
-
if (!parsedWorkspaceResult.success) {
|
|
59
|
-
const issuePath = parsedWorkspaceResult.error.issues[0]?.path.join(".") ?? "<root>";
|
|
60
|
-
const issueMessage = parsedWorkspaceResult.error.issues[0]?.message ?? "Invalid value";
|
|
61
|
-
throw new Error(`Invalid ${PNPM_WORKSPACE_FILE} schema at "${issuePath}": ${issueMessage}`);
|
|
62
|
-
}
|
|
63
|
-
const hasPackagesKey = typeof parsedWorkspaceDoc === "object" && parsedWorkspaceDoc !== null && Object.prototype.hasOwnProperty.call(parsedWorkspaceDoc, "packages");
|
|
64
|
-
const workspacePackages = parsedWorkspaceResult.data.packages;
|
|
65
|
-
if (!workspacePackages) return {
|
|
66
|
-
patterns: [...DEFAULT_WORKSPACE_PACKAGE_PATTERNS],
|
|
67
|
-
hasWorkspaceFile: true,
|
|
68
|
-
declaredEmptyPackages: false
|
|
69
|
-
};
|
|
70
|
-
if (workspacePackages.length === 0 && hasPackagesKey) return {
|
|
71
|
-
patterns: [],
|
|
72
|
-
hasWorkspaceFile: true,
|
|
73
|
-
declaredEmptyPackages: true
|
|
74
|
-
};
|
|
75
|
-
return {
|
|
76
|
-
patterns: workspacePackages,
|
|
77
|
-
hasWorkspaceFile: true,
|
|
78
|
-
declaredEmptyPackages: false
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
async function discoverWorkspacePackageDirs(rootDir, fs) {
|
|
82
|
-
const workspacePackages = await readWorkspacePackagePatterns(rootDir, fs);
|
|
83
|
-
const { include, exclude } = splitWorkspacePackagePatterns(workspacePackages.patterns);
|
|
84
|
-
const includePatterns = include.length > 0 ? include : [...DEFAULT_WORKSPACE_PACKAGE_PATTERNS];
|
|
85
|
-
const foundPackageDirs = /* @__PURE__ */ new Set();
|
|
86
|
-
const globOptions = {
|
|
87
|
-
cwd: rootDir,
|
|
88
|
-
posix: true,
|
|
89
|
-
...path.sep === "\\" ? { windowsPathsNoEscape: true } : {}
|
|
90
|
-
};
|
|
91
|
-
for (const pattern of includePatterns) {
|
|
92
|
-
const matches = globSync(workspacePatternToPackageJsonGlob(pattern), globOptions);
|
|
93
|
-
for (const matchedPath of matches) {
|
|
94
|
-
if (!matchedPath.endsWith(`/${PACKAGE_JSON_FILE}`)) continue;
|
|
95
|
-
const packageRelDir = matchedPath.slice(0, -`/${PACKAGE_JSON_FILE}`.length);
|
|
96
|
-
if (!packageRelDir) continue;
|
|
97
|
-
foundPackageDirs.add(path.resolve(rootDir, packageRelDir));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (exclude.length === 0) return {
|
|
101
|
-
packageDirs: [...foundPackageDirs].sort((leftDir, rightDir) => leftDir.localeCompare(rightDir)),
|
|
102
|
-
hasWorkspaceFile: workspacePackages.hasWorkspaceFile,
|
|
103
|
-
declaredEmptyPackages: workspacePackages.declaredEmptyPackages
|
|
104
|
-
};
|
|
105
|
-
const excludeMatchers = exclude.map((excludePattern) => picomatch(excludePattern, { dot: true }));
|
|
106
|
-
const discoveredDirs = [...foundPackageDirs].filter((packageDir) => {
|
|
107
|
-
const relativePackagePath = toPosix(path.relative(rootDir, packageDir));
|
|
108
|
-
return !excludeMatchers.some((excludeMatcher) => excludeMatcher(relativePackagePath));
|
|
109
|
-
});
|
|
110
|
-
discoveredDirs.sort((leftDir, rightDir) => leftDir.localeCompare(rightDir));
|
|
111
|
-
return {
|
|
112
|
-
packageDirs: discoveredDirs,
|
|
113
|
-
hasWorkspaceFile: workspacePackages.hasWorkspaceFile,
|
|
114
|
-
declaredEmptyPackages: workspacePackages.declaredEmptyPackages
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function readPackageName(packageDir, fs) {
|
|
118
|
-
const packageJsonPath = path.join(packageDir, PACKAGE_JSON_FILE);
|
|
119
|
-
if (!fs.existsSync(packageJsonPath)) return null;
|
|
120
|
-
try {
|
|
121
|
-
const rawPackageJson = fs.readFileSync(packageJsonPath, "utf8");
|
|
122
|
-
const parsedPackageJson = JSON.parse(rawPackageJson);
|
|
123
|
-
const parsedPackageName = packageNameSchema.safeParse(parsedPackageJson);
|
|
124
|
-
if (!parsedPackageName.success) return null;
|
|
125
|
-
return parsedPackageName.data.name ?? null;
|
|
126
|
-
} catch {
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function toRootRelativePath(rootDir, absolutePath) {
|
|
131
|
-
const relativePath = path.relative(rootDir, absolutePath);
|
|
132
|
-
return relativePath ? toPosix(relativePath) : ".";
|
|
133
|
-
}
|
|
134
|
-
function toPackageTargetCandidate(rootDir, packageDir, fs) {
|
|
135
|
-
const packageName = readPackageName(packageDir, fs);
|
|
136
|
-
return {
|
|
137
|
-
candidatePath: packageDir,
|
|
138
|
-
rootRelativeCandidatePath: toRootRelativePath(rootDir, packageDir),
|
|
139
|
-
source: "workspace-package",
|
|
140
|
-
packageDir,
|
|
141
|
-
packageName
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
async function resolveTagTargetCandidates(rootDir, explicitTarget, fs) {
|
|
145
|
-
if (explicitTarget) {
|
|
146
|
-
const resolvedExplicitTarget = path.resolve(explicitTarget);
|
|
147
|
-
return [{
|
|
148
|
-
candidatePath: resolvedExplicitTarget,
|
|
149
|
-
rootRelativeCandidatePath: toRootRelativePath(rootDir, resolvedExplicitTarget),
|
|
150
|
-
source: "explicit-target",
|
|
151
|
-
packageDir: null,
|
|
152
|
-
packageName: null
|
|
153
|
-
}];
|
|
154
|
-
}
|
|
155
|
-
const workspaceDiscovery = await discoverWorkspacePackageDirs(rootDir, fs);
|
|
156
|
-
if (workspaceDiscovery.packageDirs.length === 0) {
|
|
157
|
-
if (workspaceDiscovery.hasWorkspaceFile) return [];
|
|
158
|
-
const repoSourceDir = path.join(rootDir, "src");
|
|
159
|
-
return [{
|
|
160
|
-
candidatePath: repoSourceDir,
|
|
161
|
-
rootRelativeCandidatePath: toRootRelativePath(rootDir, repoSourceDir),
|
|
162
|
-
source: "repo-src-fallback",
|
|
163
|
-
packageDir: null,
|
|
164
|
-
packageName: null
|
|
165
|
-
}];
|
|
166
|
-
}
|
|
167
|
-
return workspaceDiscovery.packageDirs.map((packageDir) => toPackageTargetCandidate(rootDir, packageDir, fs));
|
|
168
|
-
}
|
|
169
|
-
//#endregion
|
|
170
|
-
export { resolveTagTargetCandidates };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region src/lib/tag/presentation/colors.presenter.ts
|
|
2
|
-
const TAG_COLORS = {
|
|
3
|
-
RESET: "\x1B[0m",
|
|
4
|
-
RED: "\x1B[31m",
|
|
5
|
-
GREEN: "\x1B[32m",
|
|
6
|
-
YELLOW: "\x1B[33m"
|
|
7
|
-
};
|
|
8
|
-
function withTagColor(line, colorCode) {
|
|
9
|
-
return `${colorCode}${line}${TAG_COLORS.RESET}`;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { TAG_COLORS, withTagColor };
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { CliLoggerToken } from "../../core/contracts/tokens.mjs";
|
|
2
|
-
import { presentTagSyncCliResult } from "./tag-sync.presenter.mjs";
|
|
3
|
-
import { inject, injectable } from "@codefast/di";
|
|
4
|
-
//#region src/lib/tag/presentation/present-tag-sync-result.presenter.ts
|
|
5
|
-
function toPrimitive(input, hint) {
|
|
6
|
-
if (typeof input !== "object" || input === null) return input;
|
|
7
|
-
var prim = input[Symbol.toPrimitive];
|
|
8
|
-
if (prim !== void 0) {
|
|
9
|
-
var res = prim.call(input, hint || "default");
|
|
10
|
-
if (typeof res !== "object") return res;
|
|
11
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
12
|
-
}
|
|
13
|
-
return (hint === "string" ? String : Number)(input);
|
|
14
|
-
}
|
|
15
|
-
function toPropertyKey(arg) {
|
|
16
|
-
var key = toPrimitive(arg, "string");
|
|
17
|
-
return typeof key === "symbol" ? key : String(key);
|
|
18
|
-
}
|
|
19
|
-
function checkInRHS(value) {
|
|
20
|
-
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
23
|
-
function setFunctionName(fn, name, prefix) {
|
|
24
|
-
if (typeof name === "symbol") {
|
|
25
|
-
name = name.description;
|
|
26
|
-
name = name ? "[" + name + "]" : "";
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
Object.defineProperty(fn, "name", {
|
|
30
|
-
configurable: true,
|
|
31
|
-
value: prefix ? prefix + " " + name : name
|
|
32
|
-
});
|
|
33
|
-
} catch (_) {}
|
|
34
|
-
return fn;
|
|
35
|
-
}
|
|
36
|
-
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
37
|
-
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
38
|
-
var defineProperty = Object.defineProperty;
|
|
39
|
-
var create = Object.create;
|
|
40
|
-
var metadata;
|
|
41
|
-
var existingNonFields = [create(null), create(null)];
|
|
42
|
-
var hasClassDecs = classDecs.length;
|
|
43
|
-
var _;
|
|
44
|
-
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
45
|
-
return function(thisArg, value) {
|
|
46
|
-
if (useStaticThis) {
|
|
47
|
-
value = thisArg;
|
|
48
|
-
thisArg = targetClass;
|
|
49
|
-
}
|
|
50
|
-
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
51
|
-
return hasValue ? value : thisArg;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
55
|
-
if (typeof fn !== "function") {
|
|
56
|
-
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
57
|
-
}
|
|
58
|
-
return fn;
|
|
59
|
-
}
|
|
60
|
-
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
61
|
-
function assertInstanceIfPrivate(target) {
|
|
62
|
-
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
63
|
-
}
|
|
64
|
-
var decs = [].concat(decInfo[0]);
|
|
65
|
-
var decVal = decInfo[3];
|
|
66
|
-
var isClass = !ret;
|
|
67
|
-
var isAccessor = kind === 1;
|
|
68
|
-
var isGetter = kind === 3;
|
|
69
|
-
var isSetter = kind === 4;
|
|
70
|
-
var isMethod = kind === 2;
|
|
71
|
-
function bindPropCall(name, useStaticThis, before) {
|
|
72
|
-
return function(_this, value) {
|
|
73
|
-
if (useStaticThis) {
|
|
74
|
-
value = _this;
|
|
75
|
-
_this = Class;
|
|
76
|
-
}
|
|
77
|
-
if (before) before(_this);
|
|
78
|
-
return desc[name].call(_this, value);
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
var desc1 = {};
|
|
82
|
-
var init = [];
|
|
83
|
-
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
84
|
-
if (!isClass) {
|
|
85
|
-
if (isPrivate) {
|
|
86
|
-
if (isField || isAccessor) desc1 = {
|
|
87
|
-
get: setFunctionName(function() {
|
|
88
|
-
return decVal(this);
|
|
89
|
-
}, name, "get"),
|
|
90
|
-
set: function(value) {
|
|
91
|
-
decInfo[4](this, value);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
else desc1[key] = decVal;
|
|
95
|
-
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
96
|
-
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
97
|
-
if (!isField && !isPrivate) {
|
|
98
|
-
_ = existingNonFields[+isStatic][name];
|
|
99
|
-
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
100
|
-
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
var newValue = Class;
|
|
104
|
-
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
105
|
-
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
106
|
-
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
107
|
-
var decoratorFinishedRef = {};
|
|
108
|
-
var ctx = {
|
|
109
|
-
kind: [
|
|
110
|
-
"field",
|
|
111
|
-
"accessor",
|
|
112
|
-
"method",
|
|
113
|
-
"getter",
|
|
114
|
-
"setter",
|
|
115
|
-
"class"
|
|
116
|
-
][kind],
|
|
117
|
-
name,
|
|
118
|
-
metadata,
|
|
119
|
-
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
120
|
-
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
121
|
-
assertCallable(initializer, "An initializer", "be", true);
|
|
122
|
-
initializers.push(initializer);
|
|
123
|
-
}).bind(null, decoratorFinishedRef)
|
|
124
|
-
};
|
|
125
|
-
if (isClass) {
|
|
126
|
-
_ = dec.call(decThis, newValue, ctx);
|
|
127
|
-
decoratorFinishedRef.v = 1;
|
|
128
|
-
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
ctx.static = isStatic;
|
|
132
|
-
ctx.private = isPrivate;
|
|
133
|
-
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
134
|
-
return name in target;
|
|
135
|
-
} };
|
|
136
|
-
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
137
|
-
assertInstanceIfPrivate(_this);
|
|
138
|
-
return desc1.value;
|
|
139
|
-
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
140
|
-
return target[name];
|
|
141
|
-
};
|
|
142
|
-
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
143
|
-
target[name] = value;
|
|
144
|
-
};
|
|
145
|
-
newValue = dec.call(decThis, isAccessor ? {
|
|
146
|
-
get: desc1.get,
|
|
147
|
-
set: desc1.set
|
|
148
|
-
} : desc1[key], ctx);
|
|
149
|
-
decoratorFinishedRef.v = 1;
|
|
150
|
-
if (isAccessor) {
|
|
151
|
-
if (typeof newValue === "object" && newValue) {
|
|
152
|
-
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
153
|
-
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
154
|
-
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
155
|
-
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
156
|
-
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
157
|
-
else desc1[key] = newValue;
|
|
158
|
-
}
|
|
159
|
-
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
160
|
-
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
161
|
-
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
162
|
-
else defineProperty(Class, name, desc1);
|
|
163
|
-
return newValue;
|
|
164
|
-
}
|
|
165
|
-
function applyMemberDecs() {
|
|
166
|
-
var ret = [];
|
|
167
|
-
var protoInitializers;
|
|
168
|
-
var staticInitializers;
|
|
169
|
-
var pushInitializers = function(initializers) {
|
|
170
|
-
if (initializers) ret.push(createRunInitializers(initializers));
|
|
171
|
-
};
|
|
172
|
-
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
173
|
-
for (var i = 0; i < memberDecs.length; i++) {
|
|
174
|
-
var decInfo = memberDecs[i];
|
|
175
|
-
var kind = decInfo[1];
|
|
176
|
-
var kindOnly = kind & 7;
|
|
177
|
-
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
178
|
-
var name = decInfo[2];
|
|
179
|
-
var isPrivate = !!decInfo[3];
|
|
180
|
-
var decoratorsHaveThis = kind & 16;
|
|
181
|
-
applyDec(isStatic ? targetClass : targetClass.prototype, decInfo, decoratorsHaveThis, isPrivate ? "#" + name : toPropertyKey(name), kindOnly, kindOnly < 2 ? [] : isStatic ? staticInitializers = staticInitializers || [] : protoInitializers = protoInitializers || [], ret, !!isStatic, isPrivate, isField, isStatic && isPrivate ? function(_) {
|
|
182
|
-
return checkInRHS(_) === targetClass;
|
|
183
|
-
} : instanceBrand);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
applyMemberDecsOfKind(8, 0);
|
|
188
|
-
applyMemberDecsOfKind(0, 0);
|
|
189
|
-
applyMemberDecsOfKind(8, 1);
|
|
190
|
-
applyMemberDecsOfKind(0, 1);
|
|
191
|
-
pushInitializers(protoInitializers);
|
|
192
|
-
pushInitializers(staticInitializers);
|
|
193
|
-
return ret;
|
|
194
|
-
}
|
|
195
|
-
function defineMetadata(Class) {
|
|
196
|
-
return defineProperty(Class, symbolMetadata, {
|
|
197
|
-
configurable: true,
|
|
198
|
-
enumerable: true,
|
|
199
|
-
value: metadata
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
203
|
-
metadata = create(metadata == null ? null : metadata);
|
|
204
|
-
_ = applyMemberDecs();
|
|
205
|
-
if (!hasClassDecs) defineMetadata(targetClass);
|
|
206
|
-
return {
|
|
207
|
-
e: _,
|
|
208
|
-
get c() {
|
|
209
|
-
var initializers = [];
|
|
210
|
-
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
let _dec, _initClass;
|
|
215
|
-
_dec = injectable([inject(CliLoggerToken)]);
|
|
216
|
-
let _PresentTagSyncResultPresenterImpl;
|
|
217
|
-
(class {
|
|
218
|
-
logger;
|
|
219
|
-
static {
|
|
220
|
-
({c: [_PresentTagSyncResultPresenterImpl, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
221
|
-
}
|
|
222
|
-
constructor(logger) {
|
|
223
|
-
this.logger = logger;
|
|
224
|
-
}
|
|
225
|
-
present(result, rootDir) {
|
|
226
|
-
return presentTagSyncCliResult(this.logger, result, rootDir);
|
|
227
|
-
}
|
|
228
|
-
static {
|
|
229
|
-
_initClass();
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
//#endregion
|
|
233
|
-
export { _PresentTagSyncResultPresenterImpl as PresentTagSyncResultPresenterImpl };
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { CliLoggerToken } from "../../core/contracts/tokens.mjs";
|
|
2
|
-
import { formatProgress } from "./tag-sync.presenter.mjs";
|
|
3
|
-
import { inject, injectable } from "@codefast/di";
|
|
4
|
-
//#region src/lib/tag/presentation/tag-sync-progress-listener.presenter.ts
|
|
5
|
-
function toPrimitive(input, hint) {
|
|
6
|
-
if (typeof input !== "object" || input === null) return input;
|
|
7
|
-
var prim = input[Symbol.toPrimitive];
|
|
8
|
-
if (prim !== void 0) {
|
|
9
|
-
var res = prim.call(input, hint || "default");
|
|
10
|
-
if (typeof res !== "object") return res;
|
|
11
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
12
|
-
}
|
|
13
|
-
return (hint === "string" ? String : Number)(input);
|
|
14
|
-
}
|
|
15
|
-
function toPropertyKey(arg) {
|
|
16
|
-
var key = toPrimitive(arg, "string");
|
|
17
|
-
return typeof key === "symbol" ? key : String(key);
|
|
18
|
-
}
|
|
19
|
-
function checkInRHS(value) {
|
|
20
|
-
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
23
|
-
function setFunctionName(fn, name, prefix) {
|
|
24
|
-
if (typeof name === "symbol") {
|
|
25
|
-
name = name.description;
|
|
26
|
-
name = name ? "[" + name + "]" : "";
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
Object.defineProperty(fn, "name", {
|
|
30
|
-
configurable: true,
|
|
31
|
-
value: prefix ? prefix + " " + name : name
|
|
32
|
-
});
|
|
33
|
-
} catch (_) {}
|
|
34
|
-
return fn;
|
|
35
|
-
}
|
|
36
|
-
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
37
|
-
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
38
|
-
var defineProperty = Object.defineProperty;
|
|
39
|
-
var create = Object.create;
|
|
40
|
-
var metadata;
|
|
41
|
-
var existingNonFields = [create(null), create(null)];
|
|
42
|
-
var hasClassDecs = classDecs.length;
|
|
43
|
-
var _;
|
|
44
|
-
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
45
|
-
return function(thisArg, value) {
|
|
46
|
-
if (useStaticThis) {
|
|
47
|
-
value = thisArg;
|
|
48
|
-
thisArg = targetClass;
|
|
49
|
-
}
|
|
50
|
-
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
51
|
-
return hasValue ? value : thisArg;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
55
|
-
if (typeof fn !== "function") {
|
|
56
|
-
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
57
|
-
}
|
|
58
|
-
return fn;
|
|
59
|
-
}
|
|
60
|
-
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
61
|
-
function assertInstanceIfPrivate(target) {
|
|
62
|
-
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
63
|
-
}
|
|
64
|
-
var decs = [].concat(decInfo[0]);
|
|
65
|
-
var decVal = decInfo[3];
|
|
66
|
-
var isClass = !ret;
|
|
67
|
-
var isAccessor = kind === 1;
|
|
68
|
-
var isGetter = kind === 3;
|
|
69
|
-
var isSetter = kind === 4;
|
|
70
|
-
var isMethod = kind === 2;
|
|
71
|
-
function bindPropCall(name, useStaticThis, before) {
|
|
72
|
-
return function(_this, value) {
|
|
73
|
-
if (useStaticThis) {
|
|
74
|
-
value = _this;
|
|
75
|
-
_this = Class;
|
|
76
|
-
}
|
|
77
|
-
if (before) before(_this);
|
|
78
|
-
return desc[name].call(_this, value);
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
var desc1 = {};
|
|
82
|
-
var init = [];
|
|
83
|
-
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
84
|
-
if (!isClass) {
|
|
85
|
-
if (isPrivate) {
|
|
86
|
-
if (isField || isAccessor) desc1 = {
|
|
87
|
-
get: setFunctionName(function() {
|
|
88
|
-
return decVal(this);
|
|
89
|
-
}, name, "get"),
|
|
90
|
-
set: function(value) {
|
|
91
|
-
decInfo[4](this, value);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
else desc1[key] = decVal;
|
|
95
|
-
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
96
|
-
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
97
|
-
if (!isField && !isPrivate) {
|
|
98
|
-
_ = existingNonFields[+isStatic][name];
|
|
99
|
-
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
100
|
-
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
var newValue = Class;
|
|
104
|
-
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
105
|
-
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
106
|
-
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
107
|
-
var decoratorFinishedRef = {};
|
|
108
|
-
var ctx = {
|
|
109
|
-
kind: [
|
|
110
|
-
"field",
|
|
111
|
-
"accessor",
|
|
112
|
-
"method",
|
|
113
|
-
"getter",
|
|
114
|
-
"setter",
|
|
115
|
-
"class"
|
|
116
|
-
][kind],
|
|
117
|
-
name,
|
|
118
|
-
metadata,
|
|
119
|
-
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
120
|
-
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
121
|
-
assertCallable(initializer, "An initializer", "be", true);
|
|
122
|
-
initializers.push(initializer);
|
|
123
|
-
}).bind(null, decoratorFinishedRef)
|
|
124
|
-
};
|
|
125
|
-
if (isClass) {
|
|
126
|
-
_ = dec.call(decThis, newValue, ctx);
|
|
127
|
-
decoratorFinishedRef.v = 1;
|
|
128
|
-
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
ctx.static = isStatic;
|
|
132
|
-
ctx.private = isPrivate;
|
|
133
|
-
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
134
|
-
return name in target;
|
|
135
|
-
} };
|
|
136
|
-
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
137
|
-
assertInstanceIfPrivate(_this);
|
|
138
|
-
return desc1.value;
|
|
139
|
-
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
140
|
-
return target[name];
|
|
141
|
-
};
|
|
142
|
-
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
143
|
-
target[name] = value;
|
|
144
|
-
};
|
|
145
|
-
newValue = dec.call(decThis, isAccessor ? {
|
|
146
|
-
get: desc1.get,
|
|
147
|
-
set: desc1.set
|
|
148
|
-
} : desc1[key], ctx);
|
|
149
|
-
decoratorFinishedRef.v = 1;
|
|
150
|
-
if (isAccessor) {
|
|
151
|
-
if (typeof newValue === "object" && newValue) {
|
|
152
|
-
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
153
|
-
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
154
|
-
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
155
|
-
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
156
|
-
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
157
|
-
else desc1[key] = newValue;
|
|
158
|
-
}
|
|
159
|
-
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
160
|
-
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
161
|
-
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
162
|
-
else defineProperty(Class, name, desc1);
|
|
163
|
-
return newValue;
|
|
164
|
-
}
|
|
165
|
-
function applyMemberDecs() {
|
|
166
|
-
var ret = [];
|
|
167
|
-
var protoInitializers;
|
|
168
|
-
var staticInitializers;
|
|
169
|
-
var pushInitializers = function(initializers) {
|
|
170
|
-
if (initializers) ret.push(createRunInitializers(initializers));
|
|
171
|
-
};
|
|
172
|
-
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
173
|
-
for (var i = 0; i < memberDecs.length; i++) {
|
|
174
|
-
var decInfo = memberDecs[i];
|
|
175
|
-
var kind = decInfo[1];
|
|
176
|
-
var kindOnly = kind & 7;
|
|
177
|
-
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
178
|
-
var name = decInfo[2];
|
|
179
|
-
var isPrivate = !!decInfo[3];
|
|
180
|
-
var decoratorsHaveThis = kind & 16;
|
|
181
|
-
applyDec(isStatic ? targetClass : targetClass.prototype, decInfo, decoratorsHaveThis, isPrivate ? "#" + name : toPropertyKey(name), kindOnly, kindOnly < 2 ? [] : isStatic ? staticInitializers = staticInitializers || [] : protoInitializers = protoInitializers || [], ret, !!isStatic, isPrivate, isField, isStatic && isPrivate ? function(_) {
|
|
182
|
-
return checkInRHS(_) === targetClass;
|
|
183
|
-
} : instanceBrand);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
applyMemberDecsOfKind(8, 0);
|
|
188
|
-
applyMemberDecsOfKind(0, 0);
|
|
189
|
-
applyMemberDecsOfKind(8, 1);
|
|
190
|
-
applyMemberDecsOfKind(0, 1);
|
|
191
|
-
pushInitializers(protoInitializers);
|
|
192
|
-
pushInitializers(staticInitializers);
|
|
193
|
-
return ret;
|
|
194
|
-
}
|
|
195
|
-
function defineMetadata(Class) {
|
|
196
|
-
return defineProperty(Class, symbolMetadata, {
|
|
197
|
-
configurable: true,
|
|
198
|
-
enumerable: true,
|
|
199
|
-
value: metadata
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
203
|
-
metadata = create(metadata == null ? null : metadata);
|
|
204
|
-
_ = applyMemberDecs();
|
|
205
|
-
if (!hasClassDecs) defineMetadata(targetClass);
|
|
206
|
-
return {
|
|
207
|
-
e: _,
|
|
208
|
-
get c() {
|
|
209
|
-
var initializers = [];
|
|
210
|
-
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
let _dec, _initClass;
|
|
215
|
-
_dec = injectable([inject(CliLoggerToken)]);
|
|
216
|
-
let _TagSyncProgressListener;
|
|
217
|
-
(class {
|
|
218
|
-
logger;
|
|
219
|
-
static {
|
|
220
|
-
({c: [_TagSyncProgressListener, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
221
|
-
}
|
|
222
|
-
constructor(logger) {
|
|
223
|
-
this.logger = logger;
|
|
224
|
-
}
|
|
225
|
-
onTargetStarted(target) {
|
|
226
|
-
this.logger.out(formatProgress({
|
|
227
|
-
type: "target-started",
|
|
228
|
-
target
|
|
229
|
-
}));
|
|
230
|
-
}
|
|
231
|
-
onTargetCompleted(target, result) {
|
|
232
|
-
this.logger.out(formatProgress({
|
|
233
|
-
type: "target-completed",
|
|
234
|
-
target,
|
|
235
|
-
result
|
|
236
|
-
}));
|
|
237
|
-
}
|
|
238
|
-
static {
|
|
239
|
-
_initClass();
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
//#endregion
|
|
243
|
-
export { _TagSyncProgressListener as TagSyncProgressListener };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CliLoggerToken } from "../core/contracts/tokens.mjs";
|
|
2
|
-
import { withOptionalPortTelemetry } from "../core/infrastructure/port-telemetry.decorator.mjs";
|
|
3
|
-
import { InfrastructureModule } from "../core/infrastructure/infrastructure.module.mjs";
|
|
4
|
-
import { PrepareTagSyncUseCaseToken, RunTagSyncUseCaseToken, TagSinceWriterPortToken, TagTargetResolverPortToken, TagVersionResolverPortToken, TypeScriptTreeWalkPortToken } from "./contracts/tokens.mjs";
|
|
5
|
-
import { TagSinceWriterAdapter as _TagSinceWriterAdapter } from "./adapters/secondary/tag-since-writer.adapter.mjs";
|
|
6
|
-
import { TagTargetResolverAdapter as _TagTargetResolverAdapter } from "./adapters/secondary/tag-target-resolver.adapter.mjs";
|
|
7
|
-
import { TagVersionResolverAdapter as _TagVersionResolverAdapter } from "./adapters/secondary/tag-version-resolver.adapter.mjs";
|
|
8
|
-
import { TypeScriptTreeWalkAdapter as _TypeScriptTreeWalkAdapter } from "./adapters/secondary/typescript-tree-walk.adapter.mjs";
|
|
9
|
-
import { RunTagSyncUseCaseImpl as _RunTagSyncUseCaseImpl } from "./application/use-cases/run-tag-sync.use-case.mjs";
|
|
10
|
-
import { PrepareTagSyncUseCaseImpl as _PrepareTagSyncUseCaseImpl } from "./application/use-cases/prepare-tag-sync.use-case.mjs";
|
|
11
|
-
import { Module } from "@codefast/di";
|
|
12
|
-
//#region src/lib/tag/tag.module.ts
|
|
13
|
-
const TagModule = Module.create("cli-tag", (moduleBuilder) => {
|
|
14
|
-
moduleBuilder.import(InfrastructureModule);
|
|
15
|
-
moduleBuilder.bind(TagTargetResolverPortToken).to(_TagTargetResolverAdapter).singleton().onActivation((ctx, implementation) => withOptionalPortTelemetry("TagTargetResolverPort", implementation, ctx.resolve(CliLoggerToken)));
|
|
16
|
-
moduleBuilder.bind(TypeScriptTreeWalkPortToken).to(_TypeScriptTreeWalkAdapter).singleton().onActivation((ctx, implementation) => withOptionalPortTelemetry("TypeScriptTreeWalkPort", implementation, ctx.resolve(CliLoggerToken)));
|
|
17
|
-
moduleBuilder.bind(TagSinceWriterPortToken).to(_TagSinceWriterAdapter).singleton().onActivation((ctx, implementation) => withOptionalPortTelemetry("TagSinceWriterPort", implementation, ctx.resolve(CliLoggerToken)));
|
|
18
|
-
moduleBuilder.bind(TagVersionResolverPortToken).to(_TagVersionResolverAdapter).singleton().onActivation((ctx, implementation) => withOptionalPortTelemetry("TagVersionResolverPort", implementation, ctx.resolve(CliLoggerToken)));
|
|
19
|
-
moduleBuilder.bind(PrepareTagSyncUseCaseToken).to(_PrepareTagSyncUseCaseImpl).singleton();
|
|
20
|
-
moduleBuilder.bind(RunTagSyncUseCaseToken).to(_RunTagSyncUseCaseImpl).singleton();
|
|
21
|
-
});
|
|
22
|
-
//#endregion
|
|
23
|
-
export { TagModule };
|
|
File without changes
|
/package/dist/{lib/arrange/application/ports/file-walker.port.mjs → core/filesystem/port.mjs}
RENAMED
|
File without changes
|
|
File without changes
|