@e-mc/document 0.8.2 → 0.8.4

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 CHANGED
@@ -1,7 +1,99 @@
1
- ### @e-mc/document
1
+ # @e-mc/document
2
2
 
3
- https://e-mc.readthedocs.io
3
+ * NodeJS 14
4
+ * ES2020
4
5
 
5
- ### LICENSE
6
+ ## General Usage
7
+
8
+ * [Read the Docs](https://e-mc.readthedocs.io)
9
+
10
+ ## Interface
11
+
12
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/index.d.ts
13
+
14
+ ```typescript
15
+ import type { DataSource, ViewEngine } from "./squared";
16
+
17
+ import type { IFileManager, IScopeOrigin } from "./index";
18
+ import type { ExternalAsset, FileCommand, IFileThread, OutputFinalize } from "./asset";
19
+ import type { HostInitConfig, IClient } from "./core";
20
+ import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from "./document";
21
+ import type { PostFinalizeCallback } from "./filemanager";
22
+ import type { LogComponent } from "./logger";
23
+ import type { DocumentComponent, DocumentComponentOption, DocumentModule } from "./settings";
24
+ import type { IFileGroup, WatchInitResult } from "./watch";
25
+
26
+ interface IDocument extends IClient<IFileManager, DocumentModule, TransformCallback<IFileManager, ExternalAsset>> {
27
+ Db: IDb | null;
28
+ assets: ExternalAsset[];
29
+ config: Record<string, any>;
30
+ init(assets: ExternalAsset[], config?: HostInitConfig): this;
31
+ customize(options?: CustomizeOptions): void;
32
+ findConfig(data: object, name: string, type?: string): PluginConfig;
33
+ loadConfig(data: object, name: string): ConfigOrTransformer | null | undefined;
34
+ asSourceFile(value: string, options?: AsSourceFileOptions | boolean): unknown;
35
+ findVersion(name: string | string[], fallback?: string): string;
36
+ findSourceScope(uri: string, imports: Record<string, unknown>): Record<string, string | undefined>[];
37
+ findSourceRoot(uri: string, imports?: Record<string, string | undefined>): string | undefined;
38
+ resolveDir(name: string, ...paths: string[]): string | undefined;
39
+ locateSourceFiles(file: ExternalAsset, code?: string, bundleContent?: string[]): (imports?: Record<string, string | undefined>) => SourceInput | undefined;
40
+ resolveSourceFile(file: ExternalAsset): (code?: string, imports?: Record<string, string | undefined>) => SourceInput<string> | undefined;
41
+ tryParse(source: string, format: string, options?: Record<string | number | symbol, unknown>): unknown;
42
+ forDb(item: DataSource): boolean;
43
+ hasEval(name: string): boolean;
44
+ settingsOf(name: keyof DocumentComponent, option: keyof DocumentComponentOption): unknown;
45
+ parseTemplate(viewEngine: ViewEngine | string, template: string, data: unknown[]): Promise<string | null>;
46
+ transform(type: string, code: string, format: string | string[], options?: TransformOutput & TransformAction): Promise<TransformResult | void>;
47
+ abort(name?: keyof DocumentComponent | Error, reason?: unknown): void;
48
+ restart(): void;
49
+ using?(data: IFileThread): Promise<unknown>;
50
+ setLocalUri?(file: ExternalAsset, replace?: boolean): void;
51
+ resolveUri?(file: ExternalAsset, source: string): string;
52
+ resolveUri?(file: ExternalAsset, source: string, trailing: string): [string, string];
53
+ resolveImports?(file: ExternalAsset, code: string, baseFile?: string | ExternalAsset): string | undefined;
54
+ replaceContent?(source: string, statement: RegExpExecArray | string, mimeType?: string): string | undefined;
55
+ addCopy?(data: FileCommand<ExternalAsset>, saveAs: string, replace?: boolean): string | undefined;
56
+ writeImage?(output: OutputFinalize<ExternalAsset>): boolean;
57
+ cloudInit?(state: IScopeOrigin<IFileManager, ICloud>): void;
58
+ cloudObject?(state: IScopeOrigin<IFileManager, ICloud>, file: ExternalAsset): boolean;
59
+ cloudUpload?(state: IScopeOrigin<IFileManager, ICloud>, file: ExternalAsset, url: string, active: boolean): Promise<boolean>;
60
+ cloudFinalize?(state: IScopeOrigin<IFileManager, ICloud>): Promise<unknown[]>;
61
+ watchInit?(watch: IFileGroup<ExternalAsset>, assets: ExternalAsset[], sanitize?: boolean): WatchInitResult | undefined;
62
+ watchModified?(watch: IFileGroup<ExternalAsset>, assets?: ExternalAsset[]): PostFinalizeCallback;
63
+ set dataSource(value: DataSource[]);
64
+ get dataSource(): DataSource[];
65
+ set imports(value);
66
+ get imports(): Record<string, string | undefined>;
67
+ get watching(): boolean;
68
+ }
69
+
70
+ interface DocumentConstructor extends ModuleConstructor {
71
+ finalize(this: IFileManager, instance: IDocument): Promise<unknown>;
72
+ createSourceMap(code: string, remove: boolean): SourceMap;
73
+ createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
74
+ writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): string | undefined;
75
+ updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions | boolean): string;
76
+ generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
77
+ /* @deprecated - IDocument.using */
78
+ using?(this: IFileManager, instance: IDocument, file: ExternalAsset): Promise<unknown>;
79
+ cleanup?(this: IFileManager, instance: IDocument): Promise<unknown>;
80
+ sanitizeAssets?(assets: ExternalAsset[], exclusions?: ExternalAsset[]): ExternalAsset[];
81
+ readonly prototype: IDocument;
82
+ new(module?: DocumentModule, ...args: unknown[]): IDocument;
83
+ }
84
+ ```
85
+
86
+ ## References
87
+
88
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/squared.d.ts
89
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/asset.d.ts
90
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/core.d.ts
91
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/document.d.ts
92
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/filemanager.d.ts
93
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/logger.d.ts
94
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/settings.d.ts
95
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/watch.d.ts
96
+
97
+ ## LICENSE
6
98
 
7
99
  BSD 3-Clause
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Document constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/anpham6/e-mc.git",
12
+ "url": "git+https://github.com/anpham6/e-mc.git",
13
13
  "directory": "src/document"
14
14
  },
15
15
  "keywords": [
@@ -20,11 +20,11 @@
20
20
  "license": "BSD 3-Clause",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/core": "0.8.2",
24
- "@e-mc/db": "0.8.2",
25
- "@e-mc/types": "0.8.2",
23
+ "@e-mc/core": "0.8.4",
24
+ "@e-mc/db": "0.8.4",
25
+ "@e-mc/types": "0.8.4",
26
26
  "chalk": "4.1.2",
27
- "htmlparser2": "^9.0.0",
27
+ "htmlparser2": "^9.1.0",
28
28
  "js-yaml": "^4.1.0",
29
29
  "picomatch": "^3.0.1"
30
30
  }
@@ -1,8 +1,6 @@
1
1
  import type { XmlTagNode as IXmlTagNode, TagAppend, TagData } from '../../../types/lib/squared';
2
2
 
3
- // @ts-ignore
4
3
  import type { ParserOptions } from 'htmlparser2';
5
- // @ts-ignore
6
4
  import type { AnyNode, Element } from 'domhandler';
7
5
 
8
6
  export interface IGNORE_FLAG {