@pi-r/chrome 0.7.3 → 0.7.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 +6 -6
- package/index.js +43 -46
- package/package.json +28 -28
- package/types/index.d.ts +127 -127
- package/types/squared.d.ts +137 -137
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
### @pi-r/chrome
|
|
2
|
-
|
|
3
|
-
https://e-mc.readthedocs.io/en/latest/document
|
|
4
|
-
|
|
5
|
-
### LICENSE
|
|
6
|
-
|
|
1
|
+
### @pi-r/chrome
|
|
2
|
+
|
|
3
|
+
https://e-mc.readthedocs.io/en/latest/document
|
|
4
|
+
|
|
5
|
+
### LICENSE
|
|
6
|
+
|
|
7
7
|
MIT
|
package/index.js
CHANGED
|
@@ -903,8 +903,47 @@ const errorHtml = ({ tagName, tagIndex = -1 }) => (0, types_1.errorMessage)('htm
|
|
|
903
903
|
const errorDataSource = (value, hint) => (0, types_1.errorMessage)('data-source', value, hint);
|
|
904
904
|
const isHtmlOnly = (assets, items, htmlFile) => !items.find(item => item !== htmlFile && assets.includes(item));
|
|
905
905
|
class ChromeDocument extends Document {
|
|
906
|
-
|
|
907
|
-
|
|
906
|
+
constructor() {
|
|
907
|
+
super(...arguments);
|
|
908
|
+
this.config = {
|
|
909
|
+
usedVariables: undefined,
|
|
910
|
+
usedFontFace: undefined,
|
|
911
|
+
usedKeyframes: undefined,
|
|
912
|
+
unusedStyles: undefined,
|
|
913
|
+
unusedMedia: undefined,
|
|
914
|
+
unusedSupports: undefined,
|
|
915
|
+
unusedContainer: undefined,
|
|
916
|
+
unusedScope: undefined,
|
|
917
|
+
unusedAtRules: undefined,
|
|
918
|
+
useOriginalHtmlPage: undefined,
|
|
919
|
+
useUnsafeHtmlReplace: undefined,
|
|
920
|
+
useUnsafeCssReplace: undefined,
|
|
921
|
+
useSessionCache: undefined,
|
|
922
|
+
stripCommentsAndCDATA: undefined,
|
|
923
|
+
normalizeHtmlOutput: undefined,
|
|
924
|
+
escapeReservedCharacters: undefined,
|
|
925
|
+
ignoreServerCodeBlocks: undefined
|
|
926
|
+
};
|
|
927
|
+
this.htmlFile = null;
|
|
928
|
+
this.cssFiles = [];
|
|
929
|
+
this.jsFiles = [];
|
|
930
|
+
this.svgFiles = [];
|
|
931
|
+
this.baseDirectory = '';
|
|
932
|
+
this.baseUrl = '';
|
|
933
|
+
this.productionRelease = false;
|
|
934
|
+
this.productionIncremental = false;
|
|
935
|
+
this.templateMap = {};
|
|
936
|
+
this.userAgentData = {};
|
|
937
|
+
this.related = new Map();
|
|
938
|
+
this.replaced = [];
|
|
939
|
+
this._moduleName = 'chrome';
|
|
940
|
+
this._threadable = true;
|
|
941
|
+
this._elements = null;
|
|
942
|
+
this._idMap = Object.create(null);
|
|
943
|
+
this._editing = [];
|
|
944
|
+
this._queryMap = new Map();
|
|
945
|
+
this._selectorMap = new Map();
|
|
946
|
+
}
|
|
908
947
|
static async purgeMemory(percent = 1, limit = 0, parent) {
|
|
909
948
|
if (typeof limit === 'boolean') {
|
|
910
949
|
parent = limit;
|
|
@@ -1142,50 +1181,6 @@ class ChromeDocument extends Document {
|
|
|
1142
1181
|
}
|
|
1143
1182
|
});
|
|
1144
1183
|
}
|
|
1145
|
-
config = {
|
|
1146
|
-
usedVariables: undefined,
|
|
1147
|
-
usedFontFace: undefined,
|
|
1148
|
-
usedKeyframes: undefined,
|
|
1149
|
-
unusedStyles: undefined,
|
|
1150
|
-
unusedMedia: undefined,
|
|
1151
|
-
unusedSupports: undefined,
|
|
1152
|
-
unusedContainer: undefined,
|
|
1153
|
-
unusedScope: undefined,
|
|
1154
|
-
unusedAtRules: undefined,
|
|
1155
|
-
useOriginalHtmlPage: undefined,
|
|
1156
|
-
useUnsafeHtmlReplace: undefined,
|
|
1157
|
-
useUnsafeCssReplace: undefined,
|
|
1158
|
-
useSessionCache: undefined,
|
|
1159
|
-
stripCommentsAndCDATA: undefined,
|
|
1160
|
-
normalizeHtmlOutput: undefined,
|
|
1161
|
-
escapeReservedCharacters: undefined,
|
|
1162
|
-
ignoreServerCodeBlocks: undefined
|
|
1163
|
-
};
|
|
1164
|
-
htmlFile = null;
|
|
1165
|
-
cssFiles = [];
|
|
1166
|
-
jsFiles = [];
|
|
1167
|
-
svgFiles = [];
|
|
1168
|
-
baseDirectory = '';
|
|
1169
|
-
baseUrl = '';
|
|
1170
|
-
productionRelease = false;
|
|
1171
|
-
productionIncremental = false;
|
|
1172
|
-
templateMap = {};
|
|
1173
|
-
userAgentData = {};
|
|
1174
|
-
related = new Map();
|
|
1175
|
-
replaced = [];
|
|
1176
|
-
formatMap;
|
|
1177
|
-
_moduleName = 'chrome';
|
|
1178
|
-
_threadable = true;
|
|
1179
|
-
_dataSource;
|
|
1180
|
-
_mimeMap;
|
|
1181
|
-
_elements = null;
|
|
1182
|
-
_cloudUrlMap;
|
|
1183
|
-
_cloudUploaded;
|
|
1184
|
-
_cloudEndpoint;
|
|
1185
|
-
_idMap = Object.create(null);
|
|
1186
|
-
_editing = [];
|
|
1187
|
-
_queryMap = new Map();
|
|
1188
|
-
_selectorMap = new Map();
|
|
1189
1184
|
init(assets, config) {
|
|
1190
1185
|
assets.sort((a, b) => {
|
|
1191
1186
|
if (!(0, types_1.isEmpty)(a.bundleId) && a.bundleId === b.bundleId) {
|
|
@@ -3778,4 +3773,6 @@ class ChromeDocument extends Document {
|
|
|
3778
3773
|
return this.module.settings ||= {};
|
|
3779
3774
|
}
|
|
3780
3775
|
}
|
|
3776
|
+
ChromeDocument.INTERNAL_ASSIGNUUID = "__assign__";
|
|
3777
|
+
ChromeDocument.INTERNAL_SERVERROOT = "__serverroot__";
|
|
3781
3778
|
module.exports = ChromeDocument;
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pi-r/chrome",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "Chrome document constructor for E-mc.",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/anpham6/pi-r.git",
|
|
12
|
-
"directory": "src/module/chrome"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [
|
|
15
|
-
"squared",
|
|
16
|
-
"e-mc",
|
|
17
|
-
"squared-functions"
|
|
18
|
-
],
|
|
19
|
-
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "^0.9.
|
|
24
|
-
"@e-mc/core": "^0.9.
|
|
25
|
-
"@e-mc/document": "^0.9.
|
|
26
|
-
"@e-mc/types": "^0.9.
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@pi-r/chrome",
|
|
3
|
+
"version": "0.7.4",
|
|
4
|
+
"description": "Chrome document constructor for E-mc.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/anpham6/pi-r.git",
|
|
12
|
+
"directory": "src/module/chrome"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"squared",
|
|
16
|
+
"e-mc",
|
|
17
|
+
"squared-functions"
|
|
18
|
+
],
|
|
19
|
+
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@e-mc/cloud": "^0.9.12",
|
|
24
|
+
"@e-mc/core": "^0.9.12",
|
|
25
|
+
"@e-mc/document": "^0.9.12",
|
|
26
|
+
"@e-mc/types": "^0.9.12"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
import type { LocationUri, XmlTagNode } from '@e-mc/types/lib/squared';
|
|
2
|
-
|
|
3
|
-
import type { DocumentConstructor, ICloud, IDocument, IFileManager } from '@e-mc/types/lib';
|
|
4
|
-
import type { DocumentAsset as IDocumentAsset } from '@e-mc/types/lib/document';
|
|
5
|
-
import type { LogTime } from '@e-mc/types/lib/logger';
|
|
6
|
-
import type { DbSourceDataType, DocumentComponentOption, DocumentComponent as IDocumentComponent, DocumentComponentOptions as IDocumentComponentOptions, DocumentDirectory as IDocumentDirectory, DocumentEval as IDocumentEval, DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings } from '@e-mc/types/lib/settings';
|
|
7
|
-
|
|
8
|
-
import type { CloudScopeOrigin } from '@e-mc/cloud/types';
|
|
9
|
-
import type { IDomWriter, IXmlElement } from '@e-mc/document/parse/types';
|
|
10
|
-
|
|
11
|
-
import type { ChromeAsset, CssRuleData, DataSource, DocumentOutput } from './squared';
|
|
12
|
-
|
|
13
|
-
export const enum PROPERTIES {
|
|
14
|
-
INDEX = '__index__',
|
|
15
|
-
FROM_HTML = '__fromhtml__',
|
|
16
|
-
ASSIGN = '__assign__',
|
|
17
|
-
SERVERROOT = '__serverroot__'
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface DocumentDirectory extends IDocumentDirectory {
|
|
21
|
-
template?: string;
|
|
22
|
-
data?: string;
|
|
23
|
-
export?: string;
|
|
24
|
-
schema?: string;
|
|
25
|
-
sql?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface DocumentComponentExtended<T> extends DbSourceDataType<T> {
|
|
29
|
-
uri?: T;
|
|
30
|
-
local?: T;
|
|
31
|
-
export?: T;
|
|
32
|
-
json?: T;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface DocumentComponentOptions<T> extends IDocumentComponentOptions, DocumentComponentExtended<DocumentComponentOption<T>> {}
|
|
36
|
-
|
|
37
|
-
interface DocumentEval extends IDocumentEval {
|
|
38
|
-
template?: boolean;
|
|
39
|
-
userconfig?: boolean;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface ChromeDocumentSettings extends IDocumentSettings {
|
|
43
|
-
directory?: DocumentDirectory;
|
|
44
|
-
options?: DocumentComponentOptions<boolean | number>;
|
|
45
|
-
export?: ObjectMap<string | FunctionType>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
type OutputType = "useUnsafeReplace" | "productionRelease" | "productionIncremental" | "templateMap" | "userAgentData";
|
|
49
|
-
|
|
50
|
-
export interface FormatUri extends Partial<LocationUri> {
|
|
51
|
-
dictionary?: string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface FinalizeProcessing<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> {
|
|
55
|
-
readonly host: T;
|
|
56
|
-
readonly startTime: LogTime;
|
|
57
|
-
readonly hashed: Set<DocumentAsset>;
|
|
58
|
-
readonly contentMap: StringMap;
|
|
59
|
-
readonly bufferMap: ObjectMap<Bufferable>;
|
|
60
|
-
readonly cacheMiss: string[];
|
|
61
|
-
readonly productionRelease: Undef<true>;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface DocumentComponent<T = boolean> extends IDocumentComponent<T, T>, DocumentComponentExtended<T> {}
|
|
65
|
-
|
|
66
|
-
export interface DocumentModule extends IDocumentModule {
|
|
67
|
-
eval?: DocumentEval;
|
|
68
|
-
format?: PlainObject & { uuid?: FormatUri };
|
|
69
|
-
settings?: ChromeDocumentSettings;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface DocumentAsset extends IDocumentAsset, ChromeAsset {
|
|
73
|
-
relativeUrl?: string;
|
|
74
|
-
inlineFilename?: string;
|
|
75
|
-
srcSet?: string[];
|
|
76
|
-
inlineUrl?: string;
|
|
77
|
-
inlineUrlMap?: StringMap;
|
|
78
|
-
inlineUrlCloud?: string;
|
|
79
|
-
inlineUrlCloudMap?: StringMap;
|
|
80
|
-
inlineBase64?: string;
|
|
81
|
-
modified?: boolean;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface UserConfig extends CssRuleData, Omit<DocumentOutput, OutputType> {
|
|
85
|
-
useUnsafeHtmlReplace?: boolean;
|
|
86
|
-
useUnsafeCssReplace?: boolean;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface IChromeDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset, V extends ICloud = ICloud<T>> extends IDocument<T, U, DocumentModule, DocumentComponent, DocumentComponentOption, V>, Pick<DocumentOutput, OutputType> {
|
|
90
|
-
htmlFile: Null<U>;
|
|
91
|
-
cssFiles: U[];
|
|
92
|
-
jsFiles: U[];
|
|
93
|
-
svgFiles: U[];
|
|
94
|
-
baseDirectory: string;
|
|
95
|
-
baseUrl: string;
|
|
96
|
-
config: UserConfig;
|
|
97
|
-
related: Map<U, Set<U>>;
|
|
98
|
-
replaced: U[];
|
|
99
|
-
formatMap?: ObjectMap<FormatUri>;
|
|
100
|
-
setElementSrc(asset: U, element: IXmlElement, value: string): void;
|
|
101
|
-
findDataValue(name: string): Undef<string>;
|
|
102
|
-
setInlinedAttributes(processing: FinalizeProcessing<T, U>): void;
|
|
103
|
-
applyTransforms(processing: FinalizeProcessing<T, U>): Promise<void>;
|
|
104
|
-
rewriteHtml(processing: FinalizeProcessing<T, U>): Promise<void>;
|
|
105
|
-
setElementAttributes(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
|
|
106
|
-
applyDataSource(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
|
|
107
|
-
setProductionAttributes(processing: FinalizeProcessing<T, U>): void;
|
|
108
|
-
removeUnusedStyles(source: string, options?: UserConfig): Undef<string>;
|
|
109
|
-
removeServerRoot(value: string): string;
|
|
110
|
-
replaceContent(source: string, match: RegExpExecArray | string, mimeType?: string): Undef<string>;
|
|
111
|
-
cloudInit(state: CloudScopeOrigin<T, U, V>): void;
|
|
112
|
-
cloudObject(state: CloudScopeOrigin<T, U, V>, file: U): boolean;
|
|
113
|
-
cloudUpload(state: CloudScopeOrigin<T, U, V>, file: U, url: string, active: boolean): Promise<boolean>;
|
|
114
|
-
cloudFinalize(state: CloudScopeOrigin<T, U, V>): Promise<unknown[]>;
|
|
115
|
-
get editing(): U[];
|
|
116
|
-
set dataSource(value);
|
|
117
|
-
get dataSource(): DataSource[];
|
|
118
|
-
get elements(): XmlTagNode[];
|
|
119
|
-
get settings(): ChromeDocumentSettings;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export interface ChromeDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
|
|
123
|
-
INTERNAL_ASSIGNUUID: string;
|
|
124
|
-
INTERNAL_SERVERROOT: string;
|
|
125
|
-
readonly prototype: IChromeDocument<T, U>;
|
|
126
|
-
new(module?: DocumentModule, ...args: unknown[]): IChromeDocument<T, U>;
|
|
127
|
-
}
|
|
1
|
+
import type { LocationUri, XmlTagNode } from '@e-mc/types/lib/squared';
|
|
2
|
+
|
|
3
|
+
import type { DocumentConstructor, ICloud, IDocument, IFileManager } from '@e-mc/types/lib';
|
|
4
|
+
import type { DocumentAsset as IDocumentAsset } from '@e-mc/types/lib/document';
|
|
5
|
+
import type { LogTime } from '@e-mc/types/lib/logger';
|
|
6
|
+
import type { DbSourceDataType, DocumentComponentOption, DocumentComponent as IDocumentComponent, DocumentComponentOptions as IDocumentComponentOptions, DocumentDirectory as IDocumentDirectory, DocumentEval as IDocumentEval, DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings } from '@e-mc/types/lib/settings';
|
|
7
|
+
|
|
8
|
+
import type { CloudScopeOrigin } from '@e-mc/cloud/types';
|
|
9
|
+
import type { IDomWriter, IXmlElement } from '@e-mc/document/parse/types';
|
|
10
|
+
|
|
11
|
+
import type { ChromeAsset, CssRuleData, DataSource, DocumentOutput } from './squared';
|
|
12
|
+
|
|
13
|
+
export const enum PROPERTIES {
|
|
14
|
+
INDEX = '__index__',
|
|
15
|
+
FROM_HTML = '__fromhtml__',
|
|
16
|
+
ASSIGN = '__assign__',
|
|
17
|
+
SERVERROOT = '__serverroot__'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface DocumentDirectory extends IDocumentDirectory {
|
|
21
|
+
template?: string;
|
|
22
|
+
data?: string;
|
|
23
|
+
export?: string;
|
|
24
|
+
schema?: string;
|
|
25
|
+
sql?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface DocumentComponentExtended<T> extends DbSourceDataType<T> {
|
|
29
|
+
uri?: T;
|
|
30
|
+
local?: T;
|
|
31
|
+
export?: T;
|
|
32
|
+
json?: T;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface DocumentComponentOptions<T> extends IDocumentComponentOptions, DocumentComponentExtended<DocumentComponentOption<T>> {}
|
|
36
|
+
|
|
37
|
+
interface DocumentEval extends IDocumentEval {
|
|
38
|
+
template?: boolean;
|
|
39
|
+
userconfig?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface ChromeDocumentSettings extends IDocumentSettings {
|
|
43
|
+
directory?: DocumentDirectory;
|
|
44
|
+
options?: DocumentComponentOptions<boolean | number>;
|
|
45
|
+
export?: ObjectMap<string | FunctionType>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type OutputType = "useUnsafeReplace" | "productionRelease" | "productionIncremental" | "templateMap" | "userAgentData";
|
|
49
|
+
|
|
50
|
+
export interface FormatUri extends Partial<LocationUri> {
|
|
51
|
+
dictionary?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface FinalizeProcessing<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> {
|
|
55
|
+
readonly host: T;
|
|
56
|
+
readonly startTime: LogTime;
|
|
57
|
+
readonly hashed: Set<DocumentAsset>;
|
|
58
|
+
readonly contentMap: StringMap;
|
|
59
|
+
readonly bufferMap: ObjectMap<Bufferable>;
|
|
60
|
+
readonly cacheMiss: string[];
|
|
61
|
+
readonly productionRelease: Undef<true>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface DocumentComponent<T = boolean> extends IDocumentComponent<T, T>, DocumentComponentExtended<T> {}
|
|
65
|
+
|
|
66
|
+
export interface DocumentModule extends IDocumentModule {
|
|
67
|
+
eval?: DocumentEval;
|
|
68
|
+
format?: PlainObject & { uuid?: FormatUri };
|
|
69
|
+
settings?: ChromeDocumentSettings;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface DocumentAsset extends IDocumentAsset, ChromeAsset {
|
|
73
|
+
relativeUrl?: string;
|
|
74
|
+
inlineFilename?: string;
|
|
75
|
+
srcSet?: string[];
|
|
76
|
+
inlineUrl?: string;
|
|
77
|
+
inlineUrlMap?: StringMap;
|
|
78
|
+
inlineUrlCloud?: string;
|
|
79
|
+
inlineUrlCloudMap?: StringMap;
|
|
80
|
+
inlineBase64?: string;
|
|
81
|
+
modified?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface UserConfig extends CssRuleData, Omit<DocumentOutput, OutputType> {
|
|
85
|
+
useUnsafeHtmlReplace?: boolean;
|
|
86
|
+
useUnsafeCssReplace?: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface IChromeDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset, V extends ICloud = ICloud<T>> extends IDocument<T, U, DocumentModule, DocumentComponent, DocumentComponentOption, V>, Pick<DocumentOutput, OutputType> {
|
|
90
|
+
htmlFile: Null<U>;
|
|
91
|
+
cssFiles: U[];
|
|
92
|
+
jsFiles: U[];
|
|
93
|
+
svgFiles: U[];
|
|
94
|
+
baseDirectory: string;
|
|
95
|
+
baseUrl: string;
|
|
96
|
+
config: UserConfig;
|
|
97
|
+
related: Map<U, Set<U>>;
|
|
98
|
+
replaced: U[];
|
|
99
|
+
formatMap?: ObjectMap<FormatUri>;
|
|
100
|
+
setElementSrc(asset: U, element: IXmlElement, value: string): void;
|
|
101
|
+
findDataValue(name: string): Undef<string>;
|
|
102
|
+
setInlinedAttributes(processing: FinalizeProcessing<T, U>): void;
|
|
103
|
+
applyTransforms(processing: FinalizeProcessing<T, U>): Promise<void>;
|
|
104
|
+
rewriteHtml(processing: FinalizeProcessing<T, U>): Promise<void>;
|
|
105
|
+
setElementAttributes(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
|
|
106
|
+
applyDataSource(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
|
|
107
|
+
setProductionAttributes(processing: FinalizeProcessing<T, U>): void;
|
|
108
|
+
removeUnusedStyles(source: string, options?: UserConfig): Undef<string>;
|
|
109
|
+
removeServerRoot(value: string): string;
|
|
110
|
+
replaceContent(source: string, match: RegExpExecArray | string, mimeType?: string): Undef<string>;
|
|
111
|
+
cloudInit(state: CloudScopeOrigin<T, U, V>): void;
|
|
112
|
+
cloudObject(state: CloudScopeOrigin<T, U, V>, file: U): boolean;
|
|
113
|
+
cloudUpload(state: CloudScopeOrigin<T, U, V>, file: U, url: string, active: boolean): Promise<boolean>;
|
|
114
|
+
cloudFinalize(state: CloudScopeOrigin<T, U, V>): Promise<unknown[]>;
|
|
115
|
+
get editing(): U[];
|
|
116
|
+
set dataSource(value);
|
|
117
|
+
get dataSource(): DataSource[];
|
|
118
|
+
get elements(): XmlTagNode[];
|
|
119
|
+
get settings(): ChromeDocumentSettings;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface ChromeDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
|
|
123
|
+
INTERNAL_ASSIGNUUID: string;
|
|
124
|
+
INTERNAL_SERVERROOT: string;
|
|
125
|
+
readonly prototype: IChromeDocument<T, U>;
|
|
126
|
+
new(module?: DocumentModule, ...args: unknown[]): IChromeDocument<T, U>;
|
|
127
|
+
}
|
package/types/squared.d.ts
CHANGED
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
import type { AttributeAction, ConditionProperty, CssConditionData, ElementAction, ExcludeAction, FileAsset, FromAction, HashAction, DataSource as IDataSource, ImportAction, MetadataAction, ViewEngine } from '@e-mc/types/lib/squared';
|
|
2
|
-
|
|
3
|
-
import type { UploadAction } from '@e-mc/types/lib/cloud';
|
|
4
|
-
import type { CascadeAction, DbSource } from '@e-mc/types/lib/db';
|
|
5
|
-
import type { RequestData as IRequestData } from '@e-mc/types/lib/node';
|
|
6
|
-
import type { BufferFormat } from '@e-mc/types/lib/request';
|
|
7
|
-
|
|
8
|
-
interface ImportFrom {
|
|
9
|
-
placeholder: string;
|
|
10
|
-
original: string;
|
|
11
|
-
uri: string;
|
|
12
|
-
type?: string;
|
|
13
|
-
dynamic?: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface DataObject extends CascadeAction {
|
|
17
|
-
format?: BufferFormat;
|
|
18
|
-
options?: PlainObject;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface ScopeData {
|
|
22
|
-
start: Null<string>;
|
|
23
|
-
end: Null<string>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface UserAgentData {
|
|
27
|
-
platform: string;
|
|
28
|
-
name: string;
|
|
29
|
-
brand: string;
|
|
30
|
-
browser: number;
|
|
31
|
-
version: Null<number[]>;
|
|
32
|
-
majorVersion: number;
|
|
33
|
-
mobile: boolean;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface DocumentOutput {
|
|
37
|
-
productionRelease?: boolean | string;
|
|
38
|
-
productionIncremental?: boolean;
|
|
39
|
-
useOriginalHtmlPage?: boolean | string;
|
|
40
|
-
useUnsafeReplace?: ArrayOf<"html" | "css"> | boolean;
|
|
41
|
-
useSessionCache?: boolean;
|
|
42
|
-
stripCommentsAndCDATA?: boolean | string;
|
|
43
|
-
normalizeHtmlOutput?: boolean | string;
|
|
44
|
-
escapeReservedCharacters?: boolean;
|
|
45
|
-
ignoreServerCodeBlocks?: string[];
|
|
46
|
-
webBundle?: {
|
|
47
|
-
rootDirAlias?: string;
|
|
48
|
-
baseUrl?: string;
|
|
49
|
-
primaryUrl?: string;
|
|
50
|
-
copyTo?: string;
|
|
51
|
-
rewriteHtmlPage?: boolean | string;
|
|
52
|
-
excludeHtmlPage?: boolean;
|
|
53
|
-
excludeTransforms?: boolean;
|
|
54
|
-
includeScopes?: string[];
|
|
55
|
-
excludeScopes?: string[];
|
|
56
|
-
};
|
|
57
|
-
templateMap?: TemplateMap;
|
|
58
|
-
userAgentData?: Partial<UserAgentData>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface RequestData extends IRequestData<ChromeAsset>, Readonly<DocumentOutput>, Readonly<CssRuleData> {}
|
|
62
|
-
|
|
63
|
-
export interface ChromeAsset extends FileAsset, AttributeAction, ElementAction, MetadataAction<PlainObject>, UploadAction, HashAction, ExcludeAction, ImportAction<ImportFrom[] | boolean>, FromAction {
|
|
64
|
-
preserve?: boolean;
|
|
65
|
-
static?: boolean;
|
|
66
|
-
editing?: boolean;
|
|
67
|
-
inlineContent?: string;
|
|
68
|
-
originAddress?: boolean;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface TemplateMap extends PlainObject {
|
|
72
|
-
html?: ObjectMap<StringMap>;
|
|
73
|
-
js?: ObjectMap<StringMap>;
|
|
74
|
-
css?: ObjectMap<StringMap>;
|
|
75
|
-
data?: StringMap;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface CssRuleData {
|
|
79
|
-
usedVariables?: string[];
|
|
80
|
-
usedFontFace?: string[];
|
|
81
|
-
usedKeyframes?: string[];
|
|
82
|
-
unusedStyles?: string[];
|
|
83
|
-
unusedMedia?: string[];
|
|
84
|
-
unusedSupports?: string[];
|
|
85
|
-
unusedContainer?: string[];
|
|
86
|
-
unusedScope?: ScopeData[];
|
|
87
|
-
unusedAtRules?: UnusedAtRule[];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface UnusedAtRule {
|
|
91
|
-
selector?: string;
|
|
92
|
-
media?: ConditionProperty;
|
|
93
|
-
supports?: ConditionProperty;
|
|
94
|
-
container?: CssConditionData & Partial<ConditionProperty>;
|
|
95
|
-
layer?: string[];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface DataSource<T = string> extends IDataSource<T>, ElementAction {
|
|
99
|
-
source: "cloud" | "json" | "uri" | "local" | "export" | DbSource;
|
|
100
|
-
type?: "text" | "attribute" | "display";
|
|
101
|
-
dynamic?: boolean;
|
|
102
|
-
value?: ArrayOf<string> | AnyObject;
|
|
103
|
-
template?: string;
|
|
104
|
-
viewEngine?: ViewEngine | string;
|
|
105
|
-
ignoreEmpty?: boolean;
|
|
106
|
-
ignoreCoerce?: boolean;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface TextDataSource extends DataSource {
|
|
110
|
-
type: "text";
|
|
111
|
-
leadingText?: string;
|
|
112
|
-
trailingText?: string;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface UriDataSource extends DataSource, DataObject {
|
|
116
|
-
source: "uri";
|
|
117
|
-
body?: unknown;
|
|
118
|
-
contentType?: string;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface LocalDataSource extends DataSource, DataObject {
|
|
122
|
-
source: "local";
|
|
123
|
-
pathname?: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface JSONDataSource extends DataSource, CascadeAction {
|
|
127
|
-
source: "json";
|
|
128
|
-
items?: unknown;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface ExportDataSource extends DataSource, CascadeAction {
|
|
132
|
-
source: "export";
|
|
133
|
-
execute?: FunctionType;
|
|
134
|
-
pathname?: string;
|
|
135
|
-
settings?: string;
|
|
136
|
-
params?: unknown;
|
|
137
|
-
persist?: boolean;
|
|
1
|
+
import type { AttributeAction, ConditionProperty, CssConditionData, ElementAction, ExcludeAction, FileAsset, FromAction, HashAction, DataSource as IDataSource, ImportAction, MetadataAction, ViewEngine } from '@e-mc/types/lib/squared';
|
|
2
|
+
|
|
3
|
+
import type { UploadAction } from '@e-mc/types/lib/cloud';
|
|
4
|
+
import type { CascadeAction, DbSource } from '@e-mc/types/lib/db';
|
|
5
|
+
import type { RequestData as IRequestData } from '@e-mc/types/lib/node';
|
|
6
|
+
import type { BufferFormat } from '@e-mc/types/lib/request';
|
|
7
|
+
|
|
8
|
+
interface ImportFrom {
|
|
9
|
+
placeholder: string;
|
|
10
|
+
original: string;
|
|
11
|
+
uri: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
dynamic?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface DataObject extends CascadeAction {
|
|
17
|
+
format?: BufferFormat;
|
|
18
|
+
options?: PlainObject;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface ScopeData {
|
|
22
|
+
start: Null<string>;
|
|
23
|
+
end: Null<string>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface UserAgentData {
|
|
27
|
+
platform: string;
|
|
28
|
+
name: string;
|
|
29
|
+
brand: string;
|
|
30
|
+
browser: number;
|
|
31
|
+
version: Null<number[]>;
|
|
32
|
+
majorVersion: number;
|
|
33
|
+
mobile: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface DocumentOutput {
|
|
37
|
+
productionRelease?: boolean | string;
|
|
38
|
+
productionIncremental?: boolean;
|
|
39
|
+
useOriginalHtmlPage?: boolean | string;
|
|
40
|
+
useUnsafeReplace?: ArrayOf<"html" | "css"> | boolean;
|
|
41
|
+
useSessionCache?: boolean;
|
|
42
|
+
stripCommentsAndCDATA?: boolean | string;
|
|
43
|
+
normalizeHtmlOutput?: boolean | string;
|
|
44
|
+
escapeReservedCharacters?: boolean;
|
|
45
|
+
ignoreServerCodeBlocks?: string[];
|
|
46
|
+
webBundle?: {
|
|
47
|
+
rootDirAlias?: string;
|
|
48
|
+
baseUrl?: string;
|
|
49
|
+
primaryUrl?: string;
|
|
50
|
+
copyTo?: string;
|
|
51
|
+
rewriteHtmlPage?: boolean | string;
|
|
52
|
+
excludeHtmlPage?: boolean;
|
|
53
|
+
excludeTransforms?: boolean;
|
|
54
|
+
includeScopes?: string[];
|
|
55
|
+
excludeScopes?: string[];
|
|
56
|
+
};
|
|
57
|
+
templateMap?: TemplateMap;
|
|
58
|
+
userAgentData?: Partial<UserAgentData>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface RequestData extends IRequestData<ChromeAsset>, Readonly<DocumentOutput>, Readonly<CssRuleData> {}
|
|
62
|
+
|
|
63
|
+
export interface ChromeAsset extends FileAsset, AttributeAction, ElementAction, MetadataAction<PlainObject>, UploadAction, HashAction, ExcludeAction, ImportAction<ImportFrom[] | boolean>, FromAction {
|
|
64
|
+
preserve?: boolean;
|
|
65
|
+
static?: boolean;
|
|
66
|
+
editing?: boolean;
|
|
67
|
+
inlineContent?: string;
|
|
68
|
+
originAddress?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface TemplateMap extends PlainObject {
|
|
72
|
+
html?: ObjectMap<StringMap>;
|
|
73
|
+
js?: ObjectMap<StringMap>;
|
|
74
|
+
css?: ObjectMap<StringMap>;
|
|
75
|
+
data?: StringMap;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface CssRuleData {
|
|
79
|
+
usedVariables?: string[];
|
|
80
|
+
usedFontFace?: string[];
|
|
81
|
+
usedKeyframes?: string[];
|
|
82
|
+
unusedStyles?: string[];
|
|
83
|
+
unusedMedia?: string[];
|
|
84
|
+
unusedSupports?: string[];
|
|
85
|
+
unusedContainer?: string[];
|
|
86
|
+
unusedScope?: ScopeData[];
|
|
87
|
+
unusedAtRules?: UnusedAtRule[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface UnusedAtRule {
|
|
91
|
+
selector?: string;
|
|
92
|
+
media?: ConditionProperty;
|
|
93
|
+
supports?: ConditionProperty;
|
|
94
|
+
container?: CssConditionData & Partial<ConditionProperty>;
|
|
95
|
+
layer?: string[];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface DataSource<T = string> extends IDataSource<T>, ElementAction {
|
|
99
|
+
source: "cloud" | "json" | "uri" | "local" | "export" | DbSource;
|
|
100
|
+
type?: "text" | "attribute" | "display";
|
|
101
|
+
dynamic?: boolean;
|
|
102
|
+
value?: ArrayOf<string> | AnyObject;
|
|
103
|
+
template?: string;
|
|
104
|
+
viewEngine?: ViewEngine | string;
|
|
105
|
+
ignoreEmpty?: boolean;
|
|
106
|
+
ignoreCoerce?: boolean;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface TextDataSource extends DataSource {
|
|
110
|
+
type: "text";
|
|
111
|
+
leadingText?: string;
|
|
112
|
+
trailingText?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface UriDataSource extends DataSource, DataObject {
|
|
116
|
+
source: "uri";
|
|
117
|
+
body?: unknown;
|
|
118
|
+
contentType?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface LocalDataSource extends DataSource, DataObject {
|
|
122
|
+
source: "local";
|
|
123
|
+
pathname?: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface JSONDataSource extends DataSource, CascadeAction {
|
|
127
|
+
source: "json";
|
|
128
|
+
items?: unknown;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface ExportDataSource extends DataSource, CascadeAction {
|
|
132
|
+
source: "export";
|
|
133
|
+
execute?: FunctionType;
|
|
134
|
+
pathname?: string;
|
|
135
|
+
settings?: string;
|
|
136
|
+
params?: unknown;
|
|
137
|
+
persist?: boolean;
|
|
138
138
|
}
|