@tramvai/tokens-core 5.16.2 → 5.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/command.d.ts CHANGED
@@ -1,7 +1,47 @@
1
1
  import type { Container, MultiTokenInterface, Provider } from '@tinkoff/dippy';
2
+ import type { AsyncTapableHookInstance } from '@tinkoff/hook-runner';
2
3
  export type Command = () => any;
3
4
  export interface CommandLineRunner {
4
5
  lines: CommandLines;
6
+ /**
7
+ * Hook for command line run, for example when `customer` line is executed like this:
8
+ *
9
+ * ```ts
10
+ * commandLineRunner.run('server', 'customer');
11
+ * ```
12
+ */
13
+ runLineHook: AsyncTapableHookInstance<{
14
+ env: keyof CommandLines;
15
+ line: keyof CommandLineDescription;
16
+ di: Container;
17
+ key?: string | number;
18
+ }, void>;
19
+ /**
20
+ * Hook for line commands run, for example when `customer` line is executed,
21
+ * this hook will be called sequentially for each command from this list:
22
+ * - `customerStart`
23
+ * - `resolveUserDeps`
24
+ * - `resolvePageDeps`
25
+ * - `generatePage`
26
+ * - `clear`
27
+ */
28
+ runCommandHook: AsyncTapableHookInstance<{
29
+ env: keyof CommandLines;
30
+ line: keyof CommandLineDescription;
31
+ di: Container;
32
+ command: MultiTokenInterface<Command>;
33
+ }, void>;
34
+ /**
35
+ * Hook for command function run, for example when `customerStart` command is executed,
36
+ * and you have a few `commandLineListTokens.customerStart` providers,
37
+ * this hook will be called sequentially for each provided function
38
+ */
39
+ runCommandFnHook: AsyncTapableHookInstance<{
40
+ fn: Command;
41
+ line: keyof CommandLineDescription;
42
+ command: MultiTokenInterface<Command>;
43
+ di: Container;
44
+ }, void>;
5
45
  run(type: keyof CommandLines, status: keyof CommandLineDescription, providers?: Provider[], customDi?: Container, key?: string | number): Promise<Container>;
6
46
  resolveDi(type: keyof CommandLines, status: keyof CommandLineDescription, rootDi: Container, providers?: Provider[]): Container;
7
47
  }
@@ -95,4 +135,10 @@ export declare const commandLineListTokens: {
95
135
  __type?: "multi token" | undefined;
96
136
  };
97
137
  };
138
+ export type CommandLineRunnerPlugin = {
139
+ apply(commandLineRunner: CommandLineRunner): void;
140
+ };
141
+ export declare const COMMAND_LINE_RUNNER_PLUGIN: CommandLineRunnerPlugin & {
142
+ __type?: "multi token" | undefined;
143
+ };
98
144
  //# sourceMappingURL=command.d.ts.map
package/lib/command.es.js CHANGED
@@ -66,5 +66,9 @@ const commandLineListTokens = {
66
66
  */
67
67
  close: createToken('close', { multi: true, scope: Scope.SINGLETON }),
68
68
  };
69
+ const COMMAND_LINE_RUNNER_PLUGIN = createToken('tramvai commandLineRunner plugin', {
70
+ multi: true,
71
+ scope: Scope.SINGLETON,
72
+ });
69
73
 
70
- export { COMMAND_LINES_TOKEN, COMMAND_LINE_RUNNER_TOKEN, commandLineListTokens };
74
+ export { COMMAND_LINES_TOKEN, COMMAND_LINE_RUNNER_PLUGIN, COMMAND_LINE_RUNNER_TOKEN, commandLineListTokens };
package/lib/command.js CHANGED
@@ -70,7 +70,12 @@ const commandLineListTokens = {
70
70
  */
71
71
  close: dippy.createToken('close', { multi: true, scope: dippy.Scope.SINGLETON }),
72
72
  };
73
+ const COMMAND_LINE_RUNNER_PLUGIN = dippy.createToken('tramvai commandLineRunner plugin', {
74
+ multi: true,
75
+ scope: dippy.Scope.SINGLETON,
76
+ });
73
77
 
74
78
  exports.COMMAND_LINES_TOKEN = COMMAND_LINES_TOKEN;
79
+ exports.COMMAND_LINE_RUNNER_PLUGIN = COMMAND_LINE_RUNNER_PLUGIN;
75
80
  exports.COMMAND_LINE_RUNNER_TOKEN = COMMAND_LINE_RUNNER_TOKEN;
76
81
  exports.commandLineListTokens = commandLineListTokens;
package/lib/hooks.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import type { TapableHooks } from '@tinkoff/hook-runner';
2
+ export type { TapableHooks, SyncTapableHookInstance, AsyncTapableHookInstance, AsyncParallelTapableHookInstance, } from '@tinkoff/hook-runner';
3
+ export declare const TAPABLE_HOOK_FACTORY_TOKEN: TapableHooks & {
4
+ __type?: "base token" | undefined;
5
+ };
6
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { createToken } from '@tinkoff/dippy';
2
+
3
+ const TAPABLE_HOOK_FACTORY_TOKEN = createToken('tramvai tapable hook factory');
4
+
5
+ export { TAPABLE_HOOK_FACTORY_TOKEN };
package/lib/hooks.js ADDED
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var dippy = require('@tinkoff/dippy');
6
+
7
+ const TAPABLE_HOOK_FACTORY_TOKEN = dippy.createToken('tramvai tapable hook factory');
8
+
9
+ exports.TAPABLE_HOOK_FACTORY_TOKEN = TAPABLE_HOOK_FACTORY_TOKEN;
package/lib/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { PageAction } from './action';
2
2
  export * from './action';
3
3
  export * from './command';
4
4
  export * from './bundle';
5
+ export * from './hooks';
5
6
  export declare const BUNDLE_LIST_TOKEN: any;
6
7
  export declare const ACTIONS_LIST_TOKEN: PageAction[] & {
7
8
  __type?: "base token" | undefined;
package/lib/index.es.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createToken } from '@tinkoff/dippy';
2
2
  export { ACTION_PARAMETERS } from '@tramvai/types-actions-state-context';
3
- export { COMMAND_LINES_TOKEN, COMMAND_LINE_RUNNER_TOKEN, commandLineListTokens } from './command.es.js';
3
+ export { COMMAND_LINES_TOKEN, COMMAND_LINE_RUNNER_PLUGIN, COMMAND_LINE_RUNNER_TOKEN, commandLineListTokens } from './command.es.js';
4
+ export { TAPABLE_HOOK_FACTORY_TOKEN } from './hooks.es.js';
4
5
 
5
6
  const BUNDLE_LIST_TOKEN = createToken('bundleList');
6
7
  const ACTIONS_LIST_TOKEN = createToken('actionsList');
package/lib/index.js CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var dippy = require('@tinkoff/dippy');
6
6
  var typesActionsStateContext = require('@tramvai/types-actions-state-context');
7
7
  var command = require('./command.js');
8
+ var hooks = require('./hooks.js');
8
9
 
9
10
  const BUNDLE_LIST_TOKEN = dippy.createToken('bundleList');
10
11
  const ACTIONS_LIST_TOKEN = dippy.createToken('actionsList');
@@ -16,8 +17,10 @@ Object.defineProperty(exports, 'ACTION_PARAMETERS', {
16
17
  get: function () { return typesActionsStateContext.ACTION_PARAMETERS; }
17
18
  });
18
19
  exports.COMMAND_LINES_TOKEN = command.COMMAND_LINES_TOKEN;
20
+ exports.COMMAND_LINE_RUNNER_PLUGIN = command.COMMAND_LINE_RUNNER_PLUGIN;
19
21
  exports.COMMAND_LINE_RUNNER_TOKEN = command.COMMAND_LINE_RUNNER_TOKEN;
20
22
  exports.commandLineListTokens = command.commandLineListTokens;
23
+ exports.TAPABLE_HOOK_FACTORY_TOKEN = hooks.TAPABLE_HOOK_FACTORY_TOKEN;
21
24
  exports.ACTIONS_LIST_TOKEN = ACTIONS_LIST_TOKEN;
22
25
  exports.APP_INFO_TOKEN = APP_INFO_TOKEN;
23
26
  exports.BUNDLE_LIST_TOKEN = BUNDLE_LIST_TOKEN;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tokens-core",
3
- "version": "5.16.2",
3
+ "version": "5.18.1",
4
4
  "description": "Tramvai core tokens",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.es.js",
@@ -18,7 +18,10 @@
18
18
  "watch": "tsc -w"
19
19
  },
20
20
  "dependencies": {
21
- "@tramvai/types-actions-state-context": "5.16.2"
21
+ "@tramvai/types-actions-state-context": "5.18.1"
22
+ },
23
+ "devDependencies": {
24
+ "@tinkoff/hook-runner": "0.7.3"
22
25
  },
23
26
  "peerDependencies": {
24
27
  "@tinkoff/dippy": "0.11.3",