@e-mc/document 0.13.10 → 0.14.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/README.md +22 -21
- package/asset.js +4 -2
- package/index.js +371 -193
- package/package.json +5 -8
- package/parse/dom.js +41 -42
- package/parse/index.js +54 -52
- 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.1/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,12 @@ 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
|
+
resolvePackageJSONExports(uri: string, base?: string | URL): string | undefined;
|
|
42
43
|
tryParse(source: string, format: string, options?: Record<string | number | symbol, unknown>): unknown;
|
|
43
44
|
forDb(item: DataSource): boolean;
|
|
44
45
|
hasEval(name: string): boolean;
|
|
@@ -65,7 +66,7 @@ interface IDocument extends IClient<IFileManager, DocumentModule, TransformCallb
|
|
|
65
66
|
set dataSource(value: DataSource[]);
|
|
66
67
|
get dataSource(): DataSource[];
|
|
67
68
|
set imports(value);
|
|
68
|
-
get imports():
|
|
69
|
+
get imports(): ImportModule;
|
|
69
70
|
get watching(): boolean;
|
|
70
71
|
set host(value);
|
|
71
72
|
get host(): IFileManager | null;
|
|
@@ -77,9 +78,9 @@ interface DocumentConstructor extends ModuleConstructor {
|
|
|
77
78
|
createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
|
|
78
79
|
writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): string | undefined;
|
|
79
80
|
/** @deprecated */
|
|
80
|
-
updateGradle(source: string, namespaces: string[], value: string, upgrade: boolean): string;
|
|
81
|
+
updateGradle(source: string, namespaces: (string | RegExp)[], value: string | string[], upgrade: boolean): string;
|
|
81
82
|
/** @deprecated */
|
|
82
|
-
updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
|
|
83
|
+
updateGradle(source: string, namespaces: (string | RegExp)[], value: string | string[], options?: UpdateGradleOptions): string;
|
|
83
84
|
generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
|
|
84
85
|
cleanup?(this: IFileManager, instance: IDocument): Promise<unknown>;
|
|
85
86
|
sanitizeAssets?(assets: ExternalAsset[], exclusions?: unknown[]): ExternalAsset[];
|
|
@@ -92,7 +93,7 @@ interface DocumentConstructor extends ModuleConstructor {
|
|
|
92
93
|
|
|
93
94
|
```typescript
|
|
94
95
|
import type { PermittedDirectories } from "./core";
|
|
95
|
-
import type { DbModule, DbSettings, DocumentComponentOptions, PurgeComponent } from "./settings";
|
|
96
|
+
import type { DbModule, DbSettings, DocumentComponentOptions, ImportModule, PurgeComponent } from "./settings";
|
|
96
97
|
|
|
97
98
|
interface DocumentModule {
|
|
98
99
|
// handler: "@pi-r/chrome";
|
|
@@ -111,12 +112,12 @@ interface DocumentModule {
|
|
|
111
112
|
filename?: string;
|
|
112
113
|
};
|
|
113
114
|
};
|
|
114
|
-
imports?:
|
|
115
|
+
imports?: ImportModule;
|
|
115
116
|
settings?: {
|
|
116
117
|
broadcast_id?: string | string[];
|
|
117
118
|
users?: Record<string, {
|
|
118
119
|
extensions?: string[] | null;
|
|
119
|
-
imports?:
|
|
120
|
+
imports?: ImportModule;
|
|
120
121
|
imports_strict?: boolean;
|
|
121
122
|
pages?: unknown;
|
|
122
123
|
transform?: unknown;
|
|
@@ -187,14 +188,14 @@ NOTE: **@e-mc/document** is an abstract base class and cannot be instantiated. *
|
|
|
187
188
|
|
|
188
189
|
## References
|
|
189
190
|
|
|
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.
|
|
191
|
+
- https://www.unpkg.com/@e-mc/types@0.14.1/lib/squared.d.ts
|
|
192
|
+
- https://www.unpkg.com/@e-mc/types@0.14.1/lib/asset.d.ts
|
|
193
|
+
- https://www.unpkg.com/@e-mc/types@0.14.1/lib/core.d.ts
|
|
194
|
+
- https://www.unpkg.com/@e-mc/types@0.14.1/lib/document.d.ts
|
|
195
|
+
- https://www.unpkg.com/@e-mc/types@0.14.1/lib/filemanager.d.ts
|
|
196
|
+
- https://www.unpkg.com/@e-mc/types@0.14.1/lib/logger.d.ts
|
|
197
|
+
- https://www.unpkg.com/@e-mc/types@0.14.1/lib/settings.d.ts
|
|
198
|
+
- https://www.unpkg.com/@e-mc/types@0.14.1/lib/watch.d.ts
|
|
198
199
|
|
|
199
200
|
## LICENSE
|
|
200
201
|
|
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;
|