@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,231 +0,0 @@
|
|
|
1
|
-
import { suggestCnGroups, summarizeGroupBucketLabels } from "./grouping.domain.mjs";
|
|
2
|
-
import { injectable } from "@codefast/di";
|
|
3
|
-
//#region src/lib/arrange/domain/tailwind-grouping.service.ts
|
|
4
|
-
function toPrimitive(input, hint) {
|
|
5
|
-
if (typeof input !== "object" || input === null) return input;
|
|
6
|
-
var prim = input[Symbol.toPrimitive];
|
|
7
|
-
if (prim !== void 0) {
|
|
8
|
-
var res = prim.call(input, hint || "default");
|
|
9
|
-
if (typeof res !== "object") return res;
|
|
10
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11
|
-
}
|
|
12
|
-
return (hint === "string" ? String : Number)(input);
|
|
13
|
-
}
|
|
14
|
-
function toPropertyKey(arg) {
|
|
15
|
-
var key = toPrimitive(arg, "string");
|
|
16
|
-
return typeof key === "symbol" ? key : String(key);
|
|
17
|
-
}
|
|
18
|
-
function checkInRHS(value) {
|
|
19
|
-
if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
function setFunctionName(fn, name, prefix) {
|
|
23
|
-
if (typeof name === "symbol") {
|
|
24
|
-
name = name.description;
|
|
25
|
-
name = name ? "[" + name + "]" : "";
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
Object.defineProperty(fn, "name", {
|
|
29
|
-
configurable: true,
|
|
30
|
-
value: prefix ? prefix + " " + name : name
|
|
31
|
-
});
|
|
32
|
-
} catch (_) {}
|
|
33
|
-
return fn;
|
|
34
|
-
}
|
|
35
|
-
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
|
|
36
|
-
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
|
|
37
|
-
var defineProperty = Object.defineProperty;
|
|
38
|
-
var create = Object.create;
|
|
39
|
-
var metadata;
|
|
40
|
-
var existingNonFields = [create(null), create(null)];
|
|
41
|
-
var hasClassDecs = classDecs.length;
|
|
42
|
-
var _;
|
|
43
|
-
function createRunInitializers(initializers, useStaticThis, hasValue) {
|
|
44
|
-
return function(thisArg, value) {
|
|
45
|
-
if (useStaticThis) {
|
|
46
|
-
value = thisArg;
|
|
47
|
-
thisArg = targetClass;
|
|
48
|
-
}
|
|
49
|
-
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
|
|
50
|
-
return hasValue ? value : thisArg;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function assertCallable(fn, hint1, hint2, throwUndefined) {
|
|
54
|
-
if (typeof fn !== "function") {
|
|
55
|
-
if (throwUndefined || fn !== void 0) throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
|
|
56
|
-
}
|
|
57
|
-
return fn;
|
|
58
|
-
}
|
|
59
|
-
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
|
|
60
|
-
function assertInstanceIfPrivate(target) {
|
|
61
|
-
if (!hasPrivateBrand(target)) throw new TypeError("Attempted to access private element on non-instance");
|
|
62
|
-
}
|
|
63
|
-
var decs = [].concat(decInfo[0]);
|
|
64
|
-
var decVal = decInfo[3];
|
|
65
|
-
var isClass = !ret;
|
|
66
|
-
var isAccessor = kind === 1;
|
|
67
|
-
var isGetter = kind === 3;
|
|
68
|
-
var isSetter = kind === 4;
|
|
69
|
-
var isMethod = kind === 2;
|
|
70
|
-
function bindPropCall(name, useStaticThis, before) {
|
|
71
|
-
return function(_this, value) {
|
|
72
|
-
if (useStaticThis) {
|
|
73
|
-
value = _this;
|
|
74
|
-
_this = Class;
|
|
75
|
-
}
|
|
76
|
-
if (before) before(_this);
|
|
77
|
-
return desc[name].call(_this, value);
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
var desc1 = {};
|
|
81
|
-
var init = [];
|
|
82
|
-
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
|
|
83
|
-
if (!isClass) {
|
|
84
|
-
if (isPrivate) {
|
|
85
|
-
if (isField || isAccessor) desc1 = {
|
|
86
|
-
get: setFunctionName(function() {
|
|
87
|
-
return decVal(this);
|
|
88
|
-
}, name, "get"),
|
|
89
|
-
set: function(value) {
|
|
90
|
-
decInfo[4](this, value);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
else desc1[key] = decVal;
|
|
94
|
-
if (!isField) setFunctionName(desc1[key], name, isMethod ? "" : key);
|
|
95
|
-
} else if (!isField) desc1 = Object.getOwnPropertyDescriptor(Class, name);
|
|
96
|
-
if (!isField && !isPrivate) {
|
|
97
|
-
_ = existingNonFields[+isStatic][name];
|
|
98
|
-
if (_ && (_ ^ kind) !== 7) throw new Error("Decorating two elements with the same name (" + desc1[key].name + ") is not supported yet");
|
|
99
|
-
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
var newValue = Class;
|
|
103
|
-
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
|
|
104
|
-
var dec = assertCallable(decs[i], "A decorator", "be", true);
|
|
105
|
-
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
|
|
106
|
-
var decoratorFinishedRef = {};
|
|
107
|
-
var ctx = {
|
|
108
|
-
kind: [
|
|
109
|
-
"field",
|
|
110
|
-
"accessor",
|
|
111
|
-
"method",
|
|
112
|
-
"getter",
|
|
113
|
-
"setter",
|
|
114
|
-
"class"
|
|
115
|
-
][kind],
|
|
116
|
-
name,
|
|
117
|
-
metadata,
|
|
118
|
-
addInitializer: (function(decoratorFinishedRef, initializer) {
|
|
119
|
-
if (decoratorFinishedRef.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
120
|
-
assertCallable(initializer, "An initializer", "be", true);
|
|
121
|
-
initializers.push(initializer);
|
|
122
|
-
}).bind(null, decoratorFinishedRef)
|
|
123
|
-
};
|
|
124
|
-
if (isClass) {
|
|
125
|
-
_ = dec.call(decThis, newValue, ctx);
|
|
126
|
-
decoratorFinishedRef.v = 1;
|
|
127
|
-
if (assertCallable(_, "class decorators", "return")) newValue = _;
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
ctx.static = isStatic;
|
|
131
|
-
ctx.private = isPrivate;
|
|
132
|
-
_ = ctx.access = { has: isPrivate ? hasPrivateBrand.bind() : function(target) {
|
|
133
|
-
return name in target;
|
|
134
|
-
} };
|
|
135
|
-
if (!isSetter) _.get = isPrivate ? isMethod ? function(_this) {
|
|
136
|
-
assertInstanceIfPrivate(_this);
|
|
137
|
-
return desc1.value;
|
|
138
|
-
} : bindPropCall("get", 0, assertInstanceIfPrivate) : function(target) {
|
|
139
|
-
return target[name];
|
|
140
|
-
};
|
|
141
|
-
if (!isMethod && !isGetter) _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
|
|
142
|
-
target[name] = value;
|
|
143
|
-
};
|
|
144
|
-
newValue = dec.call(decThis, isAccessor ? {
|
|
145
|
-
get: desc1.get,
|
|
146
|
-
set: desc1.set
|
|
147
|
-
} : desc1[key], ctx);
|
|
148
|
-
decoratorFinishedRef.v = 1;
|
|
149
|
-
if (isAccessor) {
|
|
150
|
-
if (typeof newValue === "object" && newValue) {
|
|
151
|
-
if (_ = assertCallable(newValue.get, "accessor.get")) desc1.get = _;
|
|
152
|
-
if (_ = assertCallable(newValue.set, "accessor.set")) desc1.set = _;
|
|
153
|
-
if (_ = assertCallable(newValue.init, "accessor.init")) init.unshift(_);
|
|
154
|
-
} else if (newValue !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
155
|
-
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) if (isField) init.unshift(newValue);
|
|
156
|
-
else desc1[key] = newValue;
|
|
157
|
-
}
|
|
158
|
-
if (kind < 2) ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
|
|
159
|
-
if (!isField && !isClass) if (isPrivate) if (isAccessor) ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
|
|
160
|
-
else ret.push(isMethod ? desc1[key] : assertCallable.call.bind(desc1[key]));
|
|
161
|
-
else defineProperty(Class, name, desc1);
|
|
162
|
-
return newValue;
|
|
163
|
-
}
|
|
164
|
-
function applyMemberDecs() {
|
|
165
|
-
var ret = [];
|
|
166
|
-
var protoInitializers;
|
|
167
|
-
var staticInitializers;
|
|
168
|
-
var pushInitializers = function(initializers) {
|
|
169
|
-
if (initializers) ret.push(createRunInitializers(initializers));
|
|
170
|
-
};
|
|
171
|
-
var applyMemberDecsOfKind = function(isStatic, isField) {
|
|
172
|
-
for (var i = 0; i < memberDecs.length; i++) {
|
|
173
|
-
var decInfo = memberDecs[i];
|
|
174
|
-
var kind = decInfo[1];
|
|
175
|
-
var kindOnly = kind & 7;
|
|
176
|
-
if ((kind & 8) == isStatic && !kindOnly == isField) {
|
|
177
|
-
var name = decInfo[2];
|
|
178
|
-
var isPrivate = !!decInfo[3];
|
|
179
|
-
var decoratorsHaveThis = kind & 16;
|
|
180
|
-
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(_) {
|
|
181
|
-
return checkInRHS(_) === targetClass;
|
|
182
|
-
} : instanceBrand);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
applyMemberDecsOfKind(8, 0);
|
|
187
|
-
applyMemberDecsOfKind(0, 0);
|
|
188
|
-
applyMemberDecsOfKind(8, 1);
|
|
189
|
-
applyMemberDecsOfKind(0, 1);
|
|
190
|
-
pushInitializers(protoInitializers);
|
|
191
|
-
pushInitializers(staticInitializers);
|
|
192
|
-
return ret;
|
|
193
|
-
}
|
|
194
|
-
function defineMetadata(Class) {
|
|
195
|
-
return defineProperty(Class, symbolMetadata, {
|
|
196
|
-
configurable: true,
|
|
197
|
-
enumerable: true,
|
|
198
|
-
value: metadata
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
if (parentClass !== void 0) metadata = parentClass[symbolMetadata];
|
|
202
|
-
metadata = create(metadata == null ? null : metadata);
|
|
203
|
-
_ = applyMemberDecs();
|
|
204
|
-
if (!hasClassDecs) defineMetadata(targetClass);
|
|
205
|
-
return {
|
|
206
|
-
e: _,
|
|
207
|
-
get c() {
|
|
208
|
-
var initializers = [];
|
|
209
|
-
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
let _dec, _initClass;
|
|
214
|
-
_dec = injectable([]);
|
|
215
|
-
let _TailwindGroupingServiceImpl;
|
|
216
|
-
(class {
|
|
217
|
-
static {
|
|
218
|
-
({c: [_TailwindGroupingServiceImpl, _initClass]} = _apply_decs_2311(this, [_dec], []));
|
|
219
|
-
}
|
|
220
|
-
suggestGroups(classString) {
|
|
221
|
-
return suggestCnGroups(classString);
|
|
222
|
-
}
|
|
223
|
-
summarizeBucketLabels(groups) {
|
|
224
|
-
return summarizeGroupBucketLabels(groups);
|
|
225
|
-
}
|
|
226
|
-
static {
|
|
227
|
-
_initClass();
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
//#endregion
|
|
231
|
-
export { _TailwindGroupingServiceImpl as TailwindGroupingServiceImpl };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import { DomainBinaryOperator, DomainSyntaxKind } from "../domain/ast/ast-node.model.mjs";
|
|
2
|
-
import ts from "typescript";
|
|
3
|
-
//#region src/lib/arrange/infrastructure/typescript-ast-translator.adapter.ts
|
|
4
|
-
/**
|
|
5
|
-
* Anti-corruption layer: maps TypeScript compiler AST to arrange domain AST.
|
|
6
|
-
* This module is the only place that imports `typescript` for arrange AST translation.
|
|
7
|
-
*/ function translateUnknown(n, parent, sf) {
|
|
8
|
-
const pos = n.getStart(sf);
|
|
9
|
-
const end = n.getEnd();
|
|
10
|
-
const self = {
|
|
11
|
-
kind: DomainSyntaxKind.Unknown,
|
|
12
|
-
pos,
|
|
13
|
-
end,
|
|
14
|
-
parent,
|
|
15
|
-
children: []
|
|
16
|
-
};
|
|
17
|
-
const childList = [];
|
|
18
|
-
ts.forEachChild(n, (child) => {
|
|
19
|
-
childList.push(translateNode(child, self, sf));
|
|
20
|
-
});
|
|
21
|
-
return {
|
|
22
|
-
...self,
|
|
23
|
-
children: childList
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function mapBinaryOperator(operatorToken) {
|
|
27
|
-
if (operatorToken.kind === ts.SyntaxKind.PlusToken) return DomainBinaryOperator.Plus;
|
|
28
|
-
return DomainBinaryOperator.Other;
|
|
29
|
-
}
|
|
30
|
-
function translateNode(n, parent, sf) {
|
|
31
|
-
const pos = n.getStart(sf);
|
|
32
|
-
const end = n.getEnd();
|
|
33
|
-
switch (n.kind) {
|
|
34
|
-
case ts.SyntaxKind.Identifier: {
|
|
35
|
-
const id = n;
|
|
36
|
-
return {
|
|
37
|
-
kind: DomainSyntaxKind.Identifier,
|
|
38
|
-
pos,
|
|
39
|
-
end,
|
|
40
|
-
parent,
|
|
41
|
-
text: id.text
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
case ts.SyntaxKind.StringLiteral: {
|
|
45
|
-
const lit = n;
|
|
46
|
-
return {
|
|
47
|
-
kind: DomainSyntaxKind.StringLiteral,
|
|
48
|
-
pos,
|
|
49
|
-
end,
|
|
50
|
-
parent,
|
|
51
|
-
text: lit.text
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
case ts.SyntaxKind.NoSubstitutionTemplateLiteral: {
|
|
55
|
-
const lit = n;
|
|
56
|
-
return {
|
|
57
|
-
kind: DomainSyntaxKind.NoSubstitutionTemplateLiteral,
|
|
58
|
-
pos,
|
|
59
|
-
end,
|
|
60
|
-
parent,
|
|
61
|
-
text: lit.text
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
case ts.SyntaxKind.ImportDeclaration: {
|
|
65
|
-
const decl = n;
|
|
66
|
-
const self = {
|
|
67
|
-
kind: DomainSyntaxKind.ImportDeclaration,
|
|
68
|
-
pos,
|
|
69
|
-
end,
|
|
70
|
-
parent,
|
|
71
|
-
importClause: void 0,
|
|
72
|
-
moduleSpecifier: void 0
|
|
73
|
-
};
|
|
74
|
-
if (decl.importClause) self.importClause = translateNode(decl.importClause, self, sf);
|
|
75
|
-
self.moduleSpecifier = translateNode(decl.moduleSpecifier, self, sf);
|
|
76
|
-
return self;
|
|
77
|
-
}
|
|
78
|
-
case ts.SyntaxKind.ImportClause: {
|
|
79
|
-
const clause = n;
|
|
80
|
-
const self = {
|
|
81
|
-
kind: DomainSyntaxKind.ImportClause,
|
|
82
|
-
pos,
|
|
83
|
-
end,
|
|
84
|
-
parent,
|
|
85
|
-
isTypeOnly: clause.isTypeOnly,
|
|
86
|
-
name: void 0,
|
|
87
|
-
namedBindings: void 0
|
|
88
|
-
};
|
|
89
|
-
if (clause.name) self.name = translateNode(clause.name, self, sf);
|
|
90
|
-
if (clause.namedBindings) self.namedBindings = translateNode(clause.namedBindings, self, sf);
|
|
91
|
-
return self;
|
|
92
|
-
}
|
|
93
|
-
case ts.SyntaxKind.NamedImports: {
|
|
94
|
-
const named = n;
|
|
95
|
-
const self = {
|
|
96
|
-
kind: DomainSyntaxKind.NamedImports,
|
|
97
|
-
pos,
|
|
98
|
-
end,
|
|
99
|
-
parent,
|
|
100
|
-
elements: []
|
|
101
|
-
};
|
|
102
|
-
const elements = [];
|
|
103
|
-
for (const element of named.elements) elements.push(translateNode(element, self, sf));
|
|
104
|
-
return {
|
|
105
|
-
...self,
|
|
106
|
-
elements
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
case ts.SyntaxKind.NamespaceImport: {
|
|
110
|
-
const ns = n;
|
|
111
|
-
const self = {
|
|
112
|
-
kind: DomainSyntaxKind.NamespaceImport,
|
|
113
|
-
pos,
|
|
114
|
-
end,
|
|
115
|
-
parent,
|
|
116
|
-
name: void 0
|
|
117
|
-
};
|
|
118
|
-
self.name = translateNode(ns.name, self, sf);
|
|
119
|
-
return self;
|
|
120
|
-
}
|
|
121
|
-
case ts.SyntaxKind.ImportSpecifier: {
|
|
122
|
-
const spec = n;
|
|
123
|
-
const self = {
|
|
124
|
-
kind: DomainSyntaxKind.ImportSpecifier,
|
|
125
|
-
pos,
|
|
126
|
-
end,
|
|
127
|
-
parent,
|
|
128
|
-
propertyName: void 0,
|
|
129
|
-
name: void 0
|
|
130
|
-
};
|
|
131
|
-
if (spec.propertyName) self.propertyName = translateNode(spec.propertyName, self, sf);
|
|
132
|
-
self.name = translateNode(spec.name, self, sf);
|
|
133
|
-
return self;
|
|
134
|
-
}
|
|
135
|
-
case ts.SyntaxKind.CallExpression: {
|
|
136
|
-
const call = n;
|
|
137
|
-
const self = {
|
|
138
|
-
kind: DomainSyntaxKind.CallExpression,
|
|
139
|
-
pos,
|
|
140
|
-
end,
|
|
141
|
-
parent,
|
|
142
|
-
expression: void 0,
|
|
143
|
-
arguments: []
|
|
144
|
-
};
|
|
145
|
-
self.expression = translateNode(call.expression, self, sf);
|
|
146
|
-
self.arguments = call.arguments.map((arg) => translateNode(arg, self, sf));
|
|
147
|
-
return self;
|
|
148
|
-
}
|
|
149
|
-
case ts.SyntaxKind.PropertyAccessExpression: {
|
|
150
|
-
const pa = n;
|
|
151
|
-
const self = {
|
|
152
|
-
kind: DomainSyntaxKind.PropertyAccessExpression,
|
|
153
|
-
pos,
|
|
154
|
-
end,
|
|
155
|
-
parent,
|
|
156
|
-
expression: void 0,
|
|
157
|
-
name: void 0
|
|
158
|
-
};
|
|
159
|
-
self.expression = translateNode(pa.expression, self, sf);
|
|
160
|
-
self.name = translateNode(pa.name, self, sf);
|
|
161
|
-
return self;
|
|
162
|
-
}
|
|
163
|
-
case ts.SyntaxKind.ObjectLiteralExpression: {
|
|
164
|
-
const obj = n;
|
|
165
|
-
const self = {
|
|
166
|
-
kind: DomainSyntaxKind.ObjectLiteralExpression,
|
|
167
|
-
pos,
|
|
168
|
-
end,
|
|
169
|
-
parent,
|
|
170
|
-
properties: []
|
|
171
|
-
};
|
|
172
|
-
const properties = [];
|
|
173
|
-
for (const prop of obj.properties) properties.push(translateNode(prop, self, sf));
|
|
174
|
-
return {
|
|
175
|
-
...self,
|
|
176
|
-
properties
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
case ts.SyntaxKind.PropertyAssignment: {
|
|
180
|
-
const prop = n;
|
|
181
|
-
const self = {
|
|
182
|
-
kind: DomainSyntaxKind.PropertyAssignment,
|
|
183
|
-
pos,
|
|
184
|
-
end,
|
|
185
|
-
parent,
|
|
186
|
-
name: void 0,
|
|
187
|
-
initializer: void 0
|
|
188
|
-
};
|
|
189
|
-
self.name = translateNode(prop.name, self, sf);
|
|
190
|
-
self.initializer = translateNode(prop.initializer, self, sf);
|
|
191
|
-
return self;
|
|
192
|
-
}
|
|
193
|
-
case ts.SyntaxKind.ArrayLiteralExpression: {
|
|
194
|
-
const arr = n;
|
|
195
|
-
const self = {
|
|
196
|
-
kind: DomainSyntaxKind.ArrayLiteralExpression,
|
|
197
|
-
pos,
|
|
198
|
-
end,
|
|
199
|
-
parent,
|
|
200
|
-
elements: []
|
|
201
|
-
};
|
|
202
|
-
const elements = [];
|
|
203
|
-
for (const element of arr.elements) elements.push(translateNode(element, self, sf));
|
|
204
|
-
return {
|
|
205
|
-
...self,
|
|
206
|
-
elements
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
case ts.SyntaxKind.SpreadElement: {
|
|
210
|
-
const sp = n;
|
|
211
|
-
const self = {
|
|
212
|
-
kind: DomainSyntaxKind.SpreadElement,
|
|
213
|
-
pos,
|
|
214
|
-
end,
|
|
215
|
-
parent,
|
|
216
|
-
expression: void 0
|
|
217
|
-
};
|
|
218
|
-
self.expression = translateNode(sp.expression, self, sf);
|
|
219
|
-
return self;
|
|
220
|
-
}
|
|
221
|
-
case ts.SyntaxKind.ParenthesizedExpression: {
|
|
222
|
-
const pe = n;
|
|
223
|
-
const self = {
|
|
224
|
-
kind: DomainSyntaxKind.ParenthesizedExpression,
|
|
225
|
-
pos,
|
|
226
|
-
end,
|
|
227
|
-
parent,
|
|
228
|
-
expression: void 0
|
|
229
|
-
};
|
|
230
|
-
self.expression = translateNode(pe.expression, self, sf);
|
|
231
|
-
return self;
|
|
232
|
-
}
|
|
233
|
-
case ts.SyntaxKind.AsExpression: {
|
|
234
|
-
const ae = n;
|
|
235
|
-
const self = {
|
|
236
|
-
kind: DomainSyntaxKind.AsExpression,
|
|
237
|
-
pos,
|
|
238
|
-
end,
|
|
239
|
-
parent,
|
|
240
|
-
expression: void 0
|
|
241
|
-
};
|
|
242
|
-
self.expression = translateNode(ae.expression, self, sf);
|
|
243
|
-
return self;
|
|
244
|
-
}
|
|
245
|
-
case ts.SyntaxKind.SatisfiesExpression: {
|
|
246
|
-
const se = n;
|
|
247
|
-
const self = {
|
|
248
|
-
kind: DomainSyntaxKind.SatisfiesExpression,
|
|
249
|
-
pos,
|
|
250
|
-
end,
|
|
251
|
-
parent,
|
|
252
|
-
expression: void 0
|
|
253
|
-
};
|
|
254
|
-
self.expression = translateNode(se.expression, self, sf);
|
|
255
|
-
return self;
|
|
256
|
-
}
|
|
257
|
-
case ts.SyntaxKind.NonNullExpression: {
|
|
258
|
-
const nn = n;
|
|
259
|
-
const self = {
|
|
260
|
-
kind: DomainSyntaxKind.NonNullExpression,
|
|
261
|
-
pos,
|
|
262
|
-
end,
|
|
263
|
-
parent,
|
|
264
|
-
expression: void 0
|
|
265
|
-
};
|
|
266
|
-
self.expression = translateNode(nn.expression, self, sf);
|
|
267
|
-
return self;
|
|
268
|
-
}
|
|
269
|
-
case ts.SyntaxKind.ConditionalExpression: {
|
|
270
|
-
const ce = n;
|
|
271
|
-
const self = {
|
|
272
|
-
kind: DomainSyntaxKind.ConditionalExpression,
|
|
273
|
-
pos,
|
|
274
|
-
end,
|
|
275
|
-
parent,
|
|
276
|
-
condition: void 0,
|
|
277
|
-
whenTrue: void 0,
|
|
278
|
-
whenFalse: void 0
|
|
279
|
-
};
|
|
280
|
-
self.condition = translateNode(ce.condition, self, sf);
|
|
281
|
-
self.whenTrue = translateNode(ce.whenTrue, self, sf);
|
|
282
|
-
self.whenFalse = translateNode(ce.whenFalse, self, sf);
|
|
283
|
-
return self;
|
|
284
|
-
}
|
|
285
|
-
case ts.SyntaxKind.BinaryExpression: {
|
|
286
|
-
const be = n;
|
|
287
|
-
const self = {
|
|
288
|
-
kind: DomainSyntaxKind.BinaryExpression,
|
|
289
|
-
pos,
|
|
290
|
-
end,
|
|
291
|
-
parent,
|
|
292
|
-
left: void 0,
|
|
293
|
-
operator: mapBinaryOperator(be.operatorToken),
|
|
294
|
-
right: void 0
|
|
295
|
-
};
|
|
296
|
-
self.left = translateNode(be.left, self, sf);
|
|
297
|
-
self.right = translateNode(be.right, self, sf);
|
|
298
|
-
return self;
|
|
299
|
-
}
|
|
300
|
-
case ts.SyntaxKind.ExpressionStatement: {
|
|
301
|
-
const es = n;
|
|
302
|
-
const self = {
|
|
303
|
-
kind: DomainSyntaxKind.ExpressionStatement,
|
|
304
|
-
pos,
|
|
305
|
-
end,
|
|
306
|
-
parent,
|
|
307
|
-
expression: void 0
|
|
308
|
-
};
|
|
309
|
-
self.expression = translateNode(es.expression, self, sf);
|
|
310
|
-
return self;
|
|
311
|
-
}
|
|
312
|
-
case ts.SyntaxKind.JsxAttribute: {
|
|
313
|
-
const ja = n;
|
|
314
|
-
const self = {
|
|
315
|
-
kind: DomainSyntaxKind.JsxAttribute,
|
|
316
|
-
pos,
|
|
317
|
-
end,
|
|
318
|
-
parent,
|
|
319
|
-
name: void 0,
|
|
320
|
-
initializer: void 0
|
|
321
|
-
};
|
|
322
|
-
self.name = translateNode(ja.name, self, sf);
|
|
323
|
-
if (ja.initializer) self.initializer = translateNode(ja.initializer, self, sf);
|
|
324
|
-
return self;
|
|
325
|
-
}
|
|
326
|
-
case ts.SyntaxKind.JsxExpression: {
|
|
327
|
-
const je = n;
|
|
328
|
-
const self = {
|
|
329
|
-
kind: DomainSyntaxKind.JsxExpression,
|
|
330
|
-
pos,
|
|
331
|
-
end,
|
|
332
|
-
parent,
|
|
333
|
-
expression: void 0
|
|
334
|
-
};
|
|
335
|
-
if (je.expression) self.expression = translateNode(je.expression, self, sf);
|
|
336
|
-
return self;
|
|
337
|
-
}
|
|
338
|
-
default: return translateUnknown(n, parent, sf);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
function translateTypeScriptSourceFile(tsSf) {
|
|
342
|
-
const text = tsSf.getFullText();
|
|
343
|
-
const statements = tsSf.statements.map((statement) => translateNode(statement, null, tsSf));
|
|
344
|
-
return {
|
|
345
|
-
fileName: tsSf.fileName,
|
|
346
|
-
text,
|
|
347
|
-
statements
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
function parseDomainSourceFile(filePath, sourceText) {
|
|
351
|
-
const scriptKind = filePath.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
|
|
352
|
-
return translateTypeScriptSourceFile(ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true, scriptKind));
|
|
353
|
-
}
|
|
354
|
-
//#endregion
|
|
355
|
-
export { parseDomainSourceFile };
|