@e-mc/document 0.13.9 → 0.14.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 +18 -18
- package/asset.js +4 -2
- package/index.js +223 -189
- package/package.json +6 -6
- package/parse/dom.js +41 -42
- package/parse/index.js +59 -57
- package/transform/index.js +23 -22
- package/util.d.ts +2 -1
- package/util.js +40 -36
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @e-mc/document
|
|
2
2
|
|
|
3
|
-
* NodeJS
|
|
3
|
+
* NodeJS 20 (Minimum 18)
|
|
4
4
|
* ES2022
|
|
5
5
|
|
|
6
6
|
## General Usage
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.14.0/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, ViewEngine } from "./squared";
|
|
@@ -20,7 +20,7 @@ import type { HostInitConfig, IClient } from "./core";
|
|
|
20
20
|
import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from "./document";
|
|
21
21
|
import type { PostFinalizeCallback } from "./filemanager";
|
|
22
22
|
import type { LogComponent } from "./logger";
|
|
23
|
-
import type { DocumentComponent, DocumentComponentOption, DocumentModule } from "./settings";
|
|
23
|
+
import type { DocumentComponent, DocumentComponentOption, DocumentModule, ImportModule } from "./settings";
|
|
24
24
|
import type { IFileGroup, WatchInitResult } from "./watch";
|
|
25
25
|
|
|
26
26
|
interface IDocument extends IClient<IFileManager, DocumentModule, TransformCallback<IFileManager, ExternalAsset>> {
|
|
@@ -34,11 +34,11 @@ interface IDocument extends IClient<IFileManager, DocumentModule, TransformCallb
|
|
|
34
34
|
asSourceFile(value: string, cache: boolean): unknown;
|
|
35
35
|
asSourceFile(value: string, options?: AsSourceFileOptions): unknown;
|
|
36
36
|
findVersion(name: string | string[], fallback?: string): string;
|
|
37
|
-
findSourceScope(uri: string, imports:
|
|
38
|
-
findSourceRoot(uri: string, imports?:
|
|
37
|
+
findSourceScope(uri: string, imports: ImportModule): Record<string, string | undefined>[];
|
|
38
|
+
findSourceRoot(uri: string, imports?: ImportModule): string | undefined;
|
|
39
39
|
resolveDir(name: string, ...paths: string[]): string | undefined;
|
|
40
|
-
locateSourceFiles(file: ExternalAsset, code?: string, bundleContent?: string[]): ((imports?:
|
|
41
|
-
resolveSourceFile(file: ExternalAsset): ((code?: string, imports?:
|
|
40
|
+
locateSourceFiles(file: ExternalAsset, code?: string, bundleContent?: string[]): ((imports?: ImportModule) => SourceInput | undefined);
|
|
41
|
+
resolveSourceFile(file: ExternalAsset): ((code?: string, imports?: ImportModule) => SourceInput<string> | undefined);
|
|
42
42
|
tryParse(source: string, format: string, options?: Record<string | number | symbol, unknown>): unknown;
|
|
43
43
|
forDb(item: DataSource): boolean;
|
|
44
44
|
hasEval(name: string): boolean;
|
|
@@ -65,7 +65,7 @@ interface IDocument extends IClient<IFileManager, DocumentModule, TransformCallb
|
|
|
65
65
|
set dataSource(value: DataSource[]);
|
|
66
66
|
get dataSource(): DataSource[];
|
|
67
67
|
set imports(value);
|
|
68
|
-
get imports():
|
|
68
|
+
get imports(): ImportModule;
|
|
69
69
|
get watching(): boolean;
|
|
70
70
|
set host(value);
|
|
71
71
|
get host(): IFileManager | null;
|
|
@@ -77,9 +77,9 @@ interface DocumentConstructor extends ModuleConstructor {
|
|
|
77
77
|
createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
|
|
78
78
|
writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): string | undefined;
|
|
79
79
|
/** @deprecated */
|
|
80
|
-
updateGradle(source: string, namespaces: string[], value: string, upgrade: boolean): string;
|
|
80
|
+
updateGradle(source: string, namespaces: (string | RegExp)[], value: string | string[], upgrade: boolean): string;
|
|
81
81
|
/** @deprecated */
|
|
82
|
-
updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
|
|
82
|
+
updateGradle(source: string, namespaces: (string | RegExp)[], value: string | string[], options?: UpdateGradleOptions): string;
|
|
83
83
|
generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
|
|
84
84
|
cleanup?(this: IFileManager, instance: IDocument): Promise<unknown>;
|
|
85
85
|
sanitizeAssets?(assets: ExternalAsset[], exclusions?: unknown[]): ExternalAsset[];
|
|
@@ -187,14 +187,14 @@ NOTE: **@e-mc/document** is an abstract base class and cannot be instantiated. *
|
|
|
187
187
|
|
|
188
188
|
## References
|
|
189
189
|
|
|
190
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
191
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
192
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
193
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
194
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
195
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
196
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
197
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
190
|
+
- https://www.unpkg.com/@e-mc/types@0.14.0/lib/squared.d.ts
|
|
191
|
+
- https://www.unpkg.com/@e-mc/types@0.14.0/lib/asset.d.ts
|
|
192
|
+
- https://www.unpkg.com/@e-mc/types@0.14.0/lib/core.d.ts
|
|
193
|
+
- https://www.unpkg.com/@e-mc/types@0.14.0/lib/document.d.ts
|
|
194
|
+
- https://www.unpkg.com/@e-mc/types@0.14.0/lib/filemanager.d.ts
|
|
195
|
+
- https://www.unpkg.com/@e-mc/types@0.14.0/lib/logger.d.ts
|
|
196
|
+
- https://www.unpkg.com/@e-mc/types@0.14.0/lib/settings.d.ts
|
|
197
|
+
- https://www.unpkg.com/@e-mc/types@0.14.0/lib/watch.d.ts
|
|
198
198
|
|
|
199
199
|
## LICENSE
|
|
200
200
|
|
package/asset.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.setInitialValue = setInitialValue;
|
|
2
|
+
|
|
4
3
|
function isEqual(item, other) {
|
|
5
4
|
return !!(item.id && item.id === other.id || item.uri === other.uri && item.pathname && item.filename && item.pathname === other.pathname && item.filename === other.filename);
|
|
6
5
|
}
|
|
7
6
|
function setInitialValue(file, cacheable = true) {
|
|
8
7
|
return file.initialValue ||= { pathname: file.pathname, filename: file.filename, mimeType: file.mimeType, localUri: file.localUri, inlineFilename: file.inlineFilename, cacheable };
|
|
9
8
|
}
|
|
9
|
+
|
|
10
|
+
exports.isEqual = isEqual;
|
|
11
|
+
exports.setInitialValue = setInitialValue;
|