@wocker/core 1.0.26 → 1.0.27-beta.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/core/ApplicationContext.d.ts +2 -2
- package/lib/core/InstanceWrapper.d.ts +1 -1
- package/lib/core/InstanceWrapper.js +15 -15
- package/lib/core/ModuleWrapper.js +2 -3
- package/lib/env.d.ts +1 -2
- package/lib/env.js +2 -3
- package/lib/makes/FileSystem.d.ts +3 -1
- package/lib/makes/FileSystem.js +10 -1
- package/lib/modules/docker/services/DockerService.d.ts +1 -1
- package/lib/services/AppConfigService.js +1 -1
- package/lib/types/FileSystemDriver.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Type } from "../types";
|
|
1
|
+
import { Type, InjectionToken } from "../types";
|
|
2
2
|
import { Container } from "./Container";
|
|
3
3
|
export declare class ApplicationContext {
|
|
4
4
|
protected readonly module: Type;
|
|
5
5
|
protected readonly container: Container;
|
|
6
6
|
constructor(module: Type, container: Container);
|
|
7
|
-
get<TInput = any, TResult = TInput>(typeOrToken:
|
|
7
|
+
get<TInput = any, TResult = TInput>(typeOrToken: InjectionToken<TInput>): TResult;
|
|
8
8
|
run(args: string[]): Promise<string>;
|
|
9
9
|
}
|
|
@@ -7,9 +7,9 @@ export declare class InstanceWrapper<TInput = any> {
|
|
|
7
7
|
protected _type?: Type<TInput>;
|
|
8
8
|
protected _instance?: TInput;
|
|
9
9
|
constructor(module: ModuleWrapper, provider: ProviderType<TInput>);
|
|
10
|
-
protected normalizeProvider(provider: ProviderType): any[];
|
|
11
10
|
get type(): Type<TInput> | undefined;
|
|
12
11
|
get token(): InjectionToken<TInput>;
|
|
13
12
|
get instance(): TInput;
|
|
14
13
|
replace(provider: ProviderType<TInput>): void;
|
|
14
|
+
protected normalizeProvider(provider: ProviderType): any[];
|
|
15
15
|
}
|
|
@@ -11,21 +11,6 @@ class InstanceWrapper {
|
|
|
11
11
|
this._type = type;
|
|
12
12
|
this._instance = instance;
|
|
13
13
|
}
|
|
14
|
-
normalizeProvider(provider) {
|
|
15
|
-
if (provider && typeof provider === "object") {
|
|
16
|
-
if ("provide" in provider && "useValue" in provider) {
|
|
17
|
-
return [provider.provide, null, provider.useValue];
|
|
18
|
-
}
|
|
19
|
-
if ("provide" in provider && "useClass" in provider) {
|
|
20
|
-
return [provider.provide, provider.useClass, null];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return [
|
|
24
|
-
Reflect.getMetadata(env_1.INJECT_TOKEN_METADATA, provider) || provider,
|
|
25
|
-
provider,
|
|
26
|
-
null
|
|
27
|
-
];
|
|
28
|
-
}
|
|
29
14
|
get type() {
|
|
30
15
|
return this._type;
|
|
31
16
|
}
|
|
@@ -57,5 +42,20 @@ class InstanceWrapper {
|
|
|
57
42
|
this._type = type;
|
|
58
43
|
this._instance = instance;
|
|
59
44
|
}
|
|
45
|
+
normalizeProvider(provider) {
|
|
46
|
+
if (typeof provider === "object") {
|
|
47
|
+
if ("provide" in provider && "useValue" in provider) {
|
|
48
|
+
return [provider.provide, null, provider.useValue];
|
|
49
|
+
}
|
|
50
|
+
if ("provide" in provider && "useClass" in provider) {
|
|
51
|
+
return [provider.provide, provider.useClass, null];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return [
|
|
55
|
+
Reflect.getMetadata(env_1.INJECT_TOKEN_METADATA, provider) || provider,
|
|
56
|
+
provider,
|
|
57
|
+
null
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
60
|
}
|
|
61
61
|
exports.InstanceWrapper = InstanceWrapper;
|
|
@@ -34,8 +34,7 @@ class ModuleWrapper {
|
|
|
34
34
|
const token = typeof type === "function"
|
|
35
35
|
? Reflect.getMetadata(env_1.INJECT_TOKEN_METADATA, type) || type
|
|
36
36
|
: type;
|
|
37
|
-
|
|
38
|
-
if (!wrapper) {
|
|
37
|
+
if (!this.providers.has(token)) {
|
|
39
38
|
for (const im of this.imports) {
|
|
40
39
|
if (!im.exports.has(token)) {
|
|
41
40
|
continue;
|
|
@@ -47,7 +46,7 @@ class ModuleWrapper {
|
|
|
47
46
|
}
|
|
48
47
|
return this.container.globalProviders.get(token);
|
|
49
48
|
}
|
|
50
|
-
return
|
|
49
|
+
return this.providers.get(token);
|
|
51
50
|
}
|
|
52
51
|
addProvider(provider) {
|
|
53
52
|
const wrapper = new InstanceWrapper_1.InstanceWrapper(this, provider);
|
package/lib/env.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const WOCKER_VERSION = "1.0.
|
|
1
|
+
export declare const WOCKER_VERSION = "1.0.27";
|
|
2
2
|
export declare const WOCKER_VERSION_KEY = "__WOCKER_VERSION__";
|
|
3
3
|
export declare const WOCKER_DATA_DIR: string;
|
|
4
4
|
export declare const WOCKER_DATA_DIR_KEY = "__WOCKER_DATA_DIR__";
|
|
@@ -13,7 +13,6 @@ export declare const COMPLETION_METADATA = "completion";
|
|
|
13
13
|
export declare const ARGS_METADATA = "__ARGS_METADATA__";
|
|
14
14
|
export declare const ARGS_OLD_METADATA = "__ARGS__";
|
|
15
15
|
export declare const ALIAS_METADATA = "__ALIAS_METADATA__";
|
|
16
|
-
export declare const OPTION_META = "__OPTION_META__";
|
|
17
16
|
export declare const PARAMTYPES_METADATA = "design:paramtypes";
|
|
18
17
|
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
|
19
18
|
export declare const INJECT_TOKEN_METADATA = "INJECT_TOKEN";
|
package/lib/env.js
CHANGED
|
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MODULE_METADATA = exports.PLUGIN_NAME_METADATA = exports.INJECT_TOKEN_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.
|
|
6
|
+
exports.MODULE_METADATA = exports.PLUGIN_NAME_METADATA = exports.INJECT_TOKEN_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.ALIAS_METADATA = exports.ARGS_OLD_METADATA = exports.ARGS_METADATA = exports.COMPLETION_METADATA = exports.COMMAND_METADATA = exports.DESCRIPTION_METADATA = exports.INJECTABLE_WATERMARK = exports.IS_MODULE_METADATA = exports.IS_GLOBAL_METADATA = exports.PLUGIN_DIR_KEY = exports.FILE_SYSTEM_DRIVER_KEY = exports.WOCKER_DATA_DIR_KEY = exports.WOCKER_DATA_DIR = exports.WOCKER_VERSION_KEY = exports.WOCKER_VERSION = void 0;
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
exports.WOCKER_VERSION = "1.0.
|
|
9
|
+
exports.WOCKER_VERSION = "1.0.27";
|
|
10
10
|
exports.WOCKER_VERSION_KEY = "__WOCKER_VERSION__";
|
|
11
11
|
exports.WOCKER_DATA_DIR = process.env.WS_DIR || path_1.default.join(os_1.default.homedir(), ".workspace");
|
|
12
12
|
exports.WOCKER_DATA_DIR_KEY = "__WOCKER_DATA_DIR__";
|
|
@@ -21,7 +21,6 @@ exports.COMPLETION_METADATA = "completion";
|
|
|
21
21
|
exports.ARGS_METADATA = "__ARGS_METADATA__";
|
|
22
22
|
exports.ARGS_OLD_METADATA = "__ARGS__";
|
|
23
23
|
exports.ALIAS_METADATA = "__ALIAS_METADATA__";
|
|
24
|
-
exports.OPTION_META = "__OPTION_META__";
|
|
25
24
|
exports.PARAMTYPES_METADATA = "design:paramtypes";
|
|
26
25
|
exports.SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
|
27
26
|
exports.INJECT_TOKEN_METADATA = "INJECT_TOKEN";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import FS from "fs";
|
|
1
|
+
import FS, { EncodingOption, BufferEncodingOption } from "fs";
|
|
2
2
|
import { Readable } from "stream";
|
|
3
3
|
import { FileSystemDriver, ReadStreamOptions, WriteStreamOptions } from "../types";
|
|
4
4
|
import { File } from "./File";
|
|
@@ -42,5 +42,7 @@ export declare class FileSystem {
|
|
|
42
42
|
createReadlineStream(path: string, options?: ReadlineOptions): Readable;
|
|
43
43
|
getLinePosition(path: string, line: number): number;
|
|
44
44
|
watch(path: string, options?: FS.WatchOptionsWithStringEncoding): FS.FSWatcher;
|
|
45
|
+
readlink(path: string, options?: EncodingOption): string;
|
|
46
|
+
readlink(path: string, options: BufferEncodingOption): Buffer<ArrayBuffer>;
|
|
45
47
|
}
|
|
46
48
|
export {};
|
package/lib/makes/FileSystem.js
CHANGED
|
@@ -26,7 +26,7 @@ class FileSystem {
|
|
|
26
26
|
return path_1.default.join(this.source, ...parts);
|
|
27
27
|
}
|
|
28
28
|
cd(path) {
|
|
29
|
-
return new FileSystem(this.path(path), this.driver);
|
|
29
|
+
return new FileSystem(path_1.default.isAbsolute(path) ? path : this.path(path), this.driver);
|
|
30
30
|
}
|
|
31
31
|
readBytes(path, position, size) {
|
|
32
32
|
const file = this.open(path, "r");
|
|
@@ -170,5 +170,14 @@ class FileSystem {
|
|
|
170
170
|
watch(path, options = {}) {
|
|
171
171
|
return this.driver.watch(this.path(path), options);
|
|
172
172
|
}
|
|
173
|
+
readlink(path, options) {
|
|
174
|
+
const link = this.driver.readlinkSync(this.path(path), options);
|
|
175
|
+
if (typeof link === "string") {
|
|
176
|
+
return path_1.default.isAbsolute(link)
|
|
177
|
+
? path_1.default.relative(this.source, link)
|
|
178
|
+
: link;
|
|
179
|
+
}
|
|
180
|
+
return link;
|
|
181
|
+
}
|
|
173
182
|
}
|
|
174
183
|
exports.FileSystem = FileSystem;
|
|
@@ -29,8 +29,8 @@ let AppConfigService = class AppConfigService {
|
|
|
29
29
|
this.processService = processService;
|
|
30
30
|
this.fs = fs;
|
|
31
31
|
this.mapTypes = {
|
|
32
|
-
[project_1.PROJECT_TYPE_PRESET]: "Preset",
|
|
33
32
|
[project_1.PROJECT_TYPE_IMAGE]: "Image",
|
|
33
|
+
[project_1.PROJECT_TYPE_PRESET]: "Preset",
|
|
34
34
|
[project_1.PROJECT_TYPE_DOCKERFILE]: "Dockerfile"
|
|
35
35
|
};
|
|
36
36
|
this._pwd = (process.cwd() || process.env.PWD);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import FS, { type Dirent } from "fs";
|
|
1
|
+
import FS, { type Dirent, type EncodingOption, type BufferEncodingOption } from "fs";
|
|
2
2
|
type StreamOptions = {
|
|
3
3
|
flags?: string;
|
|
4
4
|
fd?: number;
|
|
@@ -36,5 +36,6 @@ export interface FileSystemDriver {
|
|
|
36
36
|
watchFile(path: string, listener: FS.StatsListener): FS.StatWatcher;
|
|
37
37
|
cpSync(source: string, destination: string, opts?: FS.CopySyncOptions): void;
|
|
38
38
|
renameSync(oldPath: string, newPath: string): void;
|
|
39
|
+
readlinkSync(path: string, options?: EncodingOption | BufferEncodingOption): string | Buffer<ArrayBuffer>;
|
|
39
40
|
}
|
|
40
41
|
export {};
|