di-bag-codemod 0.1.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/LICENSE +21 -0
- package/README.md +114 -0
- package/cli.mjs +51 -0
- package/lib/codemod.mjs +77 -0
- package/lib/glob.mjs +51 -0
- package/lib/library.mjs +71 -0
- package/lib/load-typescript.mjs +33 -0
- package/lib/rename-map.mjs +292 -0
- package/lib/rewrite.mjs +946 -0
- package/lib/transforms/build-and-start.mjs +58 -0
- package/lib/transforms/collection-read.mjs +14 -0
- package/lib/transforms/collection-reference.mjs +10 -0
- package/lib/transforms/collection-token.mjs +20 -0
- package/lib/transforms/collection-tokens.mjs +98 -0
- package/lib/transforms/container-derivation.mjs +61 -0
- package/lib/transforms/index.mjs +19 -0
- package/lib/transforms/provider-facades.mjs +74 -0
- package/lib/transforms/provider-methods.mjs +100 -0
- package/lib/transforms/provider-sources.mjs +174 -0
- package/package.json +18 -0
- package/rename-map.json +160 -0
- package/rename-map.schema.json +208 -0
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "di-bag-codemod",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Type-aware DI Bag 0.4-to-0.5 codemod for checker-authenticated API uses and explicit runtime-code and import rules.",
|
|
5
|
+
"keywords": ["di-bag", "codemod", "migration", "typescript", "dependency-injection", "agents", "coding-agents"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": { "type": "git", "url": "git+https://github.com/dany-fedorov/di-bag.git", "directory": "tools/codemod" },
|
|
8
|
+
"homepage": "https://github.com/dany-fedorov/di-bag/tree/main/tools/codemod#readme",
|
|
9
|
+
"bugs": { "url": "https://github.com/dany-fedorov/di-bag/issues" },
|
|
10
|
+
"type": "module",
|
|
11
|
+
"bin": { "di-bag-codemod": "cli.mjs" },
|
|
12
|
+
"exports": { ".": "./lib/codemod.mjs", "./package.json": "./package.json" },
|
|
13
|
+
"files": ["cli.mjs", "lib", "rename-map.json", "rename-map.schema.json"],
|
|
14
|
+
"engines": { "node": ">=22" },
|
|
15
|
+
"publishConfig": { "access": "public" },
|
|
16
|
+
"scripts": { "test": "node --test test/*.test.mjs" },
|
|
17
|
+
"dependencies": { "typescript": "^6.0.3" }
|
|
18
|
+
}
|
package/rename-map.json
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./rename-map.schema.json",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"methods": [
|
|
5
|
+
{ "owner": "Builder", "from": "buildAndStart", "to": "ensureServicesReady", "transform": "build-and-start", "transformNames": { "concurrency": "maxConcurrentServiceKeys" } },
|
|
6
|
+
{ "owner": "Builder", "from": "register", "to": "withServices", "arity": [1] },
|
|
7
|
+
{ "owner": "Builder", "from": "register", "to": "withTokenService", "arity": [2] },
|
|
8
|
+
{ "owner": "Builder", "from": "alias", "to": "withServiceAlias", "arguments": { "kind": "bag", "names": ["aliasKey", "targetServiceKey"] } },
|
|
9
|
+
{ "owner": "Builder", "from": "contribute", "to": "withCollectionContribution", "arguments": { "kind": "bag", "names": ["collectionToken", "provider"] } },
|
|
10
|
+
{ "owner": "Builder", "from": "replace", "to": "withReplacedService" },
|
|
11
|
+
{ "owner": "Builder", "from": "installModule", "to": "withInstalledModules", "arguments": { "kind": "array" } },
|
|
12
|
+
{ "owner": "Builder", "from": "verifyGraph", "to": "verifyGraphAtCompileTime" },
|
|
13
|
+
{ "owner": "Builder", "from": "buildModule", "to": "buildModule", "arguments": { "kind": "bag", "names": ["exportedServiceKeys"], "alreadyBag": true, "trailing": { "mode": "merge", "keys": { "label": "moduleLabel" } } } },
|
|
14
|
+
{ "owner": "Builder", "from": "build", "to": "buildContainer" },
|
|
15
|
+
{ "owner": "token()", "from": "of", "to": "forCollectionOf", "transform": "collection-token", "transformNames": { "single": "forService", "collection": "forCollectionOf" } },
|
|
16
|
+
{ "owner": "DiBagApi", "from": "fromFactory", "to": "createProvider", "transform": "provider-sources", "transformNames": { "factory": "factory", "returnKind": "factoryReturnKind", "receivesContext": "factoryReceivesContext" } },
|
|
17
|
+
{ "owner": "DiBagApi", "from": "fromSyncFactory", "to": "createProvider", "transform": "provider-sources", "transformNames": { "factory": "factory", "returnKind": "factoryReturnKind", "receivesContext": "factoryReceivesContext" } },
|
|
18
|
+
{ "owner": "DiBagApi", "from": "fromAsyncFactory", "to": "createProvider", "transform": "provider-sources", "transformNames": { "factory": "factory", "returnKind": "factoryReturnKind", "receivesContext": "factoryReceivesContext" } },
|
|
19
|
+
{ "owner": "DiBagApi", "from": "fromFunction", "to": "createProviderFromFunction", "transform": "provider-sources", "transformNames": { "dependencies": "dependencies", "callable": "factoryFunction", "returnKind": "factoryReturnKind", "receivesContext": "factoryReceivesContext" } },
|
|
20
|
+
{ "owner": "DiBagApi", "from": "fromClass", "to": "createProviderFromClass", "transform": "provider-sources", "transformNames": { "dependencies": "dependencies", "callable": "serviceClass", "returnKind": "factoryReturnKind" } },
|
|
21
|
+
{ "owner": "DiBagApi", "from": "fromPlugin", "to": "createProviderFromPlugin", "transform": "provider-sources", "transformNames": { "dependencies": "dependencies", "descriptor": "pluginDescriptor", "validator": "isValidPluginOutput", "returnKind": "factoryReturnKind" } },
|
|
22
|
+
{ "owner": "DiBagApi", "from": "withDisposal", "to": "providerWithDisposal", "transform": "provider-facades", "transformNames": { "method": "providerWithDisposal", "provider": "provider", "disposeService": "disposeService" } },
|
|
23
|
+
{ "owner": "DiBagApi", "from": "withLifetime", "to": "providerWithLifetime", "transform": "provider-facades", "transformNames": { "method": "providerWithLifetime", "provider": "provider", "lifetime": "lifetime", "allowsScopedDependencies": "allowsScopedDependencies" } },
|
|
24
|
+
{ "owner": "DiBagApi", "from": "withMetadata", "to": "providerWithRegistrationMetadata", "transform": "provider-facades", "transformNames": { "registrationFacade": "providerWithRegistrationMetadata", "acquisitionFacade": "providerWithAcquisitionMetadata", "provider": "provider", "registrationMetadata": "registrationMetadata", "describeAcquisition": "describeAcquisition", "callbackReceives": "callbackReceives" } },
|
|
25
|
+
{ "owner": "DiBagApi", "from": "transformService", "to": "providerWithTransformedService", "transform": "provider-facades", "transformNames": { "method": "providerWithTransformedService", "provider": "provider", "transformService": "transformService", "callbackReceives": "callbackReceives", "transformReturnKind": "transformReturnKind" } },
|
|
26
|
+
{ "owner": "DiBagApi", "from": "token", "to": "createToken" },
|
|
27
|
+
{ "owner": "DiBagApi", "from": "all", "to": "forCollectionOf", "transform": "collection-reference" },
|
|
28
|
+
{ "owner": "Bag", "from": "resolveAll", "to": "resolveCollection", "transform": "collection-read" },
|
|
29
|
+
{ "owner": "Bag", "from": "inspectAll", "to": "serviceSnapshot", "transform": "collection-read" },
|
|
30
|
+
{ "owner": "Bag", "from": "inspect", "to": "serviceSnapshot" },
|
|
31
|
+
{ "owner": "Bag", "from": "inspectGraph", "to": "graphSnapshot" },
|
|
32
|
+
{ "owner": "Bag", "from": "createScope", "to": "createChildContainer", "arity": [0, 1, 2, 3], "transform": "container-derivation", "transformNames": { "keys": "replacedServiceKeys", "providers": "replacementProviders", "sharing": "sharedParentServiceKeys" } },
|
|
33
|
+
{ "owner": "Bag", "from": "fork", "to": "createIndependentContainer", "arity": [0, 1, 2], "transform": "container-derivation", "transformNames": { "keys": "replacedServiceKeys", "providers": "replacementProviders" } },
|
|
34
|
+
{ "owner": "Module", "from": "renameExport", "to": "withRenamedExport", "arguments": { "kind": "bag", "names": ["currentExportKey", "newExportKey"] } }
|
|
35
|
+
],
|
|
36
|
+
"options": [
|
|
37
|
+
{ "owner": "Bag", "method": "close", "argument": 0, "from": "signal", "to": "abortSignal" },
|
|
38
|
+
{ "owner": "Bag", "method": "close", "argument": 0, "from": "timeoutMs", "to": "waitTimeoutMs" },
|
|
39
|
+
{ "owner": "DiBagApi", "method": "withConfiguration", "argument": 0, "from": "observers", "to": "lifecycleObservers" },
|
|
40
|
+
{ "owner": "DiBagApi", "method": "withLifetime", "argument": 2, "from": "allowScopedDependencies", "to": "allowsScopedDependencies" },
|
|
41
|
+
{ "owner": "DiBagApi", "method": "transformService", "argument": 1, "from": "acquisitionMode", "to": "transformReturnKind" }
|
|
42
|
+
],
|
|
43
|
+
"values": [
|
|
44
|
+
{ "owner": "DiBagApi", "method": "transformService", "argument": 1, "path": ["acquisitionMode"], "from": "auto", "to": "auto-detect" },
|
|
45
|
+
{ "owner": "DiBagApi", "method": "transformService", "argument": 1, "path": ["acquisitionMode"], "from": "raw", "to": "uninspected" },
|
|
46
|
+
{ "owner": "DiBagApi", "method": "transformService", "argument": 1, "path": ["acquisitionMode"], "from": "nativePromise", "to": "native-promise" },
|
|
47
|
+
{ "owner": "DiBagApi", "method": "withLifetime", "argument": 1, "from": "root", "to": "singleton:one-per-container-tree" },
|
|
48
|
+
{ "owner": "DiBagApi", "method": "withLifetime", "argument": 1, "from": "scoped", "to": "scoped:one-per-container" },
|
|
49
|
+
{ "owner": "DiBagApi", "method": "withLifetime", "argument": 1, "from": "transient", "to": "transient:one-per-resolve" },
|
|
50
|
+
{ "owner": "BindingSnapshot", "property": "lifetime", "from": "root", "to": "singleton:one-per-container-tree" },
|
|
51
|
+
{ "owner": "BindingSnapshot", "property": "lifetime", "from": "scoped", "to": "scoped:one-per-container" },
|
|
52
|
+
{ "owner": "BindingSnapshot", "property": "lifetime", "from": "transient", "to": "transient:one-per-resolve" },
|
|
53
|
+
{ "owner": "AcquisitionEventFields", "property": "lifetime", "from": "root", "to": "singleton:one-per-container-tree" },
|
|
54
|
+
{ "owner": "AcquisitionEventFields", "property": "lifetime", "from": "scoped", "to": "scoped:one-per-container" },
|
|
55
|
+
{ "owner": "AcquisitionEventFields", "property": "lifetime", "from": "transient", "to": "transient:one-per-resolve" },
|
|
56
|
+
{ "owner": "LifecycleEvent", "property": "kind", "from": "scope-opened", "to": "container-opened" },
|
|
57
|
+
{ "owner": "LifecycleEvent", "property": "kind", "from": "scope-closing", "to": "container-closing" },
|
|
58
|
+
{ "owner": "LifecycleEvent", "property": "kind", "from": "scope-closed", "to": "container-closed" },
|
|
59
|
+
{ "owner": "LifecycleEvent", "property": "kind", "from": "scope-close-failed", "to": "container-close-failed" },
|
|
60
|
+
{ "owner": "LifecycleEvent", "property": "kind", "from": "cleanup-started", "to": "disposal-started" },
|
|
61
|
+
{ "owner": "LifecycleEvent", "property": "kind", "from": "cleanup-failed", "to": "disposal-failed" },
|
|
62
|
+
{ "owner": "LifecycleEvent", "property": "kind", "from": "cleanup-completed", "to": "disposal-completed" }
|
|
63
|
+
],
|
|
64
|
+
"properties": [
|
|
65
|
+
{ "owner": "Token", "from": "key", "to": "symbol" },
|
|
66
|
+
{ "owner": "CollectionToken", "from": "key", "to": "symbol" },
|
|
67
|
+
{ "owner": "AcquisitionContext", "from": "signal", "to": "abortSignal" },
|
|
68
|
+
{ "owner": "Presence", "from": "present", "to": "isPresent" },
|
|
69
|
+
{ "owner": "RegistrationSnapshot", "from": "label", "to": "bindingLabel" },
|
|
70
|
+
{ "owner": "BindingSnapshot", "from": "keys", "to": "serviceKeys" },
|
|
71
|
+
{ "owner": "BindingSnapshot", "from": "owned", "to": "isOwnedByContainer" },
|
|
72
|
+
{ "owner": "BindingSnapshot", "from": "key", "to": "tokenSymbol" },
|
|
73
|
+
{ "owner": "BindingSnapshot", "from": "kind", "to": "dependencyKind" },
|
|
74
|
+
{ "owner": "GraphSnapshot", "from": "token", "to": "collectionTokenSymbol" },
|
|
75
|
+
{ "owner": "GraphSnapshot", "from": "from", "to": "consumerBindingId" },
|
|
76
|
+
{ "owner": "GraphSnapshot", "from": "to", "to": "dependencyBindingId" },
|
|
77
|
+
{ "owner": "BindingSnapshot", "from": "acquisitionMode", "to": "factoryReturnKind" },
|
|
78
|
+
{ "owner": "CloseOptions", "from": "signal", "to": "abortSignal" },
|
|
79
|
+
{ "owner": "CloseOptions", "from": "timeoutMs", "to": "waitTimeoutMs" },
|
|
80
|
+
{ "owner": "StartupOptions", "from": "signal", "to": "abortSignal" },
|
|
81
|
+
{ "owner": "StartupOptions", "from": "timeoutMs", "to": "totalTimeoutMs" },
|
|
82
|
+
{ "owner": "StartupOptions", "from": "startupOrder", "manual": "startupOrder is gone; use maxConcurrentServiceKeys: omit it for 'parallel', 1 for 'sequential', or the number" },
|
|
83
|
+
{ "owner": "ModuleOptions", "from": "label", "to": "moduleLabel" },
|
|
84
|
+
{ "owner": "DiBagStartupError", "from": "cleanupFailures", "to": "disposalFailures" },
|
|
85
|
+
{ "owner": "DiBagStartupError", "from": "cleanupError", "to": "disposalError" },
|
|
86
|
+
{ "owner": "DiBagStartupCancelledError", "from": "cleanupPromise", "to": "disposalPromise" },
|
|
87
|
+
{ "owner": "DiBagCloseCancelledError", "from": "timeoutMs", "to": "waitTimeoutMs" },
|
|
88
|
+
{ "owner": "DiBagCloseCancelledError", "from": "cleanupPromise", "to": "disposalPromise" },
|
|
89
|
+
{ "owner": "CleanupFailure", "from": "label", "to": "bindingLabel" },
|
|
90
|
+
{ "owner": "CloseProgress", "from": "pending", "to": "disposersStillRunning" },
|
|
91
|
+
{ "owner": "CloseProgress", "from": "acquiring", "to": "acquisitionsStillPending" },
|
|
92
|
+
{ "owner": "ObserverOptions", "from": "onEvent", "to": "onLifecycleEvent" },
|
|
93
|
+
{ "owner": "ObserverOptions", "from": "onError", "to": "onObserverFailure" },
|
|
94
|
+
{ "owner": "ScopeOptions", "from": "share", "to": "sharedParentServiceKeys" },
|
|
95
|
+
{ "owner": "ScopeEventFields", "from": "scopeId", "to": "containerId" },
|
|
96
|
+
{ "owner": "ScopeEventFields", "from": "parentScopeId", "to": "parentContainerId" },
|
|
97
|
+
{ "owner": "AcquisitionEventFields", "from": "scopeId", "to": "containerId" },
|
|
98
|
+
{ "owner": "AcquisitionEventFields", "from": "label", "to": "bindingLabel" },
|
|
99
|
+
{ "owner": "GraphSnapshot", "from": "scopeId", "to": "containerId" },
|
|
100
|
+
{ "owner": "Captive", "from": "root", "to": "singleton" },
|
|
101
|
+
{ "owner": "LifetimeObligation", "from": "root", "to": "singleton" }
|
|
102
|
+
],
|
|
103
|
+
"types": [
|
|
104
|
+
{ "from": "AcquisitionMode", "to": "FactoryReturnKind", "literalValues": { "auto": "auto-detect", "raw": "uninspected", "nativePromise": "native-promise" } },
|
|
105
|
+
{ "from": "AcquisitionContext", "to": "FactoryContext" },
|
|
106
|
+
{ "from": "CompositionArguments", "to": "PositionalFactoryArguments" },
|
|
107
|
+
{ "from": "CompositionFunction", "to": "PositionalFactoryFunction" },
|
|
108
|
+
{ "from": "PluginAcquisitionMode", "to": "PluginReturnKind", "literalValues": { "raw": "uninspected", "nativePromise": "native-promise" } },
|
|
109
|
+
{ "from": "PluginOptions", "to": "CreateProviderFromPluginOptions", "genericArguments": [{ "index": 0, "values": { "raw": "uninspected", "nativePromise": "native-promise" } }] },
|
|
110
|
+
{ "from": "PluginProviderFactory", "to": "CreateProviderFromPlugin" },
|
|
111
|
+
{ "from": "PluginProvider", "to": "PluginProvider", "genericArguments": [{ "index": 2, "values": { "raw": "uninspected", "nativePromise": "native-promise" } }] },
|
|
112
|
+
{ "from": "StartupOptions", "to": "EnsureServicesReadyOptions" },
|
|
113
|
+
{ "from": "DiBagStartupError", "to": "DiBagServiceReadinessError" },
|
|
114
|
+
{ "from": "DiBagStartupCancelledError", "to": "DiBagServiceReadinessCancelledError" },
|
|
115
|
+
{ "from": "DiBagCleanupError", "to": "DiBagDisposalError" },
|
|
116
|
+
{ "from": "CleanupFailure", "to": "DisposalFailure" },
|
|
117
|
+
{ "from": "BuilderContribute", "to": "BuilderWithCollectionContribution" },
|
|
118
|
+
{ "from": "Bag", "to": "Container" },
|
|
119
|
+
{ "from": "ScopeOptions", "to": "CreateChildContainerOptions" },
|
|
120
|
+
{ "from": "CheckedScopeLifetimes", "to": "CheckedChildContainerLifetimes" },
|
|
121
|
+
{ "from": "DisjointScopeSelection", "to": "DisjointChildContainerSelection" },
|
|
122
|
+
{ "from": "ObserverOptions", "to": "LifecycleObserver" },
|
|
123
|
+
{ "from": "Registration", "to": "ProviderOrFactory" },
|
|
124
|
+
{ "from": "FactoryWithDisposal", "to": "Provider" },
|
|
125
|
+
{ "from": "ScopeEventFields", "to": "ContainerEventFields" }
|
|
126
|
+
],
|
|
127
|
+
"codes": [
|
|
128
|
+
{ "from": "DI_BAG_MISSING_REGISTRATION", "to": "DI_BAG_UNKNOWN_SERVICE_KEY" },
|
|
129
|
+
{ "from": "DI_BAG_INVALID_REPLACEMENT", "to": "DI_BAG_UNKNOWN_SERVICE_KEY" },
|
|
130
|
+
{ "from": "DI_BAG_INVALID_ALIAS", "to": "DI_BAG_UNKNOWN_SERVICE_KEY" },
|
|
131
|
+
{ "from": "DI_BAG_DUPLICATE_REGISTRATION", "to": "DI_BAG_DUPLICATE_SERVICE_KEY" },
|
|
132
|
+
{ "from": "DI_BAG_DUPLICATE_METADATA", "to": "DI_BAG_DUPLICATE_METADATA_KEY" },
|
|
133
|
+
{ "from": "DI_BAG_CYCLE", "to": "DI_BAG_DEPENDENCY_CYCLE" },
|
|
134
|
+
{ "from": "DI_BAG_STARTUP_FAILED", "to": "DI_BAG_SERVICE_READINESS_FAILED" },
|
|
135
|
+
{ "from": "DI_BAG_STARTUP_CANCELLED", "to": "DI_BAG_SERVICE_READINESS_CANCELLED" },
|
|
136
|
+
{ "from": "DI_BAG_STARTUP_TIMEOUT", "to": "DI_BAG_SERVICE_READINESS_TIMEOUT" },
|
|
137
|
+
{ "from": "DI_BAG_CLEANUP_FAILED", "to": "DI_BAG_DISPOSAL_FAILED" },
|
|
138
|
+
{ "from": "DI_BAG_CLEANUP_AFTER_FACTORY", "to": "DI_BAG_DISPOSER_PUSHED_AFTER_FACTORY" },
|
|
139
|
+
{ "from": "DI_BAG_INVALID_ACQUISITION_MODE", "to": "DI_BAG_INVALID_ARGUMENT" },
|
|
140
|
+
{ "from": "DI_BAG_INVALID_CLEANUP", "to": "DI_BAG_INVALID_ARGUMENT" },
|
|
141
|
+
{ "from": "DI_BAG_INVALID_CLOSE", "to": "DI_BAG_INVALID_ARGUMENT" },
|
|
142
|
+
{ "from": "DI_BAG_INVALID_CONFIGURATION", "to": "DI_BAG_INVALID_ARGUMENT" },
|
|
143
|
+
{ "from": "DI_BAG_INVALID_CONSTRUCTOR", "to": "DI_BAG_INVALID_ARGUMENT" },
|
|
144
|
+
{ "from": "DI_BAG_INVALID_FACTORY", "to": "DI_BAG_INVALID_ARGUMENT" },
|
|
145
|
+
{ "from": "DI_BAG_INVALID_FUNCTION", "to": "DI_BAG_INVALID_ARGUMENT" },
|
|
146
|
+
{ "from": "DI_BAG_INVALID_LIFETIME", "to": "DI_BAG_INVALID_ARGUMENT" },
|
|
147
|
+
{ "from": "DI_BAG_INVALID_PLUGIN_OPTIONS", "to": "DI_BAG_INVALID_ARGUMENT" },
|
|
148
|
+
{ "from": "DI_BAG_INVALID_TRANSFORM", "to": "DI_BAG_INVALID_ARGUMENT" },
|
|
149
|
+
{ "from": "DI_BAG_INVALID_EXPORT", "manual": "DI_BAG_INVALID_EXPORT was split: DI_BAG_UNKNOWN_SERVICE_KEY for a key the module does not export, DI_BAG_DUPLICATE_SERVICE_KEY for a rename onto an existing export, DI_BAG_INVALID_ARGUMENT for malformed input" },
|
|
150
|
+
{ "from": "DI_BAG_INVALID_METADATA", "manual": "DI_BAG_INVALID_METADATA was split: DI_BAG_INVALID_ACQUISITION_METADATA when a describe callback returns a bad record, DI_BAG_INVALID_ARGUMENT for malformed input" },
|
|
151
|
+
{ "from": "DI_BAG_INVALID_OVERRIDE", "manual": "DI_BAG_INVALID_OVERRIDE was split: DI_BAG_UNKNOWN_SERVICE_KEY, DI_BAG_MISSING_REPLACEMENT_PROVIDER, or DI_BAG_INVALID_ARGUMENT for malformed input" },
|
|
152
|
+
{ "from": "DI_BAG_INVALID_REGISTRATION", "manual": "DI_BAG_INVALID_REGISTRATION was split: DI_BAG_INVALID_PROVIDER for a value that is neither a function nor a provider, DI_BAG_INVALID_ARGUMENT for malformed input" },
|
|
153
|
+
{ "from": "DI_BAG_INVALID_SCOPE", "manual": "DI_BAG_INVALID_SCOPE was split: DI_BAG_UNKNOWN_SERVICE_KEY, DI_BAG_MISSING_REPLACEMENT_PROVIDER, DI_BAG_CONFLICTING_SERVICE_SELECTION, or DI_BAG_INVALID_ARGUMENT for malformed input" },
|
|
154
|
+
{ "from": "DI_BAG_INVALID_STARTUP", "manual": "DI_BAG_INVALID_STARTUP was split: DI_BAG_UNKNOWN_SERVICE_KEY for an unknown key, DI_BAG_INVALID_ARGUMENT for malformed input" }
|
|
155
|
+
],
|
|
156
|
+
"imports": [
|
|
157
|
+
{ "from": "di-bag/node", "to": "di-bag" },
|
|
158
|
+
{ "fromSuffix": "/src/node", "toSuffix": "/src" }
|
|
159
|
+
]
|
|
160
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "di-bag-codemod rename map",
|
|
4
|
+
"description": "The distance from di-bag 0.4.0 to the current API. Owners are library declaration names: a class, interface or type alias is `Name`, a function is `name()`, a method's inline types are `Owner.method()`. Method and property targets must be safe bare identifiers; type targets must also not be TypeScript keywords or primitive type names.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["version"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": { "type": "string", "minLength": 1 },
|
|
10
|
+
"version": { "const": 1 },
|
|
11
|
+
"methods": {
|
|
12
|
+
"description": "A renamed or reshaped method. Several entries may share owner and from when `arity` tells them apart; the first match wins.",
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"required": ["owner", "from", "to"],
|
|
18
|
+
"allOf": [
|
|
19
|
+
{ "not": { "required": ["arguments", "transform"] } },
|
|
20
|
+
{ "if": { "required": ["transformNames"] }, "then": { "required": ["transform"] } }
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"owner": { "type": "string", "minLength": 1 },
|
|
24
|
+
"from": { "type": "string", "minLength": 1 },
|
|
25
|
+
"to": { "type": "string", "minLength": 1, "pattern": "^[A-Za-z_$][A-Za-z0-9_$]*$", "description": "The 0.5 name. Equal to `from` when only the arguments change." },
|
|
26
|
+
"arity": { "type": "array", "items": { "type": "integer", "minimum": 0 }, "description": "Argument counts this entry applies to. Omit for any." },
|
|
27
|
+
"arguments": {
|
|
28
|
+
"oneOf": [
|
|
29
|
+
{
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"required": ["kind", "names"],
|
|
33
|
+
"allOf": [
|
|
34
|
+
{ "if": { "required": ["alreadyBag"] }, "then": { "properties": { "names": { "maxItems": 1 } } } }
|
|
35
|
+
],
|
|
36
|
+
"properties": {
|
|
37
|
+
"kind": { "const": "bag" },
|
|
38
|
+
"names": { "type": "array", "items": { "type": "string", "minLength": 1 }, "minItems": 1, "description": "Bag property for each positional argument, in order." },
|
|
39
|
+
"alreadyBag": { "const": true, "description": "The one-argument form may already be this bag. The checker must prove whether it is a bag or a legacy positional value; ambiguous calls are left unchanged for manual migration." },
|
|
40
|
+
"trailing": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"required": ["mode"],
|
|
44
|
+
"properties": {
|
|
45
|
+
"mode": { "enum": ["merge", "keep", "drop"], "description": "What happens to one extra argument after `names`: merge its properties into the bag, keep it as a second argument, or drop it." },
|
|
46
|
+
"keys": { "type": "object", "additionalProperties": { "type": "string", "minLength": 1 }, "description": "Key renames applied while merging." }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"required": ["kind"],
|
|
55
|
+
"properties": { "kind": { "const": "array", "description": "Wrap the single argument in an array." } }
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"transform": { "type": "string", "minLength": 1, "description": "Id of a custom transform in lib/transforms/index.mjs. Excludes `arguments`." },
|
|
60
|
+
"transformNames": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"minProperties": 1,
|
|
63
|
+
"additionalProperties": { "type": "string", "minLength": 1 }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"options": {
|
|
69
|
+
"description": "A renamed key of an object-literal argument, found by position. Works even when the call does not type-check.",
|
|
70
|
+
"type": "array",
|
|
71
|
+
"items": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"additionalProperties": false,
|
|
74
|
+
"required": ["owner", "method", "argument", "from", "to"],
|
|
75
|
+
"properties": {
|
|
76
|
+
"owner": { "type": "string", "minLength": 1 },
|
|
77
|
+
"method": { "type": "string", "minLength": 1, "description": "The 0.4.0 method name." },
|
|
78
|
+
"argument": { "type": "integer", "minimum": 0 },
|
|
79
|
+
"path": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "Keys leading to a nested object literal. Omit for the argument itself." },
|
|
80
|
+
"from": { "type": "string", "minLength": 1 },
|
|
81
|
+
"to": { "type": "string", "minLength": 1 }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"values": {
|
|
86
|
+
"description": "A renamed string value: either at an argument path of a call, or wherever a library property is compared with or assigned that string.",
|
|
87
|
+
"type": "array",
|
|
88
|
+
"items": {
|
|
89
|
+
"oneOf": [
|
|
90
|
+
{
|
|
91
|
+
"type": "object",
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"required": ["owner", "method", "argument", "from", "to"],
|
|
94
|
+
"properties": {
|
|
95
|
+
"owner": { "type": "string", "minLength": 1 },
|
|
96
|
+
"method": { "type": "string", "minLength": 1 },
|
|
97
|
+
"argument": { "type": "integer", "minimum": 0 },
|
|
98
|
+
"path": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "Keys leading to the string inside an object-literal argument. Omit when the argument is the string." },
|
|
99
|
+
"from": { "type": "string", "minLength": 1 },
|
|
100
|
+
"to": { "type": "string", "minLength": 1 }
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "object",
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"required": ["owner", "property", "from", "to"],
|
|
107
|
+
"properties": {
|
|
108
|
+
"owner": { "type": "string", "minLength": 1 },
|
|
109
|
+
"property": { "type": "string", "minLength": 1 },
|
|
110
|
+
"from": { "type": "string", "minLength": 1 },
|
|
111
|
+
"to": { "type": "string", "minLength": 1 }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"properties": {
|
|
118
|
+
"description": "A renamed property of a library type: property access, destructuring, and keys of object literals typed by it. `manual` reports every use instead.",
|
|
119
|
+
"type": "array",
|
|
120
|
+
"items": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"additionalProperties": false,
|
|
123
|
+
"required": ["owner", "from"],
|
|
124
|
+
"oneOf": [{ "required": ["to"] }, { "required": ["manual"] }],
|
|
125
|
+
"properties": {
|
|
126
|
+
"owner": { "type": "string", "minLength": 1 },
|
|
127
|
+
"from": { "type": "string", "minLength": 1 },
|
|
128
|
+
"to": { "type": "string", "minLength": 1, "pattern": "^[A-Za-z_$][A-Za-z0-9_$]*$" },
|
|
129
|
+
"manual": { "type": "string", "minLength": 1, "description": "The sentence shown to the person who has to decide." }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"types": {
|
|
134
|
+
"description": "A renamed export: classes, interfaces, type aliases and error classes, in imports and wherever they are referenced.",
|
|
135
|
+
"type": "array",
|
|
136
|
+
"items": {
|
|
137
|
+
"type": "object",
|
|
138
|
+
"additionalProperties": false,
|
|
139
|
+
"required": ["from", "to"],
|
|
140
|
+
"properties": {
|
|
141
|
+
"from": { "type": "string", "minLength": 1 },
|
|
142
|
+
"to": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"minLength": 1,
|
|
145
|
+
"pattern": "^[A-Za-z_$][A-Za-z0-9_$]*$",
|
|
146
|
+
"not": { "enum": ["abstract", "accessor", "any", "as", "asserts", "async", "await", "bigint", "boolean", "break", "case", "catch", "class", "const", "constructor", "continue", "debugger", "declare", "default", "delete", "do", "else", "enum", "export", "extends", "false", "finally", "for", "from", "function", "get", "global", "if", "implements", "import", "in", "infer", "instanceof", "interface", "intrinsic", "is", "keyof", "let", "module", "namespace", "never", "new", "null", "number", "object", "of", "out", "override", "package", "private", "protected", "public", "readonly", "require", "return", "satisfies", "set", "static", "string", "super", "switch", "symbol", "this", "throw", "true", "try", "type", "typeof", "undefined", "unique", "unknown", "using", "var", "void", "while", "with", "yield"] }
|
|
147
|
+
},
|
|
148
|
+
"genericArguments": {
|
|
149
|
+
"type": "array",
|
|
150
|
+
"items": {
|
|
151
|
+
"type": "object",
|
|
152
|
+
"additionalProperties": false,
|
|
153
|
+
"required": ["index", "values"],
|
|
154
|
+
"properties": {
|
|
155
|
+
"index": { "type": "integer", "minimum": 0 },
|
|
156
|
+
"values": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"minProperties": 1,
|
|
159
|
+
"additionalProperties": { "type": "string", "minLength": 1 }
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"literalValues": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"minProperties": 1,
|
|
167
|
+
"additionalProperties": { "type": "string", "minLength": 1 }
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"codes": {
|
|
173
|
+
"description": "A renamed runtime code. A code that was split has `manual` with the sentence that helps choose.",
|
|
174
|
+
"type": "array",
|
|
175
|
+
"items": {
|
|
176
|
+
"type": "object",
|
|
177
|
+
"additionalProperties": false,
|
|
178
|
+
"required": ["from"],
|
|
179
|
+
"oneOf": [{ "required": ["to"] }, { "required": ["manual"] }],
|
|
180
|
+
"properties": {
|
|
181
|
+
"from": { "type": "string", "minLength": 1, "pattern": "^DI_BAG_[A-Z_]+$" },
|
|
182
|
+
"to": { "type": "string", "minLength": 1, "description": "The new code, or the word manual." },
|
|
183
|
+
"manual": { "type": "string", "minLength": 1 }
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"imports": {
|
|
188
|
+
"description": "A rewritten module specifier: an exact match, or the end of a relative path.",
|
|
189
|
+
"type": "array",
|
|
190
|
+
"items": {
|
|
191
|
+
"oneOf": [
|
|
192
|
+
{
|
|
193
|
+
"type": "object",
|
|
194
|
+
"additionalProperties": false,
|
|
195
|
+
"required": ["from", "to"],
|
|
196
|
+
"properties": { "from": { "type": "string", "minLength": 1 }, "to": { "type": "string", "minLength": 1 } }
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"type": "object",
|
|
200
|
+
"additionalProperties": false,
|
|
201
|
+
"required": ["fromSuffix", "toSuffix"],
|
|
202
|
+
"properties": { "fromSuffix": { "type": "string", "minLength": 1 }, "toSuffix": { "type": "string", "minLength": 1 } }
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|